mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Update workspace delete button state properly
This commit is contained in:
parent
e02189d092
commit
60652d2095
@ -87,6 +87,9 @@ RED.tabs = function() {
|
||||
activateTab(tab.find("a"));
|
||||
}
|
||||
li.remove();
|
||||
if (options.onremove) {
|
||||
options.onremove(id);
|
||||
}
|
||||
|
||||
},
|
||||
activateTab: activateTab,
|
||||
|
@ -85,6 +85,19 @@ RED.view = function() {
|
||||
});
|
||||
|
||||
$('#workspace-menu-list').append(menuli);
|
||||
|
||||
if (workspace_tabs.count() == 1) {
|
||||
$('#btn-workspace-delete').parent().addClass("disabled");
|
||||
} else {
|
||||
$('#btn-workspace-delete').parent().removeClass("disabled");
|
||||
}
|
||||
},
|
||||
onremove: function(tab) {
|
||||
if (workspace_tabs.count() == 1) {
|
||||
$('#btn-workspace-delete').parent().addClass("disabled");
|
||||
} else {
|
||||
$('#btn-workspace-delete').parent().removeClass("disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -100,7 +113,6 @@ RED.view = function() {
|
||||
RED.nodes.addWorkspace(ws);
|
||||
workspace_tabs.addTab(ws);
|
||||
workspace_tabs.activateTab(tabId);
|
||||
|
||||
RED.history.push({t:'add',workspaces:[ws],dirty:dirty});
|
||||
RED.view.dirty(true);
|
||||
}
|
||||
@ -1144,20 +1156,10 @@ RED.view = function() {
|
||||
addWorkspace: function(ws) {
|
||||
workspace_tabs.addTab(ws);
|
||||
workspace_tabs.resize();
|
||||
if (workspace_tabs.count() == 1) {
|
||||
$('#btn-workspace-delete').parent().addClass("disabled");
|
||||
} else {
|
||||
$('#btn-workspace-delete').parent().removeClass("disabled");
|
||||
}
|
||||
},
|
||||
removeWorkspace: function(ws) {
|
||||
workspace_tabs.removeTab(ws.id);
|
||||
$('#workspace-menu-list a[href="#'+ws.id+'"]').parent().remove();
|
||||
if (workspace_tabs.count() == 1) {
|
||||
$('#btn-workspace-delete').parent().addClass("disabled");
|
||||
} else {
|
||||
$('#btn-workspace-delete').parent().removeClass("disabled");
|
||||
}
|
||||
},
|
||||
getWorkspace: function() {
|
||||
return activeWorkspace;
|
||||
|
Loading…
Reference in New Issue
Block a user