From 40dd07d5a859caf890b23d0cf47b5ec3f0bb7e04 Mon Sep 17 00:00:00 2001 From: karolina-siemieniuk-morawska <55505399+karolina-siemieniuk-morawska@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:22:41 +0200 Subject: [PATCH] ui: connect search in new holdingpen * ref: cern-sis/issues-inspire#480 --- ui/src/actions/holdingpen.ts | 2 +- .../__snapshots__/index.test.tsx.snap | 7 +- .../components/Breadcrumbs/Breadcrumbs.tsx | 37 ++- .../components/SearchFilters.tsx | 7 +- .../DashboardPageContainer.tsx | 296 ++++++++++-------- .../utils/__tests__/utils.test.tsx | 10 +- ui/src/holdingpen-new/utils/utils.tsx | 47 ++- 7 files changed, 252 insertions(+), 154 deletions(-) diff --git a/ui/src/actions/holdingpen.ts b/ui/src/actions/holdingpen.ts index fb57547bb..ae5b67ec6 100644 --- a/ui/src/actions/holdingpen.ts +++ b/ui/src/actions/holdingpen.ts @@ -215,7 +215,7 @@ export function fetchSearchResults(): ( const currentQuery = getState()?.holdingpen?.get('query')?.toJS() || {}; const resolveQuery = `${BACKOFFICE_SEARCH_API}/?${ Object.entries(currentQuery) - .filter(([_, value]) => value != null) + .filter(([_, value]) => value != null && value !== '') .map(([key, value]: [string, any]) => `${key}=${value}`) .join('&') || '' }`; diff --git a/ui/src/holdingpen-new/__tests__/__snapshots__/index.test.tsx.snap b/ui/src/holdingpen-new/__tests__/__snapshots__/index.test.tsx.snap index ccee76371..1390c0493 100644 --- a/ui/src/holdingpen-new/__tests__/__snapshots__/index.test.tsx.snap +++ b/ui/src/holdingpen-new/__tests__/__snapshots__/index.test.tsx.snap @@ -135,7 +135,7 @@ exports[`Holdingpen renders initial state 1`] = ` - new authors + all collections @@ -177,7 +177,6 @@ exports[`Holdingpen renders initial state 1`] = ` >