Ensure config list refreshes properly on tab delete

This commit is contained in:
Nick O'Leary 2016-01-14 15:22:00 +00:00
parent 17e3b71d9c
commit 51afed4041
2 changed files with 12 additions and 9 deletions

View File

@ -187,24 +187,26 @@ RED.sidebar.config = (function() {
getOrCreateCategory("global",globalCategories);
RED.nodes.eachWorkspace(function(ws) {
validList[ws.id] = true;
validList[ws.id.replace(/\./g,"-")] = true;
getOrCreateCategory(ws.id,flowCategories,ws.label);
})
RED.nodes.eachSubflow(function(sf) {
validList[sf.id] = true;
validList[sf.id.replace(/\./g,"-")] = true;
getOrCreateCategory(sf.id,subflowCategories,sf.name);
})
// $(".workspace-config-node-category").each(function() {
// if (!validList[$(this).attr('id').substring("workspace-config-node-category-".length)]) {
// $(this).remove();
// }
// })
$(".workspace-config-node-category").each(function() {
var id = $(this).attr('id').substring("workspace-config-node-category-".length);
if (!validList[id]) {
$(this).remove();
delete categories[id];
}
})
var globalConfigNodes = [];
var configList = {};
RED.nodes.eachConfig(function(cn) {
if (cn.z) {//} == RED.workspaces.active()) {
configList[cn.z] = configList[cn.z]||[];
configList[cn.z].push(cn);
configList[cn.z.replace(/\./g,"-")] = configList[cn.z.replace(/\./g,"-")]||[];
configList[cn.z.replace(/\./g,"-")].push(cn);
} else if (!cn.z) {
globalConfigNodes.push(cn);
}

View File

@ -54,6 +54,7 @@ RED.workspaces = (function() {
historyEvent.workspaces = [ws];
RED.history.push(historyEvent);
RED.nodes.dirty(true);
RED.sidebar.config.refresh();
} else {
$( "#node-dialog-delete-workspace" ).dialog('option','workspace',ws);
$( "#node-dialog-delete-workspace-content" ).text(RED._("workspace.delete",{label:ws.label}));