github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/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/attr';
     5  
     6  export default Model.extend({
     7    system: service(),
     8  
     9    name: attr('string'),
    10    address: attr('string'),
    11    serfPort: attr('string'),
    12    rpcPort: attr('string'),
    13    tags: attr({ defaultValue: () => ({}) }),
    14    status: attr('string'),
    15    datacenter: attr('string'),
    16    region: attr('string'),
    17  
    18    rpcAddr: computed('address', 'port', function() {
    19      const { address, rpcPort } = this;
    20      return address && rpcPort && `${address}:${rpcPort}`;
    21    }),
    22  
    23    isLeader: computed('system.leader.rpcAddr', function() {
    24      return this.get('system.leader.rpcAddr') === this.rpcAddr;
    25    }),
    26  });