@@ -157,7 +157,14 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
157157        maxHeight : 40 
158158      } ) ; 
159159      return  toolbar ; 
160-     } 
160+     } , 
161+ 
162+     disableIfInUse : function ( resourceData ,  widget )  { 
163+       if  ( resourceData [ "resourceType" ]  ===  "study" )  { 
164+         // disable if it's being used 
165+         widget . setEnabled ( ! osparc . study . Utils . state . getCurrentGroupIds ( resourceData [ "state" ] ) . length ) ; 
166+       } 
167+     } , 
161168  } , 
162169
163170  properties : { 
@@ -535,6 +542,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
535542
536543        const  lazyLoadContent  =  ( )  =>  { 
537544          const  billingSettings  =  new  osparc . study . BillingSettings ( resourceData ) ; 
545+           this . self ( ) . disableIfInUse ( resourceData ,  billingSettings ) ; 
538546          billingSettings . addListener ( "debtPayed" ,  ( )  =>  { 
539547            page . payDebtButton . set ( { 
540548              visibility : osparc . study . Utils . isInDebt ( resourceData )  ? "visible"  : "excluded" 
@@ -784,6 +792,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
784792
785793      const  lazyLoadContent  =  ( )  =>  { 
786794        const  servicesUpdate  =  new  osparc . metadata . ServicesInStudyUpdate ( resourceData ) ; 
795+         this . self ( ) . disableIfInUse ( resourceData ,  servicesUpdate ) ; 
787796        servicesUpdate . addListener ( "updateService" ,  e  =>  { 
788797          const  updatedData  =  e . getData ( ) ; 
789798          this . __fireUpdateEvent ( resourceData ,  updatedData ) ; 
@@ -817,6 +826,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
817826
818827      const  lazyLoadContent  =  ( )  =>  { 
819828        const  servicesBootOpts  =  new  osparc . metadata . ServicesInStudyBootOpts ( resourceData ) ; 
829+         this . self ( ) . disableIfInUse ( resourceData ,  servicesBootOpts ) ; 
820830        servicesBootOpts . addListener ( "updateService" ,  e  =>  { 
821831          const  updatedData  =  e . getData ( ) ; 
822832          this . __fireUpdateEvent ( resourceData ,  updatedData ) ; 
0 commit comments