diff --git a/addons/api/addon/models/host-set.js b/addons/api/addon/models/host-set.js
index 98f7cd5e2..bd5f64f1a 100644
--- a/addons/api/addon/models/host-set.js
+++ b/addons/api/addon/models/host-set.js
@@ -1,5 +1,6 @@
import GeneratedHostSetModel from '../generated/models/host-set';
import { fragmentArray } from 'ember-data-model-fragments/attributes';
+import { types } from './host-catalog';
export default class HostSetModel extends GeneratedHostSetModel {
// =attributes
@@ -20,6 +21,14 @@ export default class HostSetModel extends GeneratedHostSetModel {
return this.type === 'plugin';
}
+ /**
+ * True if the host set is an unknown type.
+ * @type {boolean}
+ */
+ get isUnknown() {
+ return this.isPlugin && !types.includes(this.plugin?.name);
+ }
+
/**
* Returns if a host-set plugin is AWS or not
* @type {boolean}
@@ -41,7 +50,9 @@ export default class HostSetModel extends GeneratedHostSetModel {
* @type {string}
*/
get compositeType() {
- return this.plugin ? this.plugin.name : this.type;
+ if (this.isUnknown) return 'unknown';
+ if (this.isPlugin) return this.plugin.name;
+ return 'static';
}
/**
diff --git a/addons/api/tests/unit/models/host-set-test.js b/addons/api/tests/unit/models/host-set-test.js
index 33189d3d4..f3dd6c020 100644
--- a/addons/api/tests/unit/models/host-set-test.js
+++ b/addons/api/tests/unit/models/host-set-test.js
@@ -183,15 +183,19 @@ module('Unit | Model | host set', function (hooks) {
test('get compositeType return expected values', async function (assert) {
assert.expect(3);
const store = this.owner.lookup('service:store');
- const modelPlugin = store.createRecord('host-set', {
+ const modelPlugin1 = store.createRecord('host-set', {
+ type: 'plugin',
+ plugin: { name: 'aws' },
+ });
+ const modelPlugin2 = store.createRecord('host-set', {
type: 'plugin',
plugin: { name: 'Test name' },
});
const modelStatic = store.createRecord('host-set', {
type: 'static',
});
- assert.equal(typeof modelPlugin.compositeType, 'string');
- assert.equal(modelPlugin.compositeType, 'Test name');
+ assert.equal(modelPlugin1.compositeType, 'aws');
+ assert.equal(modelPlugin2.compositeType, 'unknown');
assert.equal(modelStatic.compositeType, 'static');
});
diff --git a/ui/admin/app/components/form/target/add-host-sets/index.hbs b/ui/admin/app/components/form/target/add-host-sets/index.hbs
index ca5c7a3e4..bd4c97765 100644
--- a/ui/admin/app/components/form/target/add-host-sets/index.hbs
+++ b/ui/admin/app/components/form/target/add-host-sets/index.hbs
@@ -34,9 +34,7 @@
{{host.description}}{{hostSet.host_catalog_id}}
diff --git a/ui/admin/app/components/host-catalog-type-badge/index.hbs b/ui/admin/app/components/host-catalog-type-badge/index.hbs
new file mode 100644
index 000000000..8ee191dea
--- /dev/null
+++ b/ui/admin/app/components/host-catalog-type-badge/index.hbs
@@ -0,0 +1,15 @@
+{{#if @model.isStatic}}
+