open-nomad/ui/app/routes/csi/volumes.js

42 lines
974 B
JavaScript
Raw Normal View History

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: [
{
2020-04-05 00:11:29 +00:00
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));
},
});