mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 10:49:00 +00:00 
			
		
		
		
	Facets: Docs and a little cleanup
This commit is contained in:
		
							parent
							
								
									3459b8174a
								
							
						
					
					
						commit
						d6393ece00
					
				| @ -44,6 +44,9 @@ export default class Application extends Controller { | |||||||
|   @service('banners') |   @service('banners') | ||||||
|   banners: BannerService; |   banners: BannerService; | ||||||
| 
 | 
 | ||||||
|  |   /** | ||||||
|  |    * Keyword of the current search to pass it down to the search bar | ||||||
|  |    */ | ||||||
|   keyword: string; |   keyword: string; | ||||||
| 
 | 
 | ||||||
|   constructor() { |   constructor() { | ||||||
|  | |||||||
| @ -20,8 +20,7 @@ export default class SearchController extends Controller { | |||||||
|   category = 'datasets'; |   category = 'datasets'; | ||||||
| 
 | 
 | ||||||
|   /** |   /** | ||||||
|    * Dataset Platform to restrict search results to |    * Encoded facets state in a restli fashion | ||||||
|    * @type {DatasetPlatform} |  | ||||||
|    */ |    */ | ||||||
|   facets: string; |   facets: string; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -181,6 +181,13 @@ export default Route.extend(ApplicationRouteMixin, { | |||||||
|     }); |     }); | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|  |   /** | ||||||
|  |    * To make keyword accesible to the search bar | ||||||
|  |    * we need to read it from the search query parameters | ||||||
|  |    * and pass it down to the controller. | ||||||
|  |    * @param {*} controller | ||||||
|  |    * @param {*} model | ||||||
|  |    */ | ||||||
|   setupController(controller, model) { |   setupController(controller, model) { | ||||||
|     const keyword = this.paramsFor('search').keyword; |     const keyword = this.paramsFor('search').keyword; | ||||||
|     controller.set('keyword', keyword); |     controller.set('keyword', keyword); | ||||||
| @ -188,6 +195,10 @@ export default Route.extend(ApplicationRouteMixin, { | |||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   actions: { |   actions: { | ||||||
|  |     /** | ||||||
|  |      * Make sure we keep the keywork updated, so if we return | ||||||
|  |      * home, the search term clears | ||||||
|  |      */ | ||||||
|     willTransition() { |     willTransition() { | ||||||
|       const controller = this.controllerFor('application'); |       const controller = this.controllerFor('application'); | ||||||
|       const keyword = this.paramsFor('search').keyword; |       const keyword = this.paramsFor('search').keyword; | ||||||
|  | |||||||
| @ -20,9 +20,11 @@ export default class SearchRoute extends Route.extend(AuthenticatedRouteMixin) { | |||||||
|     return result || {}; |     return result || {}; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   /** | ||||||
|  |    * Add spinner when model is loading | ||||||
|  |    */ | ||||||
|   @action |   @action | ||||||
|   loading(transition: any) { |   loading(transition: any) { | ||||||
|     // @ts-ignore
 |  | ||||||
|     let controller = this.controllerFor('search'); |     let controller = this.controllerFor('search'); | ||||||
|     controller.set('searchLoading', true); |     controller.set('searchLoading', true); | ||||||
|     transition.promise.finally(function() { |     transition.promise.finally(function() { | ||||||
|  | |||||||
							
								
								
									
										8
									
								
								wherehows-web/app/typings/app/controllers.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								wherehows-web/app/typings/app/controllers.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | |||||||
|  | import SearchController from 'wherehows-web/controllers/search'; | ||||||
|  | 
 | ||||||
|  | declare module '@ember/controller' { | ||||||
|  |   // eslint-disable-next-line typescript/interface-name-prefix
 | ||||||
|  |   interface Registry { | ||||||
|  |     search: SearchController; | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Ignacio Bona
						Ignacio Bona