This commit is contained in:
simonox 2023-02-27 17:21:01 +01:00
parent 1aeb013e8e
commit 8d48dbbd45
31 changed files with 25642 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,733 @@
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
if (!RED) {
var RED = {}
}
RED.debug = (function() {
var config;
var messageList;
var messageTable;
var filterType = "filterAll";
var filteredNodes = {}; // id->true means hide, so default to all visible
var view = 'list';
var messages = [];
var messagesByNode = {};
var sbc;
var activeWorkspace;
var numMessages = 100; // Hardcoded number of message to show in debug window scrollback
var debugNodeTreeList;
function init(_config) {
config = _config;
var content = $("<div>").css({"position":"relative","height":"100%"});
var toolbar = $('<div class="red-ui-sidebar-header">'+
'<span class="button-group">'+
'<a id="red-ui-sidebar-debug-filter" style="padding-right: 5px" class="red-ui-sidebar-header-button" href="#"><i class="fa fa-filter"></i> <span></span> <i style="padding-left: 5px;" class="fa fa-caret-down"></i></a>'+
'</span>'+
'<span class="button-group">'+
'<a id="red-ui-sidebar-debug-clear" style="border-right: none; padding-right: 6px" class="red-ui-sidebar-header-button" href="#" data-clear-type="all"><i class="fa fa-trash"></i> <span>all</span></a>' +
'<a id="red-ui-sidebar-debug-clear-opts" style="padding: 5px; border-left: none;" class="red-ui-sidebar-header-button" href="#"><i class="fa fa-caret-down"></i></a>'+
'</span></div>').appendTo(content);
var footerToolbar = $('<div>'+
'<span class="button-group"><a id="red-ui-sidebar-debug-open" class="red-ui-footer-button" href="#"><i class="fa fa-desktop"></i></a></span> ' +
'</div>');
messageList = $('<div class="red-ui-debug-content red-ui-debug-content-list"/>').appendTo(content);
sbc = messageList[0];
messageTable = $('<div class="red-ui-debug-content red-ui-debug-content-table hide"/>').appendTo(content);
var filterDialogCloseTimeout;
var filterDialogShown = false;
var filterDialog = $('<div class="red-ui-debug-filter-box hide"></div>').appendTo(toolbar);//content);
filterDialog.on('mouseleave' ,function(evt) {
if (filterDialogShown) {
filterDialogCloseTimeout = setTimeout(function() {
filterDialog.slideUp(200);
filterDialogShown = false;
},500)
}
})
filterDialog.on('mouseenter' ,function(evt) {
clearTimeout(filterDialogCloseTimeout)
})
var filterToolbar = $('<div style="margin-bottom: 3px; display: flex;">'+
'<span style="flex-grow:1; text-align: left;">'+
'<span class="button-group"><button type="button" id="red-ui-sidebar-filter-select-all" class="red-ui-sidebar-header-button red-ui-button-small" data-i18n="node-red:debug.sidebar.selectAll"></button></span>' +
'<span class="button-group"><button type="button" id="red-ui-sidebar-filter-select-none" class="red-ui-sidebar-header-button red-ui-button-small" data-i18n="node-red:debug.sidebar.selectNone"></button></span>' +
'</span>'+
'<span class="button-group"><button type="button" id="red-ui-sidebar-filter-select-close" class="red-ui-sidebar-header-button red-ui-button-small"><i class="fa fa-times"></i></button></span>'+
'</div>').appendTo(filterDialog);
filterToolbar.find("#red-ui-sidebar-filter-select-close").on('click', function(evt) {
clearTimeout(filterDialogCloseTimeout)
filterDialogShown = false;
filterDialog.slideUp(200);
})
filterToolbar.find("#red-ui-sidebar-filter-select-all").on('click', function(evt) {
evt.preventDefault();
var data = debugNodeTreeList.treeList('data');
data.forEach(function(flow) {
if (!flow.selected) {
if (flow.treeList.checkbox) {
flow.treeList.checkbox.trigger('click')
}
} else {
flow.children.forEach(function(item) {
if (!item.selected) {
item.treeList.select();
}
})
}
});
refreshMessageList();
})
filterToolbar.find("#red-ui-sidebar-filter-select-none").on('click', function(evt) {
evt.preventDefault();
debugNodeTreeList.treeList('clearSelection');
var data = debugNodeTreeList.treeList('data');
data.forEach(function(flow) {
if (flow.children) {
flow.children.forEach(function(item) {
filteredNodes[item.node.id] = true;
})
}
});
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes))
refreshMessageList();
})
var debugNodeListRow = $('<div class="red-ui-debug-filter-row" id="red-ui-sidebar-debug-filter-node-list-row"></div>').appendTo(filterDialog);
debugNodeTreeList = $("<div></div>").appendTo(debugNodeListRow).css({width: "100%", height: "300px"})
.treeList({autoSelect: false}).on("treelistitemmouseover", function(e, item) {
if (item.node) {
item.node.highlighted = true;
item.node.dirty = true;
RED.view.redraw();
}
}).on("treelistitemmouseout", function(e, item) {
if (item.node) {
item.node.highlighted = false;
item.node.dirty = true;
RED.view.redraw();
}
}).on("treelistselect", function(e, item) {
if (item.children) {
item.children.forEach(function(child) {
if (child.checkbox) {
child.treeList.select(item.selected)
}
})
} else {
if (item.node) {
if (item.selected) {
delete filteredNodes[item.node.id]
} else {
filteredNodes[item.node.id] = true;
}
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes))
refreshMessageList();
}
}
})
try {
content.i18n();
} catch(err) {
console.log("TODO: i18n library support");
}
toolbar.find('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.filterAll'));
toolbar.find('#red-ui-sidebar-debug-filter').on("click",function(e) {
e.preventDefault();
var options = [
{ label: $('<span data-i18n="[append]node-red:debug.sidebar.filterAll"><input type="radio" value="filterAll" name="filter-type" style="margin-top:0"> </span>').i18n() , value: "filterAll" },
{ label: $('<span><span data-i18n="[append]node-red:debug.sidebar.filterSelected"><input type="radio" value="filterSelected" name="filter-type" style="margin-top:0"> </span>...</span>').i18n(), value: "filterSelected" },
{ label: $('<span data-i18n="[append]node-red:debug.sidebar.filterCurrent"><input type="radio" value="filterCurrent" name="filter-type" style="margin-top:0"> </span>').i18n(), value: "filterCurrent" }
]
var menu = RED.popover.menu({
options: options,
onselect: function(item) {
if (item.value !== filterType) {
filterType = item.value;
$('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.'+filterType));
refreshMessageList();
RED.settings.set("debug.filter",filterType)
}
if (filterType === 'filterSelected') {
refreshDebugNodeList();
filterDialog.slideDown(200);
filterDialogShown = true;
debugNodeTreeList.focus();
}
}
});
menu.show({
target: $("#red-ui-sidebar-debug-filter"),
align: "left",
offset: [$("#red-ui-sidebar-debug-filter").outerWidth()-2, -1]
})
$('input[name="filter-type"][value="'+RED.settings.get("debug.filter","filterAll")+'"]').prop("checked", true)
});
RED.popover.tooltip(toolbar.find('#red-ui-sidebar-debug-filter'),RED._('node-red:debug.sidebar.filterLog'));
toolbar.find("#red-ui-sidebar-debug-clear").on("click", function(e) {
e.preventDefault();
var action = RED.settings.get("debug.clearType","all")
clearMessageList(false, action === 'filtered');
});
var clearTooltip = RED.popover.tooltip(toolbar.find("#red-ui-sidebar-debug-clear"),RED._('node-red:debug.sidebar.clearLog'),"core:clear-debug-messages");
toolbar.find("#red-ui-sidebar-debug-clear-opts").on("click", function(e) {
e.preventDefault();
var options = [
{ label: $('<span data-i18n="[append]node-red:debug.sidebar.clearLog"><input type="radio" value="all" name="clear-type" style="margin-top:0"> </span>').i18n() , value: "all" },
{ label: $('<span data-i18n="[append]node-red:debug.sidebar.clearFilteredLog"><input type="radio" value="filtered" name="clear-type" style="margin-top:0"> </span>').i18n(), value: "filtered" }
]
var menu = RED.popover.menu({
options: options,
onselect: function(item) {
if (item.value === "all") {
$("#red-ui-sidebar-debug-clear > span").text(RED._('node-red:debug.sidebar.all'));
clearTooltip.setAction("core:clear-debug-messages");
clearTooltip.setContent(RED._('node-red:debug.sidebar.clearLog'))
RED.settings.set("debug.clearType","all")
} else {
$("#red-ui-sidebar-debug-clear > span").text(RED._('node-red:debug.sidebar.filtered'));
clearTooltip.setAction("core:clear-filtered-debug-messages");
clearTooltip.setContent(RED._('node-red:debug.sidebar.clearFilteredLog'))
RED.settings.set("debug.clearType","filtered")
}
}
});
menu.show({
target: $("#red-ui-sidebar-debug-clear-opts"),
align: "left",
offset: [$("#red-ui-sidebar-debug-clear-opts").outerWidth()-2, -1]
})
$('input[name="clear-type"][value="'+RED.settings.get("debug.clearType","all")+'"]').prop("checked", true)
})
var clearType = RED.settings.get("debug.clearType","all");
if (clearType === "all") {
toolbar.find("#red-ui-sidebar-debug-clear > span").text(RED._('node-red:debug.sidebar.all'));
clearTooltip.setAction("core:clear-debug-messages");
clearTooltip.setContent(RED._('node-red:debug.sidebar.clearLog'))
} else {
toolbar.find("#red-ui-sidebar-debug-clear > span").text(RED._('node-red:debug.sidebar.filtered'));
clearTooltip.setAction("core:clear-filtered-debug-messages");
clearTooltip.setContent(RED._('node-red:debug.sidebar.clearFilteredLog'))
}
filterType = RED.settings.get("debug.filter","filterAll")
var filteredNodeList = RED.settings.get("debug.filteredNodes",[]);
filteredNodes = {}
filteredNodeList.forEach(function(id) {
filteredNodes[id] = true
})
toolbar.find('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.'+filterType));
refreshMessageList();
return {
content: content,
footer: footerToolbar
};
}
function containsDebug(sid, map) {
var item = map[sid];
if (item) {
if (item.debug === undefined) {
var sfs = Object.keys(item.subflows);
var contain = false;
for (var i = 0; i < sfs.length; i++) {
var sf = sfs[i];
if (containsDebug(sf, map)) {
contain = true;
break;
}
}
item.debug = contain;
}
return item.debug;
}
return false;
}
function refreshDebugNodeList() {
var workspaceOrder = RED.nodes.getWorkspaceOrder();
var workspaceOrderMap = {};
workspaceOrder.forEach(function(ws,i) {
workspaceOrderMap[ws] = i;
});
var candidateNodes = [];
var candidateSFs = [];
var subflows = {};
RED.nodes.eachNode(function (n) {
var nt = n.type;
if (nt === "debug") {
if (n.z in workspaceOrderMap) {
candidateNodes.push(n);
}
else {
var sf = RED.nodes.subflow(n.z);
if (sf) {
subflows[sf.id] = {
debug: true,
subflows: {}
};
}
}
}
else if(nt.substring(0, 8) === "subflow:") {
if (n.z in workspaceOrderMap) {
candidateSFs.push(n);
}
else {
var psf = RED.nodes.subflow(n.z);
if (psf) {
var sid = nt.substring(8);
var item = subflows[psf.id];
if (!item) {
item = {
debug: undefined,
subflows: {}
};
subflows[psf.id] = item;
}
item.subflows[sid] = true;
}
}
}
});
candidateSFs.forEach(function (sf) {
var sid = sf.type.substring(8);
if (containsDebug(sid, subflows)) {
candidateNodes.push(sf);
}
});
candidateNodes.sort(function(A,B) {
var wsA = workspaceOrderMap[A.z];
var wsB = workspaceOrderMap[B.z];
if (wsA !== wsB) {
return wsA-wsB;
}
var labelA = RED.utils.getNodeLabel(A,A.id);
var labelB = RED.utils.getNodeLabel(B,B.id);
return labelA.localeCompare(labelB);
});
var currentWs = null;
var data = [];
var currentFlow;
var currentSelectedCount = 0;
candidateNodes.forEach(function(node) {
if (currentWs !== node.z) {
if (currentFlow && currentFlow.checkbox) {
currentFlow.selected = currentSelectedCount === currentFlow.children.length
}
currentSelectedCount = 0;
currentWs = node.z;
var parent = RED.nodes.workspace(currentWs) || RED.nodes.subflow(currentWs);
currentFlow = {
label: RED.utils.getNodeLabel(parent, currentWs),
}
if (!parent.disabled) {
currentFlow.children = [];
currentFlow.checkbox = true;
} else {
currentFlow.class = "disabled"
}
data.push(currentFlow);
}
if (currentFlow.children) {
if (!filteredNodes[node.id]) {
currentSelectedCount++;
}
currentFlow.children.push({
label: RED.utils.getNodeLabel(node,node.id),
node: node,
checkbox: true,
selected: !filteredNodes[node.id]
});
}
});
if (currentFlow && currentFlow.checkbox) {
currentFlow.selected = currentSelectedCount === currentFlow.children.length
}
debugNodeTreeList.treeList("data", data);
}
function getTimestamp() {
var d = new Date();
return d.toLocaleString();
}
function sanitize(m) {
return m.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
var refreshTimeout;
function refreshMessageList(_activeWorkspace) {
if (refreshTimeout) {
clearTimeout(refreshTimeout);
}
refreshTimeout = setTimeout(function() {
_refreshMessageList(_activeWorkspace);
},200);
}
function _refreshMessageList(_activeWorkspace) {
if (_activeWorkspace) {
activeWorkspace = _activeWorkspace.replace(/\./g,"_");
}
if (filterType === "filterAll") {
$(".red-ui-debug-msg").removeClass("hide");
} else {
$(".red-ui-debug-msg").each(function() {
if (filterType === 'filterCurrent') {
$(this).toggleClass('hide',!$(this).hasClass('red-ui-debug-msg-flow-'+activeWorkspace));
} else if (filterType === 'filterSelected') {
var id = $(this).data('source');
if (id) {
$(this).toggleClass('hide',!!filteredNodes[id]);
}
}
});
}
}
function refreshMessageTable() {
}
function showMessageList() {
view = 'list';
messageTable.hide();
messageTable.empty();
messages.forEach(function(m) {
messageList.append(m.el);
})
messageList.show();
}
function showMessageTable() {
view = 'table';
messageList.hide();
messageList.empty();
Object.keys(messagesByNode).forEach(function(id) {
var m = messagesByNode[id];
var msg = m.el;
var sourceNode = m.source;
if (sourceNode) {
var wrapper = $("<div>",{id:"red-ui-debug-msg-source-"+sourceNode.id.replace(/\./g,"_")}).appendTo(messageTable);
wrapper.append(msg);
}
});
messageTable.show();
}
function formatString(str) {
return str.replace(/\n/g,"&crarr;").replace(/\t/g,"&rarr;");
}
var menuOptionMenu;
var activeMenuMessage;
function showMessageMenu(button,dbgMessage,sourceId) {
activeMenuMessage = dbgMessage;
if (!menuOptionMenu) {
var opts = [
{id:"red-ui-debug-msg-menu-item-collapse",label:RED._("node-red:debug.messageMenu.collapseAll"),onselect:function(){
activeMenuMessage.collapse();
}},
];
if (activeMenuMessage.clearPinned) {
opts.push(
{id:"red-ui-debug-msg-menu-item-clear-pins",label:RED._("node-red:debug.messageMenu.clearPinned"),onselect:function(){
activeMenuMessage.clearPinned();
}},
);
}
opts.push(
null,
{id:"red-ui-debug-msg-menu-item-filter", label:RED._("node-red:debug.messageMenu.filterNode"),onselect:function(){
var candidateNodes = RED.nodes.filterNodes({type:'debug'});
candidateNodes.forEach(function(n) {
filteredNodes[n.id] = true;
});
delete filteredNodes[sourceId];
$("#red-ui-sidebar-debug-filterSelected").trigger("click");
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes))
refreshMessageList();
}},
{id:"red-ui-debug-msg-menu-item-clear-filter",label:RED._("node-red:debug.messageMenu.clearFilter"),onselect:function(){
$("#red-ui-sidebar-debug-filterAll").trigger("click");
refreshMessageList();
}}
);
menuOptionMenu = RED.menu.init({id:"red-ui-debug-msg-option-menu",
options: opts
});
menuOptionMenu.css({
position: "absolute"
})
menuOptionMenu.on('mouseleave', function(){ $(this).hide() });
menuOptionMenu.on('mouseup', function() { $(this).hide() });
menuOptionMenu.appendTo("body");
}
var filterOptionDisabled = false;
var sourceNode = RED.nodes.node(sourceId);
if (sourceNode && sourceNode.type !== 'debug') {
filterOptionDisabled = true;
}
RED.menu.setDisabled('red-ui-debug-msg-menu-item-filter',filterOptionDisabled);
RED.menu.setDisabled('red-ui-debug-msg-menu-item-clear-filter',filterOptionDisabled);
var elementPos = button.offset();
menuOptionMenu.css({
top: elementPos.top+"px",
left: (elementPos.left - menuOptionMenu.width() + 20)+"px"
})
menuOptionMenu.show();
}
var stack = [];
var busy = false;
function handleDebugMessage(o) {
if (o) { stack.push(o); }
if (!busy && (stack.length > 0)) {
busy = true;
processDebugMessage(stack.shift());
setTimeout(function() {
busy = false;
handleDebugMessage();
}, 15); // every 15mS = 66 times a second
if (stack.length > numMessages) { stack = stack.splice(-numMessages); }
}
}
function processDebugMessage(o) {
var msg = $("<div/>");
var sourceNode = o._source;
msg.on("mouseenter", function() {
msg.addClass('red-ui-debug-msg-hover');
if (o._source) {
// highlight the top-level node (could be subflow instance)
config.messageMouseEnter(o._source.id);
if (o._source._alias) {
// this is inside a subflow - highlight the node itself
config.messageMouseEnter(o._source._alias);
}
// if path.length > 2, we are nested - highlight subflow instances
for (var i=2;i<o._source.path.length;i++) {
config.messageMouseEnter(o._source.path[i]);
}
}
});
msg.on("mouseleave", function() {
msg.removeClass('red-ui-debug-msg-hover');
if (o._source) {
config.messageMouseLeave(o._source.id);
if (o._source._alias) {
config.messageMouseLeave(o._source._alias);
}
for (var i=2;i<o._source.path.length;i++) {
config.messageMouseLeave(o._source.path[i]);
}
}
});
var name = sanitize(((o.name?o.name:o.id)||"").toString());
var topic = sanitize((o.topic||"").toString());
var property = sanitize(o.property?o.property:'');
var payload = o.msg;
var format = sanitize((o.format||"").toString());
msg.attr("class", 'red-ui-debug-msg'+(o.level?(' red-ui-debug-msg-level-'+o.level):'')+
(sourceNode?(
" red-ui-debug-msg-node-"+sourceNode.id.replace(/\./g,"_")+
(sourceNode.z?" red-ui-debug-msg-flow-"+sourceNode.z.replace(/\./g,"_"):"")
):""));
if (sourceNode) {
msg.data('source',sourceNode.id);
if (filterType === "filterCurrent" && activeWorkspace) {
if (sourceNode.z && sourceNode.z.replace(/\./g,"_") !== activeWorkspace) {
msg.addClass('hide');
}
} else if (filterType === 'filterSelected'){
if (!!filteredNodes[sourceNode.id]) {
msg.addClass('hide');
}
}
}
var metaRow = $('<div class="red-ui-debug-msg-meta"></div>').appendTo(msg);
$('<span class="red-ui-debug-msg-date">'+ getTimestamp()+'</span>').appendTo(metaRow);
if (sourceNode) {
var nodeLink = $('<a>',{href:"#",class:"red-ui-debug-msg-name"}).text(RED._("node-red:debug.node")+": "+(o.name||sourceNode.name||sourceNode.id))
.appendTo(metaRow)
.on("click", function(evt) {
evt.preventDefault();
config.messageSourceClick(sourceNode.id, sourceNode._alias, sourceNode.path);
});
if (sourceNode.pathHierarchy) {
RED.popover.create({
tooltip: true,
target:nodeLink,
trigger: "hover",
size: "small",
direction: "bottom",
interactive: true,
content: function() {
const content = $("<div>")
sourceNode.pathHierarchy.forEach((pathPart,idx) => {
const link = $("<a>", {href:"#" ,style:'display: block'})
.css({
paddingLeft:((idx*10)+((idx === sourceNode.pathHierarchy.length - 1)?10:0))+"px",
paddingRight:'2px'
})
.text(pathPart.label)
.appendTo(content)
.on("click", function(evt) {
evt.preventDefault();
config.messageSourceClick(pathPart.id);
})
if (idx < sourceNode.pathHierarchy.length - 1) {
$('<i class="fa fa-angle-down" style="margin-right: 3px"></i>').prependTo(link)
}
})
return content
},
delay: { show: 50, hide: 150 }
});
}
} else if (name) {
$('<span class="red-ui-debug-msg-name">'+name+'</span>').appendTo(metaRow);
}
payload = RED.utils.decodeObject(payload,format);
var el = $('<span class="red-ui-debug-msg-payload"></span>').appendTo(msg);
var path = o.property||'';
var debugMessage = RED.utils.createObjectElement(payload, {
key: /*true*/null,
typeHint: format,
hideKey: false,
path: path,
sourceId: sourceNode&&sourceNode.id,
rootPath: path
});
// Do this in a separate step so the element functions aren't stripped
debugMessage.appendTo(el);
// NOTE: relying on function error to have a "type" that all other msgs don't
if (o.hasOwnProperty("type") && (o.type === "function")) {
var errorLvlType = 'error';
var errorLvl = 20;
if (o.hasOwnProperty("level") && o.level === 30) {
errorLvl = 30;
errorLvlType = 'warn';
}
msg.addClass('red-ui-debug-msg-level-' + errorLvl);
$('<span class="red-ui-debug-msg-topic">function : (' + errorLvlType + ')</span>').appendTo(metaRow);
} else {
var tools = $('<span class="red-ui-debug-msg-tools button-group"></span>').appendTo(metaRow);
var filterMessage = $('<button class="red-ui-button red-ui-button-small"><i class="fa fa-caret-down"></i></button>').appendTo(tools);
filterMessage.on("click", function(e) {
e.preventDefault();
e.stopPropagation();
showMessageMenu(filterMessage,debugMessage,sourceNode&&sourceNode.id);
});
$('<span class="red-ui-debug-msg-topic">'+
(o.topic?topic+' : ':'')+
(o.property?'msg.'+property:'msg')+" : "+format+
'</span>').appendTo(metaRow);
}
var atBottom = (sbc.scrollHeight-messageList.height()-sbc.scrollTop) < 5;
var m = {
el: msg
};
messages.push(m);
if (sourceNode) {
m.source = sourceNode;
messagesByNode[sourceNode.id] = m;
}
if (view == "list") {
messageList.append(msg);
} else {
if (sourceNode) {
var wrapper = $("#red-ui-debug-msg-source-"+sourceNode.id.replace(/\./g,"_"));
if (wrapper.length === 0 ) {
wrapper = $("<div>",{id:"red-ui-debug-msg-source-"+sourceNode.id.replace(/\./g,"_")}).appendTo(messageTable);
}
wrapper.empty();
wrapper.append(msg);
}
}
if (messages.length === numMessages) {
m = messages.shift();
if (view === "list") {
m.el.remove();
}
}
if (atBottom) {
messageList.scrollTop(sbc.scrollHeight);
}
}
function clearMessageList(clearFilter, filteredOnly) {
if (!filteredOnly) {
$(".red-ui-debug-msg").remove();
} else {
$(".red-ui-debug-msg:not(.hide)").remove();
}
config.clear();
if (!!clearFilter) {
clearFilterSettings();
}
refreshDebugNodeList();
}
function clearFilterSettings() {
filteredNodes = {};
filterType = 'filterAll';
RED.settings.set("debug.filter",filterType);
RED.settings.set('debug.filteredNodes',Object.keys(filteredNodes))
$('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.filterAll'));
}
return {
init: init,
refreshMessageList:refreshMessageList,
handleDebugMessage: handleDebugMessage,
clearMessageList: clearMessageList
}
})();

