github.com/hernad/nomad@v1.6.112/ui/app/routes/servers.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { inject as service } from '@ember/service';
     7  import Route from '@ember/routing/route';
     8  import RSVP from 'rsvp';
     9  import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
    10  import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
    11  import classic from 'ember-classic-decorator';
    12  
    13  @classic
    14  export default class ServersRoute extends Route.extend(WithForbiddenState) {
    15    @service store;
    16    @service system;
    17  
    18    beforeModel() {
    19      return this.get('system.leader');
    20    }
    21  
    22    model() {
    23      return RSVP.hash({
    24        nodes: this.store.findAll('node'),
    25        agents: this.store.findAll('agent'),
    26      }).catch(notifyForbidden(this));
    27    }
    28  }