open-nomad/ui/app/models/agent.js

27 lines
742 B
JavaScript
Raw Normal View History

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({
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() {
2019-03-26 07:46:44 +00:00
const { address, rpcPort } = this;
2017-09-19 14:47:10 +00:00
return address && rpcPort && `${address}:${rpcPort}`;
}),
isLeader: computed('system.leader.rpcAddr', function() {
2019-03-26 07:46:44 +00:00
return this.get('system.leader.rpcAddr') === this.rpcAddr;
2017-09-19 14:47:10 +00:00
}),
});