2017-02-13 15:05:00 -08:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
2017-03-24 20:56:31 -07:00
|
|
|
const {
|
|
|
|
get,
|
|
|
|
set,
|
|
|
|
Controller,
|
|
|
|
inject: { service }
|
|
|
|
} = Ember;
|
2017-02-13 15:05:00 -08:00
|
|
|
|
2017-03-24 20:56:31 -07:00
|
|
|
export default Controller.extend({
|
|
|
|
/**
|
|
|
|
* User session management service
|
2017-04-01 14:18:38 -07:00
|
|
|
* @type {Ember.Service}
|
2017-03-24 20:56:31 -07:00
|
|
|
*/
|
|
|
|
session: service(),
|
|
|
|
/**
|
|
|
|
* Injected global search service
|
2017-04-01 14:18:38 -07:00
|
|
|
* @type {Ember.Service}
|
2017-03-24 20:56:31 -07:00
|
|
|
*/
|
|
|
|
search: service(),
|
|
|
|
/**
|
|
|
|
* Service to retrieve type ahead keywords for a dataset
|
2017-04-01 14:18:38 -07:00
|
|
|
* @type {Ember.Service}
|
2017-03-24 20:56:31 -07:00
|
|
|
*/
|
|
|
|
keywords: service('search-keywords'),
|
|
|
|
|
2017-04-01 14:18:38 -07:00
|
|
|
/**
|
|
|
|
* Looks up user names and properties from the partyEntities api
|
|
|
|
* @type {Ember.Service}
|
|
|
|
*/
|
|
|
|
ldapUsers: service('user-lookup'),
|
|
|
|
|
2017-03-24 20:56:31 -07:00
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
2017-04-01 14:18:38 -07:00
|
|
|
|
|
|
|
// Primes the cache for keywords and userEntitiesSource
|
2017-03-24 20:56:31 -07:00
|
|
|
get(this, 'keywords.keywordsFor')();
|
2017-04-01 14:18:38 -07:00
|
|
|
get(this, 'ldapUsers.fetchUserNames')();
|
2017-03-24 20:56:31 -07:00
|
|
|
|
2017-04-01 14:18:38 -07:00
|
|
|
// Sets a reference to the query resolver function that's
|
|
|
|
// accessible by the global-search component rendered in the
|
|
|
|
// application template
|
2017-03-24 20:56:31 -07:00
|
|
|
set(this, 'sourceKeywords', get(this, 'keywords.queryResolver'));
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
/**
|
|
|
|
* Invokes the search service api to transition to the
|
|
|
|
* search results page with the search string
|
|
|
|
* @param {String} [keyword] the search string to search for
|
|
|
|
*/
|
|
|
|
didSearch(keyword) {
|
|
|
|
get(this, 'search').showSearchResults({ keyword });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|