From 71029b8980ced59a584aedb60c529d6fabbd10a8 Mon Sep 17 00:00:00 2001 From: Lyn Elisa Goltz Date: Mon, 16 Sep 2024 07:36:31 +0200 Subject: [PATCH] #9926 (#194) - sort collections by id --- .../src/main/resources/collections.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deegree-ogcapi-features/src/main/resources/collections.html b/deegree-ogcapi-features/src/main/resources/collections.html index 90965376..f023c347 100644 --- a/deegree-ogcapi-features/src/main/resources/collections.html +++ b/deegree-ogcapi-features/src/main/resources/collections.html @@ -180,7 +180,7 @@
{{ collection.title }}
var baseUrl = retrieveBaseUrl(); const response = await fetch( baseUrl, {headers: {'Accept': 'application/json' } } ); const json = await response.json(); - this.collections = json.collections; + this.collections = sortCollections(json.collections); this.collectionsMetadata = parseCollectionsMetadataLinks(this.collections); this.licenseLink = parseLinks(json, 'license', 'text/plain'); } @@ -258,6 +258,14 @@
{{ collection.title }}
return links[0]; } +function sortCollections(collections){ + return collections.sort((c1, c2) => { + const c1Id = c1.id; + const c2Id = c2.id; + return c1Id.localeCompare(c2Id); + }); +} + function parseCollectionsMetadataLinks(collections){ const metadataLinksPerCollection = {}; collections.forEach(function(collection){