refactor: 💡 consolidate host catalog type badges to component
This commit is contained in:
7 files changed
+38
-68
No files matched your search
@@ -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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user