open-nomad/ui/app/routes/csi/volumes.js
Buck Doyle cd11cd290c Add manually-converted classes
I don’t know why the codemod ignored these files 🧐
2020-06-15 10:14:26 -05:00

44 lines
1 KiB
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';
import classic from 'ember-classic-decorator';
@classic
export default class VolumesRoute extends Route.extend(WithForbiddenState) {
@service system;
@service store;
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));
}
}