mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add actions to change deploy type
This commit is contained in:
parent
4d37c28bc7
commit
8abc5b3889
@ -98,21 +98,10 @@ RED.menu = (function() {
|
||||
return;
|
||||
}
|
||||
if (opt.toggle) {
|
||||
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);
|
||||
}
|
||||
if (opt.toggle === true) {
|
||||
setSelected(opt.id, !isSelected(opt.id));
|
||||
} else {
|
||||
setSelected(opt.id, !selected);
|
||||
setSelected(opt.id, true);
|
||||
}
|
||||
} else {
|
||||
triggerAction(opt.id);
|
||||
@ -209,8 +198,9 @@ RED.menu = (function() {
|
||||
}
|
||||
|
||||
function setSelected(id,state) {
|
||||
var alreadySet = false;
|
||||
if (isSelected(id) == state) {
|
||||
return;
|
||||
alreadySet = true;
|
||||
}
|
||||
var opt = menuItems[id];
|
||||
if (state) {
|
||||
@ -218,10 +208,26 @@ RED.menu = (function() {
|
||||
} else {
|
||||
$("#"+id).removeClass("active");
|
||||
}
|
||||
if (opt && opt.onselect) {
|
||||
triggerAction(opt.id,state);
|
||||
if (opt) {
|
||||
if (opt.toggle && typeof opt.toggle === "string") {
|
||||
if (state) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!alreadySet && opt.onselect) {
|
||||
triggerAction(opt.id,state);
|
||||
}
|
||||
}
|
||||
if (!alreadySet) {
|
||||
RED.settings.set(opt.setting||("menu-"+opt.id), state);
|
||||
}
|
||||
RED.settings.set(opt.setting||("menu-"+opt.id), state);
|
||||
}
|
||||
|
||||
function toggleSelected(id) {
|
||||
|
@ -99,7 +99,13 @@ RED.deploy = (function() {
|
||||
});
|
||||
|
||||
RED.actions.add("core:deploy-flows",save);
|
||||
RED.actions.add("core:restart-flows",restart);
|
||||
if (type === "default") {
|
||||
RED.actions.add("core:restart-flows",restart);
|
||||
RED.actions.add("core:set-deploy-type-to-full",function() { RED.menu.setSelected("deploymenu-item-full",true);});
|
||||
RED.actions.add("core:set-deploy-type-to-modified-flows",function() { RED.menu.setSelected("deploymenu-item-flow",true); });
|
||||
RED.actions.add("core:set-deploy-type-to-modified-nodes",function() { RED.menu.setSelected("deploymenu-item-node",true); });
|
||||
}
|
||||
|
||||
|
||||
|
||||
RED.events.on('nodes:change',function(state) {
|
||||
|
Loading…
Reference in New Issue
Block a user