Skip to content

Commit cfece4f

Browse files
authored
Merge branch 'master' into add-redis-user
2 parents 2c53837 + 2c6692e commit cfece4f

File tree

8 files changed

+95
-32
lines changed

8 files changed

+95
-32
lines changed

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,54 @@ qx.Class.define("osparc.dashboard.ContainerHeader", {
102102
return this.__createFolderButton(currentFolder);
103103
},
104104

105-
__createRootButton: function(workspaceId) {
105+
__changeContext: function(workspaceId, folderId) {
106+
this.set({
107+
currentWorkspaceId: workspaceId,
108+
currentFolderId: folderId,
109+
});
110+
this.fireDataEvent("changeContext", {
111+
workspaceId,
112+
folderId,
113+
});
114+
},
115+
116+
__createRootButton: function() {
117+
const workspaceId = this.getCurrentWorkspaceId();
106118
let rootButton = null;
107119
if (workspaceId) {
108120
if (workspaceId === -1) {
109121
rootButton = new qx.ui.form.Button(this.tr("Shared Workspaces"), osparc.store.Workspaces.iconPath());
110122
} else {
111123
const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId);
112-
rootButton = new qx.ui.form.Button(workspace.getName(), osparc.store.Workspaces.iconPath());
124+
rootButton = new qx.ui.form.Button(workspace.getName(), osparc.store.Workspaces.iconPath()).set({
125+
maxWidth: 200
126+
});
127+
workspace.bind("name", rootButton, "label");
113128
}
114129
} else {
115130
rootButton = new qx.ui.form.Button(this.tr("My Workspace"), "@FontAwesome5Solid/home/14");
116131
}
117132
rootButton.addListener("execute", () => {
118133
const folderId = null;
119-
this.set({
120-
currentFolderId: null,
121-
});
122-
this.fireDataEvent("changeContext", {
123-
workspaceId,
124-
folderId,
125-
});
134+
this.__changeContext(workspaceId, folderId);
126135
});
127136
return rootButton;
128137
},
129138

130139
__createFolderButton: function(folder) {
131140
let folderButton = null;
132141
if (folder) {
133-
folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14");
142+
folderButton = new qx.ui.form.Button(folder.getName(), "@FontAwesome5Solid/folder/14").set({
143+
maxWidth: 200
144+
});
145+
folder.bind("name", folderButton, "label");
134146
folderButton.addListener("execute", () => {
135147
const workspaceId = this.getCurrentWorkspaceId();
136148
const folderId = folder ? folder.getFolderId() : null;
137-
this.set({
138-
currentFolderId: folderId,
139-
});
140-
this.fireDataEvent("changeContext", {
141-
workspaceId,
142-
folderId,
143-
});
149+
this.__changeContext(workspaceId, folderId);
144150
}, this);
145151
} else {
146-
const workspaceId = this.getCurrentWorkspaceId();
147-
folderButton = this.__createRootButton(workspaceId);
152+
folderButton = this.__createRootButton();
148153
}
149154
folderButton.set({
150155
backgroundColor: "transparent",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ qx.Class.define("osparc.dashboard.FolderButtonBase", {
8383
row: 0,
8484
rowSpan: 2
8585
}
86-
}
86+
},
8787
},
8888

8989
members: { // eslint-disable-line qx-rules/no-refs-in-members

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
105105
control = new qx.ui.basic.Label().set({
106106
anonymous: true,
107107
font: "text-14",
108-
rich: true,
109108
});
110109
this._add(control, osparc.dashboard.FolderButtonBase.POS.TITLE);
111110
break;
@@ -169,6 +168,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
169168
__applyTitle: function(value) {
170169
const label = this.getChildControl("title");
171170
label.setValue(value);
171+
172+
this.setToolTipText(value);
172173
},
173174

174175
__applyLastModified: function(value) {

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,18 +251,32 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
251251
resourcesContainer.addListener("publishTemplate", e => this.fireDataEvent("publishTemplate", e.getData()));
252252
resourcesContainer.addListener("tagClicked", e => this._searchBarFilter.addTagActiveFilter(e.getData()));
253253
resourcesContainer.addListener("emptyStudyClicked", e => this._deleteResourceRequested(e.getData()));
254-
resourcesContainer.addListener("folderSelected", e => this._folderSelected(e.getData()));
255254
resourcesContainer.addListener("folderUpdated", e => this._folderUpdated(e.getData()));
256255
resourcesContainer.addListener("moveFolderToFolderRequested", e => this._moveFolderToFolderRequested(e.getData()));
257256
resourcesContainer.addListener("moveFolderToWorkspaceRequested", e => this._moveFolderToWorkspaceRequested(e.getData()));
258257
resourcesContainer.addListener("deleteFolderRequested", e => this._deleteFolderRequested(e.getData()));
258+
resourcesContainer.addListener("folderSelected", e => {
259+
const folderId = e.getData();
260+
this._folderSelected(folderId);
261+
this._resourceFilter.folderSelected(folderId);
262+
}, this);
259263
resourcesContainer.addListener("workspaceSelected", e => {
260264
const workspaceId = e.getData();
261265
this._workspaceSelected(workspaceId);
262266
this._resourceFilter.workspaceSelected(workspaceId);
263-
});
267+
}, this);
264268
resourcesContainer.addListener("workspaceUpdated", e => this._workspaceUpdated(e.getData()));
265269
resourcesContainer.addListener("deleteWorkspaceRequested", e => this._deleteWorkspaceRequested(e.getData()));
270+
271+
const containerHeader = this._resourcesContainer.getContainerHeader();
272+
containerHeader.addListener("changeContext", e => {
273+
const {
274+
workspaceId,
275+
folderId,
276+
} = e.getData();
277+
this._resourceFilter.contextChanged(workspaceId, folderId);
278+
}, this);
279+
266280
this._addToLayout(resourcesContainer);
267281
},
268282

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

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
6262
}
6363
},
6464

