Skip to content

Commit b423326

Browse files
committed
[skip ci] block card IN_DEBT
1 parent 9b16d0e commit b423326

File tree

1 file changed

+39
-5
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+39
-5
lines changed

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

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,15 @@ qx.Class.define("osparc.dashboard.CardBase", {
385385
apply: "__applyState"
386386
},
387387

388+
debt: {
389+
check: "Number",
390+
nullable: true,
391+
init: 0,
392+
apply: "__applyDebt"
393+
},
394+
388395
blocked: {
389-
check: [true, "UNKNOWN_SERVICES", "IN_USE", false],
396+
check: [true, "UNKNOWN_SERVICES", "IN_USE", "IN_DEBT", false],
390397
init: false,
391398
nullable: false,
392399
apply: "__applyBlocked"
@@ -626,11 +633,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
626633
const unaccessibleServices = osparc.study.Utils.getInaccessibleServices(workbench)
627634
if (unaccessibleServices.length) {
628635
this.setBlocked("UNKNOWN_SERVICES");
629-
const image = "@FontAwesome5Solid/ban/";
636+
let image = "@FontAwesome5Solid/ban/";
630637
let toolTipText = this.tr("Service info missing");
631638
unaccessibleServices.forEach(unSrv => {
632639
toolTipText += "<br>" + unSrv.key + ":" + unSrv.version;
633640
});
641+
image += this.classname.includes("Grid") ? "32" : "22";
634642
this.__showBlockedCard(image, toolTipText);
635643
}
636644
},
@@ -680,7 +688,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
680688
}
681689
this.setBlocked(lockInUse ? "IN_USE" : false);
682690
if (lockInUse) {
683-
this.__showBlockedCardFromStatus(state["locked"]);
691+
this.__showBlockedCardFromStatus("IN_USE", state["locked"]);
684692
}
685693

686694
const pipelineState = ("state" in state) ? state["state"]["value"] : undefined;
@@ -689,6 +697,13 @@ qx.Class.define("osparc.dashboard.CardBase", {
689697
}
690698
},
691699

700+
__applyDebt: function(debt) {
701+
this.setBlocked(debt ? "IN_DEBT" : false);
702+
if (debt) {
703+
this.__showBlockedCardFromStatus("IN_DEBT", debt);
704+
}
705+
},
706+
692707
// pipelineState: ["NOT_STARTED", "STARTED", "SUCCESS", "ABORTED", "FAILED", "UNKNOWN"]
693708
__applyPipelineState: function(pipelineState) {
694709
let iconSource;
@@ -751,7 +766,18 @@ qx.Class.define("osparc.dashboard.CardBase", {
751766
});
752767
},
753768

754-
__showBlockedCardFromStatus: function(lockedStatus) {
769+
__showBlockedCardFromStatus: function(reason, moreInfo) {
770+
switch (reason) {
771+
case "IN_USE":
772+
this.__blockedInUse(moreInfo);
773+
break;
774+
case "IN_DEBT":
775+
this.__blockedInDebt(moreInfo);
776+
break;
777+
}
778+
},
779+
780+
__blockedInUse: function(lockedStatus) {
755781
const status = lockedStatus["status"];
756782
const owner = lockedStatus["owner"];
757783
let toolTip = osparc.utils.Utils.firstsUp(owner["first_name"] || this.tr("A user"), owner["last_name"] || ""); // it will be replaced by "userName"
@@ -781,6 +807,13 @@ qx.Class.define("osparc.dashboard.CardBase", {
781807
image = "@FontAwesome5Solid/lock/";
782808
break;
783809
}
810+
image += this.classname.includes("Grid") ? "32" : "22";
811+
this.__showBlockedCard(image, toolTip);
812+
},
813+
814+
__blockedInDebt: function(debt) {
815+
const toolTip = debt + "$";
816+
const image = "osparc/coins-solid.svg";
784817
this.__showBlockedCard(image, toolTip);
785818
},
786819

@@ -789,9 +822,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
789822
opacity: 1.0,
790823
visibility: "visible"
791824
});
825+
792826
const lockImage = this.getChildControl("lock-status").getChildControl("image");
793-
lockImageSrc += this.classname.includes("Grid") ? "32" : "22";
794827
lockImage.setSource(lockImageSrc);
828+
795829
if (toolTipText) {
796830
this.set({
797831
toolTipText

0 commit comments

Comments
 (0)