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:
Nikhil Mohite 2022-10-20 16:22:40 +05:30 committed by GitHub
parent dd25bb0fff
commit b4fcb61d64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -447,7 +447,7 @@ function prepareData(val, createMode=false) {
/* If its the dialog */
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();
/* Some useful states */
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}>
{gettext('Reset')}
</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')}
</PrimaryButton>
</Box>
@ -812,6 +812,7 @@ SchemaDialogView.propTypes = {
customSaveBtnIconType: PropTypes.string,
formClassName: CustomPropTypes.className,
Notifier: PropTypes.object,
checkDirtyOnEnableSave: PropTypes.bool,
};
const usePropsStyles = makeStyles((theme)=>({

View File

@ -145,6 +145,7 @@ export default function FilterDialog({onClose, onSave}) {
disableDialogHelp={true}
isTabView={false}
formClassName={classes.root}
checkDirtyOnEnableSave={true}
/>
</>);
}