adcea9b605
* Make datacenter queries use query vs findAll like the rest of the app * Make sure we have an element to pass to isInViewport * Make sure href-mut doesn't error even if the currentRoute === null * More post test cleanup and Safari fix (safari requires http:// URLs) * Reverse order of datasource nspace/dc's and add a namespace source * Rearrange routes/templates/controllers to only use HashicorpConsul once * Add datasources and correct token namespace detection/redirection * Remove old dc findAll adapter method * Add more comments around the 'child route/parent controller' vars
36 lines
1,021 B
JavaScript
36 lines
1,021 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
import { hash } from 'rsvp';
|
|
import { get, set } from '@ember/object';
|
|
|
|
export default Route.extend({
|
|
client: service('client/http'),
|
|
repo: service('settings'),
|
|
dcRepo: service('repository/dc'),
|
|
nspacesRepo: service('repository/nspace/disabled'),
|
|
model: function(params) {
|
|
const app = this.modelFor('application');
|
|
return hash({
|
|
item: this.repo.findAll(),
|
|
dc: this.dcRepo.getActive(undefined, app.dcs),
|
|
nspace: this.nspacesRepo.getActive(),
|
|
}).then(model => {
|
|
if (typeof get(model.item, 'client.blocking') === 'undefined') {
|
|
set(model, 'item.client', { blocking: true });
|
|
}
|
|
return model;
|
|
});
|
|
},
|
|
setupController: function(controller, model) {
|
|
controller.setProperties(model);
|
|
},
|
|
actions: {
|
|
update: function(item) {
|
|
if (!get(item, 'client.blocking')) {
|
|
this.client.abort();
|
|
}
|
|
this.repo.persist(item);
|
|
},
|
|
},
|
|
});
|