@@ -91,12 +91,21 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
9191 let control ;
9292 switch ( id ) {
9393 case "search-bar-filter" : {
94- control = new osparc . dashboard . SearchBarFilter ( this . __resourceType ) ;
94+ control = new osparc . dashboard . SearchBarFilter ( this . __resourceType ) . set ( {
95+ showFilterMenu : false ,
96+ } ) ;
9597 const textField = control . getChildControl ( "text-field" ) ;
9698 textField . addListener ( "appear" , ( ) => {
9799 textField . focus ( ) ;
98100 textField . activate ( ) ;
99101 } ) ;
102+ const resetButton = control . getChildControl ( "reset-button" ) ;
103+ resetButton . set ( {
104+ paddingRight : 2 , // 10-8
105+ opacity : 0.7 ,
106+ backgroundColor : "transparent" ,
107+ } ) ;
108+ osparc . utils . Utils . hideBorder ( resetButton ) ;
100109 this . _add ( control ) ;
101110 break ;
102111 }
@@ -161,17 +170,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
161170 } ,
162171
163172 __buildLayout : function ( ) {
164- this . getChildControl ( "search-bar-filter" ) . set ( {
165- showFilterMenu : false ,
166- } ) ;
167-
168- const resetButton = this . getChildControl ( "search-bar-filter" ) . getChildControl ( "reset-button" ) ;
169- resetButton . set ( {
170- paddingRight : 2 , // 10-8
171- opacity : 0.7 ,
172- backgroundColor : "transparent" ,
173- } ) ;
174- osparc . utils . Utils . hideBorder ( resetButton ) ;
173+ const searchBarFilter = this . getChildControl ( "search-bar-filter" ) ;
175174
176175 const radioGroup = new qx . ui . form . RadioGroup ( ) ;
177176 const contextButtons = [ ] ;
@@ -190,8 +189,8 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
190189 contextButtons . forEach ( contextButton => radioGroup . add ( contextButton ) ) ;
191190
192191 // Set initial state based on the provided initFilterData
193- const activeFilters = this . getChildControl ( "search-bar-filter" ) . getChildControl ( "active-filters" ) ;
194- const textField = this . getChildControl ( "search-bar-filter" ) . getChildControl ( "text-field" ) ;
192+ const activeFilters = searchBarFilter . getChildControl ( "active-filters" ) ;
193+ const textField = searchBarFilter . getChildControl ( "text-field" ) ;
195194 if ( "sharedWith" in this . __initFilterData && this . __initFilterData [ "sharedWith" ] ) {
196195 const sharedWithOptions = osparc . dashboard . SearchBarFilter . getSharedWithOptions ( this . __resourceType ) ;
197196 const optionsFound = sharedWithOptions . find ( option => option . id === this . __initFilterData [ "sharedWith" ] ) ;
@@ -224,6 +223,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
224223 this . __filter ( "text" , textField . getValue ( ) ) ;
225224 } , this ) ;
226225
226+ const resetButton = searchBarFilter . getChildControl ( "reset-button" ) ;
227227 resetButton . addListener ( "tap" , ( ) => {
228228 this . fireEvent ( "resetButtonPressed" ) ;
229229 this . exclude ( ) ;
@@ -234,30 +234,33 @@ qx.Class.define("osparc.dashboard.SearchBarFilterExtended", {
234234 if ( value === old ) {
235235 return ;
236236 }
237+ const searchBarFilter = this . getChildControl ( "search-bar-filter" ) ;
238+ const sharedWithButton = this . getChildControl ( "shared-with-button" ) ;
239+ const tagsButton = this . getChildControl ( "tags-button" ) ;
237240 switch ( value ) {
238241 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_PROJECTS :
239242 this . getChildControl ( "my-projects-button" ) . setValue ( true ) ;
240- this . getChildControl ( "search-bar-filter" ) . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in My projects" ) ) ;
241- this . getChildControl ( "shared-with-button" ) . setVisibility ( "visible" ) ;
242- this . getChildControl ( "tags-button" ) . setVisibility ( "visible" ) ;
243+ searchBarFilter . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in My projects" ) ) ;
244+ sharedWithButton . setVisibility ( "visible" ) ;
245+ tagsButton . setVisibility ( "visible" ) ;
243246 break ;
244247 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_TEMPLATES :
245248 this . getChildControl ( "templates-button" ) . setValue ( true ) ;
246- this . getChildControl ( "search-bar-filter" ) . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Templates" ) ) ;
247- this . getChildControl ( "shared-with-button" ) . setVisibility ( "excluded" ) ;
248- this . getChildControl ( "tags-button" ) . setVisibility ( "visible" ) ;
249+ searchBarFilter . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Templates" ) ) ;
250+ sharedWithButton . setVisibility ( "excluded" ) ;
251+ tagsButton . setVisibility ( "visible" ) ;
249252 break ;
250253 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_PUBLIC_TEMPLATES :
251254 this . getChildControl ( "public-projects-button" ) . setValue ( true ) ;
252- this . getChildControl ( "search-bar-filter" ) . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Public projects" ) ) ;
253- this . getChildControl ( "shared-with-button" ) . setVisibility ( "excluded" ) ;
254- this . getChildControl ( "tags-button" ) . setVisibility ( "visible" ) ;
255+ searchBarFilter . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Public projects" ) ) ;
256+ sharedWithButton . setVisibility ( "excluded" ) ;
257+ tagsButton . setVisibility ( "visible" ) ;
255258 break ;
256259 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_FUNCTIONS :
257260 this . getChildControl ( "functions-button" ) . setValue ( true ) ;
258- this . getChildControl ( "search-bar-filter" ) . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Functions" ) ) ;
259- this . getChildControl ( "shared-with-button" ) . setVisibility ( "excluded" ) ;
260- this . getChildControl ( "tags-button" ) . setVisibility ( "excluded" ) ;
261+ searchBarFilter . getChildControl ( "text-field" ) . setPlaceholder ( this . tr ( "Search in Functions" ) ) ;
262+ sharedWithButton . setVisibility ( "excluded" ) ;
263+ tagsButton . setVisibility ( "excluded" ) ;
261264 }
262265 } ,
263266
0 commit comments