forked from pgadmin-org/pgadmin4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to convert View/Edit table into a Query tool to enable ed…
…iting the SQL generated. pgadmin-org#5908
- Loading branch information
1 parent
4db13fa
commit 0458065
Showing
18 changed files
with
296 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
web/pgadmin/tools/sqleditor/static/js/components/dialogs/ConfirmPromotionContent.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState } from 'react'; | ||
import { useModalStyles } from '../../../../../../static/js/helpers/ModalProvider'; | ||
import gettext from 'sources/gettext'; | ||
import { Box, makeStyles } from '@material-ui/core'; | ||
import { DefaultButton, PrimaryButton } from '../../../../../../static/js/components/Buttons'; | ||
import CloseIcon from '@material-ui/icons/CloseRounded'; | ||
import HTMLReactParser from 'html-react-parser'; | ||
import PropTypes from 'prop-types'; | ||
import CheckRounded from '@material-ui/icons/CheckRounded'; | ||
import { InputCheckbox } from '../../../../../../static/js/components/FormComponents'; | ||
|
||
|
||
const useStyles = makeStyles(() => ({ | ||
saveChoice: { | ||
margin: '10px 0 10px 10px', | ||
} | ||
})); | ||
|
||
|
||
export default function ConfirmPromotionContent({ onContinue, onClose, closeModal, text }) { | ||
const [formData, setFormData] = useState({ | ||
save_user_choice: false | ||
}); | ||
|
||
const onDataChange = (e, id) => { | ||
let val = e; | ||
if (e?.target) { | ||
val = e.target.value; | ||
} | ||
setFormData((prev) => ({ ...prev, [id]: val })); | ||
}; | ||
const modalClasses = useModalStyles(); | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Box display="flex" flexDirection="column" height="100%"> | ||
<Box flexGrow="1" p={2}>{typeof (text) == 'string' ? HTMLReactParser(text) : text}</Box> | ||
<Box className={classes.saveChoice}> | ||
<InputCheckbox controlProps={{ label: gettext('Don\'t ask again') }} value={formData['save_user_choice']} | ||
onChange={(e) => onDataChange(e.target.checked, 'save_user_choice')} /> | ||
</Box> | ||
<Box className={modalClasses.footer}> | ||
<DefaultButton data-test="close" startIcon={<CloseIcon />} onClick={() => { | ||
onClose?.(); | ||
closeModal(); | ||
}} >{gettext('Cancel')}</DefaultButton> | ||
<PrimaryButton data-test="Continue" className={modalClasses.margin} startIcon={<CheckRounded />} onClick={() => { | ||
let postFormData = new FormData(); | ||
postFormData.append('pref_data', JSON.stringify([{ 'name': 'view_edit_promotion_warning', 'value': !formData.save_user_choice, 'module': 'sqleditor' }])); | ||
onContinue?.(postFormData); | ||
closeModal(); | ||
}} autoFocus={true} >{gettext('Continue')}</PrimaryButton> | ||
</Box> | ||
</Box> | ||
); | ||
} | ||
|
||
ConfirmPromotionContent.propTypes = { | ||
closeModal: PropTypes.func, | ||
text: PropTypes.string, | ||
onContinue: PropTypes.func, | ||
onClose: PropTypes.func | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.