mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Compare commits
2 Commits
mqtt-follo
...
context-la
Author | SHA1 | Date | |
---|---|---|---|
|
7518987083 | ||
|
5a7592a953 |
@@ -529,6 +529,7 @@
|
|||||||
"refresh": "refresh to load",
|
"refresh": "refresh to load",
|
||||||
"empty": "empty",
|
"empty": "empty",
|
||||||
"node": "Node",
|
"node": "Node",
|
||||||
|
"subflow": "Subflow",
|
||||||
"flow": "Flow",
|
"flow": "Flow",
|
||||||
"global": "Global",
|
"global": "Global",
|
||||||
"deleteConfirm": "Are you sure you want to delete this item?",
|
"deleteConfirm": "Are you sure you want to delete this item?",
|
||||||
|
@@ -14,28 +14,21 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
RED.sidebar.context = (function() {
|
RED.sidebar.context = (function() {
|
||||||
|
|
||||||
var content;
|
var content;
|
||||||
var sections;
|
var sections;
|
||||||
|
|
||||||
var localCache = {};
|
var localCache = {};
|
||||||
|
|
||||||
var flowAutoRefresh;
|
var flowAutoRefresh;
|
||||||
var nodeSection;
|
var nodeSection;
|
||||||
// var subflowSection;
|
|
||||||
var flowSection;
|
var flowSection;
|
||||||
var globalSection;
|
var globalSection;
|
||||||
|
|
||||||
var currentNode;
|
var currentNode;
|
||||||
var currentFlow;
|
var currentFlow;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
content = $("<div>").css({"position":"relative","height":"100%"});
|
content = $("<div>").css({"position":"relative","height":"100%"});
|
||||||
content.className = "red-ui-sidebar-context"
|
content.className = "red-ui-sidebar-context"
|
||||||
|
|
||||||
var header = $('<div class="red-ui-sidebar-header"></div>').appendTo(content);
|
var header = $('<div class="red-ui-sidebar-header"></div>').appendTo(content);
|
||||||
|
|
||||||
var autoUpdate = RED.settings.get("editor.context.refresh",false);
|
var autoUpdate = RED.settings.get("editor.context.refresh",false);
|
||||||
flowAutoRefresh = $('<input type="checkbox">').prop("checked",autoUpdate).appendTo(header).toggleButton({
|
flowAutoRefresh = $('<input type="checkbox">').prop("checked",autoUpdate).appendTo(header).toggleButton({
|
||||||
baseClass: "red-ui-sidebar-header-button",
|
baseClass: "red-ui-sidebar-header-button",
|
||||||
@@ -47,7 +40,6 @@ RED.sidebar.context = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var footerToolbar = $('<div></div>');
|
var footerToolbar = $('<div></div>');
|
||||||
|
|
||||||
var stackContainer = $("<div>",{class:"red-ui-sidebar-context-stack"}).appendTo(content);
|
var stackContainer = $("<div>",{class:"red-ui-sidebar-context-stack"}).appendTo(content);
|
||||||
sections = RED.stack.create({
|
sections = RED.stack.create({
|
||||||
container: stackContainer
|
container: stackContainer
|
||||||
@@ -55,10 +47,8 @@ RED.sidebar.context = (function() {
|
|||||||
|
|
||||||
nodeSection = sections.add({
|
nodeSection = sections.add({
|
||||||
title: RED._("sidebar.context.node"),
|
title: RED._("sidebar.context.node"),
|
||||||
collapsible: true,
|
collapsible: true
|
||||||
// onexpand: function() {
|
// onexpand: function() { updateNode(currentNode,true); }
|
||||||
// updateNode(currentNode,true);
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
nodeSection.expand();
|
nodeSection.expand();
|
||||||
nodeSection.content.css({height:"100%"});
|
nodeSection.content.css({height:"100%"});
|
||||||
@@ -75,22 +65,6 @@ RED.sidebar.context = (function() {
|
|||||||
})
|
})
|
||||||
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
|
RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
|
||||||
|
|
||||||
// subflowSection = sections.add({
|
|
||||||
// title: "Subflow",
|
|
||||||
// collapsible: true
|
|
||||||
// });
|
|
||||||
// subflowSection.expand();
|
|
||||||
// subflowSection.content.css({height:"100%"});
|
|
||||||
// bg = $('<div style="float: right"></div>').appendTo(subflowSection.header);
|
|
||||||
// $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-refresh"></i></button>')
|
|
||||||
// .appendTo(bg)
|
|
||||||
// .on("click", function(evt) {
|
|
||||||
// evt.stopPropagation();
|
|
||||||
// evt.preventDefault();
|
|
||||||
// })
|
|
||||||
// RED.popover.tooltip(bg,RED._("sidebar.context.refrsh"));
|
|
||||||
// subflowSection.container.hide();
|
|
||||||
|
|
||||||
flowSection = sections.add({
|
flowSection = sections.add({
|
||||||
title: RED._("sidebar.context.flow"),
|
title: RED._("sidebar.context.flow"),
|
||||||
collapsible: true
|
collapsible: true
|
||||||
@@ -165,7 +139,6 @@ RED.sidebar.context = (function() {
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
RED.events.on("view:selection-changed", function(event) {
|
RED.events.on("view:selection-changed", function(event) {
|
||||||
var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0];
|
var selectedNode = event.nodes && event.nodes.length === 1 && event.nodes[0];
|
||||||
updateNode(selectedNode);
|
updateNode(selectedNode);
|
||||||
@@ -181,20 +154,31 @@ RED.sidebar.context = (function() {
|
|||||||
$('<tr class="red-ui-help-info-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.refresh"></td></tr>').appendTo(globalSection.table).i18n();
|
$('<tr class="red-ui-help-info-row red-ui-search-empty blank" colspan="2"><td data-i18n="sidebar.context.refresh"></td></tr>').appendTo(globalSection.table).i18n();
|
||||||
globalSection.timestamp.html(" ");
|
globalSection.timestamp.html(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateNode(node,force) {
|
function updateNode(node,force) {
|
||||||
currentNode = node;
|
currentNode = node;
|
||||||
|
if (node && /^subflow:/.test(node.type)) {
|
||||||
|
if (currentNode && currentNode.hasOwnProperty("name") && currentNode.name.length > 0 ) {
|
||||||
|
$(nodeSection.title).text(RED._("sidebar.context.subflow") + ": " + currentNode.name);
|
||||||
|
} else {
|
||||||
|
$(nodeSection.title).text(RED._("sidebar.context.subflow"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (currentNode && currentNode.hasOwnProperty("name") && currentNode.name.length > 0 ) {
|
||||||
|
$(nodeSection.title).text(RED._("sidebar.context.node") + ": " + currentNode.name);
|
||||||
|
}
|
||||||
|
else { $(nodeSection.title).text(RED._("sidebar.context.node")); }
|
||||||
|
}
|
||||||
if (force) {
|
if (force) {
|
||||||
if (node) {
|
if (node) {
|
||||||
updateEntry(nodeSection,"context/node/"+node.id,node.id);
|
if (/^subflow:/.test(node.type)) {
|
||||||
// if (/^subflow:/.test(node.type)) {
|
//subflowSection.container.show();
|
||||||
// subflowSection.container.show();
|
updateEntry(nodeSection,"context/flow/"+node.id,node.id);
|
||||||
// updateEntry(subflowSection,"context/flow/"+node.id,node.id);
|
}
|
||||||
// } else {
|
else {
|
||||||
// subflowSection.container.hide();
|
updateEntry(nodeSection,"context/node/"+node.id,node.id);
|
||||||
// }
|
}
|
||||||
} else {
|
} else {
|
||||||
// subflowSection.container.hide();
|
// subflowSection.container.hide();
|
||||||
updateEntry(nodeSection)
|
updateEntry(nodeSection)
|
||||||
@@ -209,8 +193,10 @@ RED.sidebar.context = (function() {
|
|||||||
nodeSection.timestamp.html(" ");
|
nodeSection.timestamp.html(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFlow(flow, force) {
|
function updateFlow(flow, force) {
|
||||||
currentFlow = flow;
|
currentFlow = flow;
|
||||||
|
$(flowSection.title).text(RED._("sidebar.context.flow") + ": " + currentFlow.label);
|
||||||
if (force || flowAutoRefresh.prop("checked")) {
|
if (force || flowAutoRefresh.prop("checked")) {
|
||||||
if (flow) {
|
if (flow) {
|
||||||
updateEntry(flowSection,"context/flow/"+flow.id,flow.id);
|
updateEntry(flowSection,"context/flow/"+flow.id,flow.id);
|
||||||
@@ -225,7 +211,6 @@ RED.sidebar.context = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshEntry(section,baseUrl,id) {
|
function refreshEntry(section,baseUrl,id) {
|
||||||
|
|
||||||
var contextStores = RED.settings.context.stores;
|
var contextStores = RED.settings.context.stores;
|
||||||
var container = section.table;
|
var container = section.table;
|
||||||
|
|
||||||
@@ -325,7 +310,6 @@ RED.sidebar.context = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
popover.open();
|
popover.open();
|
||||||
|
|
||||||
});
|
});
|
||||||
RED.popover.tooltip(deleteItem,RED._("sidebar.context.delete"));
|
RED.popover.tooltip(deleteItem,RED._("sidebar.context.delete"));
|
||||||
var payload = v.msg;
|
var payload = v.msg;
|
||||||
@@ -346,6 +330,7 @@ RED.sidebar.context = (function() {
|
|||||||
$(section.timestamp).text(new Date().toLocaleString());
|
$(section.timestamp).text(new Date().toLocaleString());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateEntry(section,baseUrl,id) {
|
function updateEntry(section,baseUrl,id) {
|
||||||
var container = section.table;
|
var container = section.table;
|
||||||
if (id) {
|
if (id) {
|
||||||
@@ -356,11 +341,10 @@ RED.sidebar.context = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
RED.sidebar.show("context");
|
RED.sidebar.show("context");
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
init: init
|
init: init
|
||||||
}
|
}
|
||||||
|
@@ -218,7 +218,7 @@
|
|||||||
|
|
||||||
.red-ui-debug-msg-row {
|
.red-ui-debug-msg-row {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 4px 2px 2px;
|
padding: 2px 2px 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
&.red-ui-debug-msg-row-pinned {
|
&.red-ui-debug-msg-row-pinned {
|
||||||
background: $secondary-background-selected;
|
background: $secondary-background-selected;
|
||||||
|
@@ -92,12 +92,12 @@ table.red-ui-info-table tr:not(.blank) td:first-child{
|
|||||||
color: $header-text-color;
|
color: $header-text-color;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
width: 90px;
|
width: 90px;
|
||||||
padding: 3px 3px 3px 6px;
|
padding: 6px 3px 3px 6px;
|
||||||
background:$tertiary-background;
|
background:$tertiary-background;
|
||||||
border-right: 1px solid $secondary-border-color;
|
border-right: 1px solid $secondary-border-color;
|
||||||
}
|
}
|
||||||
table.red-ui-info-table tr:not(.blank) td:last-child{
|
table.red-ui-info-table tr:not(.blank) td:last-child{
|
||||||
padding: 3px 3px 3px 6px;
|
padding: 5px 3px 3px 6px;
|
||||||
color: $primary-text-color;
|
color: $primary-text-color;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user