@@ -320,7 +320,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
320
320
321
321
trashedAt : {
322
322
check : "Date" ,
323
- apply : "_applyTrasehdAt " ,
323
+ apply : "_applyTrashedAt " ,
324
324
nullable : true
325
325
} ,
326
326
@@ -385,15 +385,15 @@ qx.Class.define("osparc.dashboard.CardBase", {
385
385
apply : "__applyState"
386
386
} ,
387
387
388
- projectState : {
389
- check : [ "NOT_STARTED" , "STARTED" , "SUCCESS" , "FAILED" , "UNKNOWN" ] ,
390
- nullable : false ,
391
- init : "UNKNOWN" ,
392
- apply : "_applyProjectState "
388
+ debt : {
389
+ check : "Number" ,
390
+ nullable : true ,
391
+ init : 0 ,
392
+ apply : "__applyDebt "
393
393
} ,
394
394
395
395
blocked : {
396
- check : [ true , "UNKNOWN_SERVICES" , "IN_USE" , false ] ,
396
+ check : [ true , "UNKNOWN_SERVICES" , "IN_USE" , "IN_DEBT" , false ] ,
397
397
init : false ,
398
398
nullable : false ,
399
399
apply : "__applyBlocked"
@@ -547,7 +547,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
547
547
throw new Error ( "Abstract method called!" ) ;
548
548
} ,
549
549
550
- _applyTrasehdAt : function ( value , old ) {
550
+ _applyTrashedAt : function ( value , old ) {
551
551
throw new Error ( "Abstract method called!" ) ;
552
552
} ,
553
553
@@ -633,7 +633,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
633
633
const unaccessibleServices = osparc . study . Utils . getInaccessibleServices ( workbench )
634
634
if ( unaccessibleServices . length ) {
635
635
this . setBlocked ( "UNKNOWN_SERVICES" ) ;
636
- const image = "@FontAwesome5Solid/ban/" ;
636
+ let image = "@FontAwesome5Solid/ban/" ;
637
637
let toolTipText = this . tr ( "Service info missing" ) ;
638
638
unaccessibleServices . forEach ( unSrv => {
639
639
toolTipText += "<br>" + unSrv . key + ":" + unSrv . version ;
@@ -681,65 +681,75 @@ qx.Class.define("osparc.dashboard.CardBase", {
681
681
} ,
682
682
683
683
__applyState : function ( state ) {
684
- const locked = ( "locked" in state ) ? state [ "locked" ] [ "value" ] : false ;
685
- this . setBlocked ( locked ? "IN_USE" : false ) ;
686
- if ( locked ) {
687
- this . __showBlockedCardFromStatus ( state [ "locked" ] ) ;
684
+ let lockInUse = false ;
685
+ if ( "locked" in state && "value" in state [ "locked" ] ) {
686
+ lockInUse = state [ "locked" ] [ "value" ] ;
687
+ }
688
+ this . setBlocked ( lockInUse ? "IN_USE" : false ) ;
689
+ if ( lockInUse ) {
690
+ this . __showBlockedCardFromStatus ( "IN_USE" , state [ "locked" ] ) ;
688
691
}
689
692
690
- const projectState = ( "state" in state ) ? state [ "state" ] [ "value" ] : undefined ;
691
- if ( projectState ) {
692
- this . _applyProjectState ( state [ "state" ] ) ;
693
+ const pipelineState = ( "state" in state ) ? state [ "state" ] [ "value" ] : undefined ;
694
+ if ( pipelineState ) {
695
+ this . __applyPipelineState ( state [ "state" ] [ "value "] ) ;
693
696
}
694
697
} ,
695
698
696
- _applyProjectState : function ( projectStatus ) {
697
- const status = projectStatus [ "value" ] ;
698
- let icon ;
699
- let toolTip ;
700
- let border ;
701
- switch ( status ) {
699
+ __applyDebt : function ( debt ) {
700
+ this . setBlocked ( debt ? "IN_DEBT" : false ) ;
701
+ if ( debt ) {
702
+ this . __showBlockedCardFromStatus ( "IN_DEBT" , debt ) ;
703
+ }
704
+ } ,
705
+
706
+ // pipelineState: ["NOT_STARTED", "STARTED", "SUCCESS", "ABORTED", "FAILED", "UNKNOWN"]
707
+ __applyPipelineState : function ( pipelineState ) {
708
+ let iconSource ;
709
+ let toolTipText ;
710
+ let borderColor ;
711
+ switch ( pipelineState ) {
702
712
case "STARTED" :
703
- icon = "@FontAwesome5Solid/spinner/10" ;
704
- toolTip = this . tr ( "Running" ) ;
705
- border = "info" ;
713
+ iconSource = "@FontAwesome5Solid/spinner/10" ;
714
+ toolTipText = this . tr ( "Running" ) ;
715
+ borderColor = "info" ;
706
716
break ;
707
717
case "SUCCESS" :
708
- icon = "@FontAwesome5Solid/check/10" ;
709
- toolTip = this . tr ( "Ran successfully" ) ;
710
- border = "success" ;
718
+ iconSource = "@FontAwesome5Solid/check/10" ;
719
+ toolTipText = this . tr ( "Ran successfully" ) ;
720
+ borderColor = "success" ;
711
721
break ;
712
722
case "ABORTED" :
713
- icon = "@FontAwesome5Solid/exclamation/10" ;
714
- toolTip = this . tr ( "Run aborted" ) ;
715
- border = "warning" ;
723
+ iconSource = "@FontAwesome5Solid/exclamation/10" ;
724
+ toolTipText = this . tr ( "Run aborted" ) ;
725
+ borderColor = "warning" ;
716
726
break ;
717
727
case "FAILED" :
718
- icon = "@FontAwesome5Solid/exclamation/10" ;
719
- toolTip = this . tr ( "Ran with error" ) ;
720
- border = "error" ;
728
+ iconSource = "@FontAwesome5Solid/exclamation/10" ;
729
+ toolTipText = this . tr ( "Ran with error" ) ;
730
+ borderColor = "error" ;
721
731
break ;
732
+ case "UNKNOWN" :
733
+ case "NOT_STARTED" :
722
734
default :
723
- icon = null ;
724
- toolTip = null ;
725
- border = null ;
735
+ iconSource = null ;
736
+ toolTipText = null ;
737
+ borderColor = null ;
726
738
break ;
727
739
}
728
- this . __applyProjectLabel ( icon , toolTip , border ) ;
729
- } ,
730
740
731
- __applyProjectLabel : function ( icn , toolTipText , bdr ) {
732
741
const border = new qx . ui . decoration . Decorator ( ) . set ( {
733
742
radius : 10 ,
734
743
width : 1 ,
735
744
style : "solid" ,
736
- color : bdr ,
737
- backgroundColor : bdr ? bdr + "-bg" : null
745
+ color : borderColor ,
746
+ backgroundColor : borderColor ? borderColor + "-bg" : null
738
747
} ) ;
748
+
739
749
const projectStatusLabel = this . getChildControl ( "project-status" ) ;
740
750
projectStatusLabel . set ( {
741
751
decorator : border ,
742
- textColor : bdr ,
752
+ textColor : borderColor ,
743
753
alignX : "center" ,
744
754
alignY : "middle" ,
745
755
height : 17 ,
@@ -748,14 +758,25 @@ qx.Class.define("osparc.dashboard.CardBase", {
748
758
} ) ;
749
759
750
760
projectStatusLabel . set ( {
751
- visibility : icn && toolTipText && bdr ? "visible" : "excluded" ,
752
- source : icn ,
753
- toolTipIcon : icn ,
761
+ visibility : iconSource && toolTipText && borderColor ? "visible" : "excluded" ,
762
+ source : iconSource ,
763
+ toolTipIcon : iconSource ,
754
764
toolTipText
755
765
} ) ;
756
766
} ,
757
767
758
- __showBlockedCardFromStatus : function ( lockedStatus ) {
768
+ __showBlockedCardFromStatus : function ( reason , moreInfo ) {
769
+ switch ( reason ) {
770
+ case "IN_USE" :
771
+ this . __blockedInUse ( moreInfo ) ;
772
+ break ;
773
+ case "IN_DEBT" :
774
+ this . __blockedInDebt ( moreInfo ) ;
775
+ break ;
776
+ }
777
+ } ,
778
+
779
+ __blockedInUse : function ( lockedStatus ) {
759
780
const status = lockedStatus [ "status" ] ;
760
781
const owner = lockedStatus [ "owner" ] ;
761
782
let toolTip = osparc . utils . Utils . firstsUp ( owner [ "first_name" ] || this . tr ( "A user" ) , owner [ "last_name" ] || "" ) ; // it will be replaced by "userName"
@@ -788,14 +809,23 @@ qx.Class.define("osparc.dashboard.CardBase", {
788
809
this . __showBlockedCard ( image , toolTip ) ;
789
810
} ,
790
811
812
+ __blockedInDebt : function ( ) {
813
+ const studyAlias = osparc . product . Utils . getStudyAlias ( { firstUpperCase : true } ) ;
814
+ const toolTip = studyAlias + " " + this . tr ( "Embargoed<br>Credits Required" ) ;
815
+ const image = "@FontAwesome5Solid/lock/" ;
816
+ this . __showBlockedCard ( image , toolTip ) ;
817
+ } ,
818
+
791
819
__showBlockedCard : function ( lockImageSrc , toolTipText ) {
792
820
this . getChildControl ( "lock-status" ) . set ( {
793
821
opacity : 1.0 ,
794
822
visibility : "visible"
795
823
} ) ;
824
+
796
825
const lockImage = this . getChildControl ( "lock-status" ) . getChildControl ( "image" ) ;
797
826
lockImageSrc += this . classname . includes ( "Grid" ) ? "32" : "22" ;
798
827
lockImage . setSource ( lockImageSrc ) ;
828
+
799
829
if ( toolTipText ) {
800
830
this . set ( {
801
831
toolTipText
0 commit comments