From d1e2171f7a332ae716d7b1e18448f252337284fb Mon Sep 17 00:00:00 2001 From: Camille Moinier Date: Thu, 25 Apr 2024 11:05:18 +0200 Subject: [PATCH] feat(api): remove unused mime format and handle null --- .../record-api-form.component.ts | 17 ++++++++++++----- libs/util/shared/src/lib/links/link-utils.ts | 6 ------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts index e820ab4278..cac209d458 100644 --- a/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts +++ b/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts @@ -78,15 +78,22 @@ export class RecordApiFormComponent { ? this.apiBaseUrl.slice(0, -1) : this.apiBaseUrl - this.getOutputFormats(apiUrl).then((outputFormats) => { + this.getOutputFormats( + 'https://demo.ldproxy.net/zoomstack/collections/airports/items' + ).then((outputFormats) => { const formatsList = outputFormats.itemFormats.map((format) => { const normalizedFormat = mimeTypeToFormat(format) - return { - label: normalizedFormat.toUpperCase(), - value: normalizedFormat, + if (normalizedFormat) { + return { + label: normalizedFormat?.toUpperCase(), + value: normalizedFormat, + } } + return null }) - this.outputFormats = this.outputFormats.concat(formatsList) + this.outputFormats = this.outputFormats.concat( + formatsList.filter(Boolean) + ) this.outputFormats = this.outputFormats .filter( (format, index, self) => diff --git a/libs/util/shared/src/lib/links/link-utils.ts b/libs/util/shared/src/lib/links/link-utils.ts index 755307d38f..4c246e8606 100644 --- a/libs/util/shared/src/lib/links/link-utils.ts +++ b/libs/util/shared/src/lib/links/link-utils.ts @@ -115,12 +115,6 @@ export const FORMATS = { 'application/vnd.ogc.fg+json;compatibility=geojson', ], }, - pap: { - extensions: ['pap'], - priority: 15, - color: '#f2bb3a', - mimeTypes: ['application/vnd.policy.attributes'], - }, } as const export type FileFormat = keyof typeof FORMATS