Fix linter errors in previous commit.

This commit is contained in:
Aditya Toshniwal 2021-07-05 15:58:09 +05:30 committed by Akshay Joshi
parent 6b9e8c3039
commit bd5536dbf9
4 changed files with 14 additions and 8 deletions

View File

@ -394,7 +394,7 @@ export default function DataGridView({
<FormView value={row.original} viewHelperProps={viewHelperProps} formErr={formErr} dataDispatch={dataDispatch}
schema={schemaRef.current} accessPath={accessPath.concat([row.index])} isNested={true} className={classes.expandedForm}/>
}
</React.Fragment>
</React.Fragment>;
})}
</div>
</div>
@ -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,

View File

@ -267,4 +267,5 @@ FormView.propTypes = {
getSQLValue: PropTypes.func,
onTabChange: PropTypes.func,
firstEleRef: CustomPropTypes.ref,
className: CustomPropTypes.className,
};

View File

@ -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.

View File

@ -442,7 +442,7 @@ const customReactSelectStyles = (theme, readonly)=>({
...provided,
padding: '0rem 0.25rem',
}),
valueContainer: (provided, state)=>({
valueContainer: (provided)=>({
...provided,
padding: theme.otherVars.reactSelect.padding,
}),