Add refresh timestamp to context sidebar

This commit is contained in:
Nick O'Leary 2018-06-27 10:00:23 +01:00
parent 5d86f7b6ba
commit e01996095f
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 13 additions and 2 deletions

View File

@ -56,6 +56,7 @@ RED.sidebar.context = (function() {
});
nodeSection.expand();
nodeSection.content.css({height:"100%"});
nodeSection.timestamp = $('<div class="sidebar-context-updated">&nbsp;</div>').appendTo(nodeSection.content);
var table = $('<table class="node-info"></table>').appendTo(nodeSection.content);
nodeSection.table = $('<tbody>').appendTo(table);
var bg = $('<div style="float: right"></div>').appendTo(nodeSection.header);
@ -89,6 +90,7 @@ RED.sidebar.context = (function() {
});
flowSection.expand();
flowSection.content.css({height:"100%"});
flowSection.timestamp = $('<div class="sidebar-context-updated">&nbsp;</div>').appendTo(flowSection.content);
var table = $('<table class="node-info"></table>').appendTo(flowSection.content);
flowSection.table = $('<tbody>').appendTo(table);
bg = $('<div style="float: right"></div>').appendTo(flowSection.header);
@ -106,6 +108,7 @@ RED.sidebar.context = (function() {
});
globalSection.expand();
globalSection.content.css({height:"100%"});
globalSection.timestamp = $('<div class="sidebar-context-updated">&nbsp;</div>').appendTo(globalSection.content);
var table = $('<table class="node-info"></table>').appendTo(globalSection.content);
globalSection.table = $('<tbody>').appendTo(table);
@ -185,10 +188,10 @@ RED.sidebar.context = (function() {
$(nodeSection.table).empty();
if (node) {
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td>refresh to load</td></tr>').appendTo(nodeSection.table);
} else {
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td>none selected</td></tr>').appendTo(nodeSection.table);
}
nodeSection.timestamp.html("&nbsp;");
}
}
@ -244,6 +247,7 @@ RED.sidebar.context = (function() {
if (l === 0) {
$('<tr class="node-info-node-row red-ui-search-empty blank" colspan="2"><td>empty</td></tr>').appendTo(container);
}
$(section.timestamp).text(new Date().toLocaleString());
});
}
function updateEntry(section,baseUrl,id) {

View File

@ -92,6 +92,7 @@
font-weight: bold;
padding-left: 30px;
overflow: hidden;
user-select: none;
}
.palette-header > i {
position: absolute;

View File

@ -39,3 +39,9 @@
display: inline-block;
}
}
.sidebar-context-updated {
text-align: right;
font-size: 11px;
color: #bbb;
padding: 1px 3px;
}

View File

@ -73,7 +73,7 @@ function clean(flowConfig) {
var contextId;
var node;
for (var id in contexts) {
if (contexts.hasOwnProperty(id)) {
if (contexts.hasOwnProperty(id) && id !== "global") {
var idParts = id.split(":");
if (!flowConfig.allNodes.hasOwnProperty(idParts[0])) {
delete contexts[id];