Skip to content

Commit cbaaeb2

Browse files
authored
oSPARC-S4L M2 ready (ITISFoundation#2555)
1 parent fa61db5 commit cbaaeb2

File tree

27 files changed

+446
-224
lines changed

27 files changed

+446
-224
lines changed

services/web/client/source/class/osparc/component/node/ParameterEditor.js

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ qx.Class.define("osparc.component.node.ParameterEditor", {
2727
this.set({
2828
node
2929
});
30-
this.__buildForm();
30+
31+
this.set({
32+
appearance: "settings-groupbox",
33+
maxWidth: 800,
34+
alignX: "center"
35+
});
3136
},
3237

3338
statics: {
@@ -48,7 +53,7 @@ qx.Class.define("osparc.component.node.ParameterEditor", {
4853
},
4954

5055
events: {
51-
"editParameter": "qx.event.type.Event",
56+
"ok": "qx.event.type.Event",
5257
"cancel": "qx.event.type.Event"
5358
},
5459

@@ -59,8 +64,6 @@ qx.Class.define("osparc.component.node.ParameterEditor", {
5964
},
6065

6166
members: {
62-
__form: null,
63-
6467
_createChildControlImpl: function(id) {
6568
let control;
6669
switch (id) {
@@ -109,19 +112,55 @@ qx.Class.define("osparc.component.node.ParameterEditor", {
109112
allowGrowX: false
110113
});
111114
control.addListener("execute", () => {
112-
this.fireEvent("editParameter");
115+
this.fireEvent("ok");
113116
});
114117
break;
115118
}
116119
}
117120
return control || this.base(arguments, id);
118121
},
119122

120-
__buildForm: function() {
121-
const form = this.__form = new qx.ui.form.Form();
122-
const renderer = this.__renderer = new qx.ui.form.renderer.Single(form);
123+
formForSlideshow: function() {
124+
const form = this.__buildForm();
125+
const node = this.getNode();
126+
form.getItem("label").addListener("changeValue", e => node.setLabel(e.getData()));
127+
form.getItem("value").addListener("changeValue", e => osparc.component.node.ParameterEditor.setParameterOutputValue(node, e.getData()));
128+
129+
this._removeAll();
130+
const renderer = new qx.ui.form.renderer.Single(form);
131+
132+
const settingsGroupBox = osparc.component.node.BaseNodeView.createSettingsGroupBox(this.tr("Settings"));
133+
this._add(settingsGroupBox);
134+
settingsGroupBox.add(renderer);
135+
136+
return form;
137+
},
138+
139+
popUpInWindow: function() {
140+
const form = this.__buildForm();
141+
this.__addButtons(form);
142+
143+
this._removeAll();
144+
const renderer = new qx.ui.form.renderer.Single(form);
123145
this._add(renderer);
124146

147+
const win = osparc.ui.window.Window.popUpInWindow(this, "Edit Parameter", 250, 175);
148+
this.addListener("ok", () => {
149+
const node = this.getNode();
150+
const label = form.getItem("label").getValue();
151+
node.setLabel(label);
152+
const val = form.getItem("value").getValue();
153+
osparc.component.node.ParameterEditor.setParameterOutputValue(node, val);
154+
win.close();
155+
}, this);
156+
this.addListener("cancel", () => {
157+
win.close();
158+
}, this);
159+
},
160+
161+
__buildForm: function() {
162+
const form = new qx.ui.form.Form();
163+
125164
const node = this.getNode();
126165

127166
const label = this.getChildControl("label");
@@ -149,20 +188,15 @@ qx.Class.define("osparc.component.node.ParameterEditor", {
149188
}
150189
form.add(valueField, "Value", null, "value");
151190

191+
return form;
192+
},
193+
194+
__addButtons: function(form) {
152195
// buttons
153196
const cancelButton = this.getChildControl("cancel-button");
154197
form.addButton(cancelButton);
155198
const okButton = this.getChildControl("ok-button");
156199
form.addButton(okButton);
157-
},
158-
159-
getLabel: function() {
160-
return this.__form.getItem("label").getValue();
161-
},
162-
163-
getValue: function() {
164-
const item = this.__form.getItem("value");
165-
return item.getValue();
166200
}
167201
}
168202
});

services/web/client/source/class/osparc/component/permissions/Permissions.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,32 @@ qx.Class.define("osparc.component.permissions.Permissions", {
6464
__collaboratorsModel: null,
6565
__collaborators: null,
6666

67-
__buildLayout: function() {
68-
const addCollaborator = this.__createAddCollaboratorSection();
69-
this._add(addCollaborator);
70-
71-
const collaboratorsList = this.__createCollaboratorsListSection();
72-
this._add(collaboratorsList, {
73-
flex: 1
74-
});
75-
76-
// for now, only for studies
77-
if ("uuid" in this._serializedData) {
78-
const studyLinkSection = this.__createStudyLinkSection();
79-
this._add(studyLinkSection);
67+
_createChildControlImpl: function(id) {
68+
let control;
69+
switch (id) {
70+
case "add-collaborator":
71+
control = this.__createAddCollaboratorSection();
72+
this._add(control);
73+
break;
74+
case "collaborators-list":
75+
control = this.__createCollaboratorsListSection();
76+
this._add(control, {
77+
flex: 1
78+
});
79+
break;
80+
case "study-link":
81+
control = this.__createStudyLinkSection();
82+
this._add(control);
83+
// excluded by default
84+
control.exclude();
8085
}
86+
return control || this.base(arguments, id);
87+
},
88+
89+
__buildLayout: function() {
90+
this._createChildControlImpl("add-collaborator");
91+
this._createChildControlImpl("collaborators-list");
92+
this._createChildControlImpl("study-link");
8193
},
8294

8395
__createAddCollaboratorSection: function() {

services/web/client/source/class/osparc/component/workbench/WorkbenchUI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ qx.Class.define("osparc.component.workbench.WorkbenchUI", {
13791379
if (!this.isPropertyInitialized("study") || this.__startHint === null) {
13801380
return;
13811381
}
1382-
const isEmptyWorkspace = Object.keys(this.__getWorkbench().getNodes()).length === 0;
1382+
const isEmptyWorkspace = this.getStudy().isPipelineEmtpy();
13831383
this.__startHint.setVisibility(isEmptyWorkspace ? "visible" : "excluded");
13841384
if (isEmptyWorkspace) {
13851385
const hintBounds = this.__startHint.getBounds() || this.__startHint.getSizeHint();

services/web/client/source/class/osparc/dashboard/CardBase.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ qx.Class.define("osparc.dashboard.CardBase", {
4747
COMP_SERVICE_ICON: "@FontAwesome5Solid/cogs/",
4848
DYNAMIC_SERVICE_ICON: "@FontAwesome5Solid/mouse-pointer/",
4949
PERM_READ: "@FontAwesome5Solid/eye/14",
50+
MODE_WORKBENCH: "@FontAwesome5Solid/cubes/14",
51+
MODE_GUIDED: "@FontAwesome5Solid/play/14",
52+
MODE_APP: "@FontAwesome5Solid/desktop/14",
5053

5154
filterText: function(checks, text) {
5255
if (text && checks.filter(label => label && label.toLowerCase().trim().includes(text)).length == 0) {
@@ -144,6 +147,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
144147
apply: "_applyQuality"
145148
},
146149

150+
uiMode: {
151+
check: ["workbench", "guided", "app"],
152+
nullable: true,
153+
apply: "_applyUiMode"
154+
},
155+
147156
state: {
148157
check: "Object",
149158
nullable: false,
@@ -235,7 +244,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
235244
icon: studyData.thumbnail || defaultThumbnail,
236245
state: studyData.state ? studyData.state : {},
237246
classifiers: studyData.classifiers && studyData.classifiers ? studyData.classifiers : [],
238-
quality: studyData.quality ? studyData.quality : null
247+
quality: studyData.quality ? studyData.quality : null,
248+
uiMode: studyData.ui && studyData.ui.mode ? studyData.ui.mode : null
239249
});
240250
},
241251

@@ -275,6 +285,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
275285
throw new Error("Abstract method called!");
276286
},
277287

288+
_applyUiMode: function(uiMode) {
289+
throw new Error("Abstract method called!");
290+
},
291+
278292
_applyState: function(state) {
279293
throw new Error("Abstract method called!");
280294
},

services/web/client/source/class/osparc/dashboard/Dashboard.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,33 @@ qx.Class.define("osparc.dashboard.Dashboard", {
7070
},
7171

7272
__createMainViewLayout: function() {
73-
[
74-
[this.tr("Studies"), this.__createStudyBrowser],
75-
[this.tr("Discover"), this.__createExploreBrowser],
76-
// [this.tr("Services"), this.__createServiceBrowser],
77-
[this.tr("Data"), this.__createDataBrowser]
78-
].forEach(tuple => {
79-
const tabPage = new qx.ui.tabview.Page(tuple[0]).set({
73+
const tabs = [{
74+
label: this.tr("Studies"),
75+
buildLayout: this.__createStudyBrowser
76+
}, {
77+
label: this.tr("Discover"),
78+
buildLayout: this.__createExploreBrowser
79+
}];
80+
if (!osparc.utils.Utils.isProduct("s4l")) {
81+
tabs.push({
82+
label: this.tr("Data"),
83+
buildLayout: this.__createDataBrowser}
84+
);
85+
}
86+
tabs.forEach(({label, buildLayout}) => {
87+
const tabPage = new qx.ui.tabview.Page(label).set({
8088
appearance: "dashboard-page"
8189
});
8290
const tabButton = tabPage.getChildControl("button");
8391
tabButton.set({
8492
font: "text-16",
8593
minWidth: 70
8694
});
87-
const id = tuple[0].getMessageId().toLowerCase() + "TabBtn";
95+
const id = label.getMessageId().toLowerCase() + "TabBtn";
8896
osparc.utils.Utils.setIdToWidget(tabButton, id);
8997
tabPage.setLayout(new qx.ui.layout.Grow());
9098

91-
const viewLayout = tuple[1].call(this);
99+
const viewLayout = buildLayout.call(this);
92100
tabButton.addListener("execute", () => {
93101
if (viewLayout.resetSelection) {
94102
viewLayout.resetSelection();

services/web/client/source/class/osparc/dashboard/ExploreBrowser.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ qx.Class.define("osparc.dashboard.ExploreBrowser", {
274274
osparc.utils.Study.createStudyFromTemplate(templateData)
275275
.then(studyId => {
276276
this._hideLoadingPage();
277-
this.__startStudy(studyId);
277+
this.__startStudy(studyId, templateData);
278278
})
279279
.catch(err => {
280280
this._hideLoadingPage();
@@ -283,13 +283,20 @@ qx.Class.define("osparc.dashboard.ExploreBrowser", {
283283
});
284284
},
285285

286-
__startStudy: function(studyId) {
286+
__startStudy: function(studyId, templateData) {
287287
if (!this.__checkLoggedIn()) {
288288
return;
289289
}
290290

291+
const defaultContext = "workbench";
292+
let pageContext = defaultContext;
293+
if (templateData !== undefined) {
294+
pageContext = osparc.data.model.Study.getUiMode(templateData) || defaultContext;
295+
}
296+
291297
const data = {
292-
studyId: studyId
298+
studyId,
299+
pageContext
293300
};
294301
this.fireDataEvent("startStudy", data);
295302
},

services/web/client/source/class/osparc/dashboard/GridButtonBase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
5858
TITLE: 0,
5959
SUBTITLE: 1,
6060
THUMBNAIL: 2,
61-
TSR: 3,
61+
TSR_MODE: 3,
6262
TAGS: 4
6363
}
6464
},

services/web/client/source/class/osparc/dashboard/GridButtonItem.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,28 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
4848
_createChildControlImpl: function(id) {
4949
let control;
5050
switch (id) {
51+
case "tsr-mode-layout":
52+
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
53+
this._mainLayout.addAt(control, osparc.dashboard.GridButtonBase.POS.TSR_MODE);
54+
break;
5155
case "tsr-rating": {
56+
const tsrModeLayout = this.getChildControl("tsr-mode-layout");
5257
const tsrLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(2)).set({
5358
toolTipText: this.tr("Ten Simple Rules")
5459
});
5560
const tsrLabel = new qx.ui.basic.Label(this.tr("TSR:"));
5661
tsrLayout.add(tsrLabel);
5762
control = new osparc.ui.basic.StarsRating();
5863
tsrLayout.add(control);
59-
this._mainLayout.addAt(tsrLayout, osparc.dashboard.GridButtonBase.POS.TSR);
64+
tsrModeLayout.add(tsrLayout, {
65+
flex: 1
66+
});
67+
break;
68+
}
69+
case "ui-mode": {
70+
const tsrModeLayout = this.getChildControl("tsr-mode-layout");
71+
control = new qx.ui.basic.Image();
72+
tsrModeLayout.add(control);
6073
break;
6174
}
6275
case "tags":
@@ -287,6 +300,34 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
287300
}
288301
},
289302

303+
_applyUiMode: function(uiMode) {
304+
if (uiMode) {
305+
let source = null;
306+
let toolTipText = null;
307+
switch (uiMode) {
308+
case "guided":
309+
default:
310+
source = osparc.dashboard.CardBase.MODE_GUIDED;
311+
toolTipText = this.tr("Guided mode");
312+
break;
313+
case "app":
314+
source = osparc.dashboard.CardBase.MODE_APP;
315+
toolTipText = this.tr("App mode");
316+
break;
317+
case "workbench":
318+
source = osparc.dashboard.CardBase.MODE_WORKBENCH;
319+
toolTipText = this.tr("Workbench mode");
320+
break;
321+
}
322+
if (source) {
323+
this.getChildControl("ui-mode").set({
324+
source,
325+
toolTipText
326+
});
327+
}
328+
}
329+
},
330+
290331
_applyState: function(state) {
291332
const locked = ("locked" in state) ? state["locked"]["value"] : false;
292333
this.setLocked(locked);

services/web/client/source/class/osparc/dashboard/ListButtonBase.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ qx.Class.define("osparc.dashboard.ListButtonBase", {
5050
SHARED: 6,
5151
LAST_CHANGE: 7,
5252
TSR: 8,
53-
OPTIONS: 9
53+
UI_MODE: 9,
54+
OPTIONS: 10
5455
}
5556
},
5657

0 commit comments

Comments
 (0)