|
|
|
@@ -31,24 +31,22 @@ RED.debug = (function() {
|
|
|
|
|
var activeWorkspace;
|
|
|
|
|
var numMessages = 100; // Hardcoded number of message to show in debug window scrollback
|
|
|
|
|
|
|
|
|
|
var filterVisible = false;
|
|
|
|
|
|
|
|
|
|
var debugNodeList;
|
|
|
|
|
var debugNodeListExpandedFlows = {};
|
|
|
|
|
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" class="red-ui-sidebar-header-button" href="#"><i class="fa fa-filter"></i> <span></span></a></span>'+
|
|
|
|
|
'<span class="button-group"><a id="red-ui-sidebar-debug-clear" class="red-ui-sidebar-header-button" href="#"><i class="fa fa-trash"></i></a></span></div>').appendTo(content);
|
|
|
|
|
'<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 class="red-ui-footer-button-toggle text-button selected" id="red-ui-sidebar-debug-view-list" href="#"><span data-i18n="">list</span></a>'+
|
|
|
|
|
// '<a class="red-ui-footer-button-toggle text-button" id="red-ui-sidebar-debug-view-table" href="#"><span data-i18n="">table</span></a> '+
|
|
|
|
|
// '</span>'+
|
|
|
|
|
'<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>');
|
|
|
|
|
|
|
|
|
@@ -56,85 +54,100 @@ RED.debug = (function() {
|
|
|
|
|
sbc = messageList[0];
|
|
|
|
|
messageTable = $('<div class="red-ui-debug-content red-ui-debug-content-table hide"/>').appendTo(content);
|
|
|
|
|
|
|
|
|
|
var filterDialog = $('<div class="red-ui-debug-filter-box hide">'+
|
|
|
|
|
'<div class="red-ui-debug-filter-row">'+
|
|
|
|
|
'<span class="button-group">'+
|
|
|
|
|
'<a class="red-ui-sidebar-header-button-toggle red-ui-sidebar-debug-filter-option selected" id="red-ui-sidebar-debug-filterAll" href="#"><span data-i18n="node-red:debug.sidebar.filterAll"></span></a>'+
|
|
|
|
|
'<a class="red-ui-sidebar-header-button-toggle red-ui-sidebar-debug-filter-option" id="red-ui-sidebar-debug-filterSelected" href="#"><span data-i18n="node-red:debug.sidebar.filterSelected"></span></a>'+
|
|
|
|
|
'<a class="red-ui-sidebar-header-button-toggle red-ui-sidebar-debug-filter-option" id="red-ui-sidebar-debug-filterCurrent" href="#"><span data-i18n="node-red:debug.sidebar.filterCurrent"></span></a> '+
|
|
|
|
|
'</span>'+
|
|
|
|
|
'</div>'+
|
|
|
|
|
'</div>').appendTo(toolbar);//content);
|
|
|
|
|
|
|
|
|
|
// var filterTypeRow = $('<div class="red-ui-debug-filter-row"></div>').appendTo(filterDialog);
|
|
|
|
|
// $('<select><option>Show all debug nodes</option><option>Show selected debug nodes</option><option>Show current flow only</option></select>').appendTo(filterTypeRow);
|
|
|
|
|
|
|
|
|
|
var debugNodeListRow = $('<div class="red-ui-debug-filter-row hide" id="red-ui-sidebar-debug-filter-node-list-row"></div>').appendTo(filterDialog);
|
|
|
|
|
var flowCheckboxes = {};
|
|
|
|
|
var debugNodeListHeader = $('<div><span data-i18n="node-red:debug.sidebar.debugNodes"></span><span></span></div>');
|
|
|
|
|
var headerCheckbox = $('<input type="checkbox">').appendTo(debugNodeListHeader.find("span")[1]).checkboxSet();
|
|
|
|
|
|
|
|
|
|
debugNodeList = $('<ol>',{style:"text-align: left; min-height: 250px; max-height: 250px"}).appendTo(debugNodeListRow).editableList({
|
|
|
|
|
header: debugNodeListHeader,
|
|
|
|
|
class: 'red-ui-nodeList',
|
|
|
|
|
addItem: function(container,i,node) {
|
|
|
|
|
var row = $("<div>").appendTo(container);
|
|
|
|
|
row.attr('id','debug-filter-node-list-node-'+node.id.replace(/\./g,"_"));
|
|
|
|
|
if (node.type === 'tab') {
|
|
|
|
|
container.parent().addClass('red-ui-editableList-section-header');
|
|
|
|
|
if (!debugNodeListExpandedFlows.hasOwnProperty(node.id)) {
|
|
|
|
|
debugNodeListExpandedFlows[node.id] = true;
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
var chevron = $('<i class="fa fa-angle-right"></i>').appendTo(row);
|
|
|
|
|
$('<span>').text(RED.utils.getNodeLabel(node,node.id)).appendTo(row);
|
|
|
|
|
var muteControl = $('<input type="checkbox">').appendTo($('<span class="meta">').appendTo(row));
|
|
|
|
|
muteControl.checkboxSet({
|
|
|
|
|
parent: headerCheckbox
|
|
|
|
|
});
|
|
|
|
|
flowCheckboxes[node.id] = muteControl;
|
|
|
|
|
row.on("click", function(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
debugNodeListExpandedFlows[node.id] = !debugNodeListExpandedFlows[node.id];
|
|
|
|
|
row.toggleClass('expanded',debugNodeListExpandedFlows[node.id]);
|
|
|
|
|
debugNodeList.editableList('filter');
|
|
|
|
|
})
|
|
|
|
|
row.addClass("expandable");
|
|
|
|
|
if (node.disabled) {
|
|
|
|
|
container.addClass('disabled');
|
|
|
|
|
muteControl.checkboxSet('disable');
|
|
|
|
|
debugNodeListExpandedFlows[node.id] = false;
|
|
|
|
|
}
|
|
|
|
|
row.toggleClass('expanded',debugNodeListExpandedFlows[node.id]);
|
|
|
|
|
} else {
|
|
|
|
|
$('<span>',{style: "margin-left: 20px"}).text(RED.utils.getNodeLabel(node,node.id)).appendTo(row);
|
|
|
|
|
row.on("mouseenter",function() {
|
|
|
|
|
config.messageMouseEnter(node.id);
|
|
|
|
|
});
|
|
|
|
|
row.on("mouseleave",function() {
|
|
|
|
|
config.messageMouseLeave(node.id);
|
|
|
|
|
});
|
|
|
|
|
var muteControl = $('<input type="checkbox">').prop('checked',!filteredNodes[node.id]).appendTo($('<span class="meta">').appendTo(row));
|
|
|
|
|
muteControl.checkboxSet({
|
|
|
|
|
parent: flowCheckboxes[node.z]
|
|
|
|
|
}).on("change", function(e) {
|
|
|
|
|
filteredNodes[node.id] = !$(this).prop('checked');
|
|
|
|
|
$(".red-ui-debug-msg-node-"+node.id.replace(/\./g,"_")).toggleClass('hide',filteredNodes[node.id]);
|
|
|
|
|
});
|
|
|
|
|
if ((node.hasOwnProperty("active") && !node.active) || RED.nodes.workspace(node.z).disabled) {
|
|
|
|
|
container.addClass('disabled');
|
|
|
|
|
muteControl.checkboxSet('disable');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
addButton: false,
|
|
|
|
|
scrollOnAdd: false,
|
|
|
|
|
filter: function(node) {
|
|
|
|
|
return (node.type === 'tab' || debugNodeListExpandedFlows[node.z] )
|
|
|
|
|
},
|
|
|
|
|
sort: function(A,B) {
|
|
|
|
|
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();
|
|
|
|
@@ -144,85 +157,95 @@ RED.debug = (function() {
|
|
|
|
|
|
|
|
|
|
toolbar.find('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.filterAll'));
|
|
|
|
|
|
|
|
|
|
var filterButtonHandler = function(type) {
|
|
|
|
|
return function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (filterType !== type) {
|
|
|
|
|
$('.red-ui-sidebar-debug-filter-option').removeClass('selected');
|
|
|
|
|
$(this).addClass('selected');
|
|
|
|
|
if (filterType === 'filterSelected') {
|
|
|
|
|
debugNodeListRow.slideUp();
|
|
|
|
|
}
|
|
|
|
|
filterType = type;
|
|
|
|
|
if (filterType === 'filterSelected') {
|
|
|
|
|
debugNodeListRow.slideDown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#red-ui-sidebar-debug-filter span').text(RED._('node-red:debug.sidebar.'+filterType));
|
|
|
|
|
refreshMessageList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
filterDialog.find('#red-ui-sidebar-debug-filterAll').on("click",filterButtonHandler('filterAll'));
|
|
|
|
|
filterDialog.find('#red-ui-sidebar-debug-filterSelected').on("click",filterButtonHandler('filterSelected'));
|
|
|
|
|
filterDialog.find('#red-ui-sidebar-debug-filterCurrent').on("click",filterButtonHandler('filterCurrent'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $('#red-ui-sidebar-debug-view-list').on("click",function(e) {
|
|
|
|
|
// e.preventDefault();
|
|
|
|
|
// if (!$(this).hasClass('selected')) {
|
|
|
|
|
// $(this).addClass('selected');
|
|
|
|
|
// $('#red-ui-sidebar-debug-view-table').removeClass('selected');
|
|
|
|
|
// showMessageList();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// $('#red-ui-sidebar-debug-view-table').on("click",function(e) {
|
|
|
|
|
// e.preventDefault();
|
|
|
|
|
// if (!$(this).hasClass('selected')) {
|
|
|
|
|
// $(this).addClass('selected');
|
|
|
|
|
// $('#red-ui-sidebar-debug-view-list').removeClass('selected');
|
|
|
|
|
// showMessageTable();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hideFilterTimeout;
|
|
|
|
|
toolbar.on('mouseleave',function() {
|
|
|
|
|
if ($('#red-ui-sidebar-debug-filter').hasClass('selected')) {
|
|
|
|
|
clearTimeout(hideFilterTimeout);
|
|
|
|
|
hideFilterTimeout = setTimeout(function() {
|
|
|
|
|
filterVisible = false;
|
|
|
|
|
$('#red-ui-sidebar-debug-filter').removeClass('selected');
|
|
|
|
|
filterDialog.slideUp(200);
|
|
|
|
|
},300);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
toolbar.on('mouseenter',function() {
|
|
|
|
|
if ($('#red-ui-sidebar-debug-filter').hasClass('selected')) {
|
|
|
|
|
clearTimeout(hideFilterTimeout);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
toolbar.find('#red-ui-sidebar-debug-filter').on("click",function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if ($(this).hasClass('selected')) {
|
|
|
|
|
filterVisible = false;
|
|
|
|
|
$(this).removeClass('selected');
|
|
|
|
|
clearTimeout(hideFilterTimeout);
|
|
|
|
|
filterDialog.slideUp(200);
|
|
|
|
|
} else {
|
|
|
|
|
$(this).addClass('selected');
|
|
|
|
|
filterVisible = true;
|
|
|
|
|
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();
|
|
|
|
|
clearMessageList(false);
|
|
|
|
|
var action = RED.settings.get("debug.clearType","all")
|
|
|
|
|
clearMessageList(false, action === 'filtered');
|
|
|
|
|
});
|
|
|
|
|
RED.popover.tooltip(toolbar.find("#red-ui-sidebar-debug-clear"),RED._('node-red:debug.sidebar.clearLog'),"core:clear-debug-messages");
|
|
|
|
|
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,
|
|
|
|
@@ -254,8 +277,6 @@ RED.debug = (function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function refreshDebugNodeList() {
|
|
|
|
|
debugNodeList.editableList('empty');
|
|
|
|
|
|
|
|
|
|
var workspaceOrder = RED.nodes.getWorkspaceOrder();
|
|
|
|
|
var workspaceOrderMap = {};
|
|
|
|
|
workspaceOrder.forEach(function(ws,i) {
|
|
|
|
@@ -320,15 +341,45 @@ RED.debug = (function() {
|
|
|
|
|
return labelA.localeCompare(labelB);
|
|
|
|
|
});
|
|
|
|
|
var currentWs = null;
|
|
|
|
|
var nodeList = [];
|
|
|
|
|
var data = [];
|
|
|
|
|
var currentFlow;
|
|
|
|
|
var currentSelectedCount = 0;
|
|
|
|
|
candidateNodes.forEach(function(node) {
|
|
|
|
|
if (currentWs !== node.z) {
|
|
|
|
|
currentWs = node.z;
|
|
|
|
|
nodeList.push(RED.nodes.workspace(node.z));
|
|
|
|
|
if (currentFlow && currentFlow.checkbox) {
|
|
|
|
|
currentFlow.selected = currentSelectedCount === currentFlow.children.length
|
|
|
|
|
}
|
|
|
|
|
nodeList.push(node);
|
|
|
|
|
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]
|
|
|
|
|
});
|
|
|
|
|
debugNodeList.editableList('addItems',nodeList);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (currentFlow && currentFlow.checkbox) {
|
|
|
|
|
currentFlow.selected = currentSelectedCount === currentFlow.children.length
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
debugNodeTreeList.treeList("data", data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getTimestamp() {
|
|
|
|
@@ -340,7 +391,16 @@ RED.debug = (function() {
|
|
|
|
|
return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var refreshTimeout;
|
|
|
|
|
function refreshMessageList(_activeWorkspace) {
|
|
|
|
|
if (refreshTimeout) {
|
|
|
|
|
clearTimeout(refreshTimeout);
|
|
|
|
|
}
|
|
|
|
|
refreshTimeout = setTimeout(function() {
|
|
|
|
|
_refreshMessageList(_activeWorkspace);
|
|
|
|
|
},200);
|
|
|
|
|
}
|
|
|
|
|
function _refreshMessageList(_activeWorkspace) {
|
|
|
|
|
if (_activeWorkspace) {
|
|
|
|
|
activeWorkspace = _activeWorkspace.replace(/\./g,"_");
|
|
|
|
|
}
|
|
|
|
@@ -415,6 +475,7 @@ RED.debug = (function() {
|
|
|
|
|
});
|
|
|
|
|
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(){
|
|
|
|
@@ -601,8 +662,12 @@ RED.debug = (function() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearMessageList(clearFilter) {
|
|
|
|
|
function clearMessageList(clearFilter, filteredOnly) {
|
|
|
|
|
if (!filteredOnly) {
|
|
|
|
|
$(".red-ui-debug-msg").remove();
|
|
|
|
|
} else {
|
|
|
|
|
$(".red-ui-debug-msg:not(.hide)").remove();
|
|
|
|
|
}
|
|
|
|
|
config.clear();
|
|
|
|
|
if (!!clearFilter) {
|
|
|
|
|
clearFilterSettings();
|
|
|
|
@@ -613,10 +678,9 @@ RED.debug = (function() {
|
|
|
|
|
function clearFilterSettings() {
|
|
|
|
|
filteredNodes = {};
|
|
|
|
|
filterType = 'filterAll';
|
|
|
|
|
$('.red-ui-sidebar-debug-filter-option').removeClass('selected');
|
|
|
|
|
$('#red-ui-sidebar-debug-filterAll').addClass('selected');
|
|
|
|
|
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'));
|
|
|
|
|
$('#red-ui-sidebar-debug-filter-node-list-row').slideUp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|