Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
}

// Block card
const cantReadServices = osparc.study.Utils.getCantExecuteServices(services);
const cantReadServices = osparc.study.Utils.getCantReadServices(services);
if (cantReadServices.length) {
this.setBlocked("UNKNOWN_SERVICES");
const image = "@FontAwesome5Solid/ban/";
Expand Down Expand Up @@ -985,8 +985,17 @@ qx.Class.define("osparc.dashboard.CardBase", {
throw new Error("Abstract method called!");
},

_applyMenu: function(value, old) {
throw new Error("Abstract method called!");
_applyMenu: function(menu) {
const menuButton = this.getChildControl("menu-button");
if (menu) {
menuButton.setMenu(menu).set({
appearance: "menu-wider",
position: "bottom-left",
});
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
menu.addListener("appear", () => this.evaluateMenuButtons());
}
menuButton.setVisibility(menu ? "visible" : "excluded");
},

_setStudyPermissions: function(accessRights) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,5 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
}
}
},

// overridden
_applyMenu: function(menu, old) {
const menuButton = this.getChildControl("menu-button");
if (menu) {
menuButton.setMenu(menu).set({
appearance: "menu-wider",
position: "bottom-left",
});
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
this.evaluateMenuButtons();
}
menuButton.setVisibility(menu ? "visible" : "excluded");
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,5 @@ qx.Class.define("osparc.dashboard.ListButtonItem", {
});
});
},

