new UI - instance page - volume tab - show Create Template option in action menu if hypervisor is KVM.

This commit is contained in:
Jessica Wang 2010-10-30 15:18:06 -07:00
parent a1293ea882
commit 89f8617c9b
1 changed files with 9 additions and 4 deletions

View File

@ -1497,9 +1497,7 @@ function vmJsonToDetailsTab(){
$detailsTab.find("#tab_spinning_wheel").hide();
}
function vmJsonToVolumeTab() {
//if (getHypervisorType() == "kvm")
//detail.find("#volume_action_create_template").show();
function vmJsonToVolumeTab() {
var $thisTab = $("#right_panel_content #tab_content_volume");
beforeLoadingToTab($thisTab);
@ -1621,10 +1619,12 @@ function vmVolumeJSONToTemplate(json, $template) {
var $actionMenu = $actionLink.find("#volume_action_menu");
$actionMenu.find("#action_list").empty();
var noAvailableActions = true;
var hasCreateTemplate = false;
if(json.type=="ROOT") { //"create template" is allowed(when stopped), "detach disk" is disallowed.
if (json.vmstate == "Stopped") {
buildActionLinkForSubgridItem("Create Template", vmVolumeActionMap, $actionMenu, $template);
hasCreateTemplate = true;
noAvailableActions = false;
}
}
@ -1633,6 +1633,11 @@ function vmVolumeJSONToTemplate(json, $template) {
noAvailableActions = false;
}
if (getHypervisorType() == "kvm" && hasCreateTemplate == false) {
buildActionLinkForSubgridItem("Create Template", vmVolumeActionMap, $actionMenu, $template);
noAvailableActions = false;
}
// no available actions
if(noAvailableActions == true) {
$actionMenu.find("#action_list").append($("#no_available_actions").clone().show());