From d289fb8f0492258a0f2570fd0e6daae1ef55207a Mon Sep 17 00:00:00 2001 From: abelCoronado93 Date: Thu, 29 Jun 2017 12:24:11 +0200 Subject: [PATCH] F #4816 Make configurable a persistent instance done --- src/sunstone/etc/sunstone-views/admin.yaml | 5 ++- .../etc/sunstone-views/admin_vcenter.yaml | 5 ++- src/sunstone/etc/sunstone-views/cloud.yaml | 5 ++- .../etc/sunstone-views/cloud_vcenter.yaml | 5 ++- .../etc/sunstone-views/groupadmin.yaml | 5 ++- .../sunstone-views/groupadmin_vcenter.yaml | 5 ++- src/sunstone/etc/sunstone-views/user.yaml | 5 ++- src/sunstone/public/app/sunstone-config.js | 2 +- src/sunstone/public/app/tabs/provision-tab.js | 6 ++- .../app/tabs/provision-tab/vms/create.hbs | 2 + .../wizard-tabs/general/capacity-inputs.js | 2 +- .../templates-tab/form-panels/instantiate.js | 37 +++++++++++-------- .../form-panels/instantiate/html.hbs | 2 + 13 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 40188e0d0d..e8f8291f51 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -51,7 +51,10 @@ features: instantiate_hide_cpu: false # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 89feae0475..c0ed051a49 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -51,7 +51,10 @@ features: instantiate_hide_cpu: false # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index 94da408af1..00b6cbeba8 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -19,7 +19,10 @@ features: instantiate_hide_cpu: false # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true tabs: provision-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml b/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml index f293350afd..e80cd76784 100644 --- a/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml @@ -19,7 +19,10 @@ features: instantiate_hide_cpu: true # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true tabs: provision-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index e9e4f85a9c..3e6a3abf5f 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -51,7 +51,10 @@ features: instantiate_hide_cpu: false # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index e1162f2644..c58ad92c94 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -51,7 +51,10 @@ features: instantiate_hide_cpu: true # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index 4da1924150..aa165c3e24 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -51,7 +51,10 @@ features: instantiate_hide_cpu: false # False to not scale the CPU. Number [0, 1] to scale from VCPU - instanciate_cpu_factor: false + instantiate_cpu_factor: false + + # True to show the option to make persistent a instance + instantiate_persistent: true # True to show an input to specify the the VMs and Template path/folder where a vCenter VM will # deployed to diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index 585499a36d..d624d16dcd 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -156,7 +156,7 @@ define(function(require) { 'enabledTabs': _config['view']['enabled_tabs'], 'onedConf': _config['oned_conf'], 'confirmVMActions': _config['view']['confirm_vms'], - 'scaleFactor': _config['view']['features']['instanciate_cpu_factor'], + 'scaleFactor': _config['view']['features']['instantiate_cpu_factor'], 'filterView': _config['view']['filter_view'], "allTabs": function() { diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 5bf8b08d7e..30638bdd61 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -961,10 +961,14 @@ define(function(require) { disksContext.data("template_json", template_json); if (Config.provision.create_vm.isEnabled("disk_resize")) { + var pers = $("input.instantiate_pers", create_vm_context).prop("checked"); + if(pers == undefined){ + pers = false; + } DisksResize.insert({ template_json: template_json, disksContext: disksContext, - force_persistent: $("input.instantiate_pers", create_vm_context).prop("checked"), + force_persistent: pers, cost_callback: _calculateCost }); } else { diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs b/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs index 654186edb0..7f2fd3ac8f 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/vms/create.hbs @@ -29,6 +29,7 @@
+ {{#isFeatureEnabled "instantiate_persistent"}}
@@ -41,6 +42,7 @@ {{{tip (tr "Creates a private persistent copy of the template plus any image defined in DISK, and instantiates that copy")}}}
+ {{/isFeatureEnabled}}
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs.js index deec5be508..b98ce418e9 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/capacity-inputs.js @@ -135,7 +135,7 @@ define(function(require) { $("div.vcpu_input", context).html(input); - if (Config.isFeatureEnabled("instanciate_cpu_factor")){ + if (Config.isFeatureEnabled("instantiate_cpu_factor")){ $("div.vcpu_input input", context).on("change", function(){ var vcpuValue = $("div.vcpu_input input", context).val(); $("div.cpu_input input", context).val(vcpuValue * Config.scaleFactor); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 8c97044699..31d7087fe4 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -88,26 +88,31 @@ define(function(require) { function _setup(context) { var that = this; - $("input.instantiate_pers", context).on("change", function(){ - var persistent = $(this).prop('checked'); + if(Config.isFeatureEnabled("instantiate_persistent")){ + $("input.instantiate_pers", context).on("change", function(){ + var persistent = $(this).prop('checked'); - if(persistent){ - $("#vm_n_times_disabled", context).show(); - $("#vm_n_times", context).hide(); - } else { - $("#vm_n_times_disabled", context).hide(); - $("#vm_n_times", context).show(); - } + if(persistent){ + $("#vm_n_times_disabled", context).show(); + $("#vm_n_times", context).hide(); + } else { + $("#vm_n_times_disabled", context).hide(); + $("#vm_n_times", context).show(); + } - $.each(that.template_objects, function(index, template_json) { - DisksResize.insert({ - template_json: template_json, - disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context), - force_persistent: persistent, - cost_callback: that.calculateCost.bind(that) + $.each(that.template_objects, function(index, template_json) { + DisksResize.insert({ + template_json: template_json, + disksContext: $(".disksContext" + template_json.VMTEMPLATE.ID, context), + force_persistent: persistent, + cost_callback: that.calculateCost.bind(that) + }); }); }); - }); + } else { + $("#vm_n_times_disabled", context).hide(); + $("#vm_n_times", context).show(); + } } function _calculateCost(){ diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/html.hbs index 651bd4faa3..8c786f5744 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/html.hbs @@ -21,6 +21,7 @@
+ {{#isFeatureEnabled "instantiate_persistent"}}
+ {{/isFeatureEnabled}}