github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/models/volume.js (about) 1 import { computed } from '@ember/object'; 2 import Model from '@ember-data/model'; 3 import { attr, belongsTo, hasMany } from '@ember-data/model'; 4 5 export default class Volume extends Model { 6 @attr('string') plainId; 7 @attr('string') name; 8 9 @belongsTo('namespace') namespace; 10 @belongsTo('plugin') plugin; 11 12 @hasMany('allocation') writeAllocations; 13 @hasMany('allocation') readAllocations; 14 15 @computed('writeAllocations.[]', 'readAllocations.[]') 16 get allocations() { 17 return [...this.writeAllocations.toArray(), ...this.readAllocations.toArray()]; 18 } 19 20 @attr('number') currentWriters; 21 @attr('number') currentReaders; 22 23 @computed('currentWriters', 'currentReaders') 24 get allocationCount() { 25 return this.currentWriters + this.currentReaders; 26 } 27 28 @attr('string') externalId; 29 @attr() topologies; 30 @attr('string') accessMode; 31 @attr('string') attachmentMode; 32 @attr('boolean') schedulable; 33 @attr('string') provider; 34 @attr('string') version; 35 36 @attr('boolean') controllerRequired; 37 @attr('number') controllersHealthy; 38 @attr('number') controllersExpected; 39 40 @computed('controllersHealthy', 'controllersExpected') 41 get controllersHealthyProportion() { 42 return this.controllersHealthy / this.controllersExpected; 43 } 44 45 @attr('number') nodesHealthy; 46 @attr('number') nodesExpected; 47 48 @computed('nodesHealthy', 'nodesExpected') 49 get nodesHealthyProportion() { 50 return this.nodesHealthy / this.nodesExpected; 51 } 52 53 @attr('number') resourceExhausted; 54 @attr('number') createIndex; 55 @attr('number') modifyIndex; 56 }