@@ -26,9 +26,10 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
2626 this . _setLayout ( new qx . ui . layout . HBox ( 5 ) ) ;
2727
2828 this . set ( {
29- backgroundColor : "input_background" ,
29+ backgroundColor : this . self ( ) . BG_COLOR ,
3030 paddingLeft : 6 ,
3131 height : this . self ( ) . HEIGHT ,
32+ maxHeight : this . self ( ) . HEIGHT ,
3233 decorator : "rounded" ,
3334 } ) ;
3435
@@ -41,8 +42,17 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
4142 this . __currentFilter = null ;
4243 } ,
4344
45+ properties : {
46+ showFilterMenu : {
47+ check : "Boolean" ,
48+ init : true ,
49+ event : "changeShowFilterMenu" ,
50+ }
51+ } ,
52+
4453 statics : {
4554 HEIGHT : 36 ,
55+ BG_COLOR : "input_background" ,
4656
4757 getSharedWithOptions : function ( resourceType ) {
4858 if ( resourceType === "template" ) {
@@ -70,7 +80,19 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
7080 label : qx . locale . Manager . tr ( "Public" ) + " " + resourceAlias ,
7181 icon : "@FontAwesome5Solid/globe/20"
7282 } ] ;
73- }
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+ } ,
7496 } ,
7597
7698 events : {
@@ -100,7 +122,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
100122 break ;
101123 case "text-field" :
102124 control = new qx . ui . form . TextField ( ) . set ( {
103- backgroundColor : "input_background" ,
125+ backgroundColor : this . self ( ) . BG_COLOR ,
104126 font : "text-16" ,
105127 placeholder : this . tr ( "search" ) ,
106128 alignY : "bottom" ,
@@ -175,7 +197,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
175197 this . __hideFilterMenu ( ) ;
176198 }
177199 } , this ) ;
178- textField . addListener ( "changeValue " , ( ) => this . __filter ( ) , this ) ;
200+ textField . addListener ( "focusout " , ( ) => this . __filter ( ) , this ) ;
179201
180202 const resetButton = this . getChildControl ( "reset-button" ) ;
181203 resetButton . addListener ( "execute" , ( ) => this . __resetFilters ( ) , this ) ;
@@ -184,7 +206,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
184206 } ,
185207
186208 getTextFilterValue : function ( ) {
187- return this . getChildControl ( "text-field" ) . getValue ( ) ;
209+ return this . getChildControl ( "text-field" ) . getValue ( ) ? this . getChildControl ( "text-field" ) . getValue ( ) . trim ( ) : null ;
188210 } ,
189211
190212 __showFilterMenu : function ( ) {
@@ -203,7 +225,9 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
203225 left : left
204226 } ) ;
205227
206- this . __filtersMenu . show ( ) ;
228+ if ( this . getShowFilterMenu ( ) ) {
229+ this . __filtersMenu . show ( ) ;
230+ }
207231 } ,
208232
209233 __hideFilterMenu : function ( ) {
@@ -304,7 +328,6 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
304328 } ) ;
305329 } ,
306330
307-
308331 setSharedWithActiveFilter : function ( optionId , optionLabel ) {
309332 this . __removeChips ( "shared-with" ) ;
310333 if ( optionId === "show-all" ) {
@@ -323,30 +346,34 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
323346 }
324347 } ,
325348
349+ // this widget pops up a larger widget with all filters visible
350+ // and lets users search between projects, templates, public projects and, eventually, files
351+ popUpSearchBarFilter : function ( ) {
352+ const initFilterData = this . getFilterData ( ) ;
353+ const searchBarFilterExtended = new osparc . dashboard . SearchBarFilterExtended ( this . __resourceType , initFilterData ) ;
354+ const bounds = osparc . utils . Utils . getBounds ( this ) ;
355+ searchBarFilterExtended . setLayoutProperties ( {
356+ left : bounds . left ,
357+ top : bounds . top ,
358+ } ) ;
359+ searchBarFilterExtended . set ( {
360+ width : bounds . width ,
361+ } ) ;
362+ return searchBarFilterExtended ;
363+ } ,
364+
326365 __addChip : function ( type , id , label ) {
327366 const activeFilter = this . getChildControl ( "active-filters" ) ;
328367 const chipFound = activeFilter . getChildren ( ) . find ( chip => chip . type === type && chip . id === id ) ;
329368 if ( chipFound ) {
330369 return ;
331370 }
332- const chip = this . __createChip ( type , id , label ) ;
371+ const chip = this . self ( ) . createChip ( type , id , label ) ;
372+ chip . addListener ( "execute" , ( ) => this . __removeChip ( type , id ) , this ) ;
333373 activeFilter . add ( chip ) ;
334374 this . __filter ( ) ;
335375 } ,
336376
337- __createChip : function ( chipType , chipId , chipLabel ) {
338- const chipButton = new qx . ui . form . Button ( ) . set ( {
339- label : osparc . utils . Utils . capitalize ( chipType ) + " = '" + chipLabel + "'" ,
340- icon : "@MaterialIcons/close/12" ,
341- toolTipText : chipLabel ,
342- appearance : "chip-button"
343- } ) ;
344- chipButton . type = chipType ;
345- chipButton . id = chipId ;
346- chipButton . addListener ( "execute" , ( ) => this . __removeChip ( chipType , chipId ) , this ) ;
347- return chipButton ;
348- } ,
349-
350377 __removeChip : function ( type , id ) {
351378 const activeFilter = this . getChildControl ( "active-filters" ) ;
352379 const chipFound = activeFilter . getChildren ( ) . find ( chip => chip . type === type && chip . id === id ) ;
0 commit comments