Skip to content

Commit a886f72

Browse files
committed
fix: fix configuration of superset report height
1 parent a7b5c4b commit a886f72

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
@@ -25,7 +25,7 @@ export const SupersetReport = ({
2525
options,
2626
report,
2727
scenario,
28-
style = { width: '100%', height: '800px' },
28+
style,
2929
visibleScenarios,
3030
}) => {
3131
const containerRef = useRef(null);
@@ -98,6 +98,8 @@ export const SupersetReport = ({
9898
]);
9999

100100
const isReportVisible = isEmbedded && !showPlaceholder;
101+
const containerHeight = isReportVisible ? (report?.height ?? style?.height ?? '800px') : '100%';
102+
const containerWidth = isReportVisible ? (report?.width ?? style?.width ?? '100%') : '100%';
101103
const reportContainerDisplay = isReportVisible ? undefined : 'none';
102104
const showLoadingSpinner =
103105
!isParentLoading &&
@@ -106,15 +108,7 @@ export const SupersetReport = ({
106108
(!isEmbedded || guestToken?.status === SUPERSET_GUEST_TOKEN_STATUS.LOADING);
107109

108110
return (
109-
<Box
110-
sx={{
111-
position: 'relative',
112-
width: style?.width ?? '100%',
113-
height: style?.height ?? '800px',
114-
overflow: 'hidden',
115-
...style,
116-
}}
117-
>
111+
<Box sx={{ position: 'relative', width: containerWidth, height: containerHeight, overflow: 'hidden' }}>
118112
{placeholder}
119113
<Backdrop
120114
open={showLoadingSpinner}
@@ -143,7 +137,12 @@ SupersetReport.propTypes = {
143137
labels: PropTypes.object,
144138
noDashboardConfigured: PropTypes.bool,
145139
options: PropTypes.shape({ supersetUrl: PropTypes.string.isRequired }).isRequired,
146-
report: PropTypes.shape({ id: PropTypes.string.isRequired, uiConfig: PropTypes.object }).isRequired,
140+
report: PropTypes.shape({
141+
id: PropTypes.string.isRequired,
142+
height: PropTypes.string,
143+
width: PropTypes.string,
144+
uiConfig: PropTypes.object,
145+
}).isRequired,
147146
scenario: PropTypes.object,
148147
style: PropTypes.object,
149148
visibleScenarios: PropTypes.array,

0 commit comments

Comments
 (0)