open-consul/ui-v2/app/routes/index.js
John Cowen c0abe1e406
ui: Outlet Loading (#8779)
Moves all Route/model hook loading to use Outlet components which listen on route change.
2020-10-01 09:33:22 +01:00

17 lines
435 B
JavaScript

import Route from 'consul-ui/routing/route';
import { inject as service } from '@ember/service';
import { hash } from 'rsvp';
import { get } from '@ember/object';
export default Route.extend({
repo: service('repository/dc'),
model: function(params) {
return hash({
item: this.repo.getActive(),
});
},
afterModel: function({ item }, transition) {
this.transitionTo('dc.services', get(item, 'Name'));
},
});