1) Fixed an issue where a warning message was shown after database creation/modification. Fixes #7142.

2) Added error boundary to schema view which will improve the exception stack trace details.
3) Fixed Jasmine test cases.
This commit is contained in:
Aditya Toshniwal 2022-01-31 13:41:22 +05:30 committed by Akshay Joshi
parent 1a89c1f85f
commit bc0b25d995
5 changed files with 50 additions and 4 deletions

View File

@ -29,3 +29,4 @@ Bug fixes
| `Issue #7126 <https://redmine.postgresql.org/issues/7126>`_ - Fixed an issue where the F2 Function key removes browser panel contents.
| `Issue #7127 <https://redmine.postgresql.org/issues/7127>`_ - Added validation for Hostname in the server dialog.
| `Issue #7135 <https://redmine.postgresql.org/issues/7135>`_ - Enforce the minimum Windows version that the installer will run on.
| `Issue #7142 <https://redmine.postgresql.org/issues/7142>`_ - Fixed an issue where a warning message was shown after database creation/modification.

View File

@ -7,6 +7,7 @@
//
//////////////////////////////////////////////////////////////
import _ from 'lodash';
import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import SecLabelSchema from '../../../static/js/sec_label.ui';
@ -203,7 +204,7 @@ export default class DatabaseSchema extends BaseUISchema {
obj.informText = undefined;
}
if(obj.origData.schema_res != state.schema_res) {
if(!_.isEqual(obj.origData.schema_res, state.schema_res)) {
obj.informText = gettext(
'Please refresh the Schemas node to make changes to the schema restriction take effect.'
);

View File

@ -38,6 +38,7 @@ import FieldSetView from './FieldSetView';
import DataGridView from './DataGridView';
import { useIsMounted } from '../custom_hooks';
import Notify from '../helpers/Notifier';
import ErrorBoundary from '../helpers/ErrorBoundary';
const useDialogStyles = makeStyles((theme)=>({
root: {
@ -947,13 +948,17 @@ export default function SchemaView({formType, ...props}) {
if(formType === 'tab') {
return (
<Theme>
<ErrorBoundary>
<SchemaPropertiesView {...props}/>
</ErrorBoundary>
</Theme>
);
}
return (
<Theme>
<ErrorBoundary>
<SchemaDialogView {...props}/>
</ErrorBoundary>
</Theme>
);
}

View File

@ -767,7 +767,8 @@ export function InputSelect({
} else {
selectedVal = _.find(flatRes, (o)=>o.selected)?.value;
}
if(!_.isUndefined(selectedVal)) {
if((!_.isUndefined(selectedVal) && !_.isArray(selectedVal)) || (_.isArray(selectedVal) && selectedVal.length != 0)) {
onChange && onChange(selectedVal);
}
setFinalOptions([res || [], false]);

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
/* https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html */
import React from 'react';
import CustomPropTypes from '../custom_prop_types';
export default class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}
componentDidCatch(error, info) {
// Display fallback UI
this.setState({ hasError: true });
// You can also log the error to an error reporting service
console.error(error, info);
}
render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return <h2>Something went wrong.</h2>;
}
return this.props.children;
}
}
ErrorBoundary.propTypes = {
children: CustomPropTypes.children,
};