Skip to content

Commit e5c2407

Browse files
v1.0.2
1 parent e914a25 commit e5c2407

6 files changed

+129
-14
lines changed

admin/instance.html

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ <h6 class="m-0 font-weight-bold text-primary">Snapshots</h6>
166166
</div>
167167

168168
<div class="col-12">
169-
<!-- Network Interface List -->
169+
<!-- Network Devices List -->
170170
<div class="card shadow mb-4">
171171
<!-- Card Header - Dropdown -->
172172
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
173-
<h6 class="m-0 font-weight-bold text-primary">Network Interfaces</h6>
173+
<h6 class="m-0 font-weight-bold text-primary">Network Devices</h6>
174174
<div class="dropdown no-arrow">
175175
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
176176
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
@@ -184,12 +184,12 @@ <h6 class="m-0 font-weight-bold text-primary">Network Interfaces</h6>
184184
<!-- Card Body -->
185185
<div class="card-body">
186186
<div class="table-responsive">
187-
<table class="table" id="networkInterfaceTableList" width="100%" cellspacing="0">
187+
<table class="table" id="networkDeviceTableList" width="100%" cellspacing="0">
188188
</table>
189189
</div>
190190
</div>
191191
</div>
192-
<!-- End Network Interface ist -->
192+
<!-- End Network Devices ist -->
193193
</div>
194194

195195
<div class="col-12">
@@ -219,6 +219,33 @@ <h6 class="m-0 font-weight-bold text-primary">Disk Devices</h6>
219219
<!-- End Disk Device ist -->
220220
</div>
221221

222+
<div class="col-12">
223+
<!-- Proxy Device List -->
224+
<div class="card shadow mb-4">
225+
<!-- Card Header - Dropdown -->
226+
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
227+
<h6 class="m-0 font-weight-bold text-primary">Proxy Devices</h6>
228+
<div class="dropdown no-arrow">
229+
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
230+
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
231+
</a>
232+
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
233+
<div class="dropdown-header">Options:</div>
234+
235+
</div>
236+
</div>
237+
</div>
238+
<!-- Card Body -->
239+
<div class="card-body">
240+
<div class="table-responsive">
241+
<table class="table" id="proxyDeviceTableList" width="100%" cellspacing="0">
242+
</table>
243+
</div>
244+
</div>
245+
</div>
246+
<!-- End Proxy Device ist -->
247+
</div>
248+
222249

223250
<div class="col-12">
224251
<!-- Profile List -->
@@ -475,8 +502,9 @@ <h5 class="modal-title" id="exampleModalLabel">Publish Instance</h5>
475502
var operationNumber = "";
476503
var instanceDetails = "";
477504
var snapshotDetails = "";
478-
var networkInternfaceDetails = "";
505+
var networkDeviceDetails = "";
479506
var diskDeviceDetails = "";
507+
var proxyDeviceDetails = "";
480508
var profileDetails = "";
481509
var redirectURL = "";
482510

@@ -544,19 +572,27 @@ <h5 class="modal-title" id="exampleModalLabel">Publish Instance</h5>
544572

545573
//Load the network info for the network interfaces card if changed
546574
$.get("./php/lxd/instance-single-network-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
547-
if (networkInternfaceDetails != data){
548-
$("#networkInterfaceTableList").html(data);
549-
networkInternfaceDetails = data;
575+
if (networkDeviceDetails != data){
576+
$("#networkDeviceTableList").html(data);
577+
networkDeviceDetails = data;
550578
}
551579
});
552580

553581
//Load the disk info for the disk devices card if changed
554-
$.get("./php/lxd/instance-single-device-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
582+
$.get("./php/lxd/instance-single-disk-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
555583
if (diskDeviceDetails != data){
556584
$("#diskDeviceTableList").html(data);
557585
diskDeviceDetails = data;
558586
}
559587
});
588+
589+
//Load the proxy info for the proxy devices card if changed
590+
$.get("./php/lxd/instance-single-proxy-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {
591+
if (proxyDeviceDetails != data){
592+
$("#proxyDeviceTableList").html(data);
593+
proxyDeviceDetails = data;
594+
}
595+
});
560596

