Skip to content

Commit 7ccadab

Browse files
authored
✨ Remove non S4L-Lite relevant features (ITISFoundation#3688)
1 parent 5bbb2b3 commit 7ccadab

File tree

19 files changed

+208
-129
lines changed

19 files changed

+208
-129
lines changed

services/static-webserver/client/source/class/osparc/component/metadata/ServicesInStudyBootOpts.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ qx.Class.define("osparc.component.metadata.ServicesInStudyBootOpts", {
1919
GRID_POS: {
2020
...osparc.component.metadata.ServicesInStudy.GRID_POS,
2121
BOOT_MODE: Object.keys(osparc.component.metadata.ServicesInStudy.GRID_POS).length
22+
},
23+
24+
anyBootOptions: function(studyData) {
25+
if ("workbench" in studyData) {
26+
for (const nodeId in studyData["workbench"]) {
27+
const node = studyData["workbench"][nodeId];
28+
const metadata = osparc.utils.Services.getMetaData(node["key"], node["version"]);
29+
if (metadata && "boot-options" in metadata) {
30+
return true;
31+
}
32+
}
33+
}
34+
return false;
2235
}
2336
},
2437

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
322322
},
323323

324324
__applyQuality: function(quality) {
325-
if (osparc.component.metadata.Quality.isEnabled(quality)) {
325+
if (!osparc.utils.Utils.isProduct("s4llite") && osparc.component.metadata.Quality.isEnabled(quality)) {
326326
const tsrRating = this.getChildControl("tsr-rating");
327327
tsrRating.set({
328328
nStars: 4,

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

Lines changed: 65 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,18 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
3636

3737
this._setLayout(new qx.ui.layout.Canvas());
3838

39-
const mainLayout = this._mainLayout = new qx.ui.container.Composite(new qx.ui.layout.VBox(this.self().V_SPACING)).set({
39+
const grid = new qx.ui.layout.Grid();
40+
grid.setSpacing(this.self().SPACING_IN);
41+
grid.setRowFlex(2, 1);
42+
grid.setColumnFlex(0, 1);
43+
grid.setRowMaxHeight(0, 34);
44+
45+
const mainLayout = this._mainLayout = new qx.ui.container.Composite().set({
4046
maxWidth: this.self().ITEM_WIDTH - 2*this.self().PADDING,
4147
maxHeight: this.self().ITEM_HEIGHT - 2*this.self().PADDING
4248
});
49+
mainLayout.setLayout(grid);
50+
4351
this._add(mainLayout, {
4452
top: 0,
4553
right: 0,
@@ -52,14 +60,47 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
5260
ITEM_WIDTH: 190,
5361
ITEM_HEIGHT: 220,
5462
PADDING: 10,
55-
V_SPACING: 6,
63+
SPACING_IN: 4,
5664
SPACING: 15,
5765
POS: {
58-
TITLE: 0,
59-
SUBTITLE: 1,
60-
THUMBNAIL: 2,
61-
TSR_MODE: 3,
62-
TAGS: 4
66+
TITLE: {
67+
row: 0,
68+
column: 0,
69+
rowSpan: 1,
70+
colSpan: 3
71+
},
72+
SUBTITLE: {
73+
row: 1,
74+
column: 0,
75+
rowSpan: 1,
76+
colSpan: 3
77+
},
78+
THUMBNAIL: {
79+
row: 2,
80+
column: 0,
81+
rowSpan: 1,
82+
colSpan: 3
83+
},
84+
TSR: {
85+
row: 3,
86+
column: 0
87+
},
88+
TAGS: {
89+
row: 4,
90+
column: 0
91+
},
92+
VIEWER_MODE: {
93+
row: 3,
94+
column: 1,
95+
rowSpan: 2,
96+
colSpan: 1
97+
},
98+
UPDATES: {
99+
row: 3,
100+
column: 2,
101+
rowSpan: 2,
102+
colSpan: 1
103+
}
63104
}
64105
},
65106

@@ -77,25 +118,25 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
77118
switch (id) {
78119
case "title":
79120
control = new qx.ui.basic.Label().set({
80-
margin: [5, 0],
121+
marginTop: 3,
81122
font: "title-14",
82123
maxWidth: this.self().ITEM_WIDTH - 2*this.self().PADDING,
83124
maxHeight: 34, // two lines
84125
rich: true,
85126
wrap: true
86127
});
87-
this._mainLayout.addAt(control, this.self().POS.TITLE);
128+
this._mainLayout.add(control, this.self().POS.TITLE);
88129
break;
89130
case "subtitle":
90131
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(6)).set({
91132
anonymous: true
92133
});
93-
this._mainLayout.addAt(control, this.self().POS.SUBTITLE);
134+
this._mainLayout.add(control, this.self().POS.SUBTITLE);
94135
break;
95136
case "subtitle-icon": {
96137
control = new qx.ui.basic.Image();
97-
const sharedDescriptionLayout = this.getChildControl("subtitle");
98-
sharedDescriptionLayout.addAt(control, 0);
138+
const subtitleLayout = this.getChildControl("subtitle");
139+
subtitleLayout.addAt(control, 0);
99140
break;
100141
}
101142
case "subtitle-text": {
@@ -104,8 +145,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
104145
font: "text-13",
105146
allowGrowY: false
106147
});
107-
const sharedDescriptionLayout = this.getChildControl("subtitle");
108-
sharedDescriptionLayout.addAt(control, 1, {
148+
const subtitleLayout = this.getChildControl("subtitle");
149+
subtitleLayout.addAt(control, 0, {
109150
flex: 1
110151
});
111152
break;
@@ -116,9 +157,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
116157
control.getChildControl("image").set({
117158
anonymous: true
118159
});
119-
this._mainLayout.addAt(control, this.self().POS.THUMBNAIL, {
120-
flex: 1
121-
});
160+
this._mainLayout.add(control, this.self().POS.THUMBNAIL);
122161
break;
123162
}
124163
}
@@ -139,9 +178,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
139178
"appear",
140179
"loaded"
141180
].forEach(eventName => {
142-
image.addListener(eventName, () => {
143-
this.__fitIconHeight();
144-
}, this);
181+
image.addListener(eventName, () => this.__fitIconHeight(), this);
145182
});
146183
},
147184

@@ -167,10 +204,16 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
167204
__fitIconHeight: function() {
168205
const iconLayout = this.getChildControl("icon");
169206
let maxHeight = this.getHeight() - this.getPaddingTop() - this.getPaddingBottom();
207+
const checkThis = [
208+
"title",
209+
"subtitle",
210+
"tsr-rating",
211+
"tags"
212+
];
170213
// eslint-disable-next-line no-underscore-dangle
171214
this._mainLayout._getChildren().forEach(child => {
172-
if (child.getSubcontrolId() !== "icon" && child.getBounds()) {
173-
maxHeight -= (child.getBounds().height + 6);
215+
if (checkThis.includes(child.getSubcontrolId()) && child.getBounds()) {
216+
maxHeight -= (child.getBounds().height + this.self().SPACING_IN);
174217
}
175218
});
176219
iconLayout.getChildControl("image").setMaxHeight(maxHeight);

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

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,55 +44,46 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
4444
_createChildControlImpl: function(id) {
4545
let control;
4646
switch (id) {
47-
case "tsr-mode-update-layout":
48-
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(5));
49-
this._mainLayout.addAt(control, osparc.dashboard.GridButtonBase.POS.TSR_MODE);
50-
break;
5147
case "tsr-rating": {
52-
const layout = this.getChildControl("tsr-mode-update-layout");
5348
const tsrLayout = new qx.ui.container.Composite(new qx.ui.layout.HBox(2)).set({
5449
toolTipText: this.tr("Ten Simple Rules")
5550
});
5651
const tsrLabel = new qx.ui.basic.Label(this.tr("TSR:"));
5752
tsrLayout.add(tsrLabel);
5853
control = new osparc.ui.basic.StarsRating();
5954
tsrLayout.add(control);
60-
layout.add(tsrLayout, {
61-
flex: 1
62-
});
55+
this._mainLayout.add(tsrLayout, osparc.dashboard.GridButtonBase.POS.TSR);
6356
break;
6457
}
6558
case "ui-mode": {
66-
const layout = this.getChildControl("tsr-mode-update-layout");
67-
control = new qx.ui.basic.Image();
68-
layout.add(control);
59+
control = new qx.ui.basic.Image().set({
60+
alignY: "middle"
61+
});
62+
this._mainLayout.add(control, osparc.dashboard.GridButtonBase.POS.VIEWER_MODE);
6963
break;
7064
}
7165
case "update-study": {
72-
const layout = this.getChildControl("tsr-mode-update-layout");
7366
control = new qx.ui.basic.Image().set({
74-
source: "@MaterialIcons/update/18",
75-
visibility: "excluded"
67+
source: "@MaterialIcons/update/16",
68+
visibility: "excluded",
69+
alignY: "middle"
7670
});
77-
layout.add(control);
71+
this._mainLayout.add(control, osparc.dashboard.GridButtonBase.POS.UPDATES);
7872
break;
7973
}
8074
case "hits-service": {
81-
const layout = this.getChildControl("tsr-mode-update-layout");
8275
control = new qx.ui.basic.Label().set({
83-
toolTipText: this.tr("Number of times it was instantiated")
84-
});
85-
layout.add(new qx.ui.core.Spacer(), {
86-
flex: 1
76+
toolTipText: this.tr("Number of times it was instantiated"),
77+
alignY: "middle"
8778
});
88-
layout.add(control);
79+
this._mainLayout.add(control, osparc.dashboard.GridButtonBase.POS.UPDATES);
8980
break;
9081
}
9182
case "tags":
9283
control = new qx.ui.container.Composite(new qx.ui.layout.Flow(5, 3)).set({
9384
anonymous: true
9485
});
95-
this._mainLayout.addAt(control, osparc.dashboard.GridButtonBase.POS.TAGS);
86+
this._mainLayout.add(control, osparc.dashboard.GridButtonBase.POS.TAGS);
9687
break;
9788
case "menu-button": {
9889
this.getChildControl("title").set({
@@ -299,10 +290,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
299290
_applyTags: function(tags) {
300291
if (osparc.data.Permissions.getInstance().canDo("study.tag")) {
301292
const tagsContainer = this.getChildControl("tags");
302-
if (tags.length) {
303-
const iconContainer = this.getChildControl("icon");
304-
iconContainer.setMaxHeight(105);
305-
}
293+
tagsContainer.setVisibility(tags.length ? "visible" : "excluded");
306294
tagsContainer.removeAll();
307295
tags.forEach(tag => {
308296
const tagUI = new osparc.ui.basic.Tag(tag.name, tag.color, "searchBarFilter");

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,18 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", {
3939

4040
statics: {
4141
POS: {
42-
STATE: osparc.dashboard.GridButtonBase.THUMBNAIL + 1,
43-
PROGRESS: osparc.dashboard.GridButtonBase.THUMBNAIL + 2
42+
STATE: {
43+
row: 3,
44+
column: 0,
45+
rowSpan: 1,
46+
colSpan: 3
47+
},
48+
PROGRESS: {
49+
row: 4,
50+
column: 0,
51+
rowSpan: 1,
52+
colSpan: 3
53+
}
4454
}
4555
},
4656

@@ -50,7 +60,7 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", {
5060
switch (id) {
5161
case "state-label":
5262
control = new qx.ui.basic.Label();
53-
this._mainLayout.addAt(control, this.self().POS.STATE);
63+
this._mainLayout.add(control, this.self().POS.STATE);
5464
break;
5565
case "progress-bar":
5666
control = new qx.ui.indicator.ProgressBar().set({
@@ -59,7 +69,7 @@ qx.Class.define("osparc.dashboard.GridButtonPlaceholder", {
5969
control.getChildControl("progress").set({
6070
backgroundColor: "strong-main"
6171
});
62-
this._mainLayout.addAt(control, this.self().POS.PROGRESS);
72+
this._mainLayout.add(control, this.self().POS.PROGRESS);
6373
break;
6474
}
6575
return control || this.base(arguments, id);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
301301
let icon = "";
302302
if (org.thumbnail) {
303303
icon = org.thumbnail;
304-
} else if (org["groupType"] === 0) {
304+
} else if (org["collabType"] === 0) {
305305
icon = "@FontAwesome5Solid/globe/24";
306-
} else if (org["groupType"] === 1) {
306+
} else if (org["collabType"] === 1) {
307307
icon = "@FontAwesome5Solid/users/24";
308-
} else if (org["groupType"] === 2) {
308+
} else if (org["collabType"] === 2) {
309309
icon = "@FontAwesome5Solid/user/24";
310310
}
311311
groupContainer.set({

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
141141
this.__getServicesBootOptionsPage,
142142
this.__getSaveAsTemplatePage
143143
].forEach(pageCallee => {
144-
const page = pageCallee.call(this);
145-
if (page) {
146-
this.add(page);
144+
if (pageCallee) {
145+
const page = pageCallee.call(this);
146+
if (page) {
147+
this.add(page);
148+
}
147149
}
148150
});
149151

@@ -317,6 +319,9 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
317319
},
318320

319321
__getQualityPage: function() {
322+
if (osparc.utils.Utils.isProduct("s4llite")) {
323+
return null;
324+
}
320325
const id = "Quality";
321326
const resourceData = this.__resourceData;
322327
if (
@@ -368,6 +373,9 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
368373
if (osparc.utils.Resources.isService(resourceData)) {
369374
return null;
370375
}
376+
if (!osparc.component.metadata.ServicesInStudyBootOpts.anyBootOptions(resourceData)) {
377+
return null;
378+
}
371379

372380
const title = this.tr("Boot Options");
373381
const icon = "@FontAwesome5Solid/play-circle";

services/static-webserver/client/source/class/osparc/data/model/Study.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ qx.Class.define("osparc.data.model.Study", {
443443
},
444444

445445
__applyState: function(value) {
446-
if ("state" in value) {
446+
if (value && "state" in value) {
447447
const isRunning = this.self().isRunning(value["state"]["value"]);
448448
this.setPipelineRunning(isRunning);
449449
} else {

services/static-webserver/client/source/class/osparc/desktop/MainPage.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,17 @@ qx.Class.define("osparc.desktop.MainPage", {
8585
if (this.__studyEditor) {
8686
const preferencesSettings = osparc.desktop.preferences.Preferences.getInstance();
8787
if (preferencesSettings.getConfirmBackToDashboard()) {
88-
const msg = this.tr("Do you really want to save and close the study?");
88+
let msg = this.tr("Do you really want to save and close the study?");
89+
let confirmText = this.tr("Save & Close");
90+
if (osparc.utils.Utils.isProduct("s4llite")) {
91+
msg = this.tr("Do you really want to close the project?");
92+
msg += "<br>";
93+
msg += this.tr("Make sure you saved the changes to the current <b>smash file</b> and <b>open notebooks</b>");
94+
confirmText = this.tr("Close");
95+
}
8996
const win = new osparc.ui.window.Confirmation(msg).set({
90-
confirmText: this.tr("Save & Close")
97+
caption: confirmText,
98+
confirmText
9199
});
92100
const confirmButton = win.getConfirmButton();
93101
osparc.utils.Utils.setIdToWidget(confirmButton, "confirmDashboardBtn");

0 commit comments

Comments
 (0)