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

fix(chart): control issue #24

Merged
merged 1 commit into from
Oct 4, 2024
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 @@ -27,7 +27,7 @@
.zoom-controls {
position: absolute;
right: 10px;
bottom: 15px;
bottom: 20px;
display: flex;
flex-direction: column;
background-color: white;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class ScatterPlotGlowOverlay extends React.PureComponent {
const hrefValue = hrefMatch ? hrefMatch[1] : null;

if (hrefValue) {
window.open(hrefValue, '_blank');
window.open(hrefValue, '_self');
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions superset-frontend/src/assets/images/icons/video_play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions superset-frontend/src/components/Icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const IconFileNames = [
'dropdown',
'setting',
'information',
'video_play',
];

const iconOverrides: Record<string, React.FC<IconType>> = {};
Expand Down
27 changes: 17 additions & 10 deletions superset-frontend/src/components/PageHeaderWithActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ export const menuTriggerStyles = (theme: SupersetTheme) => css`
}
`;

const headerStyles = (theme: SupersetTheme, isFiltersOpen: boolean) => css`
const headerStyles = (
theme: SupersetTheme,
isFiltersOpen: boolean,
userCanEdit: boolean,
) => css`
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: nowrap;
justify-content: space-between;
background-color: #f5f6fa;
height: ${theme.gridUnit * 24}px;
padding: ${theme.gridUnit * 6}px;
height: ${theme.gridUnit * (userCanEdit ? 24 : 6)}px;
padding: ${userCanEdit ? theme.gridUnit * 6 : 0}px;
padding-left: ${theme.gridUnit * (isFiltersOpen ? 6 : 14.5)}px;
.editable-title {
Expand Down Expand Up @@ -102,14 +106,17 @@ const headerStyles = (theme: SupersetTheme, isFiltersOpen: boolean) => css`
.collapse-button {
background: #fff;
width: 48px;
height: 48px;
border-radius: 50%;
width: 32px;
height: 84px;
border-top-right-radius: 20px;
border-bottom-right-radius: 20px;
display: flex;
justify-content: center;
align-items: center;
margin-right: 24px;
cusrsor: pointer;
cursor: pointer;
position: fixed;
top: 24px;
left: 0px;
}
.expend {
Expand Down Expand Up @@ -174,7 +181,7 @@ export const PageHeaderWithActions = ({
const theme = useTheme();
return (
<div
css={headerStyles(theme, !!isFiltersOpen)}
css={headerStyles(theme, !!isFiltersOpen, !!userCanEdit)}
className="header-with-actions"
>
<div className="title-panel">
Expand All @@ -191,7 +198,7 @@ export const PageHeaderWithActions = ({
/>
</div>
)}
<DynamicEditableTitle {...editableTitleProps} />
{userCanEdit && <DynamicEditableTitle {...editableTitleProps} />}
{showTitlePanelItems && (
<div css={buttonsStyles}>
{certificatiedBadgeProps?.certifiedBy && (
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const StyledTabs = ({
}
.ant-tabs-ink-bar {
background: ${theme.colors.primary.base};
z-index: 1;
}
`}
/>
Expand Down Expand Up @@ -207,9 +208,9 @@ export const StyledLineEditableTabs = styled(EditableTabs)<{
}
.ant-tabs-nav {
padding-right: 24px;
padding-right: ${({ isChild }) => (isChild ? '0px' : '24px')};
position: ${({ isChild }) => (isChild ? 'unset' : 'sticky')};
top: ${({ isChild }) => (isChild ? 'unset' : '95px')};
top: ${({ isChild }) => (isChild ? 'unset' : '24px')};
z-index: ${({ isChild }) => (isChild ? 'unset' : '100')};
background: ${({ isChild }) => (isChild ? 'unset' : 'white')};
border-top-left-radius: ${({ isChild }) => (isChild ? 'unset' : '20px')};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const LoadingWrapper = styled.div`
width: 100vw;
height: 100vh;
background: #f7f7f7;
z-index: 100;
`;

// @z-index-above-dashboard-charts + 1 = 11
Expand Down Expand Up @@ -305,8 +306,9 @@ const DashboardContentWrapper = styled.div`
const StyledDashboardContent = styled.div<{
editMode: boolean;
marginLeft: number;
dashboardFiltersOpen: boolean;
}>`
${({ theme, editMode }) => css`
${({ theme, editMode, dashboardFiltersOpen }) => css`
display: flex;
flex-direction: row;
flex-wrap: nowrap;
Expand All @@ -323,7 +325,9 @@ const StyledDashboardContent = styled.div<{
width: 0;
flex: 1;
position: relative;
margin: 0px 24px 24px 24px;
margin: ${dashboardFiltersOpen
? '0px 24px 24px 24px'
: '0px 24px 24px 48px'};
${editMode &&
`
Expand Down Expand Up @@ -758,6 +762,7 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {
<StyledDashboardContent
className="dashboard-content"
editMode={editMode}
dashboardFiltersOpen={dashboardFiltersOpen}
marginLeft={dashboardContentMarginLeft}
>
{showDashboard ? (
Expand Down
61 changes: 30 additions & 31 deletions superset-frontend/src/dashboard/components/SliceHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,37 +231,36 @@ const SliceHeader: FC<SliceHeaderProps> = ({
<CrossFilterIcon iconSize="m" />
</Tooltip>
)}
{!uiConfig.hideChartControls && (
<SliceHeaderControls
slice={slice}
isCached={isCached}
isExpanded={isExpanded}
cachedDttm={cachedDttm}
updatedDttm={updatedDttm}
toggleExpandSlice={toggleExpandSlice}
forceRefresh={forceRefresh}
logExploreChart={logExploreChart}
logEvent={logEvent}
exportCSV={exportCSV}
exportFullCSV={exportFullCSV}
exportXLSX={exportXLSX}
exportFullXLSX={exportFullXLSX}
supersetCanExplore={supersetCanExplore}
supersetCanShare={supersetCanShare}
supersetCanCSV={supersetCanCSV}
componentId={componentId}
dashboardId={dashboardId}
addSuccessToast={addSuccessToast}
addDangerToast={addDangerToast}
handleToggleFullSize={handleToggleFullSize}
isFullSize={isFullSize}
isDescriptionExpanded={isExpanded}
chartStatus={chartStatus}
formData={formData}
exploreUrl={exploreUrl}
crossFiltersEnabled={isCrossFiltersEnabled}
/>
)}
<SliceHeaderControls
slice={slice}
hideChartControls={uiConfig.hideChartControls}
isCached={isCached}
isExpanded={isExpanded}
cachedDttm={cachedDttm}
updatedDttm={updatedDttm}
toggleExpandSlice={toggleExpandSlice}
forceRefresh={forceRefresh}
logExploreChart={logExploreChart}
logEvent={logEvent}
exportCSV={exportCSV}
exportFullCSV={exportFullCSV}
exportXLSX={exportXLSX}
exportFullXLSX={exportFullXLSX}
supersetCanExplore={supersetCanExplore}
supersetCanShare={supersetCanShare}
supersetCanCSV={supersetCanCSV}
componentId={componentId}
dashboardId={dashboardId}
addSuccessToast={addSuccessToast}
addDangerToast={addDangerToast}
handleToggleFullSize={handleToggleFullSize}
isFullSize={isFullSize}
isDescriptionExpanded={isExpanded}
chartStatus={chartStatus}
formData={formData}
exploreUrl={exploreUrl}
crossFiltersEnabled={isCrossFiltersEnabled}
/>
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const createProps = (viz_type = 'sunburst_v2') =>
supersetCanShare: true,
formData: { slice_id: 1, datasource: '58__table', viz_type: 'sunburst_v2' },
exploreUrl: '/explore',
hideChartControls: true,
}) as SliceHeaderControlsProps;

const renderWrapper = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export interface SliceHeaderControlsProps {
slice_description: string;
datasource: string;
};

hideChartControls: boolean;
componentId: string;
dashboardId: number;
chartStatus: string;
Expand Down Expand Up @@ -605,7 +605,7 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {

return (
<Wrapper>
{isFullSize && (
{isFullSize && !props?.hideChartControls && (
<Icons.FullscreenExitOutlined
style={{ fontSize: 22 }}
onClick={() => {
Expand Down Expand Up @@ -656,25 +656,30 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
</Popover>
</InfoWrapper>
)}
<NoAnimationDropdown
overlay={menu}
overlayStyle={dropdownOverlayStyle}
trigger={['click']}
placement="bottomRight"
>
<span
css={css`
display: flex;
align-items: center;
`}
id={`slice_${slice.slice_id}-controls`}
role="button"
aria-label="More Options"
>
<HorizontalDotsTrigger />
</span>
</NoAnimationDropdown>
{canEditCrossFilters && scopingModal}
<Icons.VideoPlay />
{!props?.hideChartControls && (
<>
<NoAnimationDropdown
overlay={menu}
overlayStyle={dropdownOverlayStyle}
trigger={['click']}
placement="bottomRight"
>
<span
css={css`
display: flex;
align-items: center;
`}
id={`slice_${slice.slice_id}-controls`}
role="button"
aria-label="More Options"
>
<HorizontalDotsTrigger />
</span>
</NoAnimationDropdown>
{canEditCrossFilters && scopingModal}
</>
)}
</Wrapper>
);
};
Expand Down
Loading