diff --git a/addons/api/addon/models/host.js b/addons/api/addon/models/host.js index 93c9632cb..aa6ab14af 100644 --- a/addons/api/addon/models/host.js +++ b/addons/api/addon/models/host.js @@ -29,6 +29,12 @@ export default class HostModel extends GeneratedHostModel { }) external_id; + @attr('string', { + description: 'The external facing name for the plugin based host.', + readOnly: true, + }) + external_name; + // Aws specific @attr({ readOnly: true, @@ -89,4 +95,9 @@ export default class HostModel extends GeneratedHostModel { this.plugin = { name: type }; } } + + // Plugin hosts can support an external name + get displayName() { + return this.name || this.external_name || this.id; + } } diff --git a/addons/api/mirage/factories/host.js b/addons/api/mirage/factories/host.js index 8d07fb4c3..c2abaa1cf 100644 --- a/addons/api/mirage/factories/host.js +++ b/addons/api/mirage/factories/host.js @@ -10,7 +10,9 @@ import generateId from '../helpers/id'; export default factory.extend({ id: () => generateId('h_'), - + name() { + if (this.type === 'static') return faker.random.words(); + }, type() { return this.hostCatalog?.type || factory.attrs.type; }, @@ -34,8 +36,16 @@ export default factory.extend({ } return result; }, + // Return external fields only for plugins external_id() { - return faker.datatype.uuid(); + if (this.type === 'plugin') { + return faker.datatype.uuid(); + } + }, + external_name(i) { + if (this.type === 'plugin') { + return `${this.plugin.name} provided name ${i}`; + } }, // Only aws plugins have dns_names dns_names() { diff --git a/addons/api/mirage/generated/factories/host.js b/addons/api/mirage/generated/factories/host.js index 423a520bd..4b3f64498 100644 --- a/addons/api/mirage/generated/factories/host.js +++ b/addons/api/mirage/generated/factories/host.js @@ -11,7 +11,6 @@ import { faker } from '@faker-js/faker'; */ export default Factory.extend({ type: 'static', - name: () => faker.random.words(), description: () => faker.random.words(), created_time: () => faker.date.recent(), updated_time: () => faker.date.recent(), diff --git a/addons/core/translations/form/en-us.yaml b/addons/core/translations/form/en-us.yaml index 3abfd6419..9d76fa1f4 100644 --- a/addons/core/translations/form/en-us.yaml +++ b/addons/core/translations/form/en-us.yaml @@ -3,9 +3,15 @@ id: label: ID +external_id: + label: External ID + help: A read-only ID given by the plugin host catalog provider name: label: Name help: Name for identification purposes +external_name: + label: External Name + help: A read-only name given by the plugin host catalog provider description: label: Description help: Description for identification purposes @@ -153,10 +159,12 @@ disable_credential_rotation: help: Azure host catalogs do not yet support credential rotation. dns_names: label: Latest DNS Names + help: Read-only DNS names given by the plugin host catalog provider host: label: Host ip_addresses: label: Latest IP Addresses + help: Read-only public and private IP addresses given by the plugin host catalog provider sync-interval: label: Sync Interval help: Optional. Number of seconds between the time Boundary syncs hosts in this set. diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 68932b448..f9cba0b87 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -149,6 +149,7 @@ host-set: host: title: Host title_plural: Hosts + no_name_title: Unnamed Host description: A host is a resource that may be accessed by a Boundary target. messages: welcome: diff --git a/ui/admin/app/components/form/host/aws/index.hbs b/ui/admin/app/components/form/host/aws/index.hbs index 2ca63199f..1b7c4944d 100644 --- a/ui/admin/app/components/form/host/aws/index.hbs +++ b/ui/admin/app/components/form/host/aws/index.hbs @@ -11,51 +11,70 @@ as |form| > -