From 2038693ebe51a79ebf4287769de4bf6c7230b1b1 Mon Sep 17 00:00:00 2001 From: ElderMatt <18527012+ElderMatt@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:31:01 +0100 Subject: [PATCH 1/3] feat: add enabled param to getAllAplCatalogs --- src/api/v2/catalogs.ts | 7 ++++++- src/openapi/api.yaml | 7 +++++++ src/otomi-stack.ts | 8 ++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/api/v2/catalogs.ts b/src/api/v2/catalogs.ts index a618d162..fac4aca3 100644 --- a/src/api/v2/catalogs.ts +++ b/src/api/v2/catalogs.ts @@ -10,7 +10,12 @@ const debug = Debug('otomi:api:v2:catalogs') */ export const getAllAplCatalogs = (req: OpenApiRequestExt, res: Response): void => { debug('getAllCatalogs') - const v = req.otomi.getAllAplCatalogs() + const { enabled } = req.query + const filter = {} + if (enabled !== undefined) { + filter['enabled'] = String(enabled) === 'true' + } + const v = req.otomi.getAllAplCatalogs(filter) res.json(v) } diff --git a/src/openapi/api.yaml b/src/openapi/api.yaml index f72a66c7..7338c3be 100644 --- a/src/openapi/api.yaml +++ b/src/openapi/api.yaml @@ -1724,6 +1724,13 @@ paths: x-eov-operation-handler: v2/catalogs description: Get all catalogs x-aclSchema: AplCatalog + parameters: + - name: enabled + in: query + description: Filter catalogs by enabled status + required: false + schema: + type: boolean responses: '200': description: Successfully obtained app catalogs diff --git a/src/otomi-stack.ts b/src/otomi-stack.ts index ba115f6d..9a1a7950 100644 --- a/src/otomi-stack.ts +++ b/src/otomi-stack.ts @@ -1610,9 +1610,13 @@ export default class OtomiStack { } } - getAllAplCatalogs(): AplCatalogResponse[] { + getAllAplCatalogs(catalogFilter: { enabled?: boolean }): AplCatalogResponse[] { const files = this.fileStore.getPlatformResourcesByKind('AplCatalog') - return Array.from(files.values()) as AplCatalogResponse[] + let catalogs = Array.from(files.values()) as AplCatalogResponse[] + if (catalogFilter.enabled !== undefined) { + catalogs = catalogs.filter((catalog) => catalog.spec.enabled === catalogFilter.enabled) + } + return catalogs } async createAplCatalog(data: AplCatalogRequest): Promise { From 2cb25143ea82360e832367f5cd05a0d267f31a07 Mon Sep 17 00:00:00 2001 From: ElderMatt <18527012+ElderMatt@users.noreply.github.com> Date: Mon, 16 Feb 2026 14:25:54 +0100 Subject: [PATCH 2/3] fix: api filtering enabled --- src/api/v2/catalogs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/v2/catalogs.ts b/src/api/v2/catalogs.ts index fac4aca3..efc49d83 100644 --- a/src/api/v2/catalogs.ts +++ b/src/api/v2/catalogs.ts @@ -13,7 +13,7 @@ export const getAllAplCatalogs = (req: OpenApiRequestExt, res: Response): void = const { enabled } = req.query const filter = {} if (enabled !== undefined) { - filter['enabled'] = String(enabled) === 'true' + filter['enabled'] = enabled } const v = req.otomi.getAllAplCatalogs(filter) res.json(v) From 71cac049c6ca61308520fa562120fce19ee81a11 Mon Sep 17 00:00:00 2001 From: ElderMatt <18527012+ElderMatt@users.noreply.github.com> Date: Mon, 16 Feb 2026 15:33:40 +0100 Subject: [PATCH 3/3] fix: updating catalog creates recursive object --- src/otomi-stack.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/otomi-stack.ts b/src/otomi-stack.ts index 9a1a7950..143bf73c 100644 --- a/src/otomi-stack.ts +++ b/src/otomi-stack.ts @@ -1,4 +1,4 @@ -import { CoreV1Api, KubeConfig, User as k8sUser, V1ObjectReference } from '@kubernetes/client-node' +import { CoreV1Api, User as k8sUser, KubeConfig, V1ObjectReference } from '@kubernetes/client-node' import Debug from 'debug' import { getRegions, ObjectStorageKeyRegions } from '@linode/api-v4' @@ -27,7 +27,6 @@ import { AplAIModelResponse, AplBuildRequest, AplBuildResponse, - AplCatalog, AplCatalogRequest, AplCatalogResponse, AplCodeRepoRequest, @@ -1644,9 +1643,7 @@ export default class OtomiStack { patch = false, ): Promise { const existing = this.getAplCatalog(name) - const updatedSpec = patch - ? merge(cloneDeep(existing.spec), data.spec) - : ({ ...existing, ...data.spec } as AplCatalog) + const updatedSpec = patch ? merge(cloneDeep(existing.spec), data.spec) : { ...existing.spec, ...data.spec } const platformObject = buildPlatformObject(existing.kind, existing.metadata.name, updatedSpec) const aplRecord = await this.saveCatalog(platformObject)