github.com/emate/nomad@v0.8.2-wo-binpacking/ui/app/models/node.js (about) 1 import { computed } from '@ember/object'; 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 export default Model.extend({ 10 // Available from list response 11 name: attr('string'), 12 datacenter: attr('string'), 13 isDraining: attr('boolean'), 14 status: attr('string'), 15 statusDescription: attr('string'), 16 shortId: shortUUIDProperty('id'), 17 modifyIndex: attr('number'), 18 19 // Available from single response 20 httpAddr: attr('string'), 21 tlsEnabled: attr('boolean'), 22 attributes: fragment('node-attributes'), 23 meta: fragment('node-attributes'), 24 resources: fragment('resources'), 25 reserved: fragment('resources'), 26 27 address: computed('httpAddr', function() { 28 return ipParts(this.get('httpAddr')).address; 29 }), 30 31 port: computed('httpAddr', function() { 32 return ipParts(this.get('httpAddr')).port; 33 }), 34 35 isPartial: computed('httpAddr', function() { 36 return this.get('httpAddr') == null; 37 }), 38 39 allocations: hasMany('allocations'), 40 });