From ae23f565a762ae08abaa1adbe6c997c5cd40f93a Mon Sep 17 00:00:00 2001 From: Jorge Lobo Date: Mon, 1 Apr 2019 19:12:08 +0200 Subject: [PATCH] F #3167 add Sunstone Banner Signed-off-by: Jorge Lobo --- src/sunstone/public/app/sunstone.js | 76 +++++++++++++----------- src/sunstone/public/scss/_menu.scss | 18 +++++- src/sunstone/public/scss/_provision.scss | 2 +- 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index 36274df4bbc..39a06936d7e 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -116,20 +116,24 @@ define(function(require) { }); }; + var _addAction = function(i=null, tabName){ + var name = "./tabs/" + tabName; + if (DefaultTabsArr.indexOf(tabName) == -1){ + name = "./addons/tabs/" + tabName; + } + var tabObj = require(name); + + var actions = tabObj.actions; + if (actions) { + $.each(actions, function(actionName, action) { + SunstoneCfg["actions"][actionName] = action; + }); + } + }; + var _addActions = function() { $.each(Config.allTabs(), function(i, tabName){ - var name = "./tabs/" + tabName; - if (DefaultTabsArr.indexOf(tabName) == -1){ - name = "./addons/tabs/" + tabName; - } - var tabObj = require(name); - - var actions = tabObj.actions; - if (actions) { - $.each(actions, function(actionName, action) { - SunstoneCfg["actions"][actionName] = action; - }); - } + _addAction(i, tabName); }); }; @@ -184,34 +188,26 @@ define(function(require) { }); } } + var support_tab = "support-tab"; if(SunstoneCfg && SunstoneCfg.tabs && - config && - config.user_config && - config.user_config.default_view && - config.user_config.default_view === "admin" + !SunstoneCfg.tabs[support_tab] ){ - var support_tab = "support-tab"; - if(!SunstoneCfg.tabs[support_tab]){ - SunstoneCfg.tabs[support_tab] = { - actions: { - "Support.create_dialog": true, - "Support.refresh": true - }, - panels_tabs:{ - "support_info_tab": true - }, - table_columns: [1,2,3,4] - }; - _addMainTab(support_tab); - _insertTab(support_tab); - _setupDataTable(support_tab); - } + SunstoneCfg.tabs[support_tab] = { + actions: { + "Support.create_dialog": true, + "Support.refresh": true + }, + panels_tabs:{ + "support_info_tab": true + }, + table_columns: [1,2,3,4] + }; + _addMainTab(support_tab); + _insertTab(support_tab); + _setupDataTable(support_tab); } _setupTabs(); - $().on("click",function(){ - - }) }; var _setupDataTable = function(tabName) { @@ -258,6 +254,16 @@ define(function(require) { } else { liItem = "
  • " + "" + title + "" + "
  • "; $("div#menu ul#navigation").append(liItem); + if(config && config.user_config){ + if(tabName === "support-tab" && config.user_config.default_view === "cloud"){ + _addAction(null, "support-tab"); + $(".sunstone-header").addClass("support_place").append(title); + $("#support-tab").remove(); + } + if(config.user_config.default_view !== "admin"){ + $("#support-tab").remove(); + } + } } //if this is a submenu... diff --git a/src/sunstone/public/scss/_menu.scss b/src/sunstone/public/scss/_menu.scss index 16aa0d58891..65df236e33b 100644 --- a/src/sunstone/public/scss/_menu.scss +++ b/src/sunstone/public/scss/_menu.scss @@ -1,3 +1,19 @@ +.sunstone-header{ + + &.support_place{ + text-align: right; + margin: 20px 2rem -2rem 0px; + + .officialy_support{ + font-family: $body-font-family; + font-weight: bold; + color: $dark-primary; + margin-bottom: 1rem; + display: inline-block; + } + } +} + #menu { #navigation { @@ -62,7 +78,7 @@ .support_connect { .officialy_support{ padding: 0px; - color: #4DBBD3; + color: $dark-primary; } span { display: block; diff --git a/src/sunstone/public/scss/_provision.scss b/src/sunstone/public/scss/_provision.scss index b5687656732..7a53310bd86 100644 --- a/src/sunstone/public/scss/_provision.scss +++ b/src/sunstone/public/scss/_provision.scss @@ -1,7 +1,7 @@ #provision_dashboard, #provision_create_vm, #provision_create_flow { - padding: 2rem; + padding: 2rem 0; }