@@ -40,6 +40,7 @@ qx.Class.define("osparc.widget.NodeOutputs", {
4040 grid . setColumnFlex ( this . self ( ) . POS . LABEL , 1 ) ;
4141 grid . setColumnFlex ( this . self ( ) . POS . VALUE , 1 ) ;
4242 grid . setColumnMinWidth ( this . self ( ) . POS . VALUE , 50 ) ;
43+ grid . setColumnMaxWidth ( this . self ( ) . POS . RETRIEVE_STATUS , 25 ) ;
4344 Object . keys ( this . self ( ) . POS ) . forEach ( ( _ , idx ) => grid . setColumnAlign ( idx , "left" , "middle" ) ) ;
4445 const gridLayout = this . __gridLayout = new qx . ui . container . Composite ( grid ) ;
4546 this . _add ( gridLayout ) ;
@@ -49,7 +50,7 @@ qx.Class.define("osparc.widget.NodeOutputs", {
4950 ports
5051 } ) ;
5152
52- node . addListener ( "changeOutputs" , ( ) => this . __populateGrid ( ) , this ) ;
53+ node . addListener ( "changeOutputs" , ( ) => this . __outputsChanged ( ) , this ) ;
5354
5455 this . addListener ( "appear" , ( ) => this . __makeLabelsResponsive ( ) , this ) ;
5556 this . addListener ( "resize" , ( ) => this . __makeLabelsResponsive ( ) , this ) ;
@@ -95,7 +96,6 @@ qx.Class.define("osparc.widget.NodeOutputs", {
9596 __populateGrid : function ( ) {
9697 this . __gridLayout . removeAll ( ) ;
9798
98- const outputs = this . getNode ( ) . getOutputs ( ) ;
9999 const ports = this . getPorts ( ) ;
100100 const portKeys = Object . keys ( ports ) ;
101101 for ( let i = 0 ; i < portKeys . length ; i ++ ) {
@@ -129,8 +129,6 @@ qx.Class.define("osparc.widget.NodeOutputs", {
129129 column : this . self ( ) . POS . ICON
130130 } ) ;
131131
132- const value = ( portKey in outputs && "value" in outputs [ portKey ] ) ? outputs [ portKey ] [ "value" ] : null ;
133- this . __valueToGrid ( value , i ) ;
134132
135133 const unit = new qx . ui . basic . Label ( port . unitShort || "" ) ;
136134 this . __gridLayout . add ( unit , {
@@ -160,44 +158,56 @@ qx.Class.define("osparc.widget.NodeOutputs", {
160158 }
161159 } ,
162160
163- __valueToGrid : function ( value , i ) {
161+ __outputsChanged : function ( ) {
162+ const outputs = this . getNode ( ) . getOutputs ( ) ;
163+ const ports = this . getPorts ( ) ;
164+ const portKeys = Object . keys ( ports ) ;
165+ for ( let i = 0 ; i < portKeys . length ; i ++ ) {
166+ const portKey = portKeys [ i ] ;
167+ const value = ( portKey in outputs && "value" in outputs [ portKey ] ) ? outputs [ portKey ] [ "value" ] : null ;
168+ this . __valueToGrid ( value , i ) ;
169+ }
170+ } ,
171+
172+ __valueToGrid : function ( value , row ) {
173+ let valueWidget = null ;
164174 if ( value && typeof value === "object" ) {
165- const valueLink = new osparc . ui . basic . LinkLabel ( ) ;
166- this . __gridLayout . add ( valueLink , {
167- row : i ,
168- column : this . self ( ) . POS . VALUE
169- } ) ;
175+ valueWidget = new osparc . ui . basic . LinkLabel ( ) ;
170176 if ( "store" in value ) {
171177 // it's a file
172178 const download = true ;
173179 const locationId = value . store ;
174180 const fileId = value . path ;
175181 const filename = value . filename || osparc . file . FilePicker . getFilenameFromPath ( value ) ;
176- valueLink . setValue ( filename ) ;
182+ valueWidget . setValue ( filename ) ;
177183 osparc . store . Data . getInstance ( ) . getPresignedLink ( download , locationId , fileId )
178184 . then ( presignedLinkData => {
179185 if ( "resp" in presignedLinkData && presignedLinkData . resp ) {
180- valueLink . setUrl ( presignedLinkData . resp . link ) ;
186+ valueWidget . setUrl ( presignedLinkData . resp . link ) ;
181187 }
182188 } ) ;
183189 } else if ( "downloadLink" in value ) {
184190 // it's a link
185191 const filename = ( value . filename && value . filename . length > 0 ) ? value . filename : osparc . file . FileDownloadLink . extractLabelFromLink ( value [ "downloadLink" ] ) ;
186- valueLink . set ( {
192+ valueWidget . set ( {
187193 value : filename ,
188194 url : value . downloadLink
189195 } ) ;
190196 }
191197 } else {
192- const valueEntry = new qx . ui . basic . Label ( "-" ) ;
198+ valueWidget = new qx . ui . basic . Label ( "-" ) ;
193199 if ( value ) {
194- valueEntry . setValue ( String ( value ) ) ;
200+ valueWidget . setValue ( String ( value ) ) ;
195201 }
196- this . __gridLayout . add ( valueEntry , {
197- row : i ,
198- column : this . self ( ) . POS . VALUE
199- } ) ;
200202 }
203+
204+ // remove first if any
205+ this . __removeEntry ( row , this . self ( ) . POS . VALUE ) ;
206+
207+ this . __gridLayout . add ( valueWidget , {
208+ row : row ,
209+ column : this . self ( ) . POS . VALUE
210+ } ) ;
201211 } ,
202212
203213 __makeLabelsResponsive : function ( ) {
@@ -226,27 +236,32 @@ qx.Class.define("osparc.widget.NodeOutputs", {
226236 }
227237 } ,
228238
229- setRetrievingStatus : function ( portId , status ) {
230- const ports = this . getPorts ( ) ;
231- const portKeys = Object . keys ( ports ) ;
232- const idx = portKeys . indexOf ( portId ) ;
233- if ( idx === - 1 ) {
234- return ;
235- }
236-
237- // remove first if any
239+ __removeEntry : function ( row , column ) {
238240 let children = this . __gridLayout . getChildren ( ) ;
239241 for ( let i = 0 ; i < children . length ; i ++ ) {
240242 let child = children [ i ] ;
241243 const layoutProps = child . getLayoutProperties ( ) ;
242244 if (
243- layoutProps . row === idx &&
244- layoutProps . column === this . self ( ) . POS . RETRIEVE_STATUS
245+ layoutProps . row === row &&
246+ layoutProps . column === column
245247 ) {
246248 this . __gridLayout . remove ( child ) ;
247249 break ;
248250 }
249251 }
252+ } ,
253+
254+ setRetrievingStatus : function ( portId , status ) {
255+ const ports = this . getPorts ( ) ;
256+ const portKeys = Object . keys ( ports ) ;
257+ const idx = portKeys . indexOf ( portId ) ;
258+ if ( idx === - 1 ) {
259+ return ;
260+ }
261+
262+ // remove first if any
263+ this . __removeEntry ( idx , this . self ( ) . POS . RETRIEVE_STATUS ) ;
264+
250265 const icon = osparc . form . renderer . PropForm . getIconForStatus ( status ) ;
251266 this . __gridLayout . add ( icon , {
252267 row : idx ,
0 commit comments