mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Make disabled flows more obvious in editor
This commit is contained in:
parent
073f38c68c
commit
dc880c672a
@ -106,7 +106,8 @@
|
||||
"warning": "<strong>Warning</strong>: __message__",
|
||||
"warnings": {
|
||||
"undeployedChanges": "node has undeployed changes",
|
||||
"nodeActionDisabled": "node actions disabled within subflow",
|
||||
"nodeActionDisabled": "node actions disabled",
|
||||
"nodeActionDisabledSubflow": "node actions disabled within subflow",
|
||||
"missing-types": "<p>Flows stopped due to missing node types.</p>",
|
||||
"safe-mode":"<p>Flows stopped in safe mode.</p><p>You can modify your flows and deploy the changes to restart.</p>",
|
||||
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
|
||||
|
@ -106,7 +106,7 @@
|
||||
"warning": "<strong>警告</strong>: __message__",
|
||||
"warnings": {
|
||||
"undeployedChanges": "ノードの変更をデプロイしていません",
|
||||
"nodeActionDisabled": "ノードのアクションは、サブフロー内で無効になっています",
|
||||
"nodeActionDisabledSubflow": "ノードのアクションは、サブフロー内で無効になっています",
|
||||
"missing-types": "不明なノードが存在するため、フローを停止しました。詳細はログを確認してください。",
|
||||
"safe-mode": "<p>セーフモードでフローを停止しました</p><p>フローを変更し、再起動するために変更をデプロイできます</p>",
|
||||
"restartRequired": "更新されたモジュールを有効化するため、Node-REDを再起動する必要があります",
|
||||
|
@ -86,7 +86,7 @@
|
||||
"warning": "<strong>警告</strong>: __message__",
|
||||
"warnings": {
|
||||
"undeployedChanges": "节点中存在未部署的更改",
|
||||
"nodeActionDisabled": "节点动作在子流程中被禁用",
|
||||
"nodeActionDisabledSubflow": "节点动作在子流程中被禁用",
|
||||
"missing-types": "流程由于缺少节点类型而停止。请检查日志的详细信息",
|
||||
"restartRequired": "Node-RED必须重新启动,以启用升级的模块"
|
||||
},
|
||||
|
@ -1909,18 +1909,25 @@ RED.view = (function() {
|
||||
|
||||
function isButtonEnabled(d) {
|
||||
var buttonEnabled = true;
|
||||
if (d._def.button.hasOwnProperty('enabled')) {
|
||||
if (typeof d._def.button.enabled === "function") {
|
||||
buttonEnabled = d._def.button.enabled.call(d);
|
||||
} else {
|
||||
buttonEnabled = d._def.button.enabled;
|
||||
var ws = RED.nodes.workspace(RED.workspaces.active());
|
||||
if (ws && !ws.disabled) {
|
||||
if (d._def.button.hasOwnProperty('enabled')) {
|
||||
if (typeof d._def.button.enabled === "function") {
|
||||
buttonEnabled = d._def.button.enabled.call(d);
|
||||
} else {
|
||||
buttonEnabled = d._def.button.enabled;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
buttonEnabled = false;
|
||||
}
|
||||
return buttonEnabled;
|
||||
}
|
||||
|
||||
function nodeButtonClicked(d) {
|
||||
if (!activeSubflow) {
|
||||
var activeWorkspace = RED.workspaces.active();
|
||||
var ws = RED.nodes.workspace(activeWorkspace);
|
||||
if (ws && !ws.disabled) {
|
||||
if (d._def.button.toggle) {
|
||||
d[d._def.button.toggle] = !d[d._def.button.toggle];
|
||||
d.dirty = true;
|
||||
@ -1936,7 +1943,11 @@ RED.view = (function() {
|
||||
redraw();
|
||||
}
|
||||
} else {
|
||||
RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
|
||||
if (activeSubflow) {
|
||||
RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabledSubflow")}),"warning");
|
||||
} else {
|
||||
RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
|
||||
}
|
||||
}
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
@ -2482,10 +2493,10 @@ RED.view = (function() {
|
||||
thisNode.selectAll(".fa-lg").attr("y",function(d){return (d.h+13)/2;});
|
||||
|
||||
thisNode.selectAll(".node_button").attr("opacity",function(d) {
|
||||
return (activeSubflow||!isButtonEnabled(d))?0.4:1
|
||||
return (!isButtonEnabled(d))?0.4:1
|
||||
});
|
||||
thisNode.selectAll(".node_button_button").attr("cursor",function(d) {
|
||||
return (activeSubflow||!isButtonEnabled(d))?"":"pointer";
|
||||
return (!isButtonEnabled(d))?"":"pointer";
|
||||
});
|
||||
thisNode.selectAll(".node_button").attr("transform",function(d){
|
||||
var x = d._def.align == "right"?d.w-6:-25;
|
||||
|
@ -108,7 +108,7 @@ RED.workspaces = (function() {
|
||||
workspace.info = info;
|
||||
}
|
||||
$("#red-ui-tab-"+(workspace.id.replace(".","-"))).toggleClass('workspace-disabled',workspace.disabled);
|
||||
// $("#workspace").toggleClass("workspace-disabled",workspace.disabled);
|
||||
$("#workspace").toggleClass("workspace-disabled",workspace.disabled);
|
||||
|
||||
if (changed) {
|
||||
var historyEvent = {
|
||||
@ -125,6 +125,14 @@ RED.workspaces = (function() {
|
||||
if (!selection.nodes && !selection.links) {
|
||||
RED.sidebar.info.refresh(workspace);
|
||||
}
|
||||
if (changes.hasOwnProperty('disabled')) {
|
||||
RED.nodes.eachNode(function(n) {
|
||||
if (n.z === workspace.id) {
|
||||
n.dirty = true;
|
||||
}
|
||||
});
|
||||
RED.view.redraw();
|
||||
}
|
||||
}
|
||||
RED.tray.close();
|
||||
}
|
||||
@ -249,6 +257,7 @@ RED.workspaces = (function() {
|
||||
// $("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||
RED.events.emit("workspace:change",event);
|
||||
window.location.hash = 'flow/'+tab.id;
|
||||
$("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||
RED.sidebar.config.refresh();
|
||||
RED.view.focus();
|
||||
},
|
||||
|
@ -169,7 +169,16 @@
|
||||
.node_subflow .node {
|
||||
stroke-dasharray:8, 3;
|
||||
}
|
||||
|
||||
.workspace-disabled {
|
||||
.link_line {
|
||||
stroke-dasharray: 10,5 !important;
|
||||
stroke-width: 2 !important;
|
||||
stroke: $link-subflow-color;
|
||||
}
|
||||
.node {
|
||||
stroke-dasharray: 10,4;
|
||||
}
|
||||
}
|
||||
|
||||
.node_quickadd * {
|
||||
stroke-dasharray: 12,3;
|
||||
|
Loading…
Reference in New Issue
Block a user