Skip to content

Commit ee5e134

Browse files
fix(dashboard): make JSON metadata editor resizable
1 parent cbb2b2f commit ee5e134

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

superset-frontend/src/components/Modal/StandardModal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,17 @@ interface StandardModalProps {
4141
maskClosable?: boolean;
4242
wrapProps?: object;
4343
contentLoading?: boolean;
44+
resizable?: boolean;
4445
}
4546

4647
// Standard modal widths
4748
export const MODAL_STANDARD_WIDTH = 500;
4849
export const MODAL_MEDIUM_WIDTH = 600;
4950
export const MODAL_LARGE_WIDTH = 900;
5051

51-
const StyledModal = styled(Modal)`
52+
const StyledModal = styled(Modal)<{ $resizable?: boolean }>`
5253
.ant-modal-body {
53-
max-height: 60vh;
54+
max-height: ${({ $resizable }) => ($resizable ? 'none' : '60vh')};
5455
height: auto;
5556
overflow-y: auto;
5657
padding: 0;
@@ -116,6 +117,7 @@ export function StandardModal({
116117
maskClosable = false,
117118
wrapProps,
118119
contentLoading = false,
120+
resizable = false,
119121
}: StandardModalProps) {
120122
const primaryButtonName = saveText || (isEditMode ? t('Save') : t('Add'));
121123

@@ -130,6 +132,8 @@ export function StandardModal({
130132
show={show}
131133
width={`${width}px`}
132134
wrapProps={wrapProps}
135+
$resizable={resizable}
136+
resizable={resizable}
133137
title={
134138
icon ? (
135139
<ModalTitleWithIcon

superset-frontend/src/dashboard/components/PropertiesModal/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ const PropertiesModal = ({
138138
Array<{
139139
id: number;
140140
theme_name: string;
141-
json_data?: string;
142141
}>
143142
>([]);
144143
const categoricalSchemeRegistry = getCategoricalSchemeRegistry();
@@ -386,9 +385,7 @@ const PropertiesModal = ({
386385
colorNamespace,
387386
certifiedBy,
388387
certificationDetails,
389-
theme: selectedThemeId
390-
? themes.find(t => t.id === selectedThemeId)
391-
: null,
388+
themeId: selectedThemeId,
392389
css: customCss,
393390
...moreOnSubmitProps,
394391
};
@@ -444,7 +441,7 @@ const PropertiesModal = ({
444441

445442
// Fetch themes (excluding system themes)
446443
const themeQuery = rison.encode({
447-
columns: ['id', 'theme_name', 'is_system', 'json_data'],
444+
columns: ['id', 'theme_name', 'is_system'],
448445
filters: [
449446
{
450447
col: 'is_system',
@@ -626,8 +623,10 @@ const PropertiesModal = ({
626623
form.submit();
627624
}
628625
}}
626+
width={900}
629627
title={t('Dashboard properties')}
630628
isEditMode
629+
resizable
631630
saveDisabled={dashboardInfo?.isManagedExternally || hasErrors}
632631
saveLoading={isApplying}
633632
contentLoading={isLoading}

superset-frontend/src/dashboard/components/PropertiesModal/sections/AdvancedSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const AdvancedSection = ({
8484
tabSize={2}
8585
wordWrap
8686
width="100%"
87-
height="200px"
87+
height="60vh"
8888
annotations={toEditorAnnotations(jsonAnnotations)}
8989
/>
9090
</ModalFormField>

0 commit comments

Comments
 (0)