Skip to content

Commit ecd2694

Browse files
committed
update isUpdatable
1 parent 0dd8425 commit ecd2694

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
207207
column: this.self().GRID_POS.COMPATIBLE_VERSION
208208
});
209209

210-
const isUpdatable = osparc.service.Utils.isUpdatable(node);
211210
if (latestCompatible && canIWrite) {
211+
const isUpdatable = osparc.service.Utils.isUpdatable(metadata);
212212
const updateButton = new osparc.ui.form.FetchButton(null, "@MaterialIcons/update/14");
213213
updateButton.set({
214214
enabled: isUpdatable

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,14 @@ qx.Class.define("osparc.service.Utils", {
162162
RETIRED_AUTOUPDATABLE_INSTRUCTIONS: qx.locale.Manager.tr("Please Update the Service"),
163163

164164
isUpdatable: function(metadata) {
165-
const latestCompatible = this.getLatestCompatible(metadata["key"], metadata["version"]);
166-
return latestCompatible && (metadata["key"] !== latestCompatible["key"] || metadata["version"] !== latestCompatible["version"]);
165+
if (metadata["history"]) {
166+
const found = metadata["history"].find(history => history["version"] === metadata["version"]);
167+
if (found && found["compatibility"] && found["compatibility"]["canUpdateTo"]) {
168+
const latestCompatible = found["compatibility"]["canUpdateTo"];
169+
return latestCompatible && (metadata["key"] !== latestCompatible["key"] || metadata["version"] !== latestCompatible["version"]);
170+
}
171+
}
172+
return false;
167173
},
168174

169175
isDeprecated: function(metadata) {

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -317,29 +317,12 @@ qx.Class.define("osparc.store.Services", {
317317
this.__servicesCached[key] = {};
318318
}
319319
this.__servicesCached[key][version] = service;
320-
321-
if ("history" in service) {
322-
this.__servicesCached[key][version]["cached"] = true;
323-
service["history"].forEach(historyEntry => {
324-
const hVersion = historyEntry.version;
325-
if (!(hVersion in this.__servicesCached[key])) {
326-
this.__servicesCached[key][hVersion] = {};
327-
this.__servicesCached[key][hVersion]["cached"] = false;
328-
}
329-
// merge history data into current metadata
330-
this.__servicesCached[key][hVersion] = {
331-
...this.__servicesCached[key][hVersion],
332-
...historyEntry
333-
};
334-
});
335-
}
336320
},
337321

338322
__isInCache: function(key, version) {
339323
return (
340324
key in this.__servicesCached &&
341-
version in this.__servicesCached[key] &&
342-
this.__servicesCached[key][version]["cached"]
325+
version in this.__servicesCached[key]
343326
);
344327
},
345328

0 commit comments

Comments
 (0)