2018-10-26 16:36:15 +00:00
|
|
|
import RepositoryService from 'consul-ui/services/repository';
|
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { get } from '@ember/object';
|
|
|
|
|
|
|
|
const modelName = 'session';
|
|
|
|
export default RepositoryService.extend({
|
|
|
|
store: service('store'),
|
|
|
|
getModelName: function() {
|
|
|
|
return modelName;
|
|
|
|
},
|
2018-12-04 17:04:44 +00:00
|
|
|
findByNode: function(node, dc, configuration = {}) {
|
|
|
|
const query = {
|
2018-10-26 16:36:15 +00:00
|
|
|
id: node,
|
|
|
|
dc: dc,
|
2018-12-04 17:04:44 +00:00
|
|
|
};
|
|
|
|
if (typeof configuration.cursor !== 'undefined') {
|
|
|
|
query.index = configuration.cursor;
|
|
|
|
}
|
|
|
|
return get(this, 'store').query(this.getModelName(), query);
|
2018-10-26 16:36:15 +00:00
|
|
|
},
|
|
|
|
// TODO: Why Key? Probably should be findBySlug like the others
|
|
|
|
findByKey: function(slug, dc) {
|
|
|
|
return this.findBySlug(slug, dc);
|
|
|
|
},
|
|
|
|
});
|