View file

@ -0,0 +1 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 .002h32v32H0z"/><g color="#000"><path fill="#fff" d="M2 13.002h10v5H2zM19 8.002h10v5H19z"/><path d="M19 21.002h10v5H19z"/></g><path d="M11.5 15.502h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

After

Width:  |  Height:  |  Size: 312 B

View file

@ -0,0 +1 @@
<svg width="27" height="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" color="#000"><path d="M0 5h10v5H0zM17 0h10v5H17zM17 13h10v5H17z"/></g><path d="M9.5 7.5h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

After

Width:  |  Height:  |  Size: 227 B

View file

@ -0,0 +1 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 0h32v32H0z"/><g fill="#fff" color="#000"><path d="M2 13h10v5H2zM19 8h10v5H19zM19 21h10v5H19z"/></g><path d="M11.5 15.5h2l4-5h2" fill="none" stroke="#fff" stroke-width="1.5"/></svg>

After

Width:  |  Height:  |  Size: 283 B

View file

@ -0,0 +1 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><path color="#000" fill="#8c101c" d="M0 .002h32v32H0z"/><path color="#000" d="M2 13.002h10v5H2zM19 21.002h10v5H19z"/><path d="M11.5 15.502h2l4-5h2" fill="none" stroke="#000" stroke-width="1.5"/><path color="#000" fill="#fff" d="M19 8.002h10v5H19z"/></svg>

