github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/controllers/csi/volumes/volume.js (about)

     1  import Controller from '@ember/controller';
     2  import { inject as service } from '@ember/service';
     3  import { action, computed } from '@ember/object';
     4  import { qpBuilder } from 'nomad-ui/utils/classes/query-params';
     5  
     6  export default class VolumeController extends Controller {
     7    // Used in the template
     8    @service system;
     9  
    10    queryParams = [
    11      {
    12        volumeNamespace: 'namespace',
    13      },
    14    ];
    15    volumeNamespace = 'default';
    16  
    17    get volume() {
    18      return this.model;
    19    }
    20  
    21    get breadcrumbs() {
    22      const volume = this.volume;
    23      return [
    24        {
    25          label: 'Volumes',
    26          args: [
    27            'csi.volumes',
    28            qpBuilder({
    29              volumeNamespace: volume.get('namespace.name') || 'default',
    30            }),
    31          ],
    32        },
    33        {
    34          label: volume.name,
    35          args: [
    36            'csi.volumes.volume',
    37            volume.plainId,
    38            qpBuilder({
    39              volumeNamespace: volume.get('namespace.name') || 'default',
    40            }),
    41          ],
    42        },
    43      ];
    44    }
    45  
    46    @computed('model.readAllocations.@each.modifyIndex')
    47    get sortedReadAllocations() {
    48      return this.model.readAllocations.sortBy('modifyIndex').reverse();
    49    }
    50  
    51    @computed('model.writeAllocations.@each.modifyIndex')
    52    get sortedWriteAllocations() {
    53      return this.model.writeAllocations.sortBy('modifyIndex').reverse();
    54    }
    55  
    56    @action
    57    gotoAllocation(allocation) {
    58      this.transitionToRoute('allocations.allocation', allocation);
    59    }
    60  }