diff --git a/packages/dashboard/src/CdcDashboardComponent.tsx b/packages/dashboard/src/CdcDashboardComponent.tsx index c57cc1446..447af5d37 100644 --- a/packages/dashboard/src/CdcDashboardComponent.tsx +++ b/packages/dashboard/src/CdcDashboardComponent.tsx @@ -542,7 +542,7 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug = return ( <> {/* Expand/Collapse All */} - {row.expandCollapseAllButtons === true && ( + {!inNoDataState && row.expandCollapseAllButtons === true && ( )} {Object.keys(dataGroups).map(groupName => { @@ -559,6 +559,7 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug = updateChildConfig={updateChildConfig} apiFilterDropdowns={apiFilterDropdowns} currentViewport={currentViewport} + inNoDataState={inNoDataState} /> ) })} @@ -576,11 +577,14 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug = updateChildConfig={updateChildConfig} apiFilterDropdowns={apiFilterDropdowns} currentViewport={currentViewport} + inNoDataState={inNoDataState} /> ) } })} + {inNoDataState ? Please complete your selection to continue. : <>} + {/* Image or PDF Inserts */}
{config.table?.downloadImageButton && ( diff --git a/packages/dashboard/src/components/VisualizationRow.tsx b/packages/dashboard/src/components/VisualizationRow.tsx index fe82b2ee8..eeb3c1d85 100644 --- a/packages/dashboard/src/components/VisualizationRow.tsx +++ b/packages/dashboard/src/components/VisualizationRow.tsx @@ -24,6 +24,7 @@ type VisualizationWrapperProps = { children: React.ReactNode currentViewport: ViewPort groupName: string + hideVisualization: boolean row: ConfigRow } @@ -31,10 +32,13 @@ const VisualizationWrapper: React.FC = ({ allExpanded, currentViewport, groupName, + hideVisualization, row, children }) => { - return row.expandCollapseAllButtons ? ( + return hideVisualization ? ( + <> + ) : row.expandCollapseAllButtons ? (
= ({
) : ( <> -

{groupName}

+ {groupName !== '' ?

{groupName}

: <>} {children} ) @@ -59,6 +63,7 @@ type VizRowProps = { groupName: string row: ConfigRow rowIndex: number + inNoDataState: boolean setSharedFilter: Function updateChildConfig: Function apiFilterDropdowns: APIFilterDropdowns @@ -71,6 +76,7 @@ const VisualizationRow: React.FC = ({ groupName, row, rowIndex: index, + inNoDataState, setSharedFilter, updateChildConfig, apiFilterDropdowns, @@ -81,11 +87,6 @@ const VisualizationRow: React.FC = ({ const setToggled = (colIndex: number) => { setShow(show.map((_, i) => i === colIndex)) } - const inNoDataState = useMemo(() => { - const vals = Object.values(rawData).flatMap(val => val) - if (!vals.length) return true - return vals.some(val => val === undefined) - }, [rawData]) const footnotesConfig = useMemo(() => { if (row.footnotesId) { @@ -150,10 +151,10 @@ const VisualizationRow: React.FC = ({ {visualizationConfig.dataKey} (Go to Table) ) - const hideFilter = + const hideVisualization = inNoDataState && - visualizationConfig.type === 'dashboardFilters' && - applyButtonNotClicked(visualizationConfig) + visualizationConfig.filterBehavior !== 'Apply Button' && + (visualizationConfig.type !== 'dashboardFilters' || applyButtonNotClicked(visualizationConfig)) const shouldShow = row.toggle === undefined || (row.toggle && show[colIndex]) @@ -166,6 +167,7 @@ const VisualizationRow: React.FC = ({ allExpanded={allExpanded} currentViewport={currentViewport} groupName={groupName} + hideVisualization={hideVisualization} row={row} > {visualizationConfig.type === 'chart' && ( @@ -272,7 +274,7 @@ const VisualizationRow: React.FC = ({ configUrl={undefined} /> )} - {visualizationConfig.type === 'dashboardFilters' && !hideFilter && ( + {visualizationConfig.type === 'dashboardFilters' && ( { updateChildConfig(col.widget, newConfig)