Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Dev-9448 Data Reset Scenario #1686

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/dashboard/src/CdcDashboardComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug =
return (
<>
{/* Expand/Collapse All */}
{row.expandCollapseAllButtons === true && (
{!inNoDataState && row.expandCollapseAllButtons === true && (
<ExpandCollapseButtons setAllExpanded={setAllExpanded} />
)}
{Object.keys(dataGroups).map(groupName => {
Expand All @@ -559,6 +559,7 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug =
updateChildConfig={updateChildConfig}
apiFilterDropdowns={apiFilterDropdowns}
currentViewport={currentViewport}
inNoDataState={inNoDataState}
/>
)
})}
Expand All @@ -576,11 +577,14 @@ export default function CdcDashboard({ initialState, isEditor = false, isDebug =
updateChildConfig={updateChildConfig}
apiFilterDropdowns={apiFilterDropdowns}
currentViewport={currentViewport}
inNoDataState={inNoDataState}
/>
)
}
})}

{inNoDataState ? <span>Please complete your selection to continue.</span> : <></>}

{/* Image or PDF Inserts */}
<section className='download-buttons'>
{config.table?.downloadImageButton && (
Expand Down
24 changes: 13 additions & 11 deletions packages/dashboard/src/components/VisualizationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ type VisualizationWrapperProps = {
children: React.ReactNode
currentViewport: ViewPort
groupName: string
hideVisualization: boolean
row: ConfigRow
}

const VisualizationWrapper: React.FC<VisualizationWrapperProps> = ({
allExpanded,
currentViewport,
groupName,
hideVisualization,
row,
children
}) => {
return row.expandCollapseAllButtons ? (
return hideVisualization ? (
<></>
) : row.expandCollapseAllButtons ? (
<div className='collapsable-multiviz-container'>
<CollapsibleVisualizationRow
allExpanded={allExpanded}
Expand All @@ -47,7 +51,7 @@ const VisualizationWrapper: React.FC<VisualizationWrapperProps> = ({
</div>
) : (
<>
<h3>{groupName}</h3>
{groupName !== '' ? <h3>{groupName}</h3> : <></>}
{children}
</>
)
Expand All @@ -59,6 +63,7 @@ type VizRowProps = {
groupName: string
row: ConfigRow
rowIndex: number
inNoDataState: boolean
setSharedFilter: Function
updateChildConfig: Function
apiFilterDropdowns: APIFilterDropdowns
Expand All @@ -71,6 +76,7 @@ const VisualizationRow: React.FC<VizRowProps> = ({
groupName,
row,
rowIndex: index,
inNoDataState,
setSharedFilter,
updateChildConfig,
apiFilterDropdowns,
Expand All @@ -81,11 +87,6 @@ const VisualizationRow: React.FC<VizRowProps> = ({
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) {
Expand Down Expand Up @@ -150,10 +151,10 @@ const VisualizationRow: React.FC<VizRowProps> = ({
{visualizationConfig.dataKey} (Go to Table)
</a>
)
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])

Expand All @@ -166,6 +167,7 @@ const VisualizationRow: React.FC<VizRowProps> = ({
allExpanded={allExpanded}
currentViewport={currentViewport}
groupName={groupName}
hideVisualization={hideVisualization}
row={row}
>
{visualizationConfig.type === 'chart' && (
Expand Down Expand Up @@ -272,7 +274,7 @@ const VisualizationRow: React.FC<VizRowProps> = ({
configUrl={undefined}
/>
)}
{visualizationConfig.type === 'dashboardFilters' && !hideFilter && (
{visualizationConfig.type === 'dashboardFilters' && (
<DashboardSharedFilters
setConfig={newConfig => {
updateChildConfig(col.widget, newConfig)
Expand Down
Loading