Skip to content

Commit 3148d13

Browse files
authored
πŸŽ¨πŸ› [Frontend] Handle error on project/services (#7883)
1 parent aa07dd8 commit 3148d13

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

β€Žservices/static-webserver/client/source/class/osparc/dashboard/CardBase.jsβ€Ž

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
405405
services: {
406406
check: "Array",
407407
init: true,
408-
nullable: false,
408+
nullable: true,
409409
apply: "__applyServices",
410410
event: "changeServices",
411411
},
@@ -567,7 +567,11 @@ qx.Class.define("osparc.dashboard.CardBase", {
567567
resourceData["services"] = services;
568568
this.setServices(services);
569569
})
570-
.catch(err => console.error(err));
570+
.catch(err => {
571+
resourceData["services"] = null;
572+
this.setServices(null);
573+
console.error(err);
574+
});
571575

572576
osparc.study.Utils.guessIcon(resourceData)
573577
.then(iconSource => this.setIcon(iconSource));
@@ -688,27 +692,38 @@ qx.Class.define("osparc.dashboard.CardBase", {
688692
},
689693

690694
__applyServices: function(services) {
691-
this.setEmptyWorkbench(services.length === 0);
692-
693-
// Updatable study
694-
if (osparc.study.Utils.anyServiceRetired(services)) {
695-
this.setUpdatable("retired");
696-
} else if (osparc.study.Utils.anyServiceDeprecated(services)) {
697-
this.setUpdatable("deprecated");
698-
} else if (osparc.study.Utils.anyServiceUpdatable(services)) {
699-
this.setUpdatable("updatable");
700-
}
701-
702-
// Block card
703-
const cantReadServices = osparc.study.Utils.getCantReadServices(services);
704-
if (cantReadServices.length) {
695+
const unknownServices = cantReadServices => {
696+
// Block card
705697
this.setBlocked("UNKNOWN_SERVICES");
706698
const image = "@FontAwesome5Solid/ban/";
707-
let toolTipText = this.tr("Inaccessible service(s):");
708-
cantReadServices.forEach(unSrv => {
709-
toolTipText += "<br>" + unSrv.key + ":" + osparc.service.Utils.extractVersionDisplay(unSrv.release);
710-
});
699+
let toolTipText = this.tr("Unknown service(s)");
700+
if (cantReadServices && cantReadServices.length) {
701+
toolTipText = this.tr("Inaccessible service(s)");
702+
cantReadServices.forEach(unSrv => {
703+
toolTipText += "<br>" + unSrv.key + ":" + osparc.service.Utils.extractVersionDisplay(unSrv.release);
704+
});
705+
}
711706
this.__showBlockedCard(image, toolTipText);
707+
};
708+
709+
if (services) {
710+
this.setEmptyWorkbench(services.length === 0);
711+
712+
// Updatable study
713+
if (osparc.study.Utils.anyServiceRetired(services)) {
714+
this.setUpdatable("retired");
715+
} else if (osparc.study.Utils.anyServiceDeprecated(services)) {
716+
this.setUpdatable("deprecated");
717+
} else if (osparc.study.Utils.anyServiceUpdatable(services)) {
718+
this.setUpdatable("updatable");
719+
}
720+
721+
const cantReadServices = osparc.study.Utils.getCantReadServices(services);
722+
if (cantReadServices.length) {
723+
unknownServices(cantReadServices);
724+
}
725+
} else {
726+
unknownServices();
712727
}
713728

714729
this.evaluateMenuButtons();

β€Žservices/static-webserver/client/source/class/osparc/dashboard/DataBrowser.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ qx.Class.define("osparc.dashboard.DataBrowser", {
4343
let control;
4444
switch (id) {
4545
case "tree-folder-view":
46-
control = new osparc.file.TreeFolderView();
46+
control = new osparc.file.TreeFolderView().set({
47+
paddingBottom: 15,
48+
});
4749
this._addToLayout(control, {
4850
flex: 1
4951
});

β€Žservices/static-webserver/client/source/class/osparc/dashboard/ResourceDetails.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
804804
__getCreateTemplatePage: function() {
805805
if (
806806
!osparc.utils.Resources.isStudy(this.__resourceData) ||
807-
osparc.product.Utils.showTemplates()
807+
!osparc.product.Utils.showTemplates()
808808
) {
809809
return null;
810810
}

β€Žservices/static-webserver/client/source/class/osparc/study/Utils.jsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ qx.Class.define("osparc.study.Utils", {
355355
},
356356

357357
__getBlockedState: function(studyData) {
358-
if (studyData["services"]) {
358+
if (studyData["services"] === null) {
359+
return "UNKNOWN_SERVICES";
360+
} else if (studyData["services"]) {
359361
const cantReadServices = osparc.study.Utils.getCantReadServices(studyData["services"]);
360362
const inaccessibleServices = osparc.store.Services.getInaccessibleServices(studyData["workbench"]);
361363
if (cantReadServices.length || inaccessibleServices.length) {

0 commit comments

Comments
Β (0)