diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index 42819041ee..b33447b710 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -80,6 +80,14 @@ define(function(require) { } }, + "isAdvancedEnabled": function(featureName) { + if (_config['view']['features'] && featureName in _config['view']['features']) { + return _config['view']['features'][featureName]; + } else { + return true; + } + }, + "tabTableColumns": function(tabName) { if (!_config['view']['tabs'][tabName]) { return []; diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab.js index c9efe4a410..ff36fc546f 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab.js @@ -152,6 +152,10 @@ define(function(require) { CreateUtils.setupPCIRows($(".pci-row", context)); $("input.pci-type-nic", context).change(); + + if (!Config.isAdvancedEnabled("show_attach_nic_advanced")){ + $("#nic_values", context).hide(); + } } function _retrieve(context) { diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs index 16326b23bb..5e8a79c9cc 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/network/nic-tab/html.hbs @@ -16,6 +16,7 @@ {{{vnetsTableSelectHTML}}}
+
{{#advancedSection (tr "Advanced options") }}
{{tr "Choose Network"}} @@ -54,7 +55,7 @@
- +
{{tr "Override Network Values IPv4"}} @@ -286,3 +287,4 @@
{{/advancedSection}} + 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 1dd4d593b4..1a8203088c 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 @@ -166,6 +166,10 @@ define(function(require) { $("input[name=\"custom_disk_dev_prefix\"]",context).parent().hide(); } }); + + if (!Config.isAdvancedEnabled("show_attach_disk_advanced")){ + $("#image_values", context).hide(); + } } function _retrieve(context) { 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 a095f6379c..828512d264 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 @@ -25,40 +25,42 @@
{{{imageTableSelectHTML}}}
- {{#advancedSection (tr "Advanced options") }} -
- {{tr "Image"}} -
-
- - +
+ {{#advancedSection (tr "Advanced options") }} +
+ {{tr "Image"}} +
+
+ + +
+
+ + +
-
- - +
+
+ + +
+
+ + +
-
-
-
- - -
-
- - -
-
-
+
{{> ./options volatile=false }} {{/advancedSection}} +

+ {{#isAdvancedEnabled "show_attach_disk_advanced"}} {{#advancedSection (tr "Advanced options") }} {{> ./options volatile=true }} {{/advancedSection}} + {{/isAdvancedEnabled}} diff --git a/src/sunstone/public/app/templates/helpers/isAdvancedEnabled.js b/src/sunstone/public/app/templates/helpers/isAdvancedEnabled.js new file mode 100644 index 0000000000..e306fec243 --- /dev/null +++ b/src/sunstone/public/app/templates/helpers/isAdvancedEnabled.js @@ -0,0 +1,32 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2018, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +define(function (require) { + var Handlebars = require('hbs/handlebars'); + var Config = require('sunstone-config'); + + var isAdvancedEnabled = function (feature, options) { + if (Config.isAdvancedEnabled(feature)) { + return options.fn(this); + } else { + return options.inverse(this); + } + }; + + Handlebars.registerHelper('isAdvancedEnabled', isAdvancedEnabled); + + return isAdvancedEnabled; +});