Incorporated review comments. #5647

This commit is contained in:
Pravesh Sharma 2023-01-02 13:30:49 +05:30 committed by GitHub
parent 18a7e85c6a
commit 33aea87dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 19 deletions

View File

@ -438,8 +438,7 @@ class TableView(BaseTableView, DataTypeReader, SchemaDiffTableCompare):
icon=icon, icon=icon,
tigger_count=row['triggercount'], tigger_count=row['triggercount'],
has_enable_triggers=row['has_enable_triggers'], has_enable_triggers=row['has_enable_triggers'],
is_partitioned=self.is_table_partitioned(row), is_partitioned=self.is_table_partitioned(row)
rows_cnt=0
)) ))
return make_json_response( return make_json_response(

View File

@ -279,7 +279,7 @@ define('pgadmin.node.table', [
type:'GET', type:'GET',
}) })
.done(function(res) { .done(function(res) {
Notify.success(res.info, undefined, true); Notify.success(res.info, null);
d.rows_cnt = res.data.total_rows; d.rows_cnt = res.data.total_rows;
t.unload(i); t.unload(i);
t.setInode(i); t.setInode(i);

View File

@ -34,6 +34,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
let isDirty = false; // usefull for warnings let isDirty = false; // usefull for warnings
let warnOnCloseFlag = true; let warnOnCloseFlag = true;
const confirmOnCloseReset = pgAdmin.Browser.get_preferences_for_module('browser').confirm_on_properties_close; const confirmOnCloseReset = pgAdmin.Browser.get_preferences_for_module('browser').confirm_on_properties_close;
let updatedData = ['table', 'partition'].includes(nodeType) && !_.isEmpty(itemNodeData.rows_cnt) ? {rows_cnt: itemNodeData.rows_cnt} : undefined;
let onError = (err)=> { let onError = (err)=> {
if(err.response){ if(err.response){
@ -210,7 +211,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
key={itemNodeData?._id} key={itemNodeData?._id}
formType={formType} formType={formType}
getInitData={initData} getInitData={initData}
updatedData={{rows_cnt: itemNodeData?.rows_cnt}} updatedData={updatedData}
schema={schema} schema={schema}
viewHelperProps={viewHelperProps} viewHelperProps={viewHelperProps}
onSave={onSaveClick} onSave={onSaveClick}

View File

@ -882,7 +882,10 @@ function SchemaPropertiesView({
data = data || {}; data = data || {};
schema.initialise(data); schema.initialise(data);
if(checkIsMounted()) { if(checkIsMounted()) {
setOrigData(data || {}); setOrigData({
...data,
...updatedData
});
setLoaderText(''); setLoaderText('');
} }
}).catch(()=>{ }).catch(()=>{

View File

@ -26,7 +26,6 @@ import pgWindow from 'sources/window';
import ModalProvider, { useModal } from './ModalProvider'; import ModalProvider, { useModal } from './ModalProvider';
const AUTO_HIDE_DURATION = 3000; // In milliseconds const AUTO_HIDE_DURATION = 3000; // In milliseconds
const PERSIST_SNACK_BAR = false; // Snackbar stays on the screen, unless it is dismissed
let snackbarRef; let snackbarRef;
let notifierInitialized = false; let notifierInitialized = false;
@ -120,35 +119,34 @@ AlertContent.propTypes = {
let Notifier = { let Notifier = {
success(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) { success(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration, persist); this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration);
}, },
warning(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) { warning(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration, persist); this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration);
}, },
info(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) { info(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration, persist); this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration);
}, },
error(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) { error(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration, persist); this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration);
}, },
notify(content, autoHideDuration, persist) { notify(content, autoHideDuration) {
if (content) { if (content) {
if(!notifierInitialized) { if(!notifierInitialized) {
initializeNotifier(); initializeNotifier();
} }
let options = {autoHideDuration, content:(key) => ( let options = {autoHideDuration, content:(key) => (
<FinalNotifyContent>{React.cloneElement(content, {onClose:()=>{snackbarRef.closeSnackbar(key);}})}</FinalNotifyContent> <FinalNotifyContent>{React.cloneElement(content, {onClose:()=>{snackbarRef.closeSnackbar(key);}})}</FinalNotifyContent>
), persist}; )};
options.content.displayName = 'content'; options.content.displayName = 'content';
snackbarRef.enqueueSnackbar(null, options); snackbarRef.enqueueSnackbar(null, options);
} }
}, },
_callNotify(msg, type, autoHideDuration, persist) { _callNotify(msg, type, autoHideDuration) {
this.notify( this.notify(
<NotifierMessage style={{maxWidth: '50vw'}} type={type} message={msg} closable={true} />, <NotifierMessage style={{maxWidth: '50vw'}} type={type} message={msg} closable={true} />,
autoHideDuration, autoHideDuration
persist
); );
}, },