From c824e3205899542421b3b50df74415147ee605d2 Mon Sep 17 00:00:00 2001 From: Joachim Nielandt Date: Tue, 18 Feb 2025 11:34:52 +0100 Subject: [PATCH 1/2] Sort thesaurus dropdown by label --- .../components/thesaurus/ThesaurusService.js | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js b/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js index d444e9a1c3f..54d5dc40ce1 100644 --- a/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js +++ b/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js @@ -192,7 +192,7 @@ return result; }; - var parseKeywordsResponse = function (data, dataToExclude) { + var parseKeywordsResponse = function (data, dataToExclude, orderById) { var listOfKeywords = []; var uiLangs = getUILangs(); @@ -202,6 +202,25 @@ } }); + listOfKeywords.sort(function(k1,k2) { + var s1; + var s2; + if (orderById == "true") { + s1 = k1.props.uri; + s2 = k2.props.uri; + } else { + s1 = k1.label.toLowerCase(); + s2 = k2.label.toLowerCase(); + } + if (s1 < s2) { + return -1; + } + if (s1 > s2) { + return 1; + } + return 0; + }); + if (dataToExclude && dataToExclude.length > 0) { // Remove from search already selected keywords listOfKeywords = $.grep(listOfKeywords, function (n) { @@ -303,20 +322,7 @@ config.outputLang ), filter: function (data) { - if (config.orderById == "true") { - data.sort(function (a, b) { - var nameA = a.uri.toUpperCase(); - var nameB = b.uri.toUpperCase(); - if (nameA < nameB) { - return -1; - } - if (nameA > nameB) { - return 1; - } - return 0; - }); - } - return parseKeywordsResponse(data, config.dataToExclude); + return parseKeywordsResponse(data, config.dataToExclude, config.orderById); } } }); From c3c6e7f4165605522e771099a60f212a9f5a2a1a Mon Sep 17 00:00:00 2001 From: joachimnielandt Date: Fri, 21 Feb 2025 13:22:35 +0100 Subject: [PATCH 2/2] Update web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Prunayre --- .../catalog/components/thesaurus/ThesaurusService.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js b/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js index 54d5dc40ce1..686f565960b 100644 --- a/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js +++ b/web-ui/src/main/resources/catalog/components/thesaurus/ThesaurusService.js @@ -212,13 +212,7 @@ s1 = k1.label.toLowerCase(); s2 = k2.label.toLowerCase(); } - if (s1 < s2) { - return -1; - } - if (s1 > s2) { - return 1; - } - return 0; + return s1.localeCompare(s2); }); if (dataToExclude && dataToExclude.length > 0) {