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

feat(explore): UX changes in fast viz switcher #20848

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -361,7 +361,7 @@ export type ControlSetRow = ControlSetItem[];
// - superset-frontend/src/explore/components/ControlPanelsContainer.jsx
// - superset-frontend/src/explore/components/ControlPanelSection.jsx
export interface ControlPanelSectionConfig {
label: ReactNode;
label?: ReactNode;
description?: ReactNode;
expanded?: boolean;
tabOverride?: TabOverride;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ const sectionsToExpand = (
// avoid expanding time section if datasource doesn't include time column
sections.reduce(
(acc, section) =>
section.expanded && (!isTimeSection(section) || hasTimeColumn(datasource))
(section.expanded || !section.label) &&
(!isTimeSection(section) || hasTimeColumn(datasource))
? [...acc, String(section.label)]
: acc,
[] as string[],
Expand Down Expand Up @@ -436,6 +437,12 @@ export const ControlPanelsContainer = (props: ControlPanelsContainerProps) => {
span.label {
display: inline-block;
}
${!section.label &&
`
.ant-collapse-header {
display: none;
}
`}
`}
header={<PanelHeader />}
key={sectionId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,29 @@ const FEATURED_CHARTS: VizMeta[] = [
name: 'echarts_timeseries_line',
icon: <Icons.LineChartTile />,
},
{
name: 'echarts_timeseries_bar',
icon: <Icons.BarChartTile />,
},
{ name: 'echarts_area', icon: <Icons.AreaChartTile /> },
{ name: 'table', icon: <Icons.TableChartTile /> },
{
name: 'big_number_total',
icon: <Icons.BigNumberChartTile />,
},
{ name: 'pie', icon: <Icons.PieChartTile /> },
{
name: 'echarts_timeseries_bar',
icon: <Icons.BarChartTile />,
},
{ name: 'echarts_area', icon: <Icons.AreaChartTile /> },
];

const antdIconProps = {
iconSize: 'l' as const,
css: (theme: SupersetTheme) => css`
padding: ${theme.gridUnit}px;
& > * {
line-height: 0;
}
`,
};

const VizTile = ({
isActive,
isRendered,
Expand Down Expand Up @@ -203,17 +213,7 @@ export const FastVizSwitcher = React.memo(
) {
vizTiles.unshift({
name: currentSelection,
icon: (
<Icons.MonitorOutlined
iconSize="l"
css={(theme: SupersetTheme) => css`
padding: ${theme.gridUnit}px;
& > * {
line-height: 0;
}
`}
/>
),
icon: <Icons.MonitorOutlined {...antdIconProps} />,
});
}
if (
Expand All @@ -224,7 +224,7 @@ export const FastVizSwitcher = React.memo(
) {
vizTiles.unshift({
name: currentViz,
icon: <Icons.CurrentRenderedTile />,
icon: <Icons.CheckSquareOutlined {...antdIconProps} />,
});
}
return vizTiles;
Expand Down
2 changes: 0 additions & 2 deletions superset-frontend/src/explore/controlPanels/sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import { ControlPanelSectionConfig } from '@superset-ui/chart-controls';
import { formatSelectOptions } from 'src/explore/exploreUtils';

export const datasourceAndVizType: ControlPanelSectionConfig = {
label: t('Visualization type'),
expanded: true,
controlSetRows: [
['datasource'],
['viz_type'],
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/explore/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ export const controls = {

viz_type: {
type: 'VizTypeControl',
label: t('Visualization type'),
default: 'table',
description: t('The type of visualization to display'),
},
Expand Down