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

     1  import Controller from '@ember/controller';
     2  import { inject as service } from '@ember/service';
     3  import { action } from '@ember/object';
     4  
     5  export default class PoliciesIndexController extends Controller {
     6    @service router;
     7    get policies() {
     8      return this.model.policies.map((policy) => {
     9        policy.tokens = this.model.tokens.filter((token) => {
    10          return token.policies.includes(policy);
    11        });
    12        return policy;
    13      });
    14    }
    15  
    16    @action openPolicy(policy) {
    17      this.router.transitionTo('policies.policy', policy.name);
    18    }
    19  }