github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/models/agent.js (about)

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