From ad8d30cead04a22e4173d9c6a7f606464557dac6 Mon Sep 17 00:00:00 2001 From: Nils Ove Tendenes Date: Wed, 9 Oct 2024 10:13:52 +0200 Subject: [PATCH] chore: hide time-series graph when org filter is active --- src/api/statistics-api/time-series.ts | 16 ++++----- .../conceptReport/conceptReport.component.tsx | 35 +++++++++++-------- .../dataserviceReport.component.tsx | 5 ++- .../datasetReport/datasetReport.component.tsx | 34 ++++++++++-------- .../informationModelReport.component.tsx | 6 +++- src/pages/report-page/report-page-resolver.js | 20 +++-------- 6 files changed, 60 insertions(+), 56 deletions(-) diff --git a/src/api/statistics-api/time-series.ts b/src/api/statistics-api/time-series.ts index aa1ca622f..a403790e0 100644 --- a/src/api/statistics-api/time-series.ts +++ b/src/api/statistics-api/time-series.ts @@ -55,22 +55,22 @@ const extractLabelsAndData = ( const timeSeriesRequest = (body: TimeSeriesRequest) => statisticsApiPost('time-series', body); -export const conceptTimeSeriesRequest = (orgPath: string | undefined) => - timeSeriesRequest(timeSeriesBody('CONCEPT', orgPath)).then( +export const conceptTimeSeriesRequest = () => + timeSeriesRequest(timeSeriesBody('CONCEPT', undefined)).then( extractLabelsAndData ); -export const dataServiceTimeSeriesRequest = (orgPath: string | undefined) => - timeSeriesRequest(timeSeriesBody('DATA_SERVICE', orgPath)).then( +export const dataServiceTimeSeriesRequest = () => + timeSeriesRequest(timeSeriesBody('DATA_SERVICE', undefined)).then( extractLabelsAndData ); -export const datasetTimeSeriesRequest = (orgPath: string | undefined) => - timeSeriesRequest(timeSeriesBody('DATASET', orgPath)).then( +export const datasetTimeSeriesRequest = () => + timeSeriesRequest(timeSeriesBody('DATASET', undefined)).then( extractLabelsAndData ); -export const infoModelTimeSeriesRequest = (orgPath: string | undefined) => - timeSeriesRequest(timeSeriesBody('INFORMATION_MODEL', orgPath)).then( +export const infoModelTimeSeriesRequest = () => + timeSeriesRequest(timeSeriesBody('INFORMATION_MODEL', undefined)).then( extractLabelsAndData ); diff --git a/src/pages/report-page/components/conceptReport/conceptReport.component.tsx b/src/pages/report-page/components/conceptReport/conceptReport.component.tsx index 009fe9235..80baeef0a 100644 --- a/src/pages/report-page/components/conceptReport/conceptReport.component.tsx +++ b/src/pages/report-page/components/conceptReport/conceptReport.component.tsx @@ -47,6 +47,9 @@ const ConceptReport: FC = ({ conceptsTimeSeries = [] }) => { conceptsTimeSeries.push([Date.now(), totalObjects]); + + const hasOrgPath = searchParams ? searchParams.includes('orgPath') : false; + return (
@@ -97,22 +100,24 @@ const ConceptReport: FC = ({ - {conceptsTimeSeries?.length > 0 && conceptsTimeSeries?.length > 0 && ( -
-
- - - + {conceptsTimeSeries?.length > 0 && + conceptsTimeSeries?.length > 0 && + !hasOrgPath && ( +
+
+ + + +
-
- )} + )} {allReferencedConcepts?.length > 0 && (
diff --git a/src/pages/report-page/components/dataserviceReport/dataserviceReport.component.tsx b/src/pages/report-page/components/dataserviceReport/dataserviceReport.component.tsx index 34db961b7..bd67c91fc 100644 --- a/src/pages/report-page/components/dataserviceReport/dataserviceReport.component.tsx +++ b/src/pages/report-page/components/dataserviceReport/dataserviceReport.component.tsx @@ -51,6 +51,8 @@ const DataserviceReport: FC = ({ const { search: searchParams } = location; dataServicesTimeSeries.push([Date.now(), totalObjects]); + const hasOrgPath = searchParams ? searchParams.includes('orgPath') : false; + const topMostUsedFormats: KeyWithCountObject[] = sortKeyWithCount(formats) .filter( ({ key }: KeyWithCountObject) => @@ -111,7 +113,8 @@ const DataserviceReport: FC = ({
{dataServicesTimeSeries?.length > 0 && - dataServicesTimeSeries?.length > 0 && ( + dataServicesTimeSeries?.length > 0 && + !hasOrgPath && (
= ({ ) ).slice(0, 10); + const hasOrgPath = searchParams ? searchParams.includes('orgPath') : false; + const theme = getConfig().isNapProfile ? themeNAP : themeFDK; return ( @@ -175,22 +177,24 @@ const DatasetReport: FC = ({
- {datasetsTimeSeries?.length > 0 && datasetsTimeSeries?.length > 0 && ( -
-
- - - + {datasetsTimeSeries?.length > 0 && + datasetsTimeSeries?.length > 0 && + !hasOrgPath && ( +
+
+ + + +
-
- )} + )} {Number(totalObjects) > 0 && (
diff --git a/src/pages/report-page/components/informationModelReport/informationModelReport.component.tsx b/src/pages/report-page/components/informationModelReport/informationModelReport.component.tsx index f69a65033..9bd4ba6e3 100644 --- a/src/pages/report-page/components/informationModelReport/informationModelReport.component.tsx +++ b/src/pages/report-page/components/informationModelReport/informationModelReport.component.tsx @@ -41,6 +41,9 @@ const InformationModelReport: FC = ({ informationModelsTimeSeries = [] }) => { informationModelsTimeSeries.push([Date.now(), totalObjects]); + + const hasOrgPath = searchParams ? searchParams.includes('orgPath') : false; + return (
@@ -94,7 +97,8 @@ const InformationModelReport: FC = ({
{informationModelsTimeSeries?.length > 0 && - informationModelsTimeSeries?.length > 0 && ( + informationModelsTimeSeries?.length > 0 && + !hasOrgPath && (
{ - const { orgPath } = parseSearchParams(location); - return memoizedGetDatasetsTimeSeries(orgPath); - }, + datasetsTimeSeries: () => memoizedGetDatasetsTimeSeries(), dataServicesReport: ({ location }) => { const { orgPath } = parseSearchParams(location); return memoizedGetDataServicesReport({ orgPath }); }, - dataServicesTimeSeries: ({ location }) => { - const { orgPath } = parseSearchParams(location); - return memoizedGetDataServicesTimeSeries(orgPath); - }, + dataServicesTimeSeries: () => memoizedGetDataServicesTimeSeries(), conceptsReport: async ({ location }) => { const { orgPath, losTheme: los } = parseSearchParams(location); @@ -59,18 +53,12 @@ const mapProps = { return { ...reportItems, allReferencedConcepts }; }, - conceptsTimeSeries: ({ location }) => { - const { orgPath } = parseSearchParams(location); - return memoizedGetConceptsTimeSeries(orgPath); - }, + conceptsTimeSeries: () => memoizedGetConceptsTimeSeries(), informationModelsReport: ({ location }) => { const { orgPath, losTheme: los } = parseSearchParams(location); return memoizedGetInformationModelsReport({ orgPath, los }); }, - informationModelsTimeSeries: ({ location }) => { - const { orgPath } = parseSearchParams(location); - return memoizedGetInformationModelsTimeSeries(orgPath); - } + informationModelsTimeSeries: () => memoizedGetInformationModelsTimeSeries() }; export const reportPageResolver = resolve(mapProps);