Icu 12781 add filtering pagination support for host catalogs (#2213)

* feat: 🎸 Add searching for host catalogs

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-12781
This commit is contained in:
Zhihe Li committed 2024-04-12 14:55:33 -04:00
1 parent 22353e7df6
commit a39b208b48
20 files changed
+477 -199

No files matched your search

+16 -3
View File
@@ -5,8 +5,19 @@
import GeneratedHostCatalogModel from '../generated/models/host-catalog';
export const types = ['static', 'plugin'];
export const pluginTypes = ['aws', 'azure'];
export const TYPE_HOST_CATALOG_STATIC = 'static';
export const TYPE_HOST_CATALOG_DYNAMIC = 'plugin';
export const TYPES_HOST_CATALOG = Object.freeze([
TYPE_HOST_CATALOG_STATIC,
TYPE_HOST_CATALOG_DYNAMIC,
]);
export const TYPE_HOST_CATALOG_PLUGIN_AWS = 'aws';
export const TYPE_HOST_CATALOG_PLUGIN_AZURE = 'azure';
export const TYPES_HOST_CATALOG_PLUGIN = [
TYPE_HOST_CATALOG_PLUGIN_AWS,
TYPE_HOST_CATALOG_PLUGIN_AZURE,
];
export default class HostCatalogModel extends GeneratedHostCatalogModel {
// =attributes
@@ -32,7 +43,9 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel {
* @type {boolean}
*/
get isUnknown() {
return this.isPlugin && !pluginTypes.includes(this.plugin?.name);
return (
this.isPlugin && !TYPES_HOST_CATALOG_PLUGIN.includes(this.plugin?.name)
);
}
/**
+4 -2
View File
@@ -4,7 +4,7 @@
*/
import GeneratedHostSetModel from '../generated/models/host-set';
import { pluginTypes } from './host-catalog';
import { TYPES_HOST_CATALOG_PLUGIN } from './host-catalog';
export default class HostSetModel extends GeneratedHostSetModel {
// =attributes
@@ -30,7 +30,9 @@ export default class HostSetModel extends GeneratedHostSetModel {
* @type {boolean}
*/
get isUnknown() {
return this.isPlugin && !pluginTypes.includes(this.plugin?.name);
return (
this.isPlugin && !TYPES_HOST_CATALOG_PLUGIN.includes(this.plugin?.name)
);
}
/**
+4 -2
View File
@@ -5,7 +5,7 @@
import GeneratedHostModel from '../generated/models/host';
import { attr } from '@ember-data/model';
import { pluginTypes } from './host-catalog';
import { TYPES_HOST_CATALOG_PLUGIN } from './host-catalog';
export default class HostModel extends GeneratedHostModel {
// =attributes
@@ -64,7 +64,9 @@ export default class HostModel extends GeneratedHostModel {
* @type {boolean}
*/
get isUnknown() {
return this.isPlugin && !pluginTypes.includes(this.plugin?.name);
return (
this.isPlugin && !TYPES_HOST_CATALOG_PLUGIN.includes(this.plugin?.name)
);
}
/**