From bd5536dbf95a2c7bb08f92fc4bae1117be157f26 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Mon, 5 Jul 2021 15:58:09 +0530 Subject: [PATCH] Fix linter errors in previous commit. --- .../static/js/SchemaView/DataGridView.jsx | 3 ++- web/pgadmin/static/js/SchemaView/FormView.jsx | 1 + web/pgadmin/static/js/SchemaView/index.jsx | 16 ++++++++++------ .../static/js/components/FormComponents.jsx | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/web/pgadmin/static/js/SchemaView/DataGridView.jsx b/web/pgadmin/static/js/SchemaView/DataGridView.jsx index d010cd5bf..23a69c895 100644 --- a/web/pgadmin/static/js/SchemaView/DataGridView.jsx +++ b/web/pgadmin/static/js/SchemaView/DataGridView.jsx @@ -394,7 +394,7 @@ export default function DataGridView({ } - + ; })} @@ -412,6 +412,7 @@ DataGridView.propTypes = { accessPath: PropTypes.array.isRequired, dataDispatch: PropTypes.func.isRequired, containerClassName: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), + columns: PropTypes.array, canEdit: PropTypes.bool, canAdd: PropTypes.bool, canDelete: PropTypes.bool, diff --git a/web/pgadmin/static/js/SchemaView/FormView.jsx b/web/pgadmin/static/js/SchemaView/FormView.jsx index e0b7031f3..1b78cf2bb 100644 --- a/web/pgadmin/static/js/SchemaView/FormView.jsx +++ b/web/pgadmin/static/js/SchemaView/FormView.jsx @@ -267,4 +267,5 @@ FormView.propTypes = { getSQLValue: PropTypes.func, onTabChange: PropTypes.func, firstEleRef: CustomPropTypes.ref, + className: CustomPropTypes.className, }; diff --git a/web/pgadmin/static/js/SchemaView/index.jsx b/web/pgadmin/static/js/SchemaView/index.jsx index 6a4b7e602..e1505a11a 100644 --- a/web/pgadmin/static/js/SchemaView/index.jsx +++ b/web/pgadmin/static/js/SchemaView/index.jsx @@ -91,7 +91,7 @@ function getChangedData(topSchema, mode, sessData, stringify=false) { /* If the orig value and new value are of different datatype but of same value(numeric) "no change" */ /* If the orig value is undefined or null and new value is boolean false "no change" */ if ((_.isEqual(origVal, sessVal) - || ((origVal === null || _.isUndefined(origVal)) && !Boolean(sessVal)) + || ((origVal === null || _.isUndefined(origVal)) && !sessVal) || (attrDefined ? _.isEqual(origVal.toString(), sessVal.toString()) : false)) && !force) { return; @@ -412,16 +412,19 @@ function SchemaDialogView({ setSaving(true); setLoaderText('Saving...'); /* Get the changed data */ - let data = getChangedData(schema, viewHelperProps.mode, sessData); + let changeData = {}; /* Add the id when in edit mode */ if(viewHelperProps.mode === 'edit') { - data[schema.idAttribute] = schema.origData[schema.idAttribute]; + changeData = getChangedData(schema, viewHelperProps.mode, sessData); + changeData[schema.idAttribute] = schema.origData[schema.idAttribute]; } else { /* If new then merge the changed data with origData */ - data = _.merge(schema.origData, data); + changeData = {...schema.origData}; + _.merge(changeData, sessData); } - props.onSave(isNew, data) + + props.onSave(isNew, changeData) .then(()=>{ if(schema.informText) { pgAlertify().alert( @@ -457,7 +460,8 @@ function SchemaDialogView({ changeData = getChangedData(schema, viewHelperProps.mode, sessData); } else { /* If new then merge the changed data with origData */ - changeData = _.merge(schema.origData, sessData); + changeData = {...schema.origData}; + _.merge(changeData, sessData); } /* Call the passed incoming getSQLValue func to get the SQL return of getSQLValue should be a promise. diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index 97953f97c..2307dde78 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -442,7 +442,7 @@ const customReactSelectStyles = (theme, readonly)=>({ ...provided, padding: '0rem 0.25rem', }), - valueContainer: (provided, state)=>({ + valueContainer: (provided)=>({ ...provided, padding: theme.otherVars.reactSelect.padding, }),