Skip to content

Commit

Permalink
Fix modal layout issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
codyml committed Aug 22, 2022
1 parent dc975d0 commit 2310b03
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
17 changes: 17 additions & 0 deletions superset-frontend/src/components/Chart/DrillDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import { useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import {
BinaryQueryObjectFilterClause,
css,
QueryFormData,
t,
useTheme,
} from '@superset-ui/core';
import DrillDetailPane from 'src/dashboard/components/DrillDetailPane';
import { DashboardPageIdContext } from 'src/dashboard/containers/DashboardPage';
Expand All @@ -46,6 +48,7 @@ const DrillDetailModal: React.FC<{
const openModal = useCallback(() => setShowModal(true), []);
const closeModal = useCallback(() => setShowModal(false), []);
const history = useHistory();
const theme = useTheme();
const dashboardPageId = useContext(DashboardPageIdContext);
const { slice_name: chartName } = useSelector(
(state: { sliceEntities: { slices: Record<number, Slice> } }) =>
Expand All @@ -70,6 +73,12 @@ const DrillDetailModal: React.FC<{

return (
<Modal
css={css`
.ant-modal-body {
display: flex;
flex-direction: column;
}
`}
show={showModal}
onHide={closeModal}
title={t('Drill to detail: %s', chartName)}
Expand All @@ -89,6 +98,14 @@ const DrillDetailModal: React.FC<{
}
responsive
resizable
resizableConfig={{
minHeight: theme.gridUnit * 128,
minWidth: theme.gridUnit * 128,
defaultSize: {
width: 'auto',
height: '75vh',
},
}}
draggable
destroyOnClose
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,17 @@ export default function DrillDetailPane({
showRowCount={false}
small
css={css`
min-height: 0;
overflow: scroll;
overflow: auto;
.table {
margin-bottom: 0;
}
`}
/>
);
}

return (
<div
css={css`
display: flex;
flex-direction: column;
height: ${theme.gridUnit * 128}px;
`}
>
<>
<TableControls
filters={filters}
setFilters={setFilters}
Expand All @@ -256,6 +252,6 @@ export default function DrillDetailPane({
onReload={handleReload}
/>
{tableContent}
</div>
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
QueryFormData,
styled,
t,
useTheme,
} from '@superset-ui/core';
import { Menu } from 'src/components/Menu';
import { NoAnimationDropdown } from 'src/components/Dropdown';
Expand Down Expand Up @@ -171,6 +172,7 @@ const DashboardChartModalTrigger = ({
const closeModal = useCallback(() => setShowModal(false), []);
const history = useHistory();
const exploreChart = () => history.push(exploreUrl);
const theme = useTheme();

return (
<>
Expand All @@ -184,6 +186,12 @@ const DashboardChartModalTrigger = ({
</span>
{(() => (
<Modal
css={css`
.ant-modal-body {
display: flex;
flex-direction: column;
}
`}
show={showModal}
onHide={closeModal}
title={modalTitle}
Expand All @@ -207,6 +215,14 @@ const DashboardChartModalTrigger = ({
}
responsive
resizable
resizableConfig={{
minHeight: theme.gridUnit * 128,
minWidth: theme.gridUnit * 128,
defaultSize: {
width: 'auto',
height: '75vh',
},
}}
draggable
destroyOnClose
>
Expand Down

0 comments on commit 2310b03

Please sign in to comment.