Skip to content

Commit cf07755

Browse files
committed
fix: fix configuration of superset report height
1 parent 1991cd3 commit cf07755

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/charts/SupersetReport/SupersetReport.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const SupersetReport = ({
1818
options,
1919
report,
2020
scenario,
21-
style = { width: '100%', height: '800px' },
21+
style,
2222
visibleScenarios,
2323
}) => {
2424
const containerRef = useRef(null);
@@ -89,19 +89,13 @@ export const SupersetReport = ({
8989
]);
9090

9191
const isReportVisible = isEmbedded && !showPlaceholder;
92+
const containerHeight = isReportVisible ? (report?.height ?? style?.height ?? '800px') : '100%';
93+
const containerWidth = isReportVisible ? (report?.width ?? style?.width ?? '100%') : '100%';
9294
const reportContainerDisplay = isReportVisible ? undefined : 'none';
9395
const showLoadingSpinner = placeholder == null && (isLoading || !isEmbedded);
9496

9597
return (
96-
<Box
97-
sx={{
98-
position: 'relative',
99-
width: style?.width ?? '100%',
100-
height: style?.height ?? '800px',
101-
overflow: 'hidden',
102-
...style,
103-
}}
104-
>
98+
<Box sx={{ position: 'relative', width: containerWidth, height: containerHeight, overflow: 'hidden' }}>
10599
{placeholder}
106100
<Backdrop
107101
open={showLoadingSpinner}
@@ -127,7 +121,12 @@ SupersetReport.propTypes = {
127121
labels: PropTypes.object,
128122
noDashboardConfigured: PropTypes.bool,
129123
options: PropTypes.shape({ supersetUrl: PropTypes.string.isRequired }).isRequired,
130-
report: PropTypes.shape({ id: PropTypes.string.isRequired, uiConfig: PropTypes.object }).isRequired,
124+
report: PropTypes.shape({
125+
id: PropTypes.string.isRequired,
126+
height: PropTypes.string,
127+
width: PropTypes.string,
128+
uiConfig: PropTypes.object,
129+
}).isRequired,
131130
scenario: PropTypes.object,
132131
style: PropTypes.object,
133132
visibleScenarios: PropTypes.array,

0 commit comments

Comments
 (0)