mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
new UI - implement reset password for VM
This commit is contained in:
parent
29451b8da7
commit
6f14b406ce
@ -20,7 +20,7 @@ $(document).ready(function() {
|
||||
var $t = $("#"+ui.selecting.id);
|
||||
if($t.find("#content").hasClass("inaction") == false) { //only items not in action are allowed to be selected
|
||||
var id =$t.data("id");
|
||||
selectedItemIds[id] = null;
|
||||
selectedItemIds[id] = $t;
|
||||
$t.find("#content").addClass("selected");
|
||||
}
|
||||
var toRightPanelFn = $t.data("toRightPanelFn");
|
||||
|
||||
@ -64,7 +64,15 @@ function clickInstanceGroupHeader($arrowIcon) {
|
||||
asyncJobResponse: "detachisoresponse",
|
||||
afterActionSeccessFn: setMidmenuItemVm,
|
||||
dialogBeforeActionFn : doDetachISO
|
||||
}
|
||||
}
|
||||
,
|
||||
resetPasswordForVirtualMachine: {
|
||||
label: "Reset Password",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "resetpasswordforvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(){},
|
||||
dialogBeforeActionFn : doResetPassword
|
||||
}
|
||||
}
|
||||
|
||||
function doAttachISO($t, selectedItemIds, listAPIMap) {
|
||||
@ -122,6 +130,35 @@ function clickInstanceGroupHeader($arrowIcon) {
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function doResetPassword($t, selectedItemIds, listAPIMap) {
|
||||
$("#dialog_confirmation")
|
||||
.html("<p>Please confirm you want to change the ROOT password for your virtual machine(s)</p>")
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
for(var id in selectedItemIds) {
|
||||
var $midMenuItem = selectedItemIds[id];
|
||||
var jsonObj = $midMenuItem.data("jsonObj");
|
||||
if(jsonObj.state != "Stopped") {
|
||||
$midMenuItem.find("#info_icon").addClass("error").show();
|
||||
$midMenuItem.data("afterActionInfo", ($t.data("label") + " action failed. Reason: This instance needs to be stopped before you can reset password"));
|
||||
continue;
|
||||
}
|
||||
if(jsonObj.passwordEnabled != "true") {
|
||||
$midMenuItem.find("#info_icon").addClass("error").show();
|
||||
$midMenuItem.data("afterActionInfo", ($t.data("label") + " action failed. Reason: This instance is not using a template that has the password reset feature enabled. If you have forgotten your root password, please contact support."));
|
||||
continue;
|
||||
}
|
||||
var apiCommand = "command=resetPasswordForVirtualMachine&id="+id;
|
||||
doAction(id, $t, apiCommand, listAPIMap);
|
||||
}
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}).dialog("open");
|
||||
}
|
||||
|
||||
function updateVirtualMachineStateInRightPanel(state) {
|
||||
if(state == "Running")
|
||||
$rightPanelContent.find("#state").text(state).removeClass("red gray").addClass("green");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user