Skip to content

Commit bf3c545

Browse files
authored
Merge branch 'master' into enh/open-request-account
2 parents a5afd90 + 5b1b84a commit bf3c545

File tree

17 files changed

+75
-45
lines changed

17 files changed

+75
-45
lines changed

packages/models-library/src/models_library/rest_error.py

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from common_library.basic_types import DEFAULT_FACTORY
55
from models_library.generics import Envelope
66
from pydantic import BaseModel, ConfigDict, Field
7+
from pydantic.config import JsonDict
78

89
from .basic_types import IDStr, LogLevel
910

@@ -72,39 +73,55 @@ class ErrorGet(BaseModel):
7273
description="Message displayed to the user",
7374
),
7475
]
76+
7577
support_id: Annotated[
7678
IDStr | None,
7779
Field(description="ID to track the incident during support", alias="supportId"),
7880
] = None
79-
status: int
8081

81-
# NOTE: The fields blow are DEPRECATED. Still here to keep compatibilty with front-end until updated
82+
status: Annotated[
83+
int,
84+
Field(
85+
description="Redundant HTTP status code of the error."
86+
"Must be the same as in the HTTP response"
87+
),
88+
]
89+
90+
# NOTE: The fields below are DEPRECATED.
91+
# Still here to keep compatibilty with front-end until updated
8292
errors: Annotated[
8393
list[ErrorItemType],
8494
Field(deprecated=True, default_factory=list, json_schema_extra={"default": []}),
8595
] = DEFAULT_FACTORY
96+
8697
logs: Annotated[
8798
list[LogMessageType],
8899
Field(deprecated=True, default_factory=list, json_schema_extra={"default": []}),
89100
] = DEFAULT_FACTORY
90101

102+
@staticmethod
103+
def _update_json_schema_extra(schema: JsonDict) -> None:
104+
schema.update(
105+
{
106+
"examples": [
107+
{
108+
"message": "Sorry you do not have sufficient access rights for product",
109+
"status": 401,
110+
},
111+
{
112+
"message": "Opps this error was unexpected. We are working on that!",
113+
"supportId": "OEC:12346789",
114+
"status": 500,
115+
},
116+
]
117+
}
118+
)
119+
91120
model_config = ConfigDict(
92121
populate_by_name=True,
93122
extra="ignore", # Used to prune extra fields from internal data
94123
frozen=True,
95-
json_schema_extra={
96-
"examples": [
97-
{
98-
"message": "Sorry you do not have sufficient access rights for product",
99-
"status": 401,
100-
},
101-
{
102-
"message": "Opps this error was unexpected. We are working on that!",
103-
"supportId": "OEC:12346789",
104-
"status": 500,
105-
},
106-
]
107-
},
124+
json_schema_extra=_update_json_schema_extra,
108125
)
109126

110127

services/static-webserver/client/source/class/osparc/FlashMessenger.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ qx.Class.define("osparc.FlashMessenger", {
105105
allowGrowX: false,
106106
});
107107
errorLabel.addListener("tap", () => {
108+
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy();
108109
const dataToClipboard = {
109110
message,
110111
supportId,
111112
timestamp: new Date().toString(),
112113
url: window.location.href,
113114
releaseTag: osparc.utils.Utils.getReleaseTag(),
114-
studyId: osparc.store.Store.getInstance().getCurrentStudy() || "",
115+
studyId: currentStudy ? currentStudy.getUuid() : "",
115116
}
116117
osparc.utils.Utils.copyTextToClipboard(osparc.utils.Utils.prettifyJson(dataToClipboard));
117118
});

services/static-webserver/client/source/class/osparc/dashboard/NewStudies.js renamed to services/static-webserver/client/source/class/osparc/dashboard/NewPlans.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
************************************************************************ */
1717

