CLOUDSTACK-6852: UI - attach volume action - VM dropdown - populate options based on whether module is included and whether service is enabled.

This commit is contained in:
Jessica Wang 2014-06-05 13:44:57 -07:00
parent 431ea8e9c2
commit 9b9154132d
1 changed files with 24 additions and 6 deletions

View File

@ -901,6 +901,14 @@
});
}
var drModuleIncluded = isModuleIncluded("dr");
var volumeDrEnabled = false;
if (drModuleIncluded) {
volumeDrEnabled = cloudStack.dr.sharedFunctions.isVolumeDrEnabled(args.context.volumes[0]);
}
$(['Running', 'Stopped']).each(function() {
$.ajax({
url: createURL('listVirtualMachines'),
@ -910,11 +918,21 @@
async: false,
success: function(json) {
var instanceObjs = json.listvirtualmachinesresponse.virtualmachine;
$(instanceObjs).each(function() {
items.push({
id: this.id,
description: this.displayname ? this.displayname : this.name
});
$(instanceObjs).each(function() {
if (drModuleIncluded) {
var vmDrEnabled = cloudStack.dr.sharedFunctions.isVmDrEnabled(this);
if (vmDrEnabled == volumeDrEnabled) {
items.push({
id: this.id,
description: this.displayname ? this.displayname : this.name
});
}
} else {
items.push({
id: this.id,
description: this.displayname ? this.displayname : this.name
});
}
});
}
});
@ -1989,7 +2007,7 @@
}
if (jsonObj.state != "Creating") {
if (jsonObj.type == "ROOT") {
if (jsonObj.type == "ROOT") {
if (jsonObj.vmstate == "Stopped") {
allowedActions.push("createTemplate");
}