Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,10 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {
{!hideDashboardHeader && <DashboardHeader />}
{showFilterBar &&
filterBarOrientation === FilterBarOrientation.HORIZONTAL && (
<FilterBar orientation={FilterBarOrientation.HORIZONTAL} />
<FilterBar
orientation={FilterBarOrientation.HORIZONTAL}
hidden={isReport}
/>
)}
{dropIndicatorProps && <div {...dropIndicatorProps} />}
{!isReport && topLevelTabs && !uiConfig.hideNav && (
Expand Down Expand Up @@ -655,18 +658,17 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {
>
<StickyPanel ref={containerRef} width={filterBarWidth}>
<ErrorBoundary>
{!isReport && (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a few places where we set margins for dashboard so that filter bar fits nicely (such as lines 541 or 628). Should we set them to 0 for reports? Or are they not visible when filter bar is hidden?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they should stay as it keeps the paddings that are also present in the right side

Screenshot 2023-03-31 at 18 37 19

<FilterBar
orientation={FilterBarOrientation.VERTICAL}
verticalConfig={{
filtersOpen: dashboardFiltersOpen,
toggleFiltersBar: toggleDashboardFiltersOpen,
width: filterBarWidth,
height: filterBarHeight,
offset: filterBarOffset,
}}
/>
)}
<FilterBar
orientation={FilterBarOrientation.VERTICAL}
verticalConfig={{
filtersOpen: dashboardFiltersOpen,
toggleFiltersBar: toggleDashboardFiltersOpen,
width: filterBarWidth,
height: filterBarHeight,
offset: filterBarOffset,
}}
hidden={isReport}
/>
</ErrorBoundary>
</StickyPanel>
</FiltersPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
SLOW_DEBOUNCE,
isNativeFilter,
usePrevious,
styled,
} from '@superset-ui/core';
import { useHistory } from 'react-router-dom';
import { updateDataMask, clearDataMask } from 'src/dataMask/actions';
Expand All @@ -51,6 +52,10 @@ import ActionButtons from './ActionButtons';
import Horizontal from './Horizontal';
import Vertical from './Vertical';

const HiddenFilterBar = styled.div`
display: none;
`;
Comment thread
geido marked this conversation as resolved.

const EXCLUDED_URL_PARAMS: string[] = [
URL_PARAMS.nativeFilters.name,
URL_PARAMS.permalinkKey.name,
Expand Down Expand Up @@ -113,6 +118,7 @@ export const FilterBarScrollContext = createContext(false);
const FilterBar: React.FC<FiltersBarProps> = ({
orientation = FilterBarOrientation.VERTICAL,
verticalConfig,
hidden = false,
}) => {
const history = useHistory();
const dataMaskApplied: DataMaskStateWithId = useNativeFiltersDataMask();
Expand Down Expand Up @@ -247,31 +253,38 @@ const FilterBar: React.FC<FiltersBarProps> = ({
/>
);

return orientation === FilterBarOrientation.HORIZONTAL ? (
<Horizontal
actions={actions}
canEdit={canEdit}
dashboardId={dashboardId}
dataMaskSelected={dataMaskSelected}
filterValues={filterValues}
isInitialized={isInitialized}
onSelectionChange={handleFilterSelectionChange}
/>
) : verticalConfig ? (
<Vertical
actions={actions}
canEdit={canEdit}
dataMaskSelected={dataMaskSelected}
filtersOpen={verticalConfig.filtersOpen}
filterValues={filterValues}
isInitialized={isInitialized}
isDisabled={isApplyDisabled}
height={verticalConfig.height}
offset={verticalConfig.offset}
onSelectionChange={handleFilterSelectionChange}
toggleFiltersBar={verticalConfig.toggleFiltersBar}
width={verticalConfig.width}
/>
) : null;
const filterBarComponent =
orientation === FilterBarOrientation.HORIZONTAL ? (
<Horizontal
actions={actions}
canEdit={canEdit}
dashboardId={dashboardId}
dataMaskSelected={dataMaskSelected}
filterValues={filterValues}
isInitialized={isInitialized}
onSelectionChange={handleFilterSelectionChange}
/>
) : verticalConfig ? (
<Vertical
actions={actions}
canEdit={canEdit}
dataMaskSelected={dataMaskSelected}
filtersOpen={verticalConfig.filtersOpen}
filterValues={filterValues}
isInitialized={isInitialized}
isDisabled={isApplyDisabled}
height={verticalConfig.height}
offset={verticalConfig.offset}
onSelectionChange={handleFilterSelectionChange}
toggleFiltersBar={verticalConfig.toggleFiltersBar}
width={verticalConfig.width}
/>
) : null;

return hidden ? (
<HiddenFilterBar>{filterBarComponent}</HiddenFilterBar>
) : (
filterBarComponent
);
};
export default React.memo(FilterBar);
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface VerticalBarConfig {
}

export interface FiltersBarProps {
hidden?: boolean;
orientation: FilterBarOrientation;
verticalConfig?: VerticalBarConfig;
}
Expand Down