diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js
index 05c595b9ad..dd0a3dc4c9 100644
--- a/src/sunstone/public/app/sunstone-config.js
+++ b/src/sunstone/public/app/sunstone-config.js
@@ -78,6 +78,14 @@ define(function(require) {
}
},
+ "isOneFeatureEnabled": function(feature1Name, feature2Name) {
+ if (_config["view"]["features"]) {
+ return _config["view"]["features"][feature1Name] || _config["view"]["features"][feature2Name];
+ } else {
+ return false;
+ }
+ },
+
"isAdvancedEnabled": function(featureName) {
if (_config["view"]["features"] && featureName in _config["view"]["features"]) {
return _config["view"]["features"][featureName];
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs
index 4790d30dd5..cebf2cb1cb 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs
@@ -48,16 +48,17 @@
- {{#advancedImportationSection "" (tr "Network") }}
{{#isFeatureEnabled "show_vnet_instantiate"}}
+ {{#advancedImportationSection "" (tr "Network") }}
- {{/isFeatureEnabled}}
{{/advancedImportationSection}}
+ {{/isFeatureEnabled}}
+ {{#isOneFeatureEnabled "show_as_uid_instantiate" "show_as_gid_instantiate"}}
{{#advancedImportationSection "" (tr "Instantiate as different User / Group")}}
{{#isFeatureEnabled "show_as_uid_instantiate"}}
@@ -78,8 +79,9 @@
{{/isFeatureEnabled}}
{{/advancedImportationSection}}
- {{#advancedImportationSection "" (tr "Deploy VM in a specific Host") }}
+ {{/isOneFeatureEnabled}}
{{#isFeatureEnabled "show_host_instantiate"}}
+ {{#advancedImportationSection "" (tr "Deploy VM in a specific Host") }}
- {{/isFeatureEnabled}}
{{/advancedImportationSection}}
- {{#advancedImportationSection "" (tr "Deploy VM in a specific Datastore") }}
+ {{/isFeatureEnabled}}
{{#isFeatureEnabled "show_ds_instantiate"}}
+ {{#advancedImportationSection "" (tr "Deploy VM in a specific Datastore") }}
- {{/isFeatureEnabled}}
{{/advancedImportationSection}}
+ {{/isFeatureEnabled}}
{{#advancedImportationSection "" (tr "Schedule Actions for VM") }}
{{/advancedImportationSection}}
- {{#advancedImportationSection "" (tr "Associate VM to a VM Group") }}
{{#isFeatureEnabled "show_vmgroup_instantiate"}}
+ {{#advancedImportationSection "" (tr "Associate VM to a VM Group") }}
- {{/isFeatureEnabled}}
{{/advancedImportationSection}}
- {{#advancedImportationSection "" (tr "vCenter Deployment") }}
+ {{/isFeatureEnabled}}
+ {{#isFeatureEnabled "vcenter_vm_folder"}}
+ {{#advancedImportationSection "" (tr "vCenter Deployment")}}
{{/advancedImportationSection}}
+ {{/isFeatureEnabled}}
\ No newline at end of file
diff --git a/src/sunstone/public/app/templates/helpers/isOneFeatureEnabled.js b/src/sunstone/public/app/templates/helpers/isOneFeatureEnabled.js
new file mode 100644
index 0000000000..556d96bf72
--- /dev/null
+++ b/src/sunstone/public/app/templates/helpers/isOneFeatureEnabled.js
@@ -0,0 +1,32 @@
+/* -------------------------------------------------------------------------- */
+/* Copyright 2002-2019, 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 isOneFeatureEnabled = function(feature1, feature2 , options) {
+ if (Config.isOneFeatureEnabled(feature1, feature2)) {
+ return options.fn(this);
+ } else {
+ return options.inverse(this);
+ }
+ };
+
+ Handlebars.registerHelper('isOneFeatureEnabled', isOneFeatureEnabled);
+
+ return isOneFeatureEnabled;
+})