1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Deploy menu style

This commit is contained in:
Nick O'Leary 2015-01-14 22:40:45 +00:00
parent a5afc258b1
commit 687a66344e
10 changed files with 192 additions and 51 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

View File

@ -34,8 +34,8 @@
<div class="pull-right"> <div class="pull-right">
<ul class="header-toolbar"> <ul class="header-toolbar">
<li><span class="deploy-button-group button-group"> <li><span class="deploy-button-group button-group">
<a id="btn-deploy" class="action-deploy disabled" href="#"><i id="btn-icn-deploy" class="fa fa-download"></i> <span>Deploy</span></a> <a id="btn-deploy" class="action-deploy disabled" href="#"><img id="btn-icn-deploy" src="images/deploy-full-o.png"> <span>Deploy</span></a>
<!-- <a id="btn-deploy-options" data-toggle="dropdown" class="" href="#"><i class="fa fa-caret-down"></i></a> --> <a id="btn-deploy-options" data-toggle="dropdown" class="" href="#"><i class="fa fa-caret-down"></i></a>
</span></li> </span></li>
<li><a id="btn-sidemenu" class="button" data-toggle="dropdown" href="#"><i class="fa fa-bars"></i></a></li> <li><a id="btn-sidemenu" class="button" data-toggle="dropdown" href="#"><i class="fa fa-bars"></i></a></li>
<ul> <ul>

View File

