mirror of https://github.com/apache/cloudstack.git
bug 6813: System VM page - add "Destroy System VM" action.
This commit is contained in:
parent
49858cf189
commit
0bedf7e367
|
|
@ -1,4 +1,7 @@
|
|||
#New - Add all new parameters here.
|
||||
label.action.destroy.systemvm=Destroy System VM
|
||||
label.action.destroy.systemvm.processing=Destroying System VM....
|
||||
message.action.destroy.systemvm=Please confirm you want to destroy System VM
|
||||
label.numretries = Number of Retries
|
||||
label.timeout.in.second = Timeout(seconds)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ dictionary = {
|
|||
'message.action.stop.systemvm' : '<fmt:message key="message.action.stop.systemvm"/>',
|
||||
'label.action.reboot.systemvm' : '<fmt:message key="label.action.reboot.systemvm"/>',
|
||||
'label.action.reboot.systemvm.processing' : '<fmt:message key="label.action.reboot.systemvm.processing"/>',
|
||||
'message.action.reboot.systemvm' : '<fmt:message key="message.action.reboot.systemvm"/>'
|
||||
'message.action.reboot.systemvm' : '<fmt:message key="message.action.reboot.systemvm"/>',
|
||||
'label.action.destroy.systemvm': '<fmt:message key="label.action.destroy.systemvm"/>',
|
||||
'label.action.destroy.systemvm.processing': '<fmt:message key="label.action.destroy.systemvm.processing"/>',
|
||||
'message.action.destroy.systemvm': '<fmt:message key="message.action.destroy.systemvm"/>'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1753,6 +1753,10 @@ function vmJsonToDetailsTab(){
|
|||
buildActionLinkForTab("label.action.change.service", vmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
noAvailableActions = false;
|
||||
}
|
||||
else if (jsonObj.state == 'Error') {
|
||||
buildActionLinkForTab("label.action.destroy.instance", vmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
noAvailableActions = false;
|
||||
}
|
||||
|
||||
// no available actions
|
||||
if(noAvailableActions == true) {
|
||||
|
|
|
|||
|
|
@ -122,14 +122,28 @@ function systemvmJsonToDetailsTab() {
|
|||
});
|
||||
var $actionMenu = $actionLink.find("#action_menu");
|
||||
$actionMenu.find("#action_list").empty();
|
||||
var noAvailableActions = true;
|
||||
|
||||
if (jsonObj.state == 'Running') { //Show "Stop System VM", "Reboot System VM"
|
||||
if (jsonObj.state == 'Running') {
|
||||
buildActionLinkForTab("label.action.stop.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
buildActionLinkForTab("label.action.reboot.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
buildActionLinkForTab("label.action.reboot.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
buildActionLinkForTab("label.action.destroy.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
noAvailableActions = false;
|
||||
}
|
||||
else if (jsonObj.state == 'Stopped') { //show "Start System VM"
|
||||
else if (jsonObj.state == 'Stopped') {
|
||||
buildActionLinkForTab("label.action.start.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
}
|
||||
buildActionLinkForTab("label.action.destroy.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
noAvailableActions = false;
|
||||
}
|
||||
else if (jsonObj.state == 'Error') {
|
||||
buildActionLinkForTab("label.action.destroy.systemvm", systemVmActionMap, $actionMenu, $midmenuItem1, $thisTab);
|
||||
noAvailableActions = false;
|
||||
}
|
||||
|
||||
// no available actions
|
||||
if(noAvailableActions == true) {
|
||||
$actionMenu.find("#action_list").append($("#no_available_actions").clone().show());
|
||||
}
|
||||
|
||||
$thisTab.find("#tab_spinning_wheel").hide();
|
||||
$thisTab.find("#tab_container").show();
|
||||
|
|
@ -197,6 +211,17 @@ var systemVmActionMap = {
|
|||
var jsonObj = json.queryasyncjobresultresponse.jobresult.systemvm;
|
||||
systemvmToMidmenu(jsonObj, $midmenuItem1);
|
||||
}
|
||||
},
|
||||
"label.action.destroy.systemvm": {
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "destroysystemvmresponse",
|
||||
dialogBeforeActionFn : doDestroySystemVM,
|
||||
inProcessText: "label.action.destroy.systemvm.processing",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
$midmenuItem1.slideUp("slow", function() {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -257,3 +282,20 @@ function doRebootSystemVM($actionLink, $detailsTab, $midmenuItem1) {
|
|||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doDestroySystemVM($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
var id = jsonObj.id;
|
||||
|
||||
$("#dialog_confirmation")
|
||||
.text(dictionary["message.action.destroy.systemvm"])
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var apiCommand = "command=destroySystemVm&id="+id;
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue