github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/app/routes/csi/volumes.js (about)

     1  import { inject as service } from '@ember/service';
     2  import Route from '@ember/routing/route';
     3  import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
     4  import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
     5  
     6  export default Route.extend(WithForbiddenState, {
     7    system: service(),
     8    store: service(),
     9  
    10    breadcrumbs: [
    11      {
    12        label: 'Storage',
    13        args: ['csi.index'],
    14      },
    15    ],
    16  
    17    queryParams: {
    18      volumeNamespace: {
    19        refreshModel: true,
    20      },
    21    },
    22  
    23    beforeModel(transition) {
    24      return this.get('system.namespaces').then(namespaces => {
    25        const queryParam = transition.to.queryParams.namespace;
    26        this.set('system.activeNamespace', queryParam || 'default');
    27  
    28        return namespaces;
    29      });
    30    },
    31  
    32    model() {
    33      return this.store
    34        .query('volume', { type: 'csi' })
    35        .then(volumes => {
    36          volumes.forEach(volume => volume.plugin);
    37          return volumes;
    38        })
    39        .catch(notifyForbidden(this));
    40    },
    41  });