@ -16,9 +16,9 @@
var RED = (function() { var RED = (function() {
var deploymentTypes = { var deploymentTypes = {
"full":"Deploy", "full":{label:"Deploy",img:"images/deploy-full-o.png"},
"nodes":"Deploy changed nodes", "nodes":{label:"Deploy modified nodes",img:"images/deploy-nodes-o.png"},
"flows":"Deploy changed flows" "flows":{label:"Deploy modified flows",img:"images/deploy-flows-o.png"}
} }
var deploymentType = "full"; var deploymentType = "full";
@ -294,7 +294,8 @@ var RED = (function() {
function changeDeploymentType(type) { function changeDeploymentType(type) {
deploymentType = type; deploymentType = type;
$("#btn-deploy span").text(deploymentTypes[type]); $("#btn-deploy img").attr("src",deploymentTypes[type].img);
//$("#btn-deploy span").text(deploymentTypes[type].label);
} }
$(function() { $(function() {
@ -330,14 +331,13 @@ var RED = (function() {
] ]
}); });
//RED.menu.init({id:"btn-deploy-options", RED.menu.init({id:"btn-deploy-options",
// options: [ options: [
// {id:"btn-deploy-select",label:"Select deployment type"}, {id:"btn-deploy-full",toggle:"deploy-type",icon:"images/deploy-full.png",label:"Full",sublabel:"Deploys everything in the workspace",onselect:function(s) { if(s){changeDeploymentType("full")}}},
// {id:"btn-deploy-full",icon:null,label:"Full deploy",tip:"Deploys all nodes",onselect:function() { changeDeploymentType("full")}}, {id:"btn-deploy-flow",toggle:"deploy-type",icon:"images/deploy-flows.png",label:"Modified Flows",sublabel:"Only deploys flows that contain changed nodes", onselect:function(s) {if(s){changeDeploymentType("flows")}}},
// {id:"btn-deploy-node",icon:null,label:"Deploy changed nodes",tip:"Deploys all nodes that have been changed",onselect:function() { changeDeploymentType("nodes")}}, {id:"btn-deploy-node",toggle:"deploy-type",icon:"images/deploy-nodes.png",label:"Modified Nodes",sublabel:"Only deploys nodes that have changed",onselect:function(s) { if(s){changeDeploymentType("nodes")}}}
// {id:"btn-deploy-flow",icon:null,label:"Deploy changed flows",tip:"Deploys all nodes in flows that contain changes",onselect:function() { changeDeploymentType("flows")}} ]
// ] });
//});
RED.keyboard.add(/* ? */ 191,{shift:true},function(){showHelp();d3.event.preventDefault();}); RED.keyboard.add(/* ? */ 191,{shift:true},function(){showHelp();d3.event.preventDefault();});
loadSettings(); loadSettings();

View File

@ -45,11 +45,27 @@ RED.menu = (function() {
item = $('<li class="divider"></li>'); item = $('<li class="divider"></li>');
} else { } else {
item = $('<li></li>'); item = $('<li></li>');
var link = $('<a '+(opt.id?'id="'+opt.id+'" ':'')+'tabindex="-1" href="#">'+
(opt.toggle?'<i class="fa fa-check pull-right"></i>':'')+ var linkContent = '<a '+(opt.id?'id="'+opt.id+'" ':'')+'tabindex="-1" href="#">'+
(opt.icon!==undefined?'<i class="'+(opt.icon?opt.icon:'" style="display: inline-block;"')+'"></i> ':"")+ (opt.toggle?'<i class="fa fa-check pull-right"></i>':'');
'<span class="menu-label">'+opt.label+'</span>'+ if (opt.icon !== undefined) {
'</a>').appendTo(item); if (/\.png/.test(opt.icon)) {
linkContent += '<img src="'+opt.icon+'"/> ';
} else {
linkContent += '<i class="'+(opt.icon?opt.icon:'" style="display: inline-block;"')+'"></i> ';
}
}
if (opt.sublabel) {
linkContent += '<span class="menu-label-container"><span class="menu-label">'+opt.label+'</span>'+
'<span class="menu-sublabel">'+opt.sublabel+'</span></span>'
} else {
linkContent += '<span class="menu-label">'+opt.label+'</span>'
}
linkContent += '</a>';
var link = $(linkContent).appendTo(item);
menuItems[opt.id] = opt; menuItems[opt.id] = opt;
@ -59,7 +75,22 @@ RED.menu = (function() {
return; return;
} }
if (opt.toggle) { if (opt.toggle) {
setSelected(opt.id, !isSelected(opt.id)); var selected = isSelected(opt.id);
if (typeof opt.toggle === "string") {
if (!selected) {
for (var m in menuItems) {
if (menuItems.hasOwnProperty(m)) {
var mi = menuItems[m];
if (mi.id != opt.id && opt.toggle == mi.toggle) {
setSelected(mi.id,false);
}
}
}
setSelected(opt.id,true);
}
} else {
setSelected(opt.id, !selected);
}
} else { } else {
opt.onselect.call(opt); opt.onselect.call(opt);
} }

View File

@ -1,5 +1,5 @@
/** /**
* Copyright 2013, 2014 IBM Corp. * Copyright 2013, 2015 IBM Corp.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -113,29 +113,29 @@ span.logo img {
} }
#btn-deploy { #btn-deploy {
background: #d24741; background: #8C101C; /*#d24741;*/
color: #fff !important; color: #fff !important;
} }
#btn-deploy + a { #btn-deploy + a {
background: #BA403B; background: #8C101C; /*#BA403B;*/
color: #fff; color: #fff;
} }
#btn-deploy + a:hover { #btn-deploy + a:hover {
background: #AD3C38; background: #6E0A1E; /*#AD3C38;*/
color: #fff; color: #fff;
} }
#btn-deploy + a:active { #btn-deploy + a:active {
background: #aa1f19; background: #4C0A17; /*#aa1f19;*/
color: #ccc; color: #ccc;
} }
#btn-deploy:not(.disabled):hover { #btn-deploy:not(.disabled):hover {
background: #ca3f39; background: #6E0A1E; /*#ca3f39;*/
} }
#btn-deploy:not(.disabled):active { #btn-deploy:not(.disabled):active {
background: #aa1f19 !important; background: #4C0A17 /*#aa1f19*/ !important;
} }
#btn-deploy:not(.disabled):active { #btn-deploy:not(.disabled):active {
color: #ccc !important; color: #ccc !important;
@ -146,8 +146,9 @@ span.logo img {
background: #444; background: #444;
color: #999 !important; color: #999 !important;
} }
#btn-deploy.disabled + a { #btn-deploy.disabled + a {
background: #666; background: #444;
color: #ddd; color: #ddd;
} }
#btn-deploy.disabled + a:hover { #btn-deploy.disabled + a:hover {
@ -159,6 +160,12 @@ span.logo img {
color: #ddd; color: #ddd;
} }
#btn-deploy img {
margin-right: 8px;
}
#btn-deploy.disabled img {
opacity: 0.3;
}
.button-group { .button-group {
display: inline-block; display: inline-block;
@ -192,6 +199,11 @@ span.logo img {
#header .button:focus { #header .button:focus {
outline: none; outline: none;
} }
li.open #btn-sidemenu {
background: #666 ;
}
#workspace-toolbar .button { #workspace-toolbar .button {
line-height: 18px; line-height: 18px;
@ -806,29 +818,7 @@ div.node-info {
.hidden { .hidden {
display: none; display: none;
} }
/*
.dropdown-menu {
font-size: 14px;
background: #000;
}
.dropdown-menu .divider {
background: #666;
border-bottom: #666;
}
.dropdown-menu>li>a {
color: #ddd;
}
.dropdown-submenu>ul {
border: 1px solid white;
border-radius: 6px !important;
}
.dropdown-menu li.disabled a {
color: #666;
}
.dropdown-menu li.disabled a:hover {
background: none;
}
*/
.dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus, .dropdown-submenu:hover>a, .dropdown-submenu:focus>a { .dropdown-menu>li>a:hover, .dropdown-menu>li>a:focus, .dropdown-submenu:hover>a, .dropdown-submenu:focus>a {
background: #999; background: #999;
} }
@ -846,7 +836,9 @@ div.node-info {
} }
/** Fix for unreachable dropdown menu **/ /** Fix for unreachable dropdown menu **/
.dropdown-menu { .dropdown-menu {
border-radius: 0;
width: 200px !important; width: 200px !important;
margin-left: 0px !important;
} }
.dropdown-menu > li > a > i { .dropdown-menu > li > a > i {
width: 10px; width: 10px;
@ -1137,3 +1129,121 @@ i.spinner {
display: none; display: none;
} }
/*
ul#btn-deploy-options-submenu {
background: black;
border-radius: 0;
width: 300px !important;
}
ul#btn-deploy-options-submenu li a {
padding: 10px 30px;
color: white;
}
ul#btn-deploy-options-submenu li a img {
margin-right: 10px;
padding: 4px;
border: 3px solid rgba(0,0,0,0);
}
ul#btn-deploy-options-submenu li a.active img {
border: 3px solid #777677;
}
ul#btn-deploy-options-submenu li a span.menu-label-container {
width: 180px;
vertical-align: top;
display: inline-block;
text-indent: 0px;
}
ul#btn-deploy-options-submenu li a span.menu-label {
font-size: 16px;
display: inline-block;
text-indent: 0px;
}
ul#btn-deploy-options-submenu li a span.menu-sublabel {
color: #aeaeae;
font-size: 13px;
display: inline-block;
text-indent: 0px;
}
ul#btn-deploy-options-submenu li a:hover {
background: #323232;
}
*/
#header ul.dropdown-menu {
background: black;
width: 300px !important;
}
#header ul.dropdown-menu li a {
color: white;
padding: 8px 40px;
}
#header ul.dropdown-menu li a img {
margin-right: 10px;
padding: 4px;
border: 3px solid rgba(0,0,0,0);
}
#header ul.dropdown-menu li a.active img {
border: 3px solid #777677;
}
#header ul.dropdown-menu li a span.menu-label-container {
width: 180px;
vertical-align: top;
display: inline-block;
text-indent: 0px;
}
#header ul.dropdown-menu li a span.menu-label {
font-size: 13px;
display: inline-block;
text-indent: 0px;
}
#header ul.dropdown-menu li a span.menu-sublabel {
color: #aeaeae;
font-size: 13px;
display: inline-block;
text-indent: 0px;
}
#header ul.dropdown-menu li a:hover {
background: #323232;
}
#header ul.dropdown-menu li.divider {
background: #5A5A5A;
border-bottom-color: #464646;
}
/* Deploy menu customisations */
#header ul#btn-deploy-options-submenu li a span.menu-label {
font-size: 16px;
display: inline-block;
text-indent: 0px;
}
#header ul#btn-deploy-options-submenu li a {
padding: 10px 30px;
color: white;
}
.dropdown-submenu>a:after {
display: none;
}
.dropdown-submenu>a:before {
display: block;
float: left;
width: 0;
height: 0;
margin-top: 5px;
margin-left: -35px;
border-color: transparent;
border-right-color: #ccc;
border-style: solid;
border-width: 5px 5px 5px 0;
content: " ";
}