561597
//Load the profile info for the profile card if changed
562598
$.get("./php/lxd/instance-single-profile-list.php?instance=" + encodeURI(instanceName) + "&remote=" + encodeURI(remoteName) + "&project=" + encodeURI(projectName), function (data) {

admin/php/lxd/instance-single-device-list.php renamed to admin/php/lxd/instance-single-disk-list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
echo "<tr>";
5353

54-
echo "<td> <i class='fas fa-hdd fa-2x' style='color:#4e73df'></i> </td>";
54+
echo "<td> <i class='fas fa-hdd fa-lg' style='color:#4e73df'></i> </td>";
5555
echo "<td>" . htmlentities($disk_name) . "</td>";
5656
echo "<td>" . htmlentities($disk_path) . "</td>";
5757
echo "<td>" . htmlentities(number_format($disk_data['usage']/1024/1024,2)) . " MB</td>";

admin/php/lxd/instance-single-network-list.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242

4343
echo "<tr>";
4444
if ($network_data['state'] == "up")
45-
echo "<td> <i class='fas fa-network-wired fa-2x' style='color:#4e73df'></i> </td>";
45+
echo "<td> <i class='fas fa-network-wired fa-lg' style='color:#4e73df'></i> </td>";
4646
else
47-
echo "<td> <i class='fas fa-network-wired fa-2x' style='color:#ddd'></i> </td>";
47+
echo "<td> <i class='fas fa-network-wired fa-lg' style='color:#ddd'></i> </td>";
4848
echo "<td>" . htmlentities($network_name) . "</td>";
4949
echo "<td>" . htmlentities($network_data['hwaddr']) . "</td>";
5050

admin/php/lxd/instance-single-profile-list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
echo "<tr>";
4646

47-
echo "<td> <i class='fas fa-address-card fa-2x' style='color:#4e73df'></i> </td>";
47+
echo "<td> <i class='fas fa-address-card fa-lg' style='color:#4e73df'></i> </td>";
4848
echo "<td>" . htmlentities($profile_data['name']) . "</td>";
4949
echo "<td>" . htmlentities($profile_data['description']) . "</td>";
5050

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
$cert = "/root/.config/lxc/client.crt";
4+
$key = "/root/.config/lxc/client.key";
5+
6+
if (isset($_GET['remote']))
7+
$remote = filter_var(urldecode($_GET['remote']), FILTER_SANITIZE_STRING);
8+
if (isset($_GET['project']))
9+
$project = filter_var(urldecode($_GET['project']), FILTER_SANITIZE_STRING);
10+
if (isset($_GET['instance']))
11+
$instance = filter_var(urldecode($_GET['instance']), FILTER_SANITIZE_STRING);
12+
13+
14+
echo "<thead>";
15+
echo "<tr>";
16+
echo "<th style='width:75px'></th>";
17+
echo "<th>Name</th>";
18+
echo "<th>Connect</th>";
19+
echo "<th>Listen</th>";
20+
echo "<th>Type</th>";
21+
echo "<th style='width:75px'></th>";
22+
echo "</tr>";
23+
echo "</thead>";
24+
25+
echo "<tbody>";
26+
27+
28+
29+
$db = new SQLite3('/var/lxdware/data/sqlite/lxdware.sqlite');
30+
$db_statement = $db->prepare('SELECT * FROM lxd_hosts WHERE id = :id LIMIT 1;');
31+
$db_statement->bindValue(':id', $remote);
32+
$db_results = $db_statement->execute();
33+
34+
while($row = $db_results->fetchArray()){
35+
36+
$url = "https://" . $row['host'] . ":" . $row['port'] . "/1.0/instances/" . $instance . "?project=" . $project;
37+
$remote_data = shell_exec("sudo curl -k -L --cert $cert --key $key -X GET $url");
38+
$remote_data = json_decode($remote_data, true);
39+
$device_names = $remote_data['metadata']['expanded_devices'];
40+
foreach ($device_names as $device_name => $device_data){
41+
if ($device_data['type'] == "proxy"){
42+
echo "<tr>";
43+
44+
echo "<td> <i class='fas fa-exchange-alt fa-lg' style='color:#4e73df'></i> </td>";
45+
echo "<td>" . htmlentities($device_name) . "</td>";
46+
echo "<td>" . htmlentities($device_data['connect']) . "</td>";
47+
echo "<td>" . htmlentities($device_data['listen']) . "</td>";
48+
echo "<td>" . htmlentities($device_data['type']) . "</td>";
49+
50+
51+
52+
echo "<td>";
53+
echo '<div class="dropdown no-arrow">';
54+
echo '<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
55+
echo '<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>';
56+
echo '</a>';
57+
echo '<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">';
58+
echo '<div class="dropdown-header">Options:</div>';
59+
//echo '<a class="dropdown-item" href="#" onclick="detachProfile(' . escapeshellarg($network_name) . ')">Detach</a>';
60+
echo '</div>';
61+
echo '</div>';
62+
echo "</td>";
63+
64+
echo "</tr>";
65+
}
66+
else {
67+
continue;
68+
}
69+
}
70+
71+
72+
73+
74+
}
75+
76+
echo "</tbody>";
77+
78+
79+
?>

admin/php/lxd/instance-single-snapshot-list.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
echo "<tr>";
5151

52-
echo "<td> <i class='fas fa-clone fa-2x' style='color:#4e73df'></i> </td>";
52+
echo "<td> <i class='fas fa-clone fa-lg' style='color:#4e73df'></i> </td>";
5353
echo "<td>" . htmlentities($snapshot_data['name']) . "</td>";
5454
echo "<td>" . htmlentities($state) . "</td>";
5555
echo "<td>" . htmlentities(number_format($snapshot_data['size']/1024/1024,2)) . "MB</td>";

0 commit comments

Comments
 (0)