feat: 🎸 Add support to display external name for dynamic hosts (#1664)

* feat: 🎸 Add support to display external name for dynamic hosts

✅ Closes: ICU-8795
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-04-17 13:22:32 -04:00
1 parent a4395b85a6
commit 054881dc4e
8 files changed
+183 -105

No files matched your search

+11
View File
@@ -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;
}
}
+12 -2
View File
@@ -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() {
@@ -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(),