diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js index 8910fa844..c18378069 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.ui.js @@ -349,7 +349,7 @@ export default class ColumnSchema extends BaseUISchema { },{ id: 'attstorage', label: gettext('Storage'), group: gettext('Definition'), type: 'select', mode: ['properties', 'edit'], - cell: 'select', disabled: obj.inSchemaWithColumnCheck, first_empty: true, + cell: 'select', disabled: obj.inSchemaWithColumnCheck, controlProps: { placeholder: gettext('Select storage'), allowClear: false, }, diff --git a/web/pgadmin/static/js/SchemaView/FormView.jsx b/web/pgadmin/static/js/SchemaView/FormView.jsx index 645a3c12b..52d780e0f 100644 --- a/web/pgadmin/static/js/SchemaView/FormView.jsx +++ b/web/pgadmin/static/js/SchemaView/FormView.jsx @@ -31,7 +31,7 @@ const useStyles = makeStyles((theme)=>({ height: '100%' }, controlRow: { - paddingBottom: theme.spacing(1), + marginBottom: theme.spacing(1), }, nestedTabPanel: { backgroundColor: theme.otherVars.headerBg, @@ -62,7 +62,6 @@ function SQLTab({active, getSQLValue}) { options={{ readOnly: true, }} - isAsync={true} readonly={true} />; } @@ -314,7 +313,7 @@ export default function FormView({ sqlTabActive = (Object.keys(tabs).length === tabValue); /* Re-render and fetch the SQL tab when it is active */ tabs[sqlTabName] = [ - useMemo(()=>, [sqlTabActive]), + useMemo(()=>, [sqlTabActive, value]), ]; tabsClassname[sqlTabName] = classes.fullSpace; fullTabs.push(sqlTabName); diff --git a/web/pgadmin/static/js/SchemaView/MappedControl.jsx b/web/pgadmin/static/js/SchemaView/MappedControl.jsx index beea73c4a..340c2bbcb 100644 --- a/web/pgadmin/static/js/SchemaView/MappedControl.jsx +++ b/web/pgadmin/static/js/SchemaView/MappedControl.jsx @@ -30,8 +30,8 @@ function MappedFormControlBase({type, value, id, onChange, className, visible, i onChange && onChange(value); }, []); - const onSqlChange = useCallback((e, cm) => { - onChange && onChange(cm.getValue()); + const onSqlChange = useCallback((value) => { + onChange && onChange(value); }, []); const onIntChange = useCallback((e) => { diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx index 3677b31de..10a262e94 100644 --- a/web/pgadmin/static/js/SchemaView/index.jsx +++ b/web/pgadmin/static/js/SchemaView/index.jsx @@ -711,7 +711,7 @@ const usePropsStyles = makeStyles((theme)=>({ flexDirection: 'column' }, controlRow: { - paddingBottom: theme.spacing(1), + marginBottom: theme.spacing(1), }, form: { padding: theme.spacing(1), @@ -726,6 +726,9 @@ const usePropsStyles = makeStyles((theme)=>({ buttonMargin: { marginRight: '0.5rem', }, + noPadding: { + padding: 0, + } })); /* If its the properties tab */ @@ -757,7 +760,7 @@ function SchemaPropertiesView({ group = group || defaultTab; if(field.isFullTab) { - tabsClassname[group] = classes.fullSpace; + tabsClassname[group] = classes.noPadding; fullTabs.push(group); } @@ -814,7 +817,7 @@ function SchemaPropertiesView({ readonly={readonly} disabled={disabled} visible={visible} - className={classes.controlRow} + className={field.isFullTab ? null : classes.controlRow} noLabel={field.isFullTab} /> ); @@ -846,7 +849,7 @@ function SchemaPropertiesView({ > {tabName} - + {finalTabs[tabName]} diff --git a/web/pgadmin/static/js/components/CodeMirror.jsx b/web/pgadmin/static/js/components/CodeMirror.jsx index 4745fda9f..350a98135 100644 --- a/web/pgadmin/static/js/components/CodeMirror.jsx +++ b/web/pgadmin/static/js/components/CodeMirror.jsx @@ -7,71 +7,64 @@ // ////////////////////////////////////////////////////////////// -import React, { useEffect, useRef } from 'react'; +import React, { useEffect, useMemo, useRef } from 'react'; import {default as OrigCodeMirror} from 'bundled_codemirror'; import {useOnScreen} from 'sources/custom_hooks'; import PropTypes from 'prop-types'; +import CustomPropTypes from '../custom_prop_types'; /* React wrapper for CodeMirror */ -export default function CodeMirror({currObj, name, value, options, events, ...props}) { +export default function CodeMirror({currEditor, name, value, options, events, className}) { const taRef = useRef(); - const cmObj = useRef(); + const editor = useRef(); const cmWrapper = useRef(); const isVisibleTrack = useRef(); useEffect(()=>{ /* Create the object only once on mount */ - cmObj.current = new OrigCodeMirror.fromTextArea( + editor.current = new OrigCodeMirror.fromTextArea( taRef.current, options); - currObj && currObj(cmObj.current); - - if(cmObj.current) { + editor.current.setValue(value); + currEditor && currEditor(editor.current); + if(editor.current) { try { - cmWrapper.current = cmObj.current.getWrapperElement(); + cmWrapper.current = editor.current.getWrapperElement(); } catch(e) { cmWrapper.current = null; } } Object.keys(events||{}).forEach((eventName)=>{ - cmObj.current.on(eventName, events[eventName]); + editor.current.on(eventName, events[eventName]); }); }, []); - useEffect(()=>{ - /* Refresh when value changes async */ - if(props.isAsync) { - if(cmObj.current) { - cmObj.current.setValue(value); - cmObj.current.refresh(); - } + useMemo(() => { + if(editor.current) { + editor.current.setValue(value); } }, [value]); const onScreenVisible = useOnScreen(cmWrapper); if(!isVisibleTrack.current && onScreenVisible) { isVisibleTrack.current = true; - - /* Refresh when value changes */ - if(cmObj.current) { - cmObj.current.setValue(value); - cmObj.current.refresh(); - } - cmObj.current.refresh(); + editor.current?.refresh(); } else if(!onScreenVisible) { isVisibleTrack.current = false; } - return