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

Ensure tabs get their definition object properly attached

This commit is contained in:
Nick O'Leary 2017-07-26 07:46:22 -07:00
parent f9bce5a5f9
commit 1c0e794f87
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 12 additions and 10 deletions

View File

@ -41,6 +41,15 @@ RED.nodes = (function() {
var typeToId = {}; var typeToId = {};
var nodeDefinitions = {}; var nodeDefinitions = {};
nodeDefinitions['tab'] = {
defaults: {
label: {value:""},
disabled: {value: false},
info: {value: ""}
}
};
var exports = { var exports = {
setModulePendingUpdated: function(module,version) { setModulePendingUpdated: function(module,version) {
moduleList[module].pending_version = version; moduleList[module].pending_version = version;
@ -274,14 +283,7 @@ RED.nodes = (function() {
function addWorkspace(ws) { function addWorkspace(ws) {
workspaces[ws.id] = ws; workspaces[ws.id] = ws;
ws._def = { ws._def = RED.nodes.getType('tab');
defaults: {
label: {value:""},
disabled: {value: false},
info: {value: ""}
}
};
workspacesOrder.push(ws.id); workspacesOrder.push(ws.id);
} }
function getWorkspace(id) { function getWorkspace(id) {
@ -817,7 +819,7 @@ RED.nodes = (function() {
// Add a tab if there isn't one there already // Add a tab if there isn't one there already
if (defaultWorkspace == null) { if (defaultWorkspace == null) {
defaultWorkspace = { type:"tab", id:getID(), label:RED._('workspace.defaultName',{number:1})}; defaultWorkspace = { type:"tab", id:getID(), disabled: false, info:"", label:RED._('workspace.defaultName',{number:1})};
addWorkspace(defaultWorkspace); addWorkspace(defaultWorkspace);
RED.workspaces.add(defaultWorkspace); RED.workspaces.add(defaultWorkspace);
new_workspaces.push(defaultWorkspace); new_workspaces.push(defaultWorkspace);

View File

@ -30,7 +30,7 @@ RED.workspaces = (function() {
workspaceIndex += 1; workspaceIndex += 1;
} while ($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0); } while ($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0);
ws = {type:"tab",id:tabId,label:RED._('workspace.defaultName',{number:workspaceIndex})}; ws = {type:"tab",id:tabId,disabled: false,info:"",label:RED._('workspace.defaultName',{number:workspaceIndex})};
RED.nodes.addWorkspace(ws); RED.nodes.addWorkspace(ws);
workspace_tabs.addTab(ws); workspace_tabs.addTab(ws);
workspace_tabs.activateTab(tabId); workspace_tabs.activateTab(tabId);