65+
66+
/* WORKSPACES AND FOLDERS */
6567
__createWorkspacesAndFoldersTree: function() {
6668
const workspacesAndFoldersTree = this.__workspacesAndFoldersTree = new osparc.dashboard.WorkspacesAndFoldersTree();
6769
// Height needs to be calculated manually to make it flexible
@@ -82,6 +84,32 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
8284
return this.__workspacesAndFoldersTree;
8385
},
8486

87+
contextChanged: function(workspaceId, folderId) {
88+
this.__workspacesAndFoldersTree.set({
89+
currentWorkspaceId: workspaceId,
90+
currentFolderId: folderId,
91+
});
92+
this.__workspacesAndFoldersTree.contextChanged();
93+
},
94+
95+
workspaceSelected: function(workspaceId) {
96+
this.__workspacesAndFoldersTree.set({
97+
currentWorkspaceId: workspaceId,
98+
currentFolderId: null,
99+
});
100+
this.__workspacesAndFoldersTree.contextChanged();
101+
},
102+
103+
folderSelected: function(folderId) {
104+
const workspaceId = this.__workspacesAndFoldersTree.getCurrentWorkspaceId();
105+
this.__workspacesAndFoldersTree.set({
106+
currentWorkspaceId: workspaceId,
107+
currentFolderId: folderId,
108+
});
109+
this.__workspacesAndFoldersTree.contextChanged();
110+
},
111+
/* /WORKSPACES AND FOLDERS */
112+
85113
/* SHARED WITH */
86114
__createSharedWithFilterLayout: function() {
87115
const sharedWithLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));
@@ -137,12 +165,6 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
137165
},
138166
/* /SHARED WITH */
139167

140-
/* WORKSPACES */
141-
workspaceSelected: function(workspaceId) {
142-
// OM: select folder
143-
},
144-
/* /WORKSPACES */
145-
146168
/* TAGS */
147169
__createTagsFilterLayout: function() {
148170
const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(5));

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -882,15 +882,17 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
882882

883883
const containerHeader = this._resourcesContainer.getContainerHeader();
884884
if (containerHeader) {
885-
this.bind("currentWorkspaceId", containerHeader, "currentWorkspaceId", {
886-
onUpdate: () => containerHeader.setCurrentFolderId(null)
887-
});
885+
this.bind("currentWorkspaceId", containerHeader, "currentWorkspaceId");
888886
this.bind("currentFolderId", containerHeader, "currentFolderId");
889887
containerHeader.addListener("changeContext", e => {
890888
const {
891889
workspaceId,
892890
folderId,
893891
} = e.getData();
892+
this.set({
893+
currentWorkspaceId: workspaceId,
894+
currentFolderId: folderId,
895+
})
894896
this._changeContext(workspaceId, folderId);
895897
});
896898
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
4646

4747
this.__initTree();
4848

49+
// preselect "My Workspace"
50+
this.contextChanged(null, null);
51+
4952
osparc.store.Folders.getInstance().addListener("folderAdded", e => {
5053
const folder = e.getData();
5154
this.__folderAdded(folder);
@@ -249,5 +252,17 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTree", {
249252
}
250253
}
251254
},
255+
256+
contextChanged: function() {
257+
const workspaceId = this.getCurrentWorkspaceId();
258+
const folderId = this.getCurrentFolderId();
259+
260+
const contextModel = this.__getModel(workspaceId, folderId);
261+
if (contextModel) {
262+
const selection = this.getSelection();
263+
selection.removeAll();
264+
selection.push(contextModel);
265+
}
266+
},
252267
}
253268
});

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", {
2929
"border-radius": "8px"
3030
});
3131

32+
this.set({
33+
maxWidth: 200 - 10
34+
});
35+
3236
this.setNotHoveredStyle();
3337
this.__attachEventHandlers();
3438
},

0 commit comments

Comments
 (0)