2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
import RSVP from 'rsvp';
|
2017-10-24 23:07:43 +00:00
|
|
|
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
|
|
|
|
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
|
2020-06-11 21:23:00 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-11 21:23:00 +00:00
|
|
|
@classic
|
|
|
|
export default class ServersRoute extends Route.extend(WithForbiddenState) {
|
|
|
|
@service store;
|
|
|
|
@service system;
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-12 20:48:52 +00:00
|
|
|
breadcrumbs = [
|
2018-06-20 01:15:46 +00:00
|
|
|
{
|
|
|
|
label: 'Servers',
|
|
|
|
args: ['servers.index'],
|
|
|
|
},
|
2020-06-12 20:48:52 +00:00
|
|
|
];
|
2018-06-20 01:15:46 +00:00
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
beforeModel() {
|
|
|
|
return this.get('system.leader');
|
2020-06-11 21:23:00 +00:00
|
|
|
}
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
model() {
|
|
|
|
return RSVP.hash({
|
2019-03-26 07:46:44 +00:00
|
|
|
nodes: this.store.findAll('node'),
|
|
|
|
agents: this.store.findAll('agent'),
|
2017-10-24 23:07:43 +00:00
|
|
|
}).catch(notifyForbidden(this));
|
2020-06-11 21:23:00 +00:00
|
|
|
}
|
|
|
|
}
|