github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/models/agent.js (about)

     1  import { inject as service } from '@ember/service';
     2  import { computed } from '@ember/object';
     3  import Model from '@ember-data/model';
     4  import { attr } from '@ember-data/model';
     5  import classic from 'ember-classic-decorator';
     6  
     7  @classic
     8  export default class Agent extends Model {
     9    @service system;
    10  
    11    @attr('string') name;
    12    @attr('string') address;
    13    @attr('string') serfPort;
    14    @attr('string') rpcPort;
    15    @attr({ defaultValue: () => ({}) }) tags;
    16    @attr('string') status;
    17    @attr('string') datacenter;
    18    @attr('string') region;
    19  
    20    @computed('address', 'port')
    21    get rpcAddr() {
    22      const { address, rpcPort } = this;
    23      return address && rpcPort && `${address}:${rpcPort}`;
    24    }
    25  
    26    @computed('rpcAddr', 'system.leader.rpcAddr')
    27    get isLeader() {
    28      return this.get('system.leader.rpcAddr') === this.rpcAddr;
    29    }
    30  }