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

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import Route from '@ember/routing/route';
     7  import withForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
     8  import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling';
     9  import { inject as service } from '@ember/service';
    10  import { hash } from 'rsvp';
    11  
    12  export default class PoliciesPolicyRoute extends Route.extend(
    13    withForbiddenState,
    14    WithModelErrorHandling
    15  ) {
    16    @service store;
    17    async model(params) {
    18      return hash({
    19        policy: this.store.findRecord('policy', decodeURIComponent(params.name), {
    20          reload: true,
    21        }),
    22        tokens: this.store
    23          .peekAll('token')
    24          .filter((token) =>
    25            token.policyNames?.includes(decodeURIComponent(params.name))
    26          ),
    27      });
    28    }
    29  }