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

     1  import Ember from 'ember';
     2  import Model from 'ember-data/model';
     3  import attr from 'ember-data/attr';
     4  import { hasMany } from 'ember-data/relationships';
     5  import { fragment } from 'ember-data-model-fragments/attributes';
     6  import shortUUIDProperty from '../utils/properties/short-uuid';
     7  import ipParts from '../utils/ip-parts';
     8  
     9  const { computed } = Ember;
    10  
    11  export default Model.extend({
    12    // Available from list response
    13    name: attr('string'),
    14    datacenter: attr('string'),
    15    isDraining: attr('boolean'),
    16    status: attr('string'),
    17    statusDescription: attr('string'),
    18    shortId: shortUUIDProperty('id'),
    19    modifyIndex: attr('number'),
    20  
    21    // Available from single response
    22    httpAddr: attr('string'),
    23    tlsEnabled: attr('boolean'),
    24    attributes: fragment('node-attributes'),
    25    resources: fragment('resources'),
    26    reserved: fragment('resources'),
    27  
    28    address: computed('httpAddr', function() {
    29      return ipParts(this.get('httpAddr')).address;
    30    }),
    31  
    32    port: computed('httpAddr', function() {
    33      return ipParts(this.get('httpAddr')).port;
    34    }),
    35  
    36    isPartial: computed('httpAddr', function() {
    37      return this.get('httpAddr') == null;
    38    }),
    39  
    40    allocations: hasMany('allocations'),
    41  });