From cba51889ebfcea861f9f0516b6655ca267e07bbc Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Wed, 16 May 2018 16:27:51 +0200 Subject: [PATCH] Advanced sections makeover --- src/sunstone/public/app/app.js | 6 +++ .../templates-tab/form-panels/instantiate.js | 3 +- .../form-panels/instantiate/templateRow.hbs | 42 +++++------------- .../helpers/advancedImportationSection.js | 44 +++++++++++++++++++ src/sunstone/public/app/utils/nics-section.js | 10 ++++- .../public/app/utils/nics-section/html.hbs | 2 + .../public/scss/_advanced-section.scss | 4 ++ 7 files changed, 78 insertions(+), 33 deletions(-) create mode 100644 src/sunstone/public/app/templates/helpers/advancedImportationSection.js diff --git a/src/sunstone/public/app/app.js b/src/sunstone/public/app/app.js index 4884b86c6a..e484c63960 100644 --- a/src/sunstone/public/app/app.js +++ b/src/sunstone/public/app/app.js @@ -85,8 +85,14 @@ define(function(require) { $(document).on("click", ".accordion_advanced_toggle", function() { if ($(this).hasClass("active")) { $(this).removeClass("active"); + if ($(this).hasClass("importation")) { + $(this).css("color", "").css("font-weight", "normal"); + } } else { $(this).addClass("active"); + if ($(this).hasClass("importation")) { + $(this).css("color", "#555").css("font-weight", "bold"); + } } $(".content", $(this).closest(".accordion_advanced")).toggle(); 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 dd35202195..ec20d0cb69 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 @@ -486,7 +486,8 @@ define(function(require) { $(".nicsContext" + template_json.VMTEMPLATE.ID, context), { "forceIPv4": true, "securityGroups": Config.isFeatureEnabled("secgroups"), - "name": " " + "name": " ", + "fieldset": false }); VMGroupSection.insert(template_json, 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 6bb370d05e..05d129b82d 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,7 +48,7 @@
- {{#advancedSection (tr "Network") }} + {{#advancedImportationSection "" (tr "Network") }} {{#isFeatureEnabled "show_vnet_instantiate"}}
@@ -57,15 +57,12 @@
{{/isFeatureEnabled}} - {{/advancedSection}} - {{#advancedSection (tr "Instantiate as different user / group")}} + {{/advancedImportationSection}} + {{#advancedImportationSection "" (tr "Instantiate as different User / Group")}} {{#isFeatureEnabled "show_as_uid_instantiate"}}
- - -
{{{usersDatatable}}}
@@ -75,23 +72,17 @@
- - -
{{{groupDatatable}}}
{{/isFeatureEnabled}} - {{/advancedSection}} - {{#advancedSection (tr "Deploy VM in a specific Host") }} + {{/advancedImportationSection}} + {{#advancedImportationSection "" (tr "Deploy VM in a specific Host") }} {{#isFeatureEnabled "show_host_instantiate"}}
- - -
{{{hostsDatatable}}}
@@ -106,15 +97,12 @@
{{/isFeatureEnabled}} - {{/advancedSection}} - {{#advancedSection (tr "Deploy VM in a specific Datastore") }} + {{/advancedImportationSection}} + {{#advancedImportationSection "" (tr "Deploy VM in a specific Datastore") }} {{#isFeatureEnabled "show_ds_instantiate"}}
- - -
{{{dsDatatable}}}
@@ -129,27 +117,21 @@
{{/isFeatureEnabled}} - {{/advancedSection}} - {{#advancedSection (tr "Schedule Actions for VM") }} + {{/advancedImportationSection}} + {{#advancedImportationSection "" (tr "Schedule Actions for VM") }}
- - - {{{table_sched_actions}}}
- {{/advancedSection}} - {{#advancedSection (tr "Associate VM to a VM Group") }} + {{/advancedImportationSection}} + {{#advancedImportationSection "" (tr "Associate VM to a VM Group") }} {{#isFeatureEnabled "show_vmgroup_instantiate"}}
{{/isFeatureEnabled}} - {{/advancedSection}} + {{/advancedImportationSection}}
diff --git a/src/sunstone/public/app/templates/helpers/advancedImportationSection.js b/src/sunstone/public/app/templates/helpers/advancedImportationSection.js new file mode 100644 index 0000000000..a4dc31e5fb --- /dev/null +++ b/src/sunstone/public/app/templates/helpers/advancedImportationSection.js @@ -0,0 +1,44 @@ +/* -------------------------------------------------------------------------- */ +/* 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 id = 0; + + var advancedImportationSection = function(icon, title, options) { + id += 1; + + var html_id = "advanced_section_" + id; + + return new Handlebars.SafeString( + '
'+ + ''+ + ''+ + ''+ + ' '+ icon + ' ' + title+ + ''+ + ''+ + '
' + ); + }; + + Handlebars.registerHelper('advancedImportationSection', advancedImportationSection); + + return advancedImportationSection; + }); diff --git a/src/sunstone/public/app/utils/nics-section.js b/src/sunstone/public/app/utils/nics-section.js index ea8279c074..5e61a40d68 100644 --- a/src/sunstone/public/app/utils/nics-section.js +++ b/src/sunstone/public/app/utils/nics-section.js @@ -294,10 +294,16 @@ define(function(require) { function _generate_provision_network_accordion(context, options) { context.off(); var name = "Network"; - if (options.name) + if (options.name){ name = options.name; + } + var fieldset = true; + if (options.fieldset !== undefined){ + fieldset = options.fieldset; + } context.html(TemplateSection({ - "name": Locale.tr(name) + "name": Locale.tr(name), + "fieldset": fieldset })); if (options.hide_add_button == true){ diff --git a/src/sunstone/public/app/utils/nics-section/html.hbs b/src/sunstone/public/app/utils/nics-section/html.hbs index c97447e5c9..36e5f41580 100644 --- a/src/sunstone/public/app/utils/nics-section/html.hbs +++ b/src/sunstone/public/app/utils/nics-section/html.hbs @@ -1,7 +1,9 @@
+ {{#if fieldset}} {{name}} + {{/if}}
diff --git a/src/sunstone/public/scss/_advanced-section.scss b/src/sunstone/public/scss/_advanced-section.scss index 52d8df3148..d695eaa44e 100644 --- a/src/sunstone/public/scss/_advanced-section.scss +++ b/src/sunstone/public/scss/_advanced-section.scss @@ -24,6 +24,10 @@ } } + .importation { + font-size: 1.2rem !important; + } + .content { margin-top: 0.5rem; }