Skip to content

Commit

Permalink
F OpenNebula#3167 add Sunstone Banner
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
  • Loading branch information
Jorge Lobo committed Apr 2, 2019
1 parent 7e3627f commit ae23f56
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 37 deletions.
76 changes: 41 additions & 35 deletions src/sunstone/public/app/sunstone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -258,6 +254,16 @@ define(function(require) {
} else {
liItem = "<li id=\"li_" + tabName + "\" class=\"" + tabClass + "\">" + "<a href=\"#\">" + title + "</a>" + "</li>";
$("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...
Expand Down
18 changes: 17 additions & 1 deletion src/sunstone/public/scss/_menu.scss
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -62,7 +78,7 @@
.support_connect {
.officialy_support{
padding: 0px;
color: #4DBBD3;
color: $dark-primary;
}
span {
display: block;
Expand Down
2 changes: 1 addition & 1 deletion src/sunstone/public/scss/_provision.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#provision_dashboard,
#provision_create_vm,
#provision_create_flow {
padding: 2rem;
padding: 2rem 0;
}


Expand Down

0 comments on commit ae23f56

Please sign in to comment.