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

     1  import { inject as service } from '@ember/service';
     2  import { action, computed } from '@ember/object';
     3  import { alias, readOnly } from '@ember/object/computed';
     4  import Controller, { inject as controller } from '@ember/controller';
     5  import SortableFactory from 'nomad-ui/mixins/sortable-factory';
     6  import Searchable from 'nomad-ui/mixins/searchable';
     7  import { lazyClick } from 'nomad-ui/helpers/lazy-click';
     8  import classic from 'ember-classic-decorator';
     9  
    10  @classic
    11  export default class IndexController extends Controller.extend(
    12    SortableFactory([
    13      'plainId',
    14      'controllersHealthyProportion',
    15      'nodesHealthyProportion',
    16      'provider',
    17    ]),
    18    Searchable
    19  ) {
    20    @service userSettings;
    21    @controller('csi/plugins') pluginsController;
    22  
    23    @alias('pluginsController.isForbidden') isForbidden;
    24  
    25    queryParams = [
    26      {
    27        currentPage: 'page',
    28      },
    29      {
    30        searchTerm: 'search',
    31      },
    32      {
    33        sortProperty: 'sort',
    34      },
    35      {
    36        sortDescending: 'desc',
    37      },
    38    ];
    39  
    40    currentPage = 1;
    41    @readOnly('userSettings.pageSize') pageSize;
    42  
    43    @computed
    44    get searchProps() {
    45      return ['id'];
    46    }
    47  
    48    @computed
    49    get fuzzySearchProps() {
    50      return ['id'];
    51    }
    52  
    53    sortProperty = 'id';
    54    sortDescending = false;
    55  
    56    @alias('model') listToSort;
    57    @alias('listSorted') listToSearch;
    58    @alias('listSearched') sortedPlugins;
    59  
    60    @action
    61    gotoPlugin(plugin, event) {
    62      lazyClick([
    63        () => this.transitionToRoute('csi.plugins.plugin', plugin.plainId),
    64        event,
    65      ]);
    66    }
    67  }