github.com/hernad/nomad@v1.6.112/ui/app/models/agent.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import { inject as service } from '@ember/service'; 7 import { computed } from '@ember/object'; 8 import Model from '@ember-data/model'; 9 import { attr } from '@ember-data/model'; 10 import classic from 'ember-classic-decorator'; 11 import formatHost from 'nomad-ui/utils/format-host'; 12 13 @classic 14 export default class Agent extends Model { 15 @service system; 16 17 @attr('string') name; 18 @attr('string') address; 19 @attr('string') serfPort; 20 @attr('string') rpcPort; 21 @attr({ defaultValue: () => ({}) }) tags; 22 @attr('string') status; 23 @attr('string') datacenter; 24 @attr('string') region; 25 26 @computed('address', 'port') 27 get rpcAddr() { 28 const { address, rpcPort } = this; 29 return formatHost(address, rpcPort); 30 } 31 32 @computed('rpcAddr', 'system.leader.rpcAddr') 33 get isLeader() { 34 return this.get('system.leader.rpcAddr') === this.rpcAddr; 35 } 36 37 @computed('tags.build') 38 get version() { 39 return this.tags?.build || ''; 40 } 41 }