18-
qx.Class.define("osparc.dashboard.NewStudies", {
18+
qx.Class.define("osparc.dashboard.NewPlans", {
1919
extend: qx.ui.core.Widget,
2020

2121
construct: function(newStudiesData) {
@@ -38,7 +38,8 @@ qx.Class.define("osparc.dashboard.NewStudies", {
3838

3939
osparc.store.Templates.getHypertools()
4040
.then(hypertools => {
41-
this.__newStudies = newButtonsInfo.filter(newButtonInfo => {
41+
// TIP and TIP lite templates are template_type: "hypertool"
42+
this.__newPlans = newButtonsInfo.filter(newButtonInfo => {
4243
if (newButtonInfo.showDisabled) {
4344
return true;
4445
}
@@ -59,15 +60,15 @@ qx.Class.define("osparc.dashboard.NewStudies", {
5960
},
6061

6162
events: {
62-
"newStudyClicked": "qx.event.type.Data",
63+
"newPlanClicked": "qx.event.type.Data",
6364
},
6465

6566
statics: {
6667
WIDTH: 600
6768
},
6869

6970
members: {
70-
__newStudies: null,
71+
__newPlans: null,
7172
__groups: null,
7273
__flatList: null,
7374
__groupedContainers: null,
@@ -103,7 +104,7 @@ qx.Class.define("osparc.dashboard.NewStudies", {
103104
}
104105

105106
const newCards = [];
106-
this.__newStudies.forEach(resourceData => {
107+
this.__newPlans.forEach(resourceData => {
107108
const cards = this.__resourceToCards(resourceData);
108109
cards.forEach(newCard => {
109110
if (resourceData.showDisabled) {
@@ -175,7 +176,7 @@ qx.Class.define("osparc.dashboard.NewStudies", {
175176
},
176177

177178
__createCard: function(templateInfo) {
178-
const newStudyClicked = () => this.fireDataEvent("newStudyClicked", templateInfo);
179+
const newPlanClicked = () => this.fireDataEvent("newPlanClicked", templateInfo);
179180

180181
const title = templateInfo.title;
181182
const desc = templateInfo.description;
@@ -184,7 +185,7 @@ qx.Class.define("osparc.dashboard.NewStudies", {
184185
newPlanButton.setCardKey(templateInfo["idToWidget"]);
185186
osparc.utils.Utils.setIdToWidget(newPlanButton, templateInfo["idToWidget"]);
186187
}
187-
newPlanButton.addListener("tap", () => newStudyClicked());
188+
newPlanButton.addListener("tap", () => newPlanClicked());
188189
return newPlanButton;
189190
},
190191

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
168168

169169
__addItems: function() {
170170
this.__addUIConfigItems();
171-
if (osparc.product.Utils.isS4LProduct()) {
172-
this.__addHypertools();
173-
}
171+
this.__addHypertools();
174172
this.__addMoreMenu();
175173
this.getChildControl("new-folder");
176174
},
@@ -196,18 +194,21 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
196194
},
197195

198196
__addHypertools: function() {
197+
const hypertoolsMenuButton = this.self().createMenuButton(null, this.tr("Hypertools"));
198+
hypertoolsMenuButton.exclude();
199+
this.addAt(hypertoolsMenuButton, this.__itemIdx);
200+
this.__itemIdx++;
201+
this.self().setIcon(hypertoolsMenuButton, osparc.data.model.StudyUI.HYPERTOOL_ICON);
202+
199203
osparc.store.Templates.getHypertools()
200204
.then(hypertools => {
205+
hypertoolsMenuButton.setVisibility(hypertools.length > 0 ? "visible" : "excluded");
206+
// add entry for hypertools if there are any
201207
if (hypertools.length) {
202-
const hypertoolsMenuButton = this.self().createMenuButton(null, this.tr("Hypertools"));
203-
this.addAt(hypertoolsMenuButton, this.__itemIdx);
204-
this.__itemIdx++;
205-
206208
const hypertoolsMenu = new qx.ui.menu.Menu().set({
207209
appearance: "menu-wider",
208210
});
209211
hypertoolsMenuButton.setMenu(hypertoolsMenu);
210-
this.self().setIcon(hypertoolsMenuButton, osparc.data.model.StudyUI.HYPERTOOL_ICON);
211212

212213
hypertools.forEach(templateData => {
213214
const hypertoolButton = this.self().createMenuButton(null, templateData["name"]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
526526
});
527527
task.addListener("taskAborted", () => {
528528
finished();
529-
const msg = this.tr("Study to Template cancelled");
529+
const msg = this.tr("Project to Template cancelled");
530530
osparc.FlashMessenger.logAs(msg, "WARNING");
531531
});
532532
task.addListener("pollingError", e => {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
421421

422422
// hypertools filter
423423
const button = new qx.ui.toolbar.RadioButton("Hypertools", null);
424+
button.exclude();
425+
osparc.store.Templates.getHypertools()
426+
.then(hypertools => {
427+
button.setVisibility(hypertools.length > 0 ? "visible" : "excluded");
428+
});
424429
osparc.utils.Utils.replaceIconWithThumbnail(button, osparc.data.model.StudyUI.HYPERTOOL_ICON, 26);
425430
// align it with the rest of icons
426431
button.set({

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
278278

279279
// hypertools filter
280280
const hypertoolTypeButton = new qx.ui.menu.Button("Hypertools", null);
281+
hypertoolTypeButton.exclude();
282+
osparc.store.Templates.getHypertools()
283+
.then(hypertools => {
284+
hypertoolTypeButton.setVisibility(hypertools.length > 0 ? "visible" : "excluded");
285+
});
281286
osparc.utils.Utils.replaceIconWithThumbnail(hypertoolTypeButton, osparc.data.model.StudyUI.HYPERTOOL_ICON, 18);
282287
serviceTypeMenu.add(hypertoolTypeButton);
283288
hypertoolTypeButton.addListener("execute", () => this.__addChip("app-type", "hypertool", "Hypertools"), this);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,13 +966,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
966966
osparc.store.Templates.getHypertools()
967967
.then(hypertools => {
968968
if (hypertools) {
969-
const newStudies = new osparc.dashboard.NewStudies(newStudiesConfig);
969+
const newPlans = new osparc.dashboard.NewPlans(newStudiesConfig);
970970
const winTitle = this.tr("New Plan");
971-
const win = osparc.ui.window.Window.popUpInWindow(newStudies, winTitle, osparc.dashboard.NewStudies.WIDTH+40, 300).set({
971+
const win = osparc.ui.window.Window.popUpInWindow(newPlans, winTitle, osparc.dashboard.NewPlans.WIDTH+40, 300).set({
972972
clickAwayClose: false,
973973
resizable: true
974974
});
975-
newStudies.addListener("newStudyClicked", e => {
975+
newPlans.addListener("newPlanClicked", e => {
976976
win.close();
977977
const templateInfo = e.getData();
978978
const templateData = hypertools.find(t => t.name === templateInfo.expectedTemplateLabel);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ qx.Class.define("osparc.desktop.MainPage", {
341341
osparc.data.Resources.fetch("studies", "getOne", params2)
342342
.then(studyData => {
343343
if (!studyData) {
344-
const msg = this.tr("Study not found");
344+
const msg = this.tr("Project not found");
345345
throw new Error(msg);
346346
}
347347
osparc.desktop.MainPageHandler.getInstance().loadStudy(studyData);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ qx.Class.define("osparc.desktop.MainPageHandler", {
7272
osparc.data.Resources.fetch("studies", "getOne", params)
7373
.then(studyData => {
7474
if (!studyData) {
75-
const msg = qx.locale.Manager.tr("Study not found");
75+
const msg = qx.locale.Manager.tr("Project not found");
7676
throw new Error(msg);
7777
}
7878
this.loadStudy(studyData);

0 commit comments

Comments
 (0)