mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add description to flow same as subflow
This commit is contained in:
parent
fb24dca019
commit
38a950a6dc
@ -277,7 +277,8 @@ RED.nodes = (function() {
|
|||||||
ws._def = {
|
ws._def = {
|
||||||
defaults: {
|
defaults: {
|
||||||
label: {value:""},
|
label: {value:""},
|
||||||
disabled: {value: false}
|
disabled: {value: false},
|
||||||
|
info: {value: ""}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ RED.sidebar.info = (function() {
|
|||||||
$("<tr><td>"+RED._("sidebar.info.instances")+"</td><td>"+userCount+"</td></tr>").appendTo(tableBody);
|
$("<tr><td>"+RED._("sidebar.info.instances")+"</td><td>"+userCount+"</td></tr>").appendTo(tableBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m && node.type != "subflow" && node.type != "comment") {
|
if (!m && node.type != "subflow" && node.type != "comment" && node.type != "tab") {
|
||||||
$('<tr class="blank"><td colspan="2"><a href="#" class="node-info-property-header"><i style="width: 10px; text-align: center;" class="fa fa-caret-'+(propertiesExpanded?"down":"right")+'"></i> '+RED._("sidebar.info.properties")+'</a></td></tr>').appendTo(tableBody);
|
$('<tr class="blank"><td colspan="2"><a href="#" class="node-info-property-header"><i style="width: 10px; text-align: center;" class="fa fa-caret-'+(propertiesExpanded?"down":"right")+'"></i> '+RED._("sidebar.info.properties")+'</a></td></tr>').appendTo(tableBody);
|
||||||
if (node._def) {
|
if (node._def) {
|
||||||
for (var n in node._def.defaults) {
|
for (var n in node._def.defaults) {
|
||||||
@ -124,12 +124,14 @@ RED.sidebar.info = (function() {
|
|||||||
}
|
}
|
||||||
$(table).appendTo(content);
|
$(table).appendTo(content);
|
||||||
$("<hr/>").appendTo(content);
|
$("<hr/>").appendTo(content);
|
||||||
if (!subflowNode && node.type != "comment") {
|
if (!subflowNode && node.type != "comment" && node.type != "tab") {
|
||||||
var helpText = $("script[data-help-name$='"+node.type+"']").html()||"";
|
var helpText = $("script[data-help-name$='"+node.type+"']").html()||"";
|
||||||
addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(helpText)+'">'+helpText+'</span></div>').appendTo(content));
|
addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(helpText)+'">'+helpText+'</span></div>').appendTo(content));
|
||||||
}
|
}
|
||||||
if (subflowNode) {
|
if (subflowNode) {
|
||||||
addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.info||"")+'">'+marked(subflowNode.info||"")+'</span></div>').appendTo(content));
|
addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.info||"")+'">'+marked(subflowNode.info||"")+'</span></div>').appendTo(content));
|
||||||
|
} else if (node.type == "tab") {
|
||||||
|
addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(node.info||"")+'">'+marked(node.info||"")+'</span></div>').appendTo(content));
|
||||||
} else if (node._def && node._def.info) {
|
} else if (node._def && node._def.info) {
|
||||||
var info = node._def.info;
|
var info = node._def.info;
|
||||||
var textInfo = (typeof info === "function" ? info.call(node) : info);
|
var textInfo = (typeof info === "function" ? info.call(node) : info);
|
||||||
@ -261,10 +263,15 @@ RED.sidebar.info = (function() {
|
|||||||
var subflow = RED.nodes.subflow(RED.workspaces.active());
|
var subflow = RED.nodes.subflow(RED.workspaces.active());
|
||||||
if (subflow) {
|
if (subflow) {
|
||||||
refresh(subflow);
|
refresh(subflow);
|
||||||
|
} else {
|
||||||
|
var workspace = RED.nodes.workspace(RED.workspaces.active());
|
||||||
|
if (workspace.info) {
|
||||||
|
refresh(workspace);
|
||||||
} else {
|
} else {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -59,6 +59,7 @@ RED.workspaces = (function() {
|
|||||||
function showRenameWorkspaceDialog(id) {
|
function showRenameWorkspaceDialog(id) {
|
||||||
var workspace = RED.nodes.workspace(id);
|
var workspace = RED.nodes.workspace(id);
|
||||||
RED.view.state(RED.state.EDITING);
|
RED.view.state(RED.state.EDITING);
|
||||||
|
var tabflowEditor;
|
||||||
var trayOptions = {
|
var trayOptions = {
|
||||||
title: RED._("workspace.editFlow",{name:workspace.label}),
|
title: RED._("workspace.editFlow",{name:workspace.label}),
|
||||||
buttons: [
|
buttons: [
|
||||||
@ -98,6 +99,12 @@ RED.workspaces = (function() {
|
|||||||
changed = true;
|
changed = true;
|
||||||
workspace.disabled = disabled;
|
workspace.disabled = disabled;
|
||||||
}
|
}
|
||||||
|
var info = tabflowEditor.getValue();
|
||||||
|
if (workspace.info !== info) {
|
||||||
|
changes.info = workspace.info;
|
||||||
|
changed = true;
|
||||||
|
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);
|
||||||
|
|
||||||
@ -117,6 +124,9 @@ RED.workspaces = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
resize: function(dimensions) {
|
||||||
|
tabflowEditor.resize();
|
||||||
|
},
|
||||||
open: function(tray) {
|
open: function(tray) {
|
||||||
var trayBody = tray.find('.editor-tray-body');
|
var trayBody = tray.find('.editor-tray-body');
|
||||||
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
|
var dialogForm = $('<form id="dialog-form" class="form-horizontal"></form>').appendTo(trayBody);
|
||||||
@ -131,6 +141,16 @@ RED.workspaces = (function() {
|
|||||||
'<input type="checkbox" id="node-input-disabled" style="display: none;"/>'+
|
'<input type="checkbox" id="node-input-disabled" style="display: none;"/>'+
|
||||||
'</div>').appendTo(dialogForm);
|
'</div>').appendTo(dialogForm);
|
||||||
|
|
||||||
|
$('<div class="form-row node-text-editor-row">'+
|
||||||
|
'<label for="node-input-info" data-i18n="editor:workspace.info"></label>'+
|
||||||
|
'<div style="height: 250px;" class="node-text-editor" id="node-input-info"></div>'+
|
||||||
|
'</div>').appendTo(dialogForm);
|
||||||
|
tabflowEditor = RED.editor.createEditor({
|
||||||
|
id: 'node-input-info',
|
||||||
|
mode: 'ace/mode/markdown',
|
||||||
|
value: ""
|
||||||
|
});
|
||||||
|
|
||||||
dialogForm.find('#node-input-disabled-btn').on("click",function(e) {
|
dialogForm.find('#node-input-disabled-btn').on("click",function(e) {
|
||||||
var i = $(this).find("i");
|
var i = $(this).find("i");
|
||||||
if (i.hasClass('fa-toggle-off')) {
|
if (i.hasClass('fa-toggle-off')) {
|
||||||
@ -162,13 +182,15 @@ RED.workspaces = (function() {
|
|||||||
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
$('<input type="text" style="display: none;" />').prependTo(dialogForm);
|
||||||
dialogForm.submit(function(e) { e.preventDefault();});
|
dialogForm.submit(function(e) { e.preventDefault();});
|
||||||
$("#node-input-name").val(workspace.label);
|
$("#node-input-name").val(workspace.label);
|
||||||
RED.text.bidi.prepareInput($("#node-input-name"))
|
RED.text.bidi.prepareInput($("#node-input-name"));
|
||||||
|
tabflowEditor.getSession().setValue(workspace.info || "", -1);
|
||||||
dialogForm.i18n();
|
dialogForm.i18n();
|
||||||
},
|
},
|
||||||
close: function() {
|
close: function() {
|
||||||
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
if (RED.view.state() != RED.state.IMPORT_DRAGGING) {
|
||||||
RED.view.state(RED.state.DEFAULT);
|
RED.view.state(RED.state.DEFAULT);
|
||||||
}
|
}
|
||||||
|
RED.sidebar.info.refresh(workspace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RED.tray.show(trayOptions);
|
RED.tray.show(trayOptions);
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
"dropFlowHere": "Drop the flow here",
|
"dropFlowHere": "Drop the flow here",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
"disabled":"Disabled"
|
"disabled":"Disabled",
|
||||||
|
"info": "Description"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"label": {
|
"label": {
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"editFlow": "フローを編集: __name__",
|
"editFlow": "フローを編集: __name__",
|
||||||
"confirmDelete": "削除の確認",
|
"confirmDelete": "削除の確認",
|
||||||
"delete": "本当に '__label__' を削除しますか?",
|
"delete": "本当に '__label__' を削除しますか?",
|
||||||
"dropFlowHere": "ここにフローをドロップしてください"
|
"dropFlowHere": "ここにフローをドロップしてください",
|
||||||
|
"info": "詳細"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"label": {
|
"label": {
|
||||||
|
Loading…
Reference in New Issue
Block a user