Skip to content

Commit

Permalink
Ensure config list refreshes properly on tab delete
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Jan 14, 2016
1 parent 17e3b71 commit 51afed4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
20 changes: 11 additions & 9 deletions editor/js/ui/tab-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions editor/js/ui/workspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}));
Expand Down

0 comments on commit 51afed4

Please sign in to comment.