Charlie Tran 843a6c5bbb
feat(frontend): update datahub-web client UI code (#1806)
* Releases updated version of datahub-web client UI code

* Fix typo in yarn lock

* Change yarn lock to match yarn registry directories

* Previous commit missed some paths

* Even more changes to yarnlock missing in previous commit

* Include codegen file for typings

* Add files to get parity for datahub-web and current OS datahub-midtier

* Add in typo fix from previous commit - change to proper license

* Implement proper OS fix for person entity picture url

* Workarounds for open source DH issues

* Fixes institutional memory api and removes unopensourced tabs for datasets

* Fixes search dataset deprecation and user search issue as a result of changes

* Remove internal only options in the avatar menu
2020-08-26 15:44:50 -07:00

49 lines
1.2 KiB
TypeScript

import Controller from '@ember/controller';
import { setProperties, action } from '@ember/object';
import { DatasetEntity } from '@datahub/data-models/entity/dataset/dataset-entity';
import { DataModelName } from '@datahub/data-models/constants/entity';
export default class SearchController extends Controller {
queryParams = ['entity', 'page', 'facets', 'keyword'];
/**
* The category to narrow/ filter search results
*/
entity?: DataModelName = DatasetEntity.displayName;
/**
* Encoded facets state in a restli fashion
*/
facets: string;
/**
* The current search page
* @type {number}
*/
page = 1;
/**
* Will clean previous data
*/
resetData(): void {
setProperties(this, {
page: 1,
facets: '',
entity: DatasetEntity.displayName
});
}
/**
* Changes our search context to a new entity and resets the current page (to avoid variable leak)
* @param {DataModelName} newEntity - the name of the entity to change our search context to
*/
@action
onChangeEntity(newEntity: DataModelName): void {
setProperties(this, {
entity: newEntity,
page: 1,
facets: ''
});
}
}