mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Fixed an issue where row count notification was disappearing automatically. #5647
This commit is contained in:
parent
34e409f313
commit
67bc0c23ef
@ -279,7 +279,7 @@ define('pgadmin.node.table', [
|
||||
type:'GET',
|
||||
})
|
||||
.done(function(res) {
|
||||
Notify.success(res.info);
|
||||
Notify.success(res.info, undefined, true);
|
||||
d.rows_cnt = res.data.total_rows;
|
||||
t.unload(i);
|
||||
t.setInode(i);
|
||||
|
@ -210,6 +210,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
|
||||
key={itemNodeData?._id}
|
||||
formType={formType}
|
||||
getInitData={initData}
|
||||
updatedData={{rows_cnt: itemNodeData?.rows_cnt}}
|
||||
schema={schema}
|
||||
viewHelperProps={viewHelperProps}
|
||||
onSave={onSaveClick}
|
||||
|
@ -866,7 +866,7 @@ const usePropsStyles = makeStyles((theme)=>({
|
||||
|
||||
/* If its the properties tab */
|
||||
function SchemaPropertiesView({
|
||||
getInitData, viewHelperProps, schema={}, ...props}) {
|
||||
getInitData, viewHelperProps, schema={}, updatedData, ...props}) {
|
||||
const classes = usePropsStyles();
|
||||
let defaultTab = 'General';
|
||||
let tabs = {};
|
||||
@ -890,6 +890,14 @@ function SchemaPropertiesView({
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(()=>{
|
||||
if(updatedData) {
|
||||
setOrigData(prevData => ({
|
||||
...prevData,
|
||||
...updatedData
|
||||
}));
|
||||
}
|
||||
},[updatedData]);
|
||||
|
||||
/* A simple loop to get all the controls for the fields */
|
||||
schema.fields.forEach((field)=>{
|
||||
@ -1008,6 +1016,7 @@ function SchemaPropertiesView({
|
||||
|
||||
SchemaPropertiesView.propTypes = {
|
||||
getInitData: PropTypes.func.isRequired,
|
||||
updatedData: PropTypes.object,
|
||||
viewHelperProps: PropTypes.shape({
|
||||
mode: PropTypes.string.isRequired,
|
||||
serverInfo: PropTypes.shape({
|
||||
|
@ -26,6 +26,7 @@ import pgWindow from 'sources/window';
|
||||
import ModalProvider, { useModal } from './ModalProvider';
|
||||
|
||||
const AUTO_HIDE_DURATION = 3000; // In milliseconds
|
||||
const PERSIST_SNACK_BAR = false; // Snackbar stays on the screen, unless it is dismissed
|
||||
|
||||
let snackbarRef;
|
||||
let notifierInitialized = false;
|
||||
@ -119,34 +120,35 @@ AlertContent.propTypes = {
|
||||
|
||||
|
||||
let Notifier = {
|
||||
success(msg, autoHideDuration = AUTO_HIDE_DURATION) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration);
|
||||
success(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration, persist);
|
||||
},
|
||||
warning(msg, autoHideDuration = AUTO_HIDE_DURATION) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration);
|
||||
warning(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration, persist);
|
||||
},
|
||||
info(msg, autoHideDuration = AUTO_HIDE_DURATION) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration);
|
||||
info(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration, persist);
|
||||
},
|
||||
error(msg, autoHideDuration = AUTO_HIDE_DURATION) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration);
|
||||
error(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
|
||||
this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration, persist);
|
||||
},
|
||||
notify(content, autoHideDuration) {
|
||||
notify(content, autoHideDuration, persist) {
|
||||
if (content) {
|
||||
if(!notifierInitialized) {
|
||||
initializeNotifier();
|
||||
}
|
||||
let options = {autoHideDuration, content:(key) => (
|
||||
<FinalNotifyContent>{React.cloneElement(content, {onClose:()=>{snackbarRef.closeSnackbar(key);}})}</FinalNotifyContent>
|
||||
)};
|
||||
), persist};
|
||||
options.content.displayName = 'content';
|
||||
snackbarRef.enqueueSnackbar(null, options);
|
||||
}
|
||||
},
|
||||
_callNotify(msg, type, autoHideDuration) {
|
||||
_callNotify(msg, type, autoHideDuration, persist) {
|
||||
this.notify(
|
||||
<NotifierMessage style={{maxWidth: '50vw'}} type={type} message={msg} closable={true} />,
|
||||
autoHideDuration
|
||||
autoHideDuration,
|
||||
persist
|
||||
);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user