Skip to content

Commit bf5a336

Browse files
v3.4.0
1 parent db310f6 commit bf5a336

File tree

9 files changed

+70
-9
lines changed

9 files changed

+70
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v3.4.0
2+
- Added additional delete option for powered-off instances on the containers and virtual machines pages
3+
- Fixed bug in populating both profile and cluster member options in drop-down box for virtual machine configurations
4+
- Added verification for numeric values in instance memory gauge display
5+
16
# v3.3.0
27
- Updated PDO try-catch exception for PHP 8
38
- Created recursive PHP in_array for SQLite Pragma array search in PHP 8

lxd-dashboard/backend/config/about.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<body class="">
4444
<p>The open source LXD Dashboard is developed by LXDWARE and provides a web-based user interface capable of managing multiple LXD servers from a single location.</p>
4545
<p>
46-
<strong>Version</strong>: <span id="versionNumber">v3.3.0</span> <br />
46+
<strong>Version</strong>: <span id="versionNumber">v3.4.0</span> <br />
4747
<strong>License</strong>: AGPL-3.0 <br />
4848
<strong>URL</strong>: https://lxdware.com <br />
4949
</p>

lxd-dashboard/backend/lxd/containers-single.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,13 @@
14321432
$results[0] = null;
14331433
}
14341434

1435-
$results[1] = number_format($results[1],1);
1435+
if (is_numeric($results[1])){
1436+
$results[1] = number_format($results[1],1);
1437+
}
1438+
else{
1439+
$results[1] = null;
1440+
}
1441+
14361442
$results = json_encode($results);
14371443

14381444
echo $results;

