From 7594dd9e611cdf3747019b67089b047214019483 Mon Sep 17 00:00:00 2001 From: Hanbyul Jo Date: Wed, 24 Apr 2024 13:13:00 +0900 Subject: [PATCH] Handle empty dataset with message properly --- app/scripts/components/exploration/analysis-data.ts | 2 +- .../components/datasets/dataset-list-item-status.tsx | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/scripts/components/exploration/analysis-data.ts b/app/scripts/components/exploration/analysis-data.ts index 926f7b625..8756775f6 100644 --- a/app/scripts/components/exploration/analysis-data.ts +++ b/app/scripts/components/exploration/analysis-data.ts @@ -241,7 +241,7 @@ export async function requestDatasetTimeseriesData({ status: TimelineDatasetStatus.ERROR, error: new ExtendedError( 'The selected time and area of interest contains no valid data. Please adjust your selection.', - 'ANALYSIS_NO_DATA' + 'ANALYSIS_NO_VALID_DATA' ), data: null }; diff --git a/app/scripts/components/exploration/components/datasets/dataset-list-item-status.tsx b/app/scripts/components/exploration/components/datasets/dataset-list-item-status.tsx index a49d67423..a3d73ee3b 100644 --- a/app/scripts/components/exploration/components/datasets/dataset-list-item-status.tsx +++ b/app/scripts/components/exploration/components/datasets/dataset-list-item-status.tsx @@ -142,7 +142,7 @@ export function DatasetTrackError(props: { ); } - + if (error instanceof ExtendedError && error.code === 'ANALYSIS_NO_DATA') { return ( <> @@ -153,6 +153,16 @@ export function DatasetTrackError(props: { ); } + if (error instanceof ExtendedError && error.code === 'ANALYSIS_NO_VALID_DATA') { + return ( + <> + {patternContent} + +

{error.message}

+
+ + ); + } return ( <>