_applyMenu: function(menu, old) {
const menuButton = this.getChildControl("menu-button");
if (menu) {
menuButton.setMenu(menu).set({
appearance: "menu-wider",
position: "bottom-left",
});
osparc.utils.Utils.setIdToWidget(menu, "studyItemMenuMenu");
this.evaluateMenuButtons();
}
menuButton.setVisibility(menu ? "visible" : "excluded");
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -1598,10 +1598,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
const duplicateStudyButton = this.__getDuplicateMenuButton(studyData);
menu.add(duplicateStudyButton);

const convertToPipelineButton = this.__getConvertToPipelineMenuButton(studyData);
menu.add(convertToPipelineButton);
if (writeAccess && osparc.product.Utils.showConvertToPipeline()) {
const convertToPipelineButton = this.__getConvertToPipelineMenuButton(studyData);
menu.add(convertToPipelineButton);
}

if (osparc.product.Utils.hasExportCMisEnabled()) {
if (osparc.product.Utils.showExportCMis()) {
const exportStudyButton = this.__getExportCMisMenuButton(studyData);
menu.add(exportStudyButton);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
osparc.store.Services.getStudyServices(this._studyData["uuid"])
.then(resp => {
const services = resp["services"];
if (osparc.study.Utils.getCantExecuteServices(services).length) {
if (osparc.study.Utils.getCantReadServices(services).length) {
msg += this.tr("Some services are inaccessible. Please contact the service owner:");
msg += "<br><br>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
});
control.addListener("execute", () => this.__convertToPipelineClicked(), this);
break;
case "study-menu-restore":
control = new qx.ui.menu.Button().set({
label: this.tr("Restore"),
icon: osparc.theme.common.Image.URLS["window-restore"] + "/20",
});
control.addListener("execute", () => {
this.getStudy().getUi().setMode("workbench");
});
break;
case "study-menu-open-logger":
control = new qx.ui.menu.Button().set({
label: this.tr("Platform Logs..."),
Expand All @@ -111,8 +102,9 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
optionsMenu.add(this.getChildControl("study-menu-info"));
optionsMenu.add(this.getChildControl("study-menu-reload"));
optionsMenu.add(this.getChildControl("study-menu-conversations"));
optionsMenu.add(this.getChildControl("study-menu-convert-to-pipeline"));
optionsMenu.add(this.getChildControl("study-menu-restore"));
if (osparc.product.Utils.showConvertToPipeline()) {
optionsMenu.add(this.getChildControl("study-menu-convert-to-pipeline"));
}
optionsMenu.add(this.getChildControl("study-menu-open-logger"));
control = new qx.ui.form.MenuButton().set({
appearance: "fab-button",
Expand Down Expand Up @@ -162,15 +154,12 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
converter: mode => mode === "standalone" ? "visible" : "excluded"
});

const convertToPipelineButton = this.getChildControl("study-menu-convert-to-pipeline");
study.getUi().bind("mode", convertToPipelineButton, "visibility", {
converter: mode => mode === "standalone" ? "visible" : "excluded"
});

const restoreButton = this.getChildControl("study-menu-restore");
study.getUi().bind("mode", restoreButton, "visibility", {
converter: mode => mode === "standalone" ? "visible" : "excluded"
});
if (osparc.product.Utils.showConvertToPipeline()) {
const convertToPipelineButton = this.getChildControl("study-menu-convert-to-pipeline");
study.getUi().bind("mode", convertToPipelineButton, "visibility", {
converter: mode => mode === "standalone" ? "visible" : "excluded"
});
}

const loggerButton = this.getChildControl("study-menu-open-logger");
study.getUi().bind("mode", loggerButton, "visibility", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ qx.Class.define("osparc.product.Utils", {
},

// oSPARC only
hasExportCMisEnabled: function() {
showExportCMis: function() {
const product = this.getProductName();
return product === "osparc";
},
Expand Down Expand Up @@ -307,17 +307,15 @@ qx.Class.define("osparc.product.Utils", {
},

showQuality: function() {
if (this.isProduct("osparc")) {
return true;
}
return false;
return this.isProduct("osparc");
},

showClassifiers: function() {
if (this.getProductName().includes("s4l")) {
return false;
}
return true;
return this.isProduct("osparc");
},

showConvertToPipeline: function() {
return this.isS4LProduct() || this.isProduct("osparc");
},

showS4LStore: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ qx.Class.define("osparc.store.Services", {
const servicesObj = osparc.service.Utils.convertArrayToObject(servicesArray);
this.__addHits(servicesObj);
this.__addTSRInfos(servicesObj);
this.__addExtraTypeInfos(servicesObj);
this.__addXTypeInfos(servicesObj);

Object.values(servicesObj).forEach(serviceKey => {
Object.values(serviceKey).forEach(service => this.__addServiceToCache(service));
Expand Down Expand Up @@ -128,9 +128,6 @@ qx.Class.define("osparc.store.Services", {
};
this.__servicesPromisesCached[key][version] = osparc.data.Resources.fetch("services", "getOne", params)
.then(service => {
this.__addHit(service);
this.__addTSRInfo(service);
this.__addExtraTypeInfo(service);
this.__addServiceToCache(service);
// Resolve the promise locally before deleting it
resolve(service);
Expand Down Expand Up @@ -168,6 +165,15 @@ qx.Class.define("osparc.store.Services", {
}
};
this.__studyServicesPromisesCached[studyId] = osparc.data.Resources.fetch("studies", "getServices", params)
.then(resp => {
const services = resp["services"];
services.forEach(service => {
// this service information is not complete, keep it in cache anyway
service.version = service["release"]["version"];
this.__addServiceToCache(service);
});
return resp;
})
.finally(() => {
delete this.__studyServicesPromisesCached[studyId];
});
Expand Down Expand Up @@ -368,13 +374,26 @@ qx.Class.define("osparc.store.Services", {
},

__addServiceToCache: function(service) {
this.__addHit(service);
this.__addTSRInfo(service);
this.__addXTypeInfo(service);

const key = service.key;
const version = service.version;
service["resourceType"] = "service";
this.__addToCache(key, version, service);
},

__addToCache: function(key, version, value) {
// some services that go to the cache are not complete, e.g. study services
// if the one in the cache is the complete one, do not overwrite it
if (
this.__isInCache(key, version) &&
"inputs" in this.__servicesCached[key][version]
) {
return;
}

if (!(key in this.__servicesCached)) {
this.__servicesCached[key] = {};
}
Expand Down Expand Up @@ -414,7 +433,7 @@ qx.Class.define("osparc.store.Services", {
});
},

__addExtraTypeInfo: function(service) {
__addXTypeInfo: function(service) {
service["xType"] = service["type"];
if (["backend", "frontend"].includes(service["xType"])) {
if (osparc.data.model.Node.isFilePicker(service)) {
Expand All @@ -429,10 +448,10 @@ qx.Class.define("osparc.store.Services", {
}
},

__addExtraTypeInfos: function(servicesObj) {
__addXTypeInfos: function(servicesObj) {
Object.values(servicesObj).forEach(serviceWVersion => {
Object.values(serviceWVersion).forEach(service => {
this.__addExtraTypeInfo(service);
this.__addXTypeInfo(service);
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ qx.Class.define("osparc.study.Utils", {
return parameters.length && probes.length;
},

getCantExecuteServices: function(studyServices = []) {
getCantReadServices: function(studyServices = []) {
return studyServices.filter(studyService => studyService["myAccessRights"]["execute"] === false);
},

Expand Down Expand Up @@ -357,7 +357,7 @@ qx.Class.define("osparc.study.Utils", {

__getBlockedState: function(studyData) {
if (studyData["services"]) {
const cantReadServices = osparc.study.Utils.getCantExecuteServices(studyData["services"]);
const cantReadServices = osparc.study.Utils.getCantReadServices(studyData["services"]);
const inaccessibleServices = osparc.store.Services.getInaccessibleServices(studyData["workbench"]);
if (cantReadServices.length || inaccessibleServices.length) {
return "UNKNOWN_SERVICES";
Expand Down

This file was deleted.

Loading