refactor: 💡 consolidate host catalog type badges to component

This commit is contained in:
Randall Morey committed 2022-02-14 18:06:12 -05:00
1 parent 318103b745
commit ed248f583f
7 files changed
+38 -68

No files matched your search

+12 -1
View File
@@ -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';
}
/**