After

Width:  |  Height:  |  Size: 318 B

View file

@ -0,0 +1 @@
<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><g color="#000"><path fill="#8c101c" d="M0 .006h32v32H0z"/><path d="M11.81 25.429a10.02 10.02 0 0 0 4.19.914c5.562 0 10.107-4.545 10.107-10.106S21.562 6.131 16 6.131 5.895 10.676 5.895 16.237h3.368c0-3.74 2.997-6.737 6.738-6.737s6.737 2.996 6.737 6.737-2.996 6.738-6.737 6.738a6.775 6.775 0 0 1-2.533-.486l1.43-3.48-6.947 1.317 2.13 8.485z" fill="#fff" style="isolation:auto;mix-blend-mode:normal;text-decoration-color:#000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-transform:none;white-space:normal"/></g></svg>

After

Width:  |  Height:  |  Size: 606 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
/** gridstack.js 0.6.4 - JQuery UI Drag&Drop plugin @preserve */
!function(t){if("function"==typeof define&&define.amd)define(["jquery","gridstack","exports"],t);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(t){}try{gridstack=require("gridstack")}catch(t){}t(jQuery,gridstack.GridStackUI,exports)}else t(jQuery,GridStackUI,window)}(function(a,e,t){function r(t){e.GridStackDragDropPlugin.call(this,t)}return e.GridStackDragDropPlugin.registerPlugin(r),((r.prototype=Object.create(e.GridStackDragDropPlugin.prototype)).constructor=r).prototype.resizable=function(t,e){if(t=a(t),"disable"===e||"enable"===e)t.resizable(e);else if("option"===e){var r=arguments[2],i=arguments[3];t.resizable(e,r,i)}else{var n=t.data("gs-resize-handles")?t.data("gs-resize-handles"):this.grid.opts.resizable.handles;t.resizable(a.extend({},this.grid.opts.resizable,{handles:n},{start:e.start||function(){},stop:e.stop||function(){},resize:e.resize||function(){}}))}return this},r.prototype.draggable=function(t,e){return t=a(t),"disable"===e||"enable"===e?t.draggable(e):t.draggable(a.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested&&!this.grid.opts.dragOut?this.grid.container.parent():this.grid.opts.draggable.containment||null,start:e.start||function(){},stop:e.stop||function(){},drag:e.drag||function(){}})),this},r.prototype.droppable=function(t,e){return(t=a(t)).droppable(e),this},r.prototype.isDroppable=function(t,e){return t=a(t),Boolean(t.data("droppable"))},r.prototype.on=function(t,e,r){return a(t).on(e,r),this},t.JQueryUIGridStackDragDropPlugin=r});
//# sourceMappingURL=gridstack.min.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
<!DOCTYPE html>
<!-- saved from url=(0062)chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/index.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width"><meta name="next-head-count" content="2"><link rel="preload" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/e1f3fc4f37b73b75.css" as="style"><link rel="stylesheet" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/e1f3fc4f37b73b75.css" data-n-g=""><link rel="preload" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/dbb3cce3661ac5c0.css" as="style"><link rel="stylesheet" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/dbb3cce3661ac5c0.css" data-n-p=""><link rel="preload" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/1e3285f6f12d0906.css" as="style"><link rel="stylesheet" href="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/css/1e3285f6f12d0906.css" data-n-p=""><noscript data-n-css=""></noscript><script defer="" nomodule="" src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/polyfills-0d1b80a048d4787e.js"></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/webpack-9416c693c650cdc9.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/framework-25a828f663c71176.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/main-7b75b77264532375.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/pages/_app-004a08b02ae3936b.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/247-687a9dcc57d11d43.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/457-681ed9a1ace1278b.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/917-2a929b26e0e3c9e3.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/236-81a5b0e797edebba.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/chunks/pages/index-39af106d4b750cab.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/MlRHwSEgi8a1HKafQVEF9/_buildManifest.js" defer=""></script><script src="chrome-extension://knjbgabkeojmfdhindppcmhhfiembkeb/next/static/MlRHwSEgi8a1HKafQVEF9/_ssgManifest.js" defer=""></script></head><body><div id="__next" data-reactroot=""><div class="_12u1he45d"><div class="_8jp051a ouiv4n5 _12u1he418 _12u1he436 _12u1he44e _12u1he445 _12u1he413 _12u1he481 _12u1he486 _12u1he48j _12u1he41t _12u1he454"><nav class="_12u1he44e _12u1he43z"><button class="kkxc9fv _12u1he43k _12u1he44e _12u1he418 _12u1he453 _12u1he44c kkxc9f19 kkxc9fy kkxc9fm kkxc9f1b "><svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.38618 4.38612C4.64978 4.12251 5.07717 4.12251 5.34077 4.38612L9.00005 8.0454L12.6593 4.38612C12.9229 4.12251 13.3503 4.12251 13.6139 4.38612C13.8775 4.64972 13.8775 5.07711 13.6139 5.34071L9.95465 8.99999L13.6139 12.6593C13.8775 12.9229 13.8775 13.3503 13.6139 13.6139C13.3503 13.8775 12.9229 13.8775 12.6593 13.6139L9.00005 9.95458L5.34077 13.6139C5.07717 13.8775 4.64978 13.8775 4.38618 13.6139C4.12258 13.3503 4.12258 12.9229 4.38618 12.6593L8.04546 8.99999L4.38618 5.34071C4.12258 5.07711 4.12258 4.64972 4.38618 4.38612Z" fill="currentColor"></path></svg></button></nav></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"MlRHwSEgi8a1HKafQVEF9","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script><next-route-announcer><p aria-live="assertive" id="__next-route-announcer__" role="alert" style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; width: 1px; white-space: nowrap; overflow-wrap: normal;"></p></next-route-announcer></body></html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,16 @@
/**
* Copyright OpenJS Foundation and other contributors, https://openjsf.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
$(function(){"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname&&(document.title=document.title+" : "+window.location.hostname),RED.init({apiRootUrl:""})});

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,26 @@
(function() {
var _isIE = /MSIE \d|Trident.*rv:/.test(navigator.userAgent);
//dont load monaco if IE
if(_isIE === false) {
var userLocale = (localStorage.getItem("editor-language") + "")
var browserLocale = typeof navigator === "undefined" ? "" : (navigator.language || navigator.userLanguage || "");
var cultureDists = {
"zh-cn":"zh-hans",
"zh-tw":"zh-hant",
"ja":"ja",
"ko":"ko",
"de":"de",
"fr":"fr",
"it":"it",
"es":"es",
"ru":"ru",
"tr":"tr",
"pl":"pl",
"pt-br":"pt-br",
"cs":"cs"
};
var uiLanguage = cultureDists[userLocale.toLowerCase()] || cultureDists[browserLocale.toLowerCase()];
if(uiLanguage) document.write('<script src="vendor/monaco/dist/locale/' + uiLanguage + '.js"><\/script>');
document.write('<script src="vendor/monaco/dist/editor.js"><\/script>');
}
})();

View file

@ -0,0 +1 @@
<svg width="46.994" height="18.006" xmlns="http://www.w3.org/2000/svg"><g stroke="#d6d6d6"><g fill="#9e3131" stroke-linejoin="round" stroke-width="3.847" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"><rect x="249.04" y="435.92" width="50.294" height="22.953" ry="6.608"/><rect x="345.63" y="416.93" width="50.294" height="22.953" ry="6.608"/><rect x="376.71" y="459.01" width="50.294" height="22.953" ry="6.608"/></g><path d="M301.04 447.43c24.406.184 7.107-18.84 42.708-19.03M374.82 470.48c-46.966.538-28.989-22.664-73.619-22.944" fill="none" stroke-width="5.771" transform="matrix(.25848 0 0 .2614 -63.87 -108.483)"/></g></svg>

After

Width:  |  Height:  |  Size: 636 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,41 @@
<!--
The MIT License (MIT)
Copyright (c) 2014 Brent Jackson
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
https://github.com/jxnblk/loading
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" fill="#999">
<path transform="translate(2)" d="M0 12 V20 H4 V12z">
<animate attributeName="d" values="M0 12 V20 H4 V12z; M0 4 V28 H4 V4z; M0 12 V20 H4 V12z; M0 12 V20 H4 V12z" dur="1.2s" repeatCount="indefinite" begin="0" keytimes="0;.2;.5;1" keySplines="0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.8 0.4 0.8" calcMode="spline" />
</path>
<path transform="translate(8)" d="M0 12 V20 H4 V12z">
<animate attributeName="d" values="M0 12 V20 H4 V12z; M0 4 V28 H4 V4z; M0 12 V20 H4 V12z; M0 12 V20 H4 V12z" dur="1.2s" repeatCount="indefinite" begin="0.2" keytimes="0;.2;.5;1" keySplines="0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.8 0.4 0.8" calcMode="spline" />
</path>
<path transform="translate(14)" d="M0 12 V20 H4 V12z">
<animate attributeName="d" values="M0 12 V20 H4 V12z; M0 4 V28 H4 V4z; M0 12 V20 H4 V12z; M0 12 V20 H4 V12z" dur="1.2s" repeatCount="indefinite" begin="0.4" keytimes="0;.2;.5;1" keySplines="0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.8 0.4 0.8" calcMode="spline" />
</path>
<path transform="translate(20)" d="M0 12 V20 H4 V12z">
<animate attributeName="d" values="M0 12 V20 H4 V12z; M0 4 V28 H4 V4z; M0 12 V20 H4 V12z; M0 12 V20 H4 V12z" dur="1.2s" repeatCount="indefinite" begin="0.6" keytimes="0;.2;.5;1" keySplines="0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.8 0.4 0.8" calcMode="spline" />
</path>
<path transform="translate(26)" d="M0 12 V20 H4 V12z">
<animate attributeName="d" values="M0 12 V20 H4 V12z; M0 4 V28 H4 V4z; M0 12 V20 H4 V12z; M0 12 V20 H4 V12z" dur="1.2s" repeatCount="indefinite" begin="0.8" keytimes="0;.2;.5;1" keySplines="0.2 0.2 0.4 0.8;0.2 0.6 0.4 0.8;0.2 0.8 0.4 0.8" calcMode="spline" />
</path>
</svg>

View file

@ -0,0 +1,22 @@
/*
Some classes and styles in node-red affect the monaco editor.
This stylesheet overrides those to correct some graphical glitches
*/
/* unset `margin-left: 180px` of `.controls` class for hover tips */
.monaco-editor div.phwrapper > div.controls {
margin-left: unset;
}
/* unset some styles of `code` tag (set by node-red css) for monaco hover items */
.monaco-editor .monaco-hover code {
font-size: unset;
color: unset;
margin: unset;
}
/* unset some styles of `input` tag (set by node-red css) for monaco rename box */
.monaco-editor .rename-box .rename-input {
box-sizing: unset;
height: unset;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -86,7 +86,7 @@ The message is fed into a filter function to only store usefull information:
return {
payload: {
power: Number(msg.payload.ENERGY.Power),
volate: Number(msg.payload.ENERGY.Voltage),
voltage: Number(msg.payload.ENERGY.Voltage),
current: Number(msg.payload.ENERGY.Current)
}
};
@ -106,7 +106,7 @@ The query created by Data Explorer looks like that:
from(bucket: "shelly")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "msg")
|> filter(fn: (r) => r["_field"] == "power" or r["_field"] == "volate" or r["_field"] == "current")
|> filter(fn: (r) => r["_field"] == "power" or r["_field"] == "voltage" or r["_field"] == "current")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 KiB

After

Width:  |  Height:  |  Size: 556 KiB

View file

@ -419,7 +419,7 @@
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "shelly2Influx",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n volate: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERBY.Current)\n }\n};\n",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n volate: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERGY.Current)\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",

View file

@ -419,7 +419,7 @@
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "shelly2Influx",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n volate: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERGY.Current)\n }\n};\n",
"func": "return {\n payload: {\n power: Number(msg.payload.ENERGY.Power),\n voltage: Number(msg.payload.ENERGY.Voltage),\n current: Number(msg.payload.ENERGY.Current)\n }\n};\n",
"outputs": 1,
"noerr": 0,
"initialize": "",