From b9c15559243dc2256dfe8bb60967bdbbcbe68bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Mon, 4 Nov 2024 10:02:37 +0100 Subject: [PATCH] Directory entries / Fix parsing of sorting configuration --- .../DirectoryEntrySelector.js | 15 ++++++++++++--- .../catalog/js/edit/DirectoryController.js | 7 ++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/edit/directoryentryselector/DirectoryEntrySelector.js b/web-ui/src/main/resources/catalog/components/edit/directoryentryselector/DirectoryEntrySelector.js index a872c3d2a8c..2f0e39be264 100644 --- a/web-ui/src/main/resources/catalog/components/edit/directoryentryselector/DirectoryEntrySelector.js +++ b/web-ui/src/main/resources/catalog/components/edit/directoryentryselector/DirectoryEntrySelector.js @@ -128,6 +128,10 @@ pre: function preLink(scope) { var directorySearchSettings = gnGlobalSettings.gnCfg.mods.directory || {}; + var sortConfig = ( + directorySearchSettings.sortBy || gnSearchSettings.sortBy + ).split("#"); + scope.searchObj = { any: "", internal: true, @@ -138,8 +142,8 @@ from: 1, to: 20, root: "gmd:CI_ResponsibleParty", - sortBy: directorySearchSettings.sortBy || gnSearchSettings.sortBy, - sortOrder: "", + sortBy: sortConfig[0] || "relevance", + sortOrder: sortConfig[1] || "", resultType: "subtemplates", queryBase: directorySearchSettings.queryBase || gnSearchSettings.queryBase @@ -639,6 +643,10 @@ pre: function preLink(scope) { var directorySearchSettings = gnGlobalSettings.gnCfg.mods.directory || {}; + var sortConfig = ( + directorySearchSettings.sortBy || gnSearchSettings.sortBy + ).split("#"); + scope.searchObj = { internal: true, configId: "directoryInEditor", @@ -648,7 +656,8 @@ from: 1, to: 10, root: "gmd:CI_ResponsibleParty", - sortBy: directorySearchSettings.sortBy || gnSearchSettings.sortBy, + sortBy: sortConfig[0] || "relevance", + sortOrder: sortConfig[1] || "", queryBase: directorySearchSettings.queryBase || gnSearchSettings.queryBase } diff --git a/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js b/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js index 3baa7a89bd0..8c8b6abfe81 100644 --- a/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js +++ b/web-ui/src/main/resources/catalog/js/edit/DirectoryController.js @@ -106,12 +106,17 @@ $scope.facetConfig = directorySearchSettings.facetConfig; + var sortConfig = (directorySearchSettings.sortBy || gnSearchSettings.sortBy).split( + "#" + ); + $scope.defaultSearchObj = { selectionBucket: "d101", configId: "directory", any: "", params: { - sortBy: directorySearchSettings.sortBy || gnSearchSettings.sortBy, + sortBy: sortConfig[0] || "relevance", + sortOrder: sortConfig[1] || "", isTemplate: ["s"], from: 1, to: 20,