open-nomad/ui/app/routes/servers.js

29 lines
679 B
JavaScript
Raw Normal View History

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import RSVP from 'rsvp';
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
2017-09-19 14:47:10 +00:00
export default Route.extend(WithForbiddenState, {
store: service(),
system: service(),
2017-09-19 14:47:10 +00:00
breadcrumbs: Object.freeze([
{
label: 'Servers',
args: ['servers.index'],
},
]),
2017-09-19 14:47:10 +00:00
beforeModel() {
return this.get('system.leader');
},
model() {
return RSVP.hash({
2019-03-26 07:46:44 +00:00
nodes: this.store.findAll('node'),
agents: this.store.findAll('agent'),
}).catch(notifyForbidden(this));
2017-09-19 14:47:10 +00:00
},
});