Files
pgadmin4/web/pgadmin/static/js/SchemaView/SchemaView.jsx
Ashesh Vashi 52af8d3e49 Introduce custom React Hook useSchemaState to simplify SchemaView component. #7776
Changes include: 
- Simplify current SchemaView code
- Add ability to reuse the schema data & state management implementation outside the SchemaDialogView component.
- Further split components in small and manageable separate files.
- Removed the 'DepListenerContext' context as there was no need for separate context.
- Added a reload functionality in the 'useSchemaState'
- Changes in feature tests.
2024-08-02 09:59:01 +05:30

35 lines
881 B
JavaScript

/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import React from 'react';
import PropTypes from 'prop-types';
import ErrorBoundary from 'sources/helpers/ErrorBoundary';
import SchemaDialogView from './SchemaDialogView';
import SchemaPropertiesView from './SchemaPropertiesView';
export default function SchemaView({formType, ...props}) {
/* Switch the view based on formType */
return (
<ErrorBoundary>
{
formType === 'tab' ?
<SchemaPropertiesView {...props}/> : <SchemaDialogView {...props}/>
}
</ErrorBoundary>
);
}
SchemaView.propTypes = {
formType: PropTypes.oneOf(['tab', 'dialog']),
};