open-nomad/ui/app/routes/csi/volumes.js
Buck Doyle 1cca7abcab
Add Ember ESLint plugin (#8134)
This is extracted from #8094, where I have run into some snags. Since
these ESLint fixes aren’t actually connected to the Ember 3.16 update
but involve changes to many files, we might as well address them
separately. Where possible I fixed the problems but in cases where
a fix seemed too involved, I added per-line or -file exceptions.
2020-06-09 16:03:28 -05:00

42 lines
989 B
JavaScript

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
export default Route.extend(WithForbiddenState, {
system: service(),
store: service(),
breadcrumbs: Object.freeze([
{
label: 'Storage',
args: ['csi.index'],
},
]),
queryParams: {
volumeNamespace: {
refreshModel: true,
},
},
beforeModel(transition) {
return this.get('system.namespaces').then(namespaces => {
const queryParam = transition.to.queryParams.namespace;
this.set('system.activeNamespace', queryParam || 'default');
return namespaces;
});
},
model() {
return this.store
.query('volume', { type: 'csi' })
.then(volumes => {
volumes.forEach(volume => volume.plugin);
return volumes;
})
.catch(notifyForbidden(this));
},
});