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__",
|
"warning": "<strong>Warning</strong>: __message__",
|
||||||
"warnings": {
|
"warnings": {
|
||||||
"undeployedChanges": "node has undeployed changes",
|
"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>",
|
"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>",
|
"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",
|
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
"warning": "<strong>警告</strong>: __message__",
|
"warning": "<strong>警告</strong>: __message__",
|
||||||
"warnings": {
|
"warnings": {
|
||||||
"undeployedChanges": "ノードの変更をデプロイしていません",
|
"undeployedChanges": "ノードの変更をデプロイしていません",
|
||||||
"nodeActionDisabled": "ノードのアクションは、サブフロー内で無効になっています",
|
"nodeActionDisabledSubflow": "ノードのアクションは、サブフロー内で無効になっています",
|
||||||
"missing-types": "不明なノードが存在するため、フローを停止しました。詳細はログを確認してください。",
|
"missing-types": "不明なノードが存在するため、フローを停止しました。詳細はログを確認してください。",
|
||||||
"safe-mode": "<p>セーフモードでフローを停止しました</p><p>フローを変更し、再起動するために変更をデプロイできます</p>",
|
"safe-mode": "<p>セーフモードでフローを停止しました</p><p>フローを変更し、再起動するために変更をデプロイできます</p>",
|
||||||
"restartRequired": "更新されたモジュールを有効化するため、Node-REDを再起動する必要があります",
|
"restartRequired": "更新されたモジュールを有効化するため、Node-REDを再起動する必要があります",
|
||||||
|
@ -86,7 +86,7 @@
|
|||||||
"warning": "<strong>警告</strong>: __message__",
|
"warning": "<strong>警告</strong>: __message__",
|
||||||
"warnings": {
|
"warnings": {
|
||||||
"undeployedChanges": "节点中存在未部署的更改",
|
"undeployedChanges": "节点中存在未部署的更改",
|
||||||
"nodeActionDisabled": "节点动作在子流程中被禁用",
|
"nodeActionDisabledSubflow": "节点动作在子流程中被禁用",
|
||||||
"missing-types": "流程由于缺少节点类型而停止。请检查日志的详细信息",
|
"missing-types": "流程由于缺少节点类型而停止。请检查日志的详细信息",
|
||||||
"restartRequired": "Node-RED必须重新启动,以启用升级的模块"
|
"restartRequired": "Node-RED必须重新启动,以启用升级的模块"
|
||||||
},
|
},
|
||||||
|
@ -1909,18 +1909,25 @@ RED.view = (function() {
|
|||||||
|
|
||||||
function isButtonEnabled(d) {
|
function isButtonEnabled(d) {
|
||||||
var buttonEnabled = true;
|
var buttonEnabled = true;
|
||||||
if (d._def.button.hasOwnProperty('enabled')) {
|
var ws = RED.nodes.workspace(RED.workspaces.active());
|
||||||
if (typeof d._def.button.enabled === "function") {
|
if (ws && !ws.disabled) {
|
||||||
buttonEnabled = d._def.button.enabled.call(d);
|
if (d._def.button.hasOwnProperty('enabled')) {
|
||||||
} else {
|
if (typeof d._def.button.enabled === "function") {
|
||||||
buttonEnabled = d._def.button.enabled;
|
buttonEnabled = d._def.button.enabled.call(d);
|
||||||
|
} else {
|
||||||
|
buttonEnabled = d._def.button.enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
buttonEnabled = false;
|
||||||
}
|
}
|
||||||
return buttonEnabled;
|
return buttonEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeButtonClicked(d) {
|
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) {
|
if (d._def.button.toggle) {
|
||||||
d[d._def.button.toggle] = !d[d._def.button.toggle];
|
d[d._def.button.toggle] = !d[d._def.button.toggle];
|
||||||
d.dirty = true;
|
d.dirty = true;
|
||||||
@ -1936,7 +1943,11 @@ RED.view = (function() {
|
|||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
} else {
|
} 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();
|
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(".fa-lg").attr("y",function(d){return (d.h+13)/2;});
|
||||||
|
|
||||||
thisNode.selectAll(".node_button").attr("opacity",function(d) {
|
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) {
|
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){
|
thisNode.selectAll(".node_button").attr("transform",function(d){
|
||||||
var x = d._def.align == "right"?d.w-6:-25;
|
var x = d._def.align == "right"?d.w-6:-25;
|
||||||
|
@ -108,7 +108,7 @@ RED.workspaces = (function() {
|
|||||||
workspace.info = info;
|
workspace.info = info;
|
||||||
}
|
}
|
||||||
$("#red-ui-tab-"+(workspace.id.replace(".","-"))).toggleClass('workspace-disabled',workspace.disabled);
|
$("#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) {
|
if (changed) {
|
||||||
var historyEvent = {
|
var historyEvent = {
|
||||||
@ -125,6 +125,14 @@ RED.workspaces = (function() {
|
|||||||
if (!selection.nodes && !selection.links) {
|
if (!selection.nodes && !selection.links) {
|
||||||
RED.sidebar.info.refresh(workspace);
|
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();
|
RED.tray.close();
|
||||||
}
|
}
|
||||||
@ -249,6 +257,7 @@ RED.workspaces = (function() {
|
|||||||
// $("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
// $("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||||
RED.events.emit("workspace:change",event);
|
RED.events.emit("workspace:change",event);
|
||||||
window.location.hash = 'flow/'+tab.id;
|
window.location.hash = 'flow/'+tab.id;
|
||||||
|
$("#workspace").toggleClass("workspace-disabled",tab.disabled);
|
||||||
RED.sidebar.config.refresh();
|
RED.sidebar.config.refresh();
|
||||||
RED.view.focus();
|
RED.view.focus();
|
||||||
},
|
},
|
||||||
|
@ -169,7 +169,16 @@
|
|||||||
.node_subflow .node {
|
.node_subflow .node {
|
||||||
stroke-dasharray:8, 3;
|
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 * {
|
.node_quickadd * {
|
||||||
stroke-dasharray: 12,3;
|
stroke-dasharray: 12,3;
|
||||||
|
Loading…
Reference in New Issue
Block a user