2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { computed } from '@ember/object';
|
2017-09-19 14:47:10 +00:00
|
|
|
import Model from 'ember-data/model';
|
|
|
|
import attr from 'ember-data/attr';
|
|
|
|
|
|
|
|
export default Model.extend({
|
2017-12-15 21:39:18 +00:00
|
|
|
system: service(),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
name: attr('string'),
|
|
|
|
address: attr('string'),
|
|
|
|
serfPort: attr('string'),
|
|
|
|
rpcPort: attr('string'),
|
|
|
|
tags: attr({ defaultValue: () => ({}) }),
|
|
|
|
status: attr('string'),
|
|
|
|
datacenter: attr('string'),
|
|
|
|
region: attr('string'),
|
|
|
|
|
|
|
|
rpcAddr: computed('address', 'port', function() {
|
|
|
|
const { address, rpcPort } = this.getProperties('address', 'rpcPort');
|
|
|
|
return address && rpcPort && `${address}:${rpcPort}`;
|
|
|
|
}),
|
|
|
|
|
|
|
|
isLeader: computed('system.leader.rpcAddr', function() {
|
|
|
|
return this.get('system.leader.rpcAddr') === this.get('rpcAddr');
|
|
|
|
}),
|
|
|
|
});
|