Skip to content

Commit cef4362

Browse files
🎨 [Frontend] Enh: RM 03.06 (#7794)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7d720d1 commit cef4362

File tree

7 files changed

+62
-26
lines changed

7 files changed

+62
-26
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
170170
if (osparc.product.Utils.isS4LProduct()) {
171171
this.__addHypertools();
172172
}
173-
this.__addOtherTabsAccess();
173+
this.__addMoreMenu();
174174
this.getChildControl("new-folder");
175175
},
176176

@@ -230,8 +230,11 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
230230
});
231231
},
232232

233-
__addOtherTabsAccess: function() {
234-
const moreMenuButton = this.self().createMenuButton("@FontAwesome5Solid/star/16", this.tr("More"));
233+
__addMoreMenu: function() {
234+
const moreMenuButton = this.self().createMenuButton("@FontAwesome5Solid/angle-double-right/16", this.tr("More"));
235+
moreMenuButton.getChildControl("icon").set({
236+
marginLeft: 6, // center it
237+
});
235238
this.addAt(moreMenuButton, this.__itemIdx);
236239
this.__itemIdx++;
237240

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
6060
switch (this.__resourceType) {
6161
case "study": {
6262
this._add(this.__createWorkspacesAndFoldersTree());
63-
this._add(this.__createTemplates());
64-
this._add(this.__createPublicProjects());
63+
if (osparc.product.Utils.showTemplates()) {
64+
this._add(this.__createTemplates());
65+
}
66+
if (osparc.product.Utils.showPublicProjects()) {
67+
this._add(this.__createPublicProjects());
68+
}
6569
this._add(this.__createTrashBin());
6670
this._add(filtersSpacer);
6771
const scrollView = new qx.ui.container.Scroll();
@@ -417,7 +421,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
417421

418422
// hypertools filter
419423
const button = new qx.ui.toolbar.RadioButton("Hypertools", null);
420-
osparc.utils.Utils.replaceIconWithThumbnail(button, osparc.data.model.StudyUI.HYPERTOOL_ICON(), 20);
424+
osparc.utils.Utils.replaceIconWithThumbnail(button, osparc.data.model.StudyUI.HYPERTOOL_ICON(18), 20);
421425
button.appType = "hypertool";
422426
this.__appTypeButtons.push(button);
423427

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,10 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
761761
},
762762

763763
__getPublishPage: function() {
764-
if (!osparc.utils.Resources.isStudy(this.__resourceData)) {
764+
if (
765+
!osparc.utils.Resources.isStudy(this.__resourceData) ||
766+
!osparc.product.Utils.showPublicProjects()
767+
) {
765768
return null;
766769
}
767770

@@ -799,7 +802,10 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
799802
},
800803

801804
__getCreateTemplatePage: function() {
802-
if (!osparc.utils.Resources.isStudy(this.__resourceData)) {
805+
if (
806+
!osparc.utils.Resources.isStudy(this.__resourceData) ||
807+
osparc.product.Utils.showTemplates()
808+
) {
803809
return null;
804810
}
805811

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@ qx.Class.define("osparc.data.SubJob", {
2424
this.set({
2525
projectUuid: subJobData["projectUuid"],
2626
nodeId: subJobData["nodeId"],
27-
nodeName: subJobData["nodeName"],
28-
state: subJobData["state"],
29-
progress: subJobData["progress"],
30-
startedAt: subJobData["startedAt"] ? new Date(subJobData["startedAt"]) : null,
31-
endedAt: subJobData["endedAt"] ? new Date(subJobData["endedAt"]) : null,
32-
osparcCredits: subJobData["osparcCredits"] === null ? null : -1*parseFloat(subJobData["osparcCredits"]),
33-
image: subJobData["image"] || {},
34-
logDownloadLink: subJobData["logDownloadLink"] || null,
3527
});
28+
29+
this.updateSubJob(subJobData);
3630
},
3731

3832
properties: {
@@ -100,11 +94,14 @@ qx.Class.define("osparc.data.SubJob", {
10094
members: {
10195
updateSubJob: function(subJobData) {
10296
this.set({
97+
nodeName: subJobData["nodeName"],
10398
state: subJobData["state"],
10499
progress: subJobData["progress"],
105100
startedAt: subJobData["startedAt"] ? new Date(subJobData["startedAt"]) : null,
106101
endedAt: subJobData["endedAt"] ? new Date(subJobData["endedAt"]) : null,
107102
osparcCredits: subJobData["osparcCredits"] === null ? null : -1*parseFloat(subJobData["osparcCredits"]),
103+
image: subJobData["image"] || {},
104+
logDownloadLink: subJobData["logDownloadLink"] || null,
108105
});
109106
},
110107
},

services/static-webserver/client/source/class/osparc/info/CommentUI.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,13 @@ qx.Class.define("osparc.info.CommentUI", {
126126
const commentContent = this.getChildControl("comment-content");
127127
commentContent.setValue(this.__comment["content"]);
128128

129-
const user = osparc.store.Groups.getInstance().getUserByGroupId(this.__comment["userGroupId"])
130-
if (user) {
131-
thumbnail.setSource(user.getThumbnail());
132-
userName.setValue(user.getLabel());
133-
}
129+
osparc.store.Users.getInstance().getUser(this.__comment["userGroupId"])
130+
.then(user => {
131+
if (user) {
132+
thumbnail.setSource(user.getThumbnail());
133+
userName.setValue(user.getLabel());
134+
}
135+
});
134136

135137
this.getChildControl("spacer");
136138
}

services/static-webserver/client/source/class/osparc/product/Utils.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,28 @@ qx.Class.define("osparc.product.Utils", {
284284
return true;
285285
},
286286

287+
showTemplates: function() {
288+
if (osparc.data.Permissions.getInstance().isTester()) {
289+
return true;
290+
}
291+
292+
if (this.isProduct("tis") || this.isProduct("tiplite")) {
293+
return false;
294+
}
295+
return true;
296+
},
297+
298+
showPublicProjects: function() {
299+
if (osparc.data.Permissions.getInstance().isTester()) {
300+
return true;
301+
}
302+
303+
if (this.isProduct("tis") || this.isProduct("tiplite")) {
304+
return false;
305+
}
306+
return true;
307+
},
308+
287309
showQuality: function() {
288310
if (this.isProduct("osparc")) {
289311
return true;

services/static-webserver/client/source/class/osparc/widget/PersistentIframe.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ qx.Class.define("osparc.widget.PersistentIframe", {
248248
},
249249

250250
__attachInterframeMessageHandlers: function() {
251-
this.__attachTriggerers();
252-
this.__attachListeners();
251+
this.__attachInterIframeThemeSyncer();
252+
this.__attachInterIframeListeners();
253253
},
254254

255-
__attachTriggerers: function() {
255+
__attachInterIframeThemeSyncer: function() {
256256
this.postThemeSwitch = theme => {
257257
const msg = "osparc;theme=" + theme;
258258
this.sendMessageToIframe(msg);
@@ -279,12 +279,14 @@ qx.Class.define("osparc.widget.PersistentIframe", {
279279
}
280280
},
281281

282-
__attachListeners: function() {
282+
__attachInterIframeListeners: function() {
283283
this.__iframe.addListener("load", () => {
284284
const iframe = this._getIframeElement();
285285
if (iframe) {
286286
const iframeDomEl = iframe.getDomElement();
287-
if (iframeDomEl) {
287+
const iframeSource = iframe.getSource();
288+
// Make sure the iframe is loaded and has a valid source
289+
if (iframeDomEl && iframeSource && iframeSource !== "about:blank") {
288290
window.addEventListener("message", message => {
289291
const data = message.data;
290292
if (data) {

0 commit comments

Comments
 (0)