mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that the save button should be disabled by default on the Sort/Filter dialog in the query tool. #5058
This commit is contained in:
parent
dd25bb0fff
commit
b4fcb61d64
@ -447,7 +447,7 @@ function prepareData(val, createMode=false) {
|
|||||||
|
|
||||||
/* If its the dialog */
|
/* If its the dialog */
|
||||||
function SchemaDialogView({
|
function SchemaDialogView({
|
||||||
getInitData, viewHelperProps, loadingText, schema={}, showFooter=true, isTabView=true, ...props}) {
|
getInitData, viewHelperProps, loadingText, schema={}, showFooter=true, isTabView=true, checkDirtyOnEnableSave=false, ...props}) {
|
||||||
const classes = useDialogStyles();
|
const classes = useDialogStyles();
|
||||||
/* Some useful states */
|
/* Some useful states */
|
||||||
const [dirty, setDirty] = useState(false);
|
const [dirty, setDirty] = useState(false);
|
||||||
@ -773,7 +773,7 @@ function SchemaDialogView({
|
|||||||
<DefaultButton data-test="Reset" onClick={onResetClick} startIcon={<SettingsBackupRestoreIcon />} disabled={!dirty || saving} className={classes.buttonMargin}>
|
<DefaultButton data-test="Reset" onClick={onResetClick} startIcon={<SettingsBackupRestoreIcon />} disabled={!dirty || saving} className={classes.buttonMargin}>
|
||||||
{gettext('Reset')}
|
{gettext('Reset')}
|
||||||
</DefaultButton>
|
</DefaultButton>
|
||||||
<PrimaryButton data-test="Save" onClick={onSaveClick} startIcon={ButtonIcon} disabled={ !(viewHelperProps.mode === 'edit' ? dirty : true) || saving || Boolean(formErr.name) || !formReady}>
|
<PrimaryButton data-test="Save" onClick={onSaveClick} startIcon={ButtonIcon} disabled={ !(viewHelperProps.mode === 'edit' || checkDirtyOnEnableSave ? dirty : true) || saving || Boolean(formErr.name) || !formReady}>
|
||||||
{props.customSaveBtnName ? gettext(props.customSaveBtnName) : gettext('Save')}
|
{props.customSaveBtnName ? gettext(props.customSaveBtnName) : gettext('Save')}
|
||||||
</PrimaryButton>
|
</PrimaryButton>
|
||||||
</Box>
|
</Box>
|
||||||
@ -812,6 +812,7 @@ SchemaDialogView.propTypes = {
|
|||||||
customSaveBtnIconType: PropTypes.string,
|
customSaveBtnIconType: PropTypes.string,
|
||||||
formClassName: CustomPropTypes.className,
|
formClassName: CustomPropTypes.className,
|
||||||
Notifier: PropTypes.object,
|
Notifier: PropTypes.object,
|
||||||
|
checkDirtyOnEnableSave: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
const usePropsStyles = makeStyles((theme)=>({
|
const usePropsStyles = makeStyles((theme)=>({
|
||||||
|
@ -145,6 +145,7 @@ export default function FilterDialog({onClose, onSave}) {
|
|||||||
disableDialogHelp={true}
|
disableDialogHelp={true}
|
||||||
isTabView={false}
|
isTabView={false}
|
||||||
formClassName={classes.root}
|
formClassName={classes.root}
|
||||||
|
checkDirtyOnEnableSave={true}
|
||||||
/>
|
/>
|
||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user