Fixed review comments for Grant Wizard.

refs #6687
This commit is contained in:
Nikhil Mohite 2021-09-23 14:40:38 +05:30 committed by Akshay Joshi
parent 19f0181756
commit 15a494c189
7 changed files with 16 additions and 17 deletions

View File

@ -13,18 +13,18 @@ import url_for from 'sources/url_for';
import React from 'react'; import React from 'react';
import { Box } from '@material-ui/core'; import { Box } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from '@material-ui/core/styles';
import Wizard from '../../../../browser/static/js/WizardView'; import Wizard from '../helpers/wizard/Wizard';
import WizardStep from '../../../../browser/static/js/WizardStep'; import WizardStep from '../helpers/wizard/WizardStep';
import PgTable from '../../../../browser/static/js/PgTable'; import PgTable from 'sources/components/PgTable';
import { getNodePrivilegeRoleSchema } from '../../../../browser/server_groups/servers/static/js/privilege.ui.js'; import { getNodePrivilegeRoleSchema } from '../../../browser/server_groups/servers/static/js/privilege.ui.js';
import { InputSQL, InputText, FormFooterMessage, MESSAGE_TYPE } from '../../../../static/js/components/FormComponents'; import { InputSQL, InputText, FormFooterMessage, MESSAGE_TYPE } from './FormComponents';
import getApiInstance from '../../../../static/js/api_instance'; import getApiInstance from '../api_instance';
import SchemaView from '../../../../static/js/SchemaView'; import SchemaView from '../SchemaView';
import clsx from 'clsx'; import clsx from 'clsx';
import Loader from 'sources/components/Loader'; import Loader from 'sources/components/Loader';
import Alertify from 'pgadmin.alertifyjs'; import Alertify from 'pgadmin.alertifyjs';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import PrivilegeSchema from './privilege_schema.ui'; import PrivilegeSchema from '../../../tools/grant_wizard/static/js/privilege_schema.ui';
const useStyles = makeStyles(() => const useStyles = makeStyles(() =>
({ ({
@ -230,9 +230,9 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
setLoaderText(''); setLoaderText('');
Alertify.wizardDialog().close(); Alertify.wizardDialog().close();
}) })
.catch(() => { .catch((error) => {
setLoaderText(''); setLoaderText('');
Alertify.error(gettext('Error while saving grant wizard data.')); Alertify.error(gettext(`Error while saving grant wizard data: ${error.response.data.errormsg}`));
}); });
}; };

View File

@ -73,7 +73,7 @@ const useStyles = makeStyles((theme) => ({
}), }),
); );
export default function pgTable({ columns, data, isSelectRow, ...props }) { export default function PgTable({ columns, data, isSelectRow, ...props }) {
// Use the state and functions returned from useTable to build your UI // Use the state and functions returned from useTable to build your UI
const classes = useStyles(); const classes = useStyles();
const defaultColumn = React.useMemo( const defaultColumn = React.useMemo(
@ -274,7 +274,7 @@ const scrollbarWidth = () => {
return scrollbarWidth; return scrollbarWidth;
}; };
pgTable.propTypes = { PgTable.propTypes = {
stepId: PropTypes.number, stepId: PropTypes.number,
height: PropTypes.number, height: PropTypes.number,
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),

View File

@ -6,7 +6,7 @@ import FastRewindIcon from '@material-ui/icons/FastRewind';
import ChevronRightIcon from '@material-ui/icons/ChevronRight'; import ChevronRightIcon from '@material-ui/icons/ChevronRight';
import HelpIcon from '@material-ui/icons/HelpRounded'; import HelpIcon from '@material-ui/icons/HelpRounded';
import CheckIcon from '@material-ui/icons/Check'; import CheckIcon from '@material-ui/icons/Check';
import { DefaultButton, PrimaryButton, PgIconButton } from '../../../static/js/components/Buttons'; import { DefaultButton, PrimaryButton, PgIconButton } from '../../../../static/js/components/Buttons';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Box } from '@material-ui/core'; import { Box } from '@material-ui/core';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';

View File

@ -9,7 +9,7 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Theme from 'sources/Theme'; import Theme from 'sources/Theme';
import GrantWizard from './grantWizard'; import GrantWizard from 'sources/components/GrantWizard';
// Grant Wizard // Grant Wizard

View File

@ -13,10 +13,9 @@ import '../helper/enzyme.helper';
import { createMount } from '@material-ui/core/test-utils'; import { createMount } from '@material-ui/core/test-utils';
import pgAdmin from 'sources/pgadmin'; import pgAdmin from 'sources/pgadmin';
import { messages } from '../fake_messages'; import { messages } from '../fake_messages';
// import GrantWizard from '../../../pgadmin/tools/grant_wizard/static/js/grant_wizard_view';
import Theme from 'sources/Theme'; import Theme from 'sources/Theme';
import Wizard from '../../../pgadmin/browser/static/js/WizardView'; import Wizard from '../../../pgadmin/static/js/helpers/wizard/Wizard';
import WizardStep from '../../../pgadmin/browser/static/js/WizardStep'; import WizardStep from '../../../pgadmin/static/js/helpers/wizard/WizardStep';
describe('Wizard', () => { describe('Wizard', () => {
let mount; let mount;