From ade30e058b4e945412d3061afd33ab65d9dd67b2 Mon Sep 17 00:00:00 2001 From: Daniel von Atzigen Date: Mon, 25 Nov 2024 08:02:40 +0100 Subject: [PATCH 1/2] Fix client build warnings --- apps/client-asset-sg/project.json | 2 +- package-lock.json | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/client-asset-sg/project.json b/apps/client-asset-sg/project.json index acc6be8d..8de86db8 100644 --- a/apps/client-asset-sg/project.json +++ b/apps/client-asset-sg/project.json @@ -19,7 +19,7 @@ "assets": ["apps/client-asset-sg/src/favicon.ico", "apps/client-asset-sg/src/assets"], "styles": ["apps/client-asset-sg/src/styles.scss"], "scripts": [], - "allowedCommonJsDependencies": ["tsafe", "xml-utils", "pbf", "rbush", "earcut", "@prisma/client"] + "allowedCommonJsDependencies": ["tsafe", "xml-utils", "pbf", "rbush", "earcut", "@prisma/client", "validator"] }, "configurations": { "production": { diff --git a/package-lock.json b/package-lock.json index 6a7bb821..36e41398 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13828,9 +13828,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001621", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001621.tgz", - "integrity": "sha512-+NLXZiviFFKX0fk8Piwv3PfLPGtRqJeq2TiNoUff/qB5KJgwecJTvCXDpmlyP/eCI/GUEmp/h/y5j0yckiiZrA==", + "version": "1.0.30001684", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001684.tgz", + "integrity": "sha512-G1LRwLIQjBQoyq0ZJGqGIJUXzJ8irpbjHLpVRXDvBEScFJ9b17sgK6vlx0GAJFE21okD7zXl08rRRUfq6HdoEQ==", "funding": [ { "type": "opencollective", @@ -13844,7 +13844,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/caseless": { "version": "0.12.0", From 0495380ae3de4b92695faa36967ac51ecda2ea10 Mon Sep 17 00:00:00 2001 From: Daniel von Atzigen Date: Mon, 25 Nov 2024 17:41:24 +0100 Subject: [PATCH 2/2] Fix studies being invisible when asset is selected --- .../src/lib/components/map/map.component.ts | 11 ++++++----- .../lib/state/asset-search/asset-search.effects.ts | 8 ++++---- .../lib/state/asset-search/asset-search.selector.ts | 10 +++++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/libs/asset-viewer/src/lib/components/map/map.component.ts b/libs/asset-viewer/src/lib/components/map/map.component.ts index 2a01bf50..45a45295 100644 --- a/libs/asset-viewer/src/lib/components/map/map.component.ts +++ b/libs/asset-viewer/src/lib/components/map/map.component.ts @@ -21,7 +21,8 @@ import { selectAssetSearchPolygon, selectAssetSearchResultData, selectCurrentAssetDetail, - selectHasDefaultFilters, + selectHasNoActiveFilters, + selectIsSearchQueryEmpty, selectStudies, } from '../../state/asset-search/asset-search.selector'; import { AppStateWithMapControl } from '../../state/map-control/map-control.reducer'; @@ -129,8 +130,8 @@ export class MapComponent implements AfterViewInit, OnChanges, OnDestroy { this.controller.addControl(this.controls.draw); this.subscription.add( - this.store.select(selectHasDefaultFilters).subscribe((hasDefaultFilters) => { - if (hasDefaultFilters) { + this.store.select(selectIsSearchQueryEmpty).subscribe((isSearchQueryEmpty) => { + if (isSearchQueryEmpty) { this.controls.zoom.resetZoom(); } }) @@ -155,8 +156,8 @@ export class MapComponent implements AfterViewInit, OnChanges, OnDestroy { private initializeStoreBindings() { this.subscription.add( - this.store.select(selectHasDefaultFilters).subscribe((showStudies) => { - this.controller.setShowHeatmap(showStudies); + this.store.select(selectHasNoActiveFilters).subscribe((hasNoActiveFilters) => { + this.controller.setShowHeatmap(hasNoActiveFilters); }) ); this.subscription.add( diff --git a/libs/asset-viewer/src/lib/state/asset-search/asset-search.effects.ts b/libs/asset-viewer/src/lib/state/asset-search/asset-search.effects.ts index f7a37778..218d92c1 100644 --- a/libs/asset-viewer/src/lib/state/asset-search/asset-search.effects.ts +++ b/libs/asset-viewer/src/lib/state/asset-search/asset-search.effects.ts @@ -18,7 +18,7 @@ import { selectAssetSearchIsInitialized, selectAssetSearchQuery, selectCurrentAssetDetail, - selectHasDefaultFilters, + selectIsSearchQueryEmpty, selectSearchLoadingState, selectStudies, } from './asset-search.selector'; @@ -221,9 +221,9 @@ export class AssetSearchEffects { this.actions$.pipe( ofType(actions.updateResults), map(({ results }) => results.page.total !== 0), - withLatestFrom(this.store.select(selectHasDefaultFilters)), - map(([hasResults, hasNoFilters]) => - !hasResults || hasNoFilters ? actions.closeResults() : actions.openResults() + withLatestFrom(this.store.select(selectIsSearchQueryEmpty)), + map(([hasResults, isSearchQueryEmpty]) => + !hasResults || isSearchQueryEmpty ? actions.closeResults() : actions.openResults() ) ) ); diff --git a/libs/asset-viewer/src/lib/state/asset-search/asset-search.selector.ts b/libs/asset-viewer/src/lib/state/asset-search/asset-search.selector.ts index 03a02c80..197042a6 100644 --- a/libs/asset-viewer/src/lib/state/asset-search/asset-search.selector.ts +++ b/libs/asset-viewer/src/lib/state/asset-search/asset-search.selector.ts @@ -60,12 +60,16 @@ export const selectAssetSearchTotalResults = createSelector(assetSearchFeature, export const selectCurrentAssetDetail = createSelector(assetSearchFeature, (state) => state.currentAsset); export const selectStudies = createSelector(assetSearchFeature, (state) => state.studies); -export const selectHasDefaultFilters = createSelector( +export const selectHasNoActiveFilters = createSelector(assetSearchFeature, ({ query }) => hasNoActiveFilters(query)); + +export const selectIsSearchQueryEmpty = createSelector( assetSearchFeature, - ({ query, currentAsset }) => - currentAsset == null && Object.values(query).every((value) => value === undefined || value == false) + ({ query, currentAsset }) => currentAsset == null && hasNoActiveFilters(query) ); +const hasNoActiveFilters = (query: AssetSearchQuery): boolean => + Object.values(query).every((value) => value === undefined || value == false); + export const selectCurrentAssetDetailVM = createSelector( fromAppShared.selectRDReferenceData, selectCurrentAssetDetail,