From aba4edfd4ef7f70000c5ab53e315b877f8868d55 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Tue, 5 Sep 2017 12:57:02 +0200 Subject: [PATCH] B #5336 Solved bug in attach volatile disk (raw, qcow2) (#437) --- .../create/wizard-tabs/storage/disk-tab.js | 42 ++++++++++++++++--- .../wizard-tabs/storage/disk-tab/html.hbs | 8 ++-- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js index f96ed4ee83..714fde8f73 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab.js @@ -105,19 +105,31 @@ define(function(require) { $("[wizard_field]", imageContext).prop('wizard_field_disabled', true); } }); - $("[wizard_field]", imageContext).prop('wizard_field_disabled', false); $("[wizard_field]", volatileContext).prop('wizard_field_disabled', true); // Volatile Type FS hides Format, Type SWAP displays Format - $("select#TYPE", volatileContext).change(function() { + $("select#TYPE_KVM", volatileContext).change(function() { var value = $(this).val(); switch (value){ case "fs": - $("select#FORMAT", volatileContext).parent().show(); + $("select#FORMAT_KVM", volatileContext).parent().show(); break; case "swap": - $("select#FORMAT", volatileContext).parent().hide(); + $("select#FORMAT_KVM", volatileContext).parent().hide(); + break; + } + }); + + // Volatile Type FS hides Format, Type SWAP displays Format + $("select#TYPE_VCENTER", volatileContext).change(function() { + var value = $(this).val(); + switch (value){ + case "fs": + $("select#FORMAT_VCENTER", volatileContext).parent().show(); + break; + case "swap": + $("select#FORMAT_VCENTER", volatileContext).parent().hide(); break; } }); @@ -140,7 +152,16 @@ define(function(require) { } else { selectedContext = $("div.volatile", context); - if ($("select#TYPE", selectedContext).val() == "swap") + var typeKvm = $("#TYPE_KVM", context).val(); + var typeVcenter = $("#TYPE_VCENTER", context).val(); + var type = "fs"; + if(typeKvm != "fs"){ + type = typeKvm; + } else if (typeVcenter != "fs"){ + type = typeVcenter; + } + + if (type == "swap") { $("select#FORMAT", selectedContext).val(""); } @@ -148,6 +169,17 @@ define(function(require) { var tmpl = WizardFields.retrieve(selectedContext); + tmpl.TYPE = type; + + var formatKvm = $("#FORMAT_KVM", context).val(); + var formatVcenter = $("#FORMAT_VCENTER", context).val(); + + if(formatKvm != "raw"){ + tmpl.FORMAT = formatKvm; + } else if (formatVcenter != "raw"){ + tmpl.FORMAT = formatVcenter; + } + if($(".mb_input_unit", context).val() == "GB"){ tmpl.SIZE = tmpl.SIZE * 1024; tmpl.SIZE = tmpl.SIZE.toString(); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs index ca8d55eef0..23ec3c827e 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/storage/disk-tab/html.hbs @@ -84,11 +84,11 @@ - - @@ -96,11 +96,11 @@ - -