Files
threshold-ui/addons/api/addon/models/host-catalog.js
T

55 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-06-04 16:32:16 -04:00
import GeneratedHostCatalogModel from '../generated/models/host-catalog';
export default class HostCatalogModel extends GeneratedHostCatalogModel {
2022-01-12 15:34:12 -08:00
/**
* Returns if the host-catalog is static type or not.
* @type {boolean}
*/
get isStatic() {
return this.type === 'static';
}
/**
2022-01-11 15:34:11 -08:00
* Returns if the host-catalog is a plugin or not.
* @type {boolean}
*/
2022-01-11 15:34:11 -08:00
get isPlugin() {
return this.type === 'plugin';
}
/**
* Returns if host-catalog plugin is AWS or not
* @type {boolean}
*/
get isAWS() {
2022-01-14 13:14:50 -08:00
return this.compositeType === 'aws';
2022-01-11 15:34:11 -08:00
}
/**
* Return if host-catalog plugin is Azure or not.
* @type {boolean}
*/
get isAzure() {
2022-01-14 13:14:50 -08:00
return this.compositeType === 'azure';
}
2022-01-12 15:34:12 -08:00
/** If host-catalog is a plugins returns its name,
* otherwise returns the host-catalog type
* @type {string}
*/
get compositeType() {
return this.isPlugin ? this.plugin.name : this.type;
}
/**
* Sets type, if type is different than static, sets plugin name to type
*/
set compositeType(type) {
if (type === 'static') {
this.type = 'static';
} else {
this.type = 'plugin';
2022-01-14 13:32:38 -08:00
this.plugin = { name: type };
}
}
}