@@ -21,19 +21,13 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
2121 construct : function ( ) {
2222 this . base ( arguments ) ;
2323
24- this . _setLayout ( new qx . ui . layout . VBox ( ) . set ( {
25- alignY : "middle"
26- } ) ) ;
27-
2824 const grid = new qx . ui . layout . Grid ( 2 , 2 ) ;
29- const miniGrid = this . __miniGrid = new qx . ui . container . Composite ( grid ) . set ( {
30- minWidth : 1
31- } ) ;
32- this . _add ( miniGrid ) ;
25+ this . _setLayout ( grid ) ;
3326
3427 this . __listenToClusterDetails ( ) ;
3528
3629 this . set ( {
30+ allowGrowY : false ,
3731 cursor : "pointer"
3832 } ) ;
3933 this . addListener ( "tap" , ( ) => osparc . utils . Clusters . popUpClustersDetails ( this . __clusterId ) , this ) ;
@@ -60,8 +54,6 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
6054
6155 members : {
6256 __clusterId : null ,
63- __clusterDetailsLayout : null ,
64- __miniGrid : null ,
6557 __hint : null ,
6658
6759 setClusterId : function ( clusterId ) {
@@ -91,8 +83,7 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
9183 } ,
9284
9385 __showBulb : function ( failed ) {
94- const miniGrid = this . __miniGrid ;
95- miniGrid . removeAll ( ) ;
86+ this . _removeAll ( ) ;
9687
9788 const clusterStatusImage = new qx . ui . basic . Image ( ) . set ( {
9889 source : "@FontAwesome5Solid/lightbulb/16" ,
@@ -101,7 +92,7 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
10192 paddingLeft : 3 ,
10293 textColor : failed ? "failed-red" : "ready-green"
10394 } ) ;
104- miniGrid . add ( clusterStatusImage , {
95+ this . _add ( clusterStatusImage , {
10596 row : 0 ,
10697 column : 0
10798 } ) ;
@@ -113,8 +104,7 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
113104 } ,
114105
115106 __updateWorkersDetails : function ( clusterDetails ) {
116- const miniGrid = this . __miniGrid ;
117- miniGrid . removeAll ( ) ;
107+ this . _removeAll ( ) ;
118108
119109 const workers = clusterDetails . scheduler . workers ;
120110 if ( Object . keys ( workers ) . length === 0 ) {
@@ -126,20 +116,23 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
126116 const resources = {
127117 cpu : {
128118 metric : "cpu" ,
119+ usedResource : "CPU" ,
129120 resource : "CPU" ,
130121 icon : "@FontAwesome5Solid/microchip/10" ,
131122 available : 0 ,
132123 used : 0
133124 } ,
134125 ram : {
135126 metric : "memory" ,
127+ usedResource : "RAM" ,
136128 resource : "RAM" ,
137129 icon : "@MaterialIcons/memory/10" ,
138130 available : 0 ,
139131 used : 0
140132 } ,
141133 gpu : {
142134 metric : "gpu" ,
135+ usedResource : "GPU" ,
143136 resource : "GPU" ,
144137 icon : "@FontAwesome5Solid/server/10" ,
145138 available : 0 ,
@@ -155,14 +148,13 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
155148 } ,
156149
157150 __updateMiniView : function ( resources ) {
158- const miniGrid = this . __miniGrid ;
159151 Object . keys ( resources ) . forEach ( ( resourceKey , idx ) => {
160152 const resourceInfo = resources [ resourceKey ] ;
161153 if ( resourceInfo . available === 0 ) {
162154 return ;
163155 }
164156 const icon = new qx . ui . basic . Image ( resourceInfo . icon ) ;
165- miniGrid . add ( icon , {
157+ this . _add ( icon , {
166158 row : idx ,
167159 column : 0
168160 } ) ;
@@ -174,7 +166,7 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
174166 progressBar . getChildControl ( "progress" ) . set ( {
175167 backgroundColor : "visual-blue"
176168 } ) ;
177- miniGrid . add ( progressBar , {
169+ this . _add ( progressBar , {
178170 row : idx ,
179171 column : 1
180172 } ) ;
@@ -189,9 +181,7 @@ qx.Class.define("osparc.component.cluster.ClusterMiniView", {
189181 return ;
190182 }
191183 text += resourceInfo . resource + ": " ;
192- if ( resourceKey === "cpu" ) {
193- text += osparc . utils . Utils . toTwoDecimals ( resourceInfo . used * resourceInfo . available / 100 ) + " / " + resourceInfo . available ;
194- } else if ( resourceKey === "ram" ) {
184+ if ( resourceKey === "ram" ) {
195185 text += osparc . utils . Utils . bytesToGB ( resourceInfo . used ) + "GB / " + osparc . utils . Utils . bytesToGB ( resourceInfo . available ) + "GB" ;
196186 } else {
197187 text += resourceInfo . used + " / " + resourceInfo . available ;
0 commit comments