mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-01 13:23:09 +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')
|
||||
banners: BannerService;
|
||||
|
||||
/**
|
||||
* Keyword of the current search to pass it down to the search bar
|
||||
*/
|
||||
keyword: string;
|
||||
|
||||
constructor() {
|
||||
|
@ -20,8 +20,7 @@ export default class SearchController extends Controller {
|
||||
category = 'datasets';
|
||||
|
||||
/**
|
||||
* Dataset Platform to restrict search results to
|
||||
* @type {DatasetPlatform}
|
||||
* Encoded facets state in a restli fashion
|
||||
*/
|
||||
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) {
|
||||
const keyword = this.paramsFor('search').keyword;
|
||||
controller.set('keyword', keyword);
|
||||
@ -188,6 +195,10 @@ export default Route.extend(ApplicationRouteMixin, {
|
||||
},
|
||||
|
||||
actions: {
|
||||
/**
|
||||
* Make sure we keep the keywork updated, so if we return
|
||||
* home, the search term clears
|
||||
*/
|
||||
willTransition() {
|
||||
const controller = this.controllerFor('application');
|
||||
const keyword = this.paramsFor('search').keyword;
|
||||
|
@ -20,9 +20,11 @@ export default class SearchRoute extends Route.extend(AuthenticatedRouteMixin) {
|
||||
return result || {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Add spinner when model is loading
|
||||
*/
|
||||
@action
|
||||
loading(transition: any) {
|
||||
// @ts-ignore
|
||||
let controller = this.controllerFor('search');
|
||||
controller.set('searchLoading', true);
|
||||
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