github.com/hernad/nomad@v1.6.112/ui/app/controllers/csi/volumes/volume.js (about)

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