1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Clear debug message when switching projects (#1523)

* Clear debug sidebar when switching project

* Delete a unnecessary comment

* Clear any filters the users has enabled

* Clear filter settings only when the user opens a project
This commit is contained in:
Hideki Nakamura 2018-01-06 01:13:02 +09:00 committed by Nick O'Leary
parent 5a6cde1446
commit 207d3d3340
4 changed files with 41 additions and 7 deletions

View File

@ -910,7 +910,9 @@ RED.projects = (function() {
}
}
}
},projectData).always(function() {
},projectData).then(function() {
RED.events.emit("project:change", {name:name});
}).always(function() {
RED.deploy.setDeployInflight(false);
})
@ -1075,7 +1077,9 @@ RED.projects = (function() {
}
},
}
},{active:true}).always(function() {
},{active:true}).then(function() {
RED.events.emit("project:change", {name:name});
}).always(function() {
RED.deploy.setDeployInflight(false);
})
}

View File

@ -183,6 +183,18 @@
};
RED.comms.subscribe("debug",this.handleDebugMessage);
this.clearMessageList = function() {
RED.debug.clearMessageList(true);
if (subWindow) {
try {
subWindow.postMessage({event:"projectChange"},"*");
} catch(err) {
console.log(err);
}
}
};
RED.events.on("project:change", this.clearMessageList);
$("#debug-tab-open").click(function(e) {
e.preventDefault();
subWindow = window.open(document.location.toString().replace(/[?#].*$/,"")+"debug/view/view.html"+document.location.search,"nodeREDDebugView","menubar=no,location=no,toolbar=no,chrome,height=500,width=600");

View File

@ -68,7 +68,7 @@ RED.debug = (function() {
// var filterTypeRow = $('<div class="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="debug-filter-row hide"></div>').appendTo(filterDialog);
var debugNodeListRow = $('<div class="debug-filter-row hide" id="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();
@ -218,9 +218,7 @@ RED.debug = (function() {
toolbar.find("#debug-tab-clear").click(function(e) {
e.preventDefault();
$(".debug-message").remove();
messageCount = 0;
config.clear();
clearMessageList(false);
});
@ -508,10 +506,28 @@ RED.debug = (function() {
}
}
function clearMessageList(clearFilter) {
$(".debug-message").remove();
config.clear();
if (!!clearFilter) {
clearFilterSettings();
}
refreshDebugNodeList();
}
function clearFilterSettings() {
filteredNodes = {};
filterType = 'filterAll';
$('.debug-tab-filter-option').removeClass('selected');
$('#debug-tab-filterAll').addClass('selected');
$('#debug-tab-filter span').text(RED._('node-red:debug.sidebar.filterAll'));
$('#debug-filter-node-list-row').slideUp();
}
return {
init: init,
refreshMessageList:refreshMessageList,
handleDebugMessage: handleDebugMessage,
clearMessageList: clearMessageList,
}
})();

View File

@ -24,6 +24,8 @@ $(function() {
RED.debug.handleDebugMessage(evt.data.msg);
} else if (evt.data.event === "workspaceChange") {
RED.debug.refreshMessageList(evt.data.activeWorkspace);
} else if (evt.data.event === "projectChange") {
RED.debug.clearMessageList(true);
}
},false);
})