Skip to content

Commit c2231b9

Browse files
committed
minor
1 parent 9a9b459 commit c2231b9

File tree

1 file changed

+34
-27
lines changed

1 file changed

+34
-27
lines changed

services/static-webserver/client/source/class/osparc/dashboard/WorkspacesAndFoldersTree.js

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -134,33 +134,42 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
134134
});
135135
},
136136

137-
__addMyWorkspace: function(rootModel) {
138-
const myWorkspaceData = {
139-
label: "My Workspace",
140-
icon: "home",
141-
workspaceId: null,
142-
folderId: null,
137+
__createItemData: function(label, icon, workspaceId, folderId) {
138+
return {
139+
label,
140+
icon,
141+
workspaceId,
142+
folderId,
143143
loaded: false,
144144
children: [{
145145
label: "Loading...",
146146
}],
147-
}
147+
};
148+
},
149+
150+
__addMyWorkspace: function(rootModel) {
151+
const workspaceId = null;
152+
const folderId = null;
153+
const myWorkspaceData = this.__createItemData(
154+
"My Workspace",
155+
"home",
156+
workspaceId,
157+
folderId,
158+
);
148159
const myWorkspaceModel = qx.data.marshal.Json.createModel(myWorkspaceData, true);
149160
this.__models.push(myWorkspaceModel);
150161
rootModel.getChildren().append(myWorkspaceModel);
151162
},
152163

153164
__addSharedWorkspaces: function(rootModel) {
154-
const sharedWorkspaceData = {
155-
label: "Shared Workspaces",
156-
icon: "shared",
157-
workspaceId: -1,
158-
folderId: null,
159-
loaded: false,
160-
children: [{
161-
label: "Loading...",
162-
}],
163-
}
165+
const workspaceId = -1;
166+
const folderId = null;
167+
const sharedWorkspaceData = this.__createItemData(
168+
"Shared Workspaces",
169+
"shared",
170+
workspaceId,
171+
folderId,
172+
);
164173
const sharedWorkspaceModel = qx.data.marshal.Json.createModel(sharedWorkspaceData, true);
165174
this.__models.push(sharedWorkspaceModel);
166175
rootModel.getChildren().append(sharedWorkspaceModel);
@@ -177,16 +186,14 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
177186
},
178187

179188
__addWorkspace: function(workspace) {
180-
const workspaceData = {
181-
label: "",
182-
icon: "shared",
183-
workspaceId: workspace.getWorkspaceId(),
184-
folderId: null,
185-
loaded: false,
186-
children: [{
187-
label: "Loading...",
188-
}],
189-
};
189+
const workspaceId = workspace.getWorkspaceId();
190+
const folderId = null;
191+
const workspaceData = this.__createItemData(
192+
"",
193+
"shared",
194+
workspaceId,
195+
folderId,
196+
);
190197
const workspaceModel = qx.data.marshal.Json.createModel(workspaceData, true);
191198
this.__models.push(workspaceModel);
192199
workspace.bind("name", workspaceModel, "label");

0 commit comments

Comments
 (0)