@@ -80,7 +80,19 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
8080 label : qx . locale . Manager . tr ( "Public" ) + " " + resourceAlias ,
8181 icon : "@FontAwesome5Solid/globe/20"
8282 } ] ;
83- }
83+ } ,
84+
85+ createChip : function ( chipType , chipId , chipLabel ) {
86+ const chipButton = new qx . ui . form . Button ( ) . set ( {
87+ label : osparc . utils . Utils . capitalize ( chipType ) + " = '" + chipLabel + "'" ,
88+ icon : "@MaterialIcons/close/12" ,
89+ toolTipText : chipLabel ,
90+ appearance : "chip-button"
91+ } ) ;
92+ chipButton . type = chipType ;
93+ chipButton . id = chipId ;
94+ return chipButton ;
95+ } ,
8496 } ,
8597
8698 events : {
@@ -356,24 +368,12 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
356368 if ( chipFound ) {
357369 return ;
358370 }
359- const chip = this . __createChip ( type , id , label ) ;
371+ const chip = this . self ( ) . createChip ( type , id , label ) ;
372+ chip . addListener ( "execute" , ( ) => this . __removeChip ( chipType , chipId ) , this ) ;
360373 activeFilter . add ( chip ) ;
361374 this . __filter ( ) ;
362375 } ,
363376
364- __createChip : function ( chipType , chipId , chipLabel ) {
365- const chipButton = new qx . ui . form . Button ( ) . set ( {
366- label : osparc . utils . Utils . capitalize ( chipType ) + " = '" + chipLabel + "'" ,
367- icon : "@MaterialIcons/close/12" ,
368- toolTipText : chipLabel ,
369- appearance : "chip-button"
370- } ) ;
371- chipButton . type = chipType ;
372- chipButton . id = chipId ;
373- chipButton . addListener ( "execute" , ( ) => this . __removeChip ( chipType , chipId ) , this ) ;
374- return chipButton ;
375- } ,
376-
377377 __removeChip : function ( type , id ) {
378378 const activeFilter = this . getChildControl ( "active-filters" ) ;
379379 const chipFound = activeFilter . getChildren ( ) . find ( chip => chip . type === type && chip . id === id ) ;
0 commit comments