2020-03-25 12:51:26 +00:00
|
|
|
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';
|
2020-06-11 21:23:00 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2020-03-25 12:51:26 +00:00
|
|
|
|
2020-06-11 21:23:00 +00:00
|
|
|
@classic
|
|
|
|
export default class VolumesRoute extends Route.extend(WithForbiddenState) {
|
|
|
|
@service system;
|
|
|
|
@service store;
|
2020-03-25 12:51:26 +00:00
|
|
|
|
2020-06-12 20:48:52 +00:00
|
|
|
breadcrumbs = [
|
2020-03-25 12:51:26 +00:00
|
|
|
{
|
2020-04-05 00:11:29 +00:00
|
|
|
label: 'Storage',
|
|
|
|
args: ['csi.index'],
|
2020-03-25 12:51:26 +00:00
|
|
|
},
|
2020-06-12 20:48:52 +00:00
|
|
|
];
|
2020-03-25 12:51:26 +00:00
|
|
|
|
2020-06-11 21:23:00 +00:00
|
|
|
queryParams = {
|
2020-03-25 12:51:26 +00:00
|
|
|
volumeNamespace: {
|
|
|
|
refreshModel: true,
|
|
|
|
},
|
2020-06-11 21:23:00 +00:00
|
|
|
};
|
2020-03-25 12:51:26 +00:00
|
|
|
|
|
|
|
beforeModel(transition) {
|
|
|
|
return this.get('system.namespaces').then(namespaces => {
|
|
|
|
const queryParam = transition.to.queryParams.namespace;
|
|
|
|
this.set('system.activeNamespace', queryParam || 'default');
|
|
|
|
|
|
|
|
return namespaces;
|
|
|
|
});
|
2020-06-11 21:23:00 +00:00
|
|
|
}
|
2020-03-25 12:51:26 +00:00
|
|
|
|
|
|
|
model() {
|
|
|
|
return this.store
|
|
|
|
.query('volume', { type: 'csi' })
|
|
|
|
.then(volumes => {
|
|
|
|
volumes.forEach(volume => volume.plugin);
|
|
|
|
return volumes;
|
|
|
|
})
|
|
|
|
.catch(notifyForbidden(this));
|
2020-06-11 21:23:00 +00:00
|
|
|
}
|
|
|
|
}
|