lxd-dashboard/backend/lxd/containers.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,17 +678,23 @@
678678
switch ($instance_data['status']) {
679679
case "Running":
680680
echo '"';
681-
echo "<a href='#' onclick=stopInstance('".$instance_data['name']."')> <i class='fas fa-stop fa-lg' style='color:#ddd' title='Stop' aria-hidden='true'></i> </a>";
681+
echo "<a href='#' onclick=stopInstance('".$instance_data['name']."')> <i class='fas fa-stop fa-lg' style='color:#cdcdcd' title='Stop' aria-hidden='true'></i> </a>";
682+
echo " &nbsp ";
683+
echo "<a href='#'><i class='fas fa-trash-alt fa-lg' style='color:#ededed' title='Delete (disabled)' aria-hidden='true'></i></a>";
682684
echo '"';
683685
break;
684686
case "Frozen":
685687
echo '"';
686-
echo "<a href='#' onclick=unfreezeInstance('".$instance_data['name']."')> <i class='fas fa-pause fa-lg' style='color:#ddd' title='Unfreeze' aria-hidden='true'></i> </a>";
688+
echo "<a href='#' onclick=unfreezeInstance('".$instance_data['name']."')> <i class='fas fa-pause fa-lg' style='color:#cdcdcd' title='Unfreeze' aria-hidden='true'></i> </a>";
689+
echo " &nbsp ";
690+
echo "<a href='#'><i class='fas fa-trash-alt fa-lg' style='color:#ededed' title='Delete (disabled)' aria-hidden='true'></i></a>";
687691
echo '"';
688692
break;
689693
case "Stopped":
690694
echo '"';
691-
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#ddd' title='Start' aria-hidden='true'></i> </a>";
695+
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#cdcdcd' title='Start' aria-hidden='true'></i> </a>";
696+
echo " &nbsp ";
697+
echo "<a href='#' onclick=confirmDeleteInstance('".$instance_data['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#cdcdcd' title='Delete' aria-hidden='true'></i></a>";
692698
echo '"';
693699
break;
694700
default:

lxd-dashboard/backend/lxd/virtual-machines-single.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,13 @@
13201320
$results[0] = null;
13211321
}
13221322

1323-
$results[1] = number_format($results[1],1);
1323+
if (is_numeric($results[1])){
1324+
$results[1] = number_format($results[1],1);
1325+
}
1326+
else{
1327+
$results[1] = null;
1328+
}
1329+
13241330
$results = json_encode($results);
13251331

13261332
echo $results;

lxd-dashboard/backend/lxd/virtual-machines.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,17 +599,23 @@
599599
switch ($instance_data['status']) {
600600
case "Running":
601601
echo '"';
602-
echo "<a href='#' onclick=stopInstance('".$instance_data['name']."')> <i class='fas fa-stop fa-lg' style='color:#ddd' title='Stop' aria-hidden='true'></i> </a>";
602+
echo "<a href='#' onclick=stopInstance('".$instance_data['name']."')> <i class='fas fa-stop fa-lg' style='color:#cdcdcd' title='Stop' aria-hidden='true'></i> </a>";
603+
echo " &nbsp ";
604+
echo "<a href='#'><i class='fas fa-trash-alt fa-lg' style='color:#ededed' title='Delete (disabled)' aria-hidden='true'></i></a>";
603605
echo '"';
604606
break;
605607
case "Frozen":
606608
echo '"';
607-
echo "<a href='#' onclick=unfreezeInstance('".$instance_data['name']."')> <i class='fas fa-pause fa-lg' style='color:#ddd' title='Unfreeze' aria-hidden='true'></i> </a>";
609+
echo "<a href='#' onclick=unfreezeInstance('".$instance_data['name']."')> <i class='fas fa-pause fa-lg' style='color:#cdcdcd' title='Unfreeze' aria-hidden='true'></i> </a>";
610+
echo " &nbsp ";
611+
echo "<a href='#'><i class='fas fa-trash-alt fa-lg' style='color:#ededed' title='Delete (disabled)' aria-hidden='true'></i></a>";
608612
echo '"';
609613
break;
610614
case "Stopped":
611615
echo '"';
612-
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#ddd' title='Start' aria-hidden='true'></i> </a>";
616+
echo "<a href='#' onclick=startInstance('".$instance_data['name']."')> <i class='fas fa-play fa-lg' style='color:#cdcdcd' title='Start' aria-hidden='true'></i> </a>";
617+
echo " &nbsp ";
618+
echo "<a href='#' onclick=confirmDeleteInstance('".$instance_data['name']."')><i class='fas fa-trash-alt fa-lg' style='color:#cdcdcd' title='Delete' aria-hidden='true'></i></a>";
613619
echo '"';
614620
break;
615621
default:

lxd-dashboard/containers.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,20 @@ function unfreezeInstance(instanceName){
16401640
});
16411641
}
16421642
1643+
function confirmDeleteInstance(instanceName){
1644+
console.log("Info: confirming deletion of container " + instanceName);
1645+
if (confirm("Are you sure you want to delete container " + instanceName + "?") == true) {
1646+
$.get("./backend/lxd/containers.php?remote=" + encodeURI(remoteId) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=deleteInstance", function (data) {
1647+
var operationData = JSON.parse(data);
1648+
console.log(operationData);
1649+
if (operationData.metadata.status_code >= 400){
1650+
alert(operationData.metadata.err)
1651+
}
1652+
setTimeout(() => { reloadPageContent(); }, 1000);
1653+
});
1654+
}
1655+
}
1656+
16431657
function setSidebarToggleValue(){
16441658
sidebarState = localStorage.getItem('sidebarState');
16451659
if (sidebarState == "collapsed"){

lxd-dashboard/virtual-machines-single.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,6 +4883,10 @@ function percentageToDegrees(percentage) {
48834883
//Load Page Content
48844884
loadPageContent();
48854885
4886+
//Populate the select options fields used in modals
4887+
$("#selectProfileInput").load("./backend/lxd/profiles.php?remote=" + encodeURI(remoteId) + "&project=" + encodeURI(projectName) + "&action=listProfilesForSelectOption");
4888+
$("#selectClusterInput").load("./backend/lxd/cluster-members.php?remote=" + encodeURI(remoteId) + "&action=listClusterMembersForSelectOption");
4889+
48864890
//When tab changes, set active tab for content refresh
48874891
$('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
48884892
clearTimeout(pageReloadTimeout); //clear reload because new tab is being loaded

lxd-dashboard/virtual-machines.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,20 @@ function unfreezeInstance(instanceName){
11011101
});
11021102
}
11031103
1104+
function confirmDeleteInstance(instanceName){
1105+
console.log("Info: confirming deletion of virtual machine " + instanceName);
1106+
if (confirm("Are you sure you want to delete virtual machine " + instanceName + "?") == true) {
1107+
$.get("./backend/lxd/virtual-machines.php?remote=" + encodeURI(remoteId) + "&project=" + encodeURI(projectName) + "&instance=" + encodeURI(instanceName) + "&action=deleteInstance", function (data) {
1108+
var operationData = JSON.parse(data);
1109+
console.log(operationData);
1110+
if (operationData.metadata.status_code >= 400){
1111+
alert(operationData.metadata.err)
1112+
}
1113+
setTimeout(() => { reloadPageContent(); }, 1000);
1114+
});
1115+
}
1116+
}
1117+
11041118
function setSidebarToggleValue(){
11051119
sidebarState = localStorage.getItem('sidebarState');
11061120
if (sidebarState == "collapsed"){

0 commit comments

Comments
 (0)