mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add deployment types in runtime
- removes ui option as it needs work
This commit is contained in:
@@ -32,14 +32,13 @@
|
||||
<div id="header">
|
||||
<span class="logo"><img src="node-red.png"> <span>Node-RED</span></span>
|
||||
<div class="pull-right">
|
||||
<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> Deploy</a>
|
||||
<a id="btn-deploy-options" data-toggle="dropdown" class="" href="#"><i class="fa fa-caret-down"></i></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>Foo</li>
|
||||
</ul>
|
||||
</span>
|
||||
<a id="btn-sidemenu" class="button dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-bars"></i></a>
|
||||
<ul class="header-toolbar">
|
||||
<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-options" data-toggle="dropdown" class="" href="#"><i class="fa fa-caret-down"></i></a> -->
|
||||
</span></li>
|
||||
<li><a id="btn-sidemenu" class="button" data-toggle="dropdown" href="#"><i class="fa fa-bars"></i></a></li>
|
||||
<ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="main-container" class="sidebar-closed">
|
||||
|
@@ -15,6 +15,14 @@
|
||||
**/
|
||||
var RED = (function() {
|
||||
|
||||
var deploymentTypes = {
|
||||
"full":"Deploy",
|
||||
"nodes":"Deploy changed nodes",
|
||||
"flows":"Deploy changed flows"
|
||||
}
|
||||
var deploymentType = "full";
|
||||
|
||||
|
||||
function hideDropTarget() {
|
||||
$("#dropTarget").hide();
|
||||
RED.keyboard.remove(/* ESCAPE */ 27);
|
||||
@@ -82,7 +90,10 @@ var RED = (function() {
|
||||
url:"flows",
|
||||
type: "POST",
|
||||
data: JSON.stringify(nns),
|
||||
contentType: "application/json; charset=utf-8"
|
||||
contentType: "application/json; charset=utf-8",
|
||||
headers: {
|
||||
"Node-RED-Deployment-Type":deploymentType
|
||||
}
|
||||
}).done(function(data,textStatus,xhr) {
|
||||
RED.notify("Successfully deployed","success");
|
||||
RED.nodes.eachNode(function(node) {
|
||||
@@ -280,6 +291,12 @@ var RED = (function() {
|
||||
dialog.modal();
|
||||
}
|
||||
|
||||
|
||||
function changeDeploymentType(type) {
|
||||
deploymentType = type;
|
||||
$("#btn-deploy span").text(deploymentTypes[type]);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
RED.menu.init({id:"btn-sidemenu",
|
||||
options: [
|
||||
@@ -312,6 +329,15 @@ var RED = (function() {
|
||||
{id:"btn-help",icon:"fa fa-question",label:"Help...", href:"http://nodered.org/docs"}
|
||||
]
|
||||
});
|
||||
|
||||
//RED.menu.init({id:"btn-deploy-options",
|
||||
// options: [
|
||||
// {id:"btn-deploy-select",label:"Select deployment type"},
|
||||
// {id:"btn-deploy-full",icon:null,label:"Full deploy",tip:"Deploys all nodes",onselect:function() { changeDeploymentType("full")}},
|
||||
// {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-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();});
|
||||
loadSettings();
|
||||
|
@@ -394,7 +394,7 @@ RED.nodes = (function() {
|
||||
var wires = links.filter(function(d) { return d.source === p });
|
||||
for (var i=0;i<wires.length;i++) {
|
||||
var w = wires[i];
|
||||
if (w.target.id != p.id) {
|
||||
if (w.target.type != "subflow") {
|
||||
nIn.wires.push({id:w.target.id})
|
||||
}
|
||||
}
|
||||
|
@@ -47,8 +47,8 @@ RED.menu = (function() {
|
||||
item = $('<li></li>');
|
||||
var link = $('<a '+(opt.id?'id="'+opt.id+'" ':'')+'tabindex="-1" href="#">'+
|
||||
(opt.toggle?'<i class="fa fa-check pull-right"></i>':'')+
|
||||
(opt.icon?'<i class="'+opt.icon+'"></i> ':'')+
|
||||
opt.label+
|
||||
(opt.icon!==undefined?'<i class="'+(opt.icon?opt.icon:'" style="display: inline-block;"')+'"></i> ':"")+
|
||||
'<span class="menu-label">'+opt.label+'</span>'+
|
||||
'</a>').appendTo(item);
|
||||
|
||||
menuItems[opt.id] = opt;
|
||||
@@ -67,6 +67,11 @@ RED.menu = (function() {
|
||||
setState();
|
||||
} else if (opt.href) {
|
||||
link.attr("target","_blank").attr("href",opt.href);
|
||||
} else if (!opt.options) {
|
||||
item.addClass("disabled");
|
||||
link.click(function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
}
|
||||
if (opt.options) {
|
||||
item.addClass("dropdown-submenu pull-left");
|
||||
@@ -79,6 +84,17 @@ RED.menu = (function() {
|
||||
if (opt.disabled) {
|
||||
item.addClass("disabled");
|
||||
}
|
||||
if (opt.tip) {
|
||||
item.popover({
|
||||
placement:"left",
|
||||
trigger: "hover",
|
||||
delay: { show: 350, hide: 20 },
|
||||
html: true,
|
||||
container:'body',
|
||||
content: opt.tip
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +104,8 @@ RED.menu = (function() {
|
||||
function createMenu(options) {
|
||||
|
||||
var button = $("#"+options.id);
|
||||
|
||||
var topMenu = $("<ul/>",{class:"dropdown-menu"}).insertAfter(button);
|
||||
|
||||
var topMenu = $("<ul/>",{id:options.id+"-submenu", class:"dropdown-menu pull-right"}).insertAfter(button);
|
||||
|
||||
for (var i=0;i<options.options.length;i++) {
|
||||
var opt = options.options[i];
|
||||
|
@@ -74,6 +74,19 @@ span.logo span {
|
||||
span.logo img {
|
||||
height: 18px;
|
||||
}
|
||||
#header ul.header-toolbar {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#header ul.header-toolbar > li {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.button {
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
@@ -83,6 +96,8 @@ span.logo img {
|
||||
}
|
||||
|
||||
#header .button {
|
||||
min-width: 20px;
|
||||
text-align: center;
|
||||
line-height: 22px;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
@@ -90,7 +105,7 @@ span.logo img {
|
||||
text-decoration: none;
|
||||
border-radius: 3px;
|
||||
color: #ccc;
|
||||
margin: auto 10px;
|
||||
margin: auto 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#header .button:not(.disabled):hover {
|
||||
|
Reference in New Issue
Block a user