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,
tigger_count=row['triggercount'],
has_enable_triggers=row['has_enable_triggers'],
is_partitioned=self.is_table_partitioned(row),
rows_cnt=0
is_partitioned=self.is_table_partitioned(row)
))
return make_json_response(

View File

@ -279,7 +279,7 @@ define('pgadmin.node.table', [
type:'GET',
})
.done(function(res) {
Notify.success(res.info, undefined, true);
Notify.success(res.info, null);
d.rows_cnt = res.data.total_rows;
t.unload(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 warnOnCloseFlag = true;
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)=> {
if(err.response){
@ -210,7 +211,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo
key={itemNodeData?._id}
formType={formType}
getInitData={initData}
updatedData={{rows_cnt: itemNodeData?.rows_cnt}}
updatedData={updatedData}
schema={schema}
viewHelperProps={viewHelperProps}
onSave={onSaveClick}

View File

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

View File

@ -26,7 +26,6 @@ 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;
@ -120,35 +119,34 @@ AlertContent.propTypes = {
let Notifier = {
success(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration, persist);
success(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.SUCCESS, autoHideDuration);
},
warning(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration, persist);
warning(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.WARNING, autoHideDuration);
},
info(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration, persist);
info(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.INFO, autoHideDuration);
},
error(msg, autoHideDuration = AUTO_HIDE_DURATION, persist = PERSIST_SNACK_BAR) {
this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration, persist);
error(msg, autoHideDuration = AUTO_HIDE_DURATION) {
this._callNotify(msg, MESSAGE_TYPE.ERROR, autoHideDuration);
},
notify(content, autoHideDuration, persist) {
notify(content, autoHideDuration) {
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, persist) {
_callNotify(msg, type, autoHideDuration) {
this.notify(
<NotifierMessage style={{maxWidth: '50vw'}} type={type} message={msg} closable={true} />,
autoHideDuration,
persist
autoHideDuration
);
},