Skip to content

Commit d7df635

Browse files
authored
🐛 Fix: Do not reask for updating the services (#5468)
1 parent 8b7cadc commit d7df635

File tree

2 files changed

+65
-66
lines changed

2 files changed

+65
-66
lines changed

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

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
8383
__qualityPage: null,
8484
__servicesUpdatePage: null,
8585
__openButton: null,
86-
__anyUpdatable: null,
8786
_services: null,
8887

8988
__createToolbar: function() {
@@ -107,7 +106,7 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
107106
toolbar.add(serviceVersionSelector);
108107
}
109108

110-
const openButton = this.__openButton = new qx.ui.form.Button(this.tr("Open")).set({
109+
const openButton = this.__openButton = new osparc.ui.form.FetchButton(this.tr("Open")).set({
111110
enabled: true
112111
});
113112
osparc.dashboard.resources.pages.BasePage.decorateHeaderButton(openButton);
@@ -120,79 +119,79 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
120119
converter: show => (store.getCurrentStudy() === null && show) ? "visible" : "excluded"
121120
});
122121

123-
this.__handleServiceUpdatableCheck(resourceData.workbench);
122+
openButton.addListener("execute", () => this.__openTapped());
124123

125124
toolbar.add(openButton);
126125
},
127126

128-
__handleServiceUpdatableCheck: function(workbench) {
129-
const updatableServices = [];
130-
this.__anyUpdatable = false;
131-
for (const nodeId in workbench) {
132-
const node = workbench[nodeId];
133-
const latestCompatibleMetadata = osparc.service.Utils.getLatestCompatible(this._services, node["key"], node["version"]);
134-
if (latestCompatibleMetadata === null) {
135-
osparc.FlashMessenger.logAs(this.tr("Some service information could not be retrieved"), "WARNING");
136-
}
137-
const isUpdatable = osparc.service.Utils.isUpdatable(node);
138-
if (isUpdatable) {
139-
this.__anyUpdatable = true;
140-
updatableServices.push(nodeId);
141-
}
142-
}
143-
if (this.__anyUpdatable) {
144-
this.__confirmUpdate();
145-
} else {
127+
__openTapped: function() {
128+
if (this.__resourceData["resourceType"] !== "study") {
129+
// Nothing to pre-check
146130
this.__openStudy();
131+
return;
147132
}
133+
this.__openButton.setFetching(true);
134+
const params = {
135+
url: {
136+
"studyId": this.__resourceData["uuid"]
137+
}
138+
};
139+
osparc.data.Resources.getOne("studies", params)
140+
.then(updatedStudyData => {
141+
this.__openButton.setFetching(false);
142+
const workbench = updatedStudyData.workbench;
143+
const updatableServices = [];
144+
let anyUpdatable = false;
145+
for (const nodeId in workbench) {
146+
const node = workbench[nodeId];
147+
const latestCompatibleMetadata = osparc.service.Utils.getLatestCompatible(this._services, node["key"], node["version"]);
148+
if (latestCompatibleMetadata === null) {
149+
osparc.FlashMessenger.logAs(this.tr("Some service information could not be retrieved"), "WARNING");
150+
}
151+
const isUpdatable = osparc.service.Utils.isUpdatable(node);
152+
if (isUpdatable) {
153+
anyUpdatable = true;
154+
updatableServices.push(nodeId);
155+
}
156+
}
157+
if (anyUpdatable) {
158+
this.__confirmUpdate();
159+
} else {
160+
this.__openStudy();
161+
}
162+
})
163+
.catch(() => this.__openButton.setFetching(false));
148164
},
149165

150-
__openStudy: function() {
151-
this.__openButton.setLabel("Open");
152-
this.__openButton.addListenerOnce("execute", () => {
153-
switch (this.__resourceData["resourceType"]) {
154-
case "study":
155-
this.fireDataEvent("openStudy", this.__resourceData);
156-
break;
157-
case "template":
158-
this.fireDataEvent("openTemplate", this.__resourceData);
159-
break;
160-
case "service":
161-
this.fireDataEvent("openService", this.__resourceData);
162-
break;
166+
__confirmUpdate: function() {
167+
const msg = this.tr("Some of your services are outdated. Please update to the latest version for better performance.\n\nDo you want to update now?");
168+
const win = new osparc.dashboard.ResourceUpgradeHelper(msg).set({
169+
primaryAction: "create",
170+
secondaryAction: "primary"
171+
});
172+
win.center();
173+
win.open();
174+
win.addListenerOnce("close", () => {
175+
if (win.getConfirmed()) {
176+
this.__openPage(this.__servicesUpdatePage);
177+
} else {
178+
this.__openStudy();
163179
}
164-
}, true);
180+
});
165181
},
166182

167-
__confirmUpdate: function() {
168-
this.__openButton.addListenerOnce("tap", () => {
169-
const msg = this.tr("Some of your services are outdated. Please update to the latest version for better performance.\n\nDo you want to update now?");
170-
const win = new osparc.dashboard.ResourceUpgradeHelper(msg).set({
171-
primaryAction: "create",
172-
secondaryAction: "primary"
173-
});
174-
win.center();
175-
win.open();
176-
win.addListenerOnce("close", () => {
177-
if (win.getConfirmed()) {
178-
this.__isUpdatable = false;
179-
this.__openPage(this.__servicesUpdatePage);
180-
} else {
181-
this.__isUpdatable = false;
182-
switch (this.__resourceData["resourceType"]) {
183-
case "study":
184-
this.fireDataEvent("openStudy", this.__resourceData);
185-
break;
186-
case "template":
187-
this.fireDataEvent("openTemplate", this.__resourceData);
188-
break;
189-
case "service":
190-
this.fireDataEvent("openService", this.__resourceData);
191-
break;
192-
}
193-
}
194-
});
195-
}, this);
183+
__openStudy: function() {
184+
switch (this.__resourceData["resourceType"]) {
185+
case "study":
186+
this.fireDataEvent("openStudy", this.__resourceData);
187+
break;
188+
case "template":
189+
this.fireDataEvent("openTemplate", this.__resourceData);
190+
break;
191+
case "service":
192+
this.fireDataEvent("openService", this.__resourceData);
193+
break;
194+
}
196195
},
197196

198197
__addTabPagesView: function() {
@@ -592,7 +591,6 @@ qx.Class.define("osparc.dashboard.ResourceMoreOptions", {
592591
} else if (osparc.utils.Resources.isTemplate(resourceData)) {
593592
this.fireDataEvent("updateTemplate", updatedData);
594593
}
595-
this.__handleServiceUpdatableCheck(updatedData.workbench);
596594
});
597595

598596
const page = this.__servicesUpdatePage = new osparc.dashboard.resources.pages.BasePage(title, iconSrc, id);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ qx.Class.define("osparc.desktop.credits.ProfilePage", {
6464

6565
const email = new qx.ui.form.TextField().set({
6666
tabIndex: 1,
67-
placeholder: this.tr("Email")
67+
placeholder: this.tr("Email"),
68+
readOnly: true
6869
});
6970

7071
const form = new qx.ui.form.Form();

0 commit comments

Comments
 (0)