Skip to content

Commit 0e41132

Browse files
authored
🎨 [Frontend] Second app on Sim4Life.lite (II) (#7823)
1 parent ddd71db commit 0e41132

File tree

8 files changed

+43
-15
lines changed

8 files changed

+43
-15
lines changed

services/static-webserver/client/source/class/osparc/editor/HtmlEditor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ qx.Class.define("osparc.editor.HtmlEditor", {
2626

2727
this.getChildControl("preview-html");
2828
this.getChildControl("subtitle").set({
29-
value: this.tr("Supports HTML")
29+
value: this.tr("Supports HTML"),
30+
url: "https://en.wikipedia.org/wiki/HTML",
3031
});
3132
},
3233

services/static-webserver/client/source/class/osparc/editor/MarkdownEditor.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ qx.Class.define("osparc.editor.MarkdownEditor", {
3131

3232
this.getChildControl("preview-markdown");
3333
this.getChildControl("subtitle").set({
34-
value: this.tr("Markdown supported")
34+
value: this.tr("Markdown supported"),
35+
url: "https://en.wikipedia.org/wiki/Markdown",
3536
});
3637
},
3738

services/static-webserver/client/source/class/osparc/editor/TextEditor.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,13 @@ qx.Class.define("osparc.editor.TextEditor", {
8181
writePage.add(control, {
8282
flex: 1
8383
});
84-
const subtitle = this.getChildControl("subtitle").set({
85-
value: this.tr("Supports HTML")
86-
});
84+
const subtitle = this.getChildControl("subtitle");
8785
writePage.add(subtitle);
8886
tabs.add(writePage);
8987
break;
9088
}
9189
case "subtitle":
92-
control = new qx.ui.basic.Label().set({
90+
control = new osparc.ui.basic.LinkLabel().set({
9391
font: "text-12"
9492
});
9593
this._add(control);

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ qx.Class.define("osparc.info.CommentUI", {
113113

114114
__buildLayout: function() {
115115
const thumbnail = this.getChildControl("thumbnail");
116-
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail("", "", 32));
117116

118117
const userName = this.getChildControl("user-name");
119-
userName.setValue("Unknown");
120118

121119
const date = new Date(this.__comment["modified"]);
122120
const date2 = osparc.utils.Utils.formatDateAndTime(date);
@@ -131,7 +129,14 @@ qx.Class.define("osparc.info.CommentUI", {
131129
if (user) {
132130
thumbnail.setSource(user.getThumbnail());
133131
userName.setValue(user.getLabel());
132+
} else {
133+
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail());
134+
userName.setValue("Unknown user");
134135
}
136+
})
137+
.catch(() => {
138+
thumbnail.setSource(osparc.utils.Avatar.emailToThumbnail());
139+
userName.setValue("Unknown user");
135140
});
136141

137142
this.getChildControl("spacer");

services/static-webserver/client/source/class/osparc/store/Services.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,18 @@ qx.Class.define("osparc.store.Services", {
385385
},
386386

387387
__addToCache: function(key, version, value) {
388-
// some services that go to the cache are not complete, e.g. study services
388+
// some services that go to the cache are not complete: /latest, /study/services
389389
// if the one in the cache is the complete one, do not overwrite it
390390
if (
391391
this.__isInCache(key, version) &&
392-
"inputs" in this.__servicesCached[key][version]
392+
"history" in this.__servicesCached[key][version] // the most complete service metadata is already in cache
393+
) {
394+
return;
395+
}
396+
if (
397+
this.__isInCache(key, version) &&
398+
"inputs" in this.__servicesCached[key][version] && // this is the second most complete service metadata (/latest)
399+
value && !("inputs" in value) // the one to be added is not more complete
393400
) {
394401
return;
395402
}

services/static-webserver/client/source/class/osparc/store/Users.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ qx.Class.define("osparc.store.Users", {
1919
extend: qx.core.Object,
2020
type: "singleton",
2121

22+
construct: function() {
23+
this.base(arguments);
24+
25+
this.__unknowns = [];
26+
},
27+
2228
properties: {
2329
users: {
2430
check: "Array",
@@ -28,6 +34,8 @@ qx.Class.define("osparc.store.Users", {
2834
},
2935

3036
members: {
37+
__unknowns: null,
38+
3139
__fetchUser: function(groupId) {
3240
const params = {
3341
url: {
@@ -38,10 +46,17 @@ qx.Class.define("osparc.store.Users", {
3846
.then(userData => {
3947
const user = this.addUser(userData[0]);
4048
return user;
49+
})
50+
.catch(() => {
51+
this.__unknowns.push(groupId);
52+
return null;
4153
});
4254
},
4355

4456
getUser: async function(groupId, fetchIfNotFound = true) {
57+
if (this.__unknowns.includes(groupId)) {
58+
return null;
59+
}
4560
const userFound = this.getUsers().find(user => user.getGroupId() === groupId);
4661
if (userFound) {
4762
return userFound;

services/static-webserver/client/source/class/osparc/utils/Avatar.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ qx.Class.define("osparc.utils.Avatar", {
3434
type: "static",
3535

3636
statics: {
37-
emailToThumbnail: function(email, username) {
38-
return this.__getUrl(email, username, 32);
39-
},
40-
41-
__getUrl: function(email, username, size = 100) {
37+
emailToThumbnail: function(email, username = "??", size = 32) {
4238
email = email || "";
4339
// MD5 (Message-Digest Algorithm) by WebToolkit
4440
const MD5 = function(s) {

services/static-webserver/client/source/resource/osparc/ui_config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@
156156
"title": "${replace_me_product_name}",
157157
"newStudyLabel": "New Project",
158158
"idToWidget": "startS4LButton"
159+
}, {
160+
"resourceType": "service",
161+
"expectedKey": "simcore/services/dynamic/s4l-ui-framework",
162+
"title": "Sim4Life.framework",
163+
"newStudyLabel": "Sim4Life.framework"
159164
}]
160165
}
161166
},

0 commit comments

Comments
 (0)