-
- {steps.map((label, index) => (
-
- {index + 1}
- {label}
- {index === activeStep ? : null}
-
- ))}
-
-
-
- {
- React.Children.map(props.children, (child) => {
- return (
-
- {child}
-
- );
- })
- }
-
+
+ {props.title}
+
+
+
+ {steps.map((label, index) => (
+
+ {index + 1}
+ {label}
+ {index === activeStep ? : null}
+
+ ))}
+
+
+ {
+ React.Children.map(props.children, (child) => {
+ return (
+
+ {child}
+
+ );
+ })
+ }
+
+
+
+
+ props.onHelp()} icon={} title="Help for this dialog."
+ disabled={props.disableDialogHelp} />
+
+
+ }>
+ {gettext('Back')}
+
+ handleNext()} className={classes.buttonMargin} startIcon={} disabled={activeStep == steps.length - 1 || disableNext}>
+ {gettext('Next')}
+
+ } disabled={activeStep == steps.length - 1 ? false : true} onClick={onSave}>
+ {gettext('Finish')}
+
+
-
-
- props.onHelp()} icon={} title="Help for this dialog."
- disabled={props.disableDialogHelp} />
-
-
- }>
- {gettext('Back')}
-
- handleNext()} className={classes.buttonMargin} startIcon={} disabled={activeStep == steps.length - 1 || disableNext}>
- {gettext('Next')}
-
- } disabled={activeStep == steps.length - 1 ? false : true} onClick={onSave}>
- {gettext('Finish')}
-
-
-
-
+
);
}
@@ -208,6 +232,7 @@ export default Wizard;
Wizard.propTypes = {
props: PropTypes.object,
+ title: PropTypes.string,
stepList: PropTypes.array,
onSave: PropTypes.func,
onHelp: PropTypes.func,
diff --git a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx
index 86b1f1237..e961b8ac0 100644
--- a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx
+++ b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx
@@ -29,31 +29,9 @@ import Notify from '../../../../static/js/helpers/Notifier';
const useStyles = makeStyles(() =>
({
- grantWizardStep: {
+ root: {
height: '100%'
},
- grantWizardTitle: {
- top: '0 !important',
- opacity: '1 !important',
- borderRadius: '6px 6px 0px 0px !important',
- margin: '0 !important',
- width: '100%',
- height: '6%'
- },
- grantWizardContent: {
- height: '94% !important'
- },
- stepPanelCss: {
- height: 500,
- overflow: 'hidden'
- },
- objectSelection: {
- display: 'flex',
- flexDirection: 'column',
- height: '100%',
- overflow: 'hidden',
- marginBottom: '1em'
- },
searchBox: {
marginBottom: '1em',
display: 'flex',
@@ -67,16 +45,16 @@ const useStyles = makeStyles(() =>
borderLeft: 'none',
paddingLeft: 5
},
- grantWizardPanelContent: {
- paddingTop: '0.9em !important',
- overflow: 'hidden'
- },
grantWizardSql: {
height: '90% !important',
width: '100%'
},
privilegeStep: {
height: '100%',
+ overflow: 'auto'
+ },
+ panelContent: {
+ height: '100%'
}
}),
);
@@ -139,7 +117,6 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
const [selectedObject, setSelectedObject] = React.useState([]);
const [selectedAcl, setSelectedAcl] = React.useState({});
const [msqlData, setSQL] = React.useState('');
- const [stepType, setStepType] = React.useState('');
const [searchVal, setSearchVal] = React.useState('');
const [loaderText, setLoaderText] = React.useState('');
const [tablebData, setTableData] = React.useState([]);
@@ -213,12 +190,6 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
const wizardStepChange = (data) => {
switch (data.currentStep) {
- case 0:
- setStepType('object_type');
- break;
- case 1:
- setStepType('privileges');
- break;
case 2:
setLoaderText('Loading SQL ...');
var msql_url = url_for(
@@ -240,7 +211,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
});
break;
default:
- setStepType('');
+ break;
}
};
@@ -258,7 +229,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
api.post(_url, post_data)
.then(() => {
setLoaderText('');
- Alertify.wizardDialog().close();
+ Alertify.grantWizardDialog().close();
})
.catch((error) => {
setLoaderText('');
@@ -266,9 +237,9 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
});
};
- const disableNextCheck = () => {
- return selectedObject.length > 0 && stepType === 'object_type' ?
- false : selectedAcl?.privilege?.length > 0 && stepType === 'privileges' ? validatePrivilege() : true;
+ const disableNextCheck = (stepId) => {
+ return selectedObject.length > 0 && stepId === 0 ?
+ false : selectedAcl?.privilege?.length > 0 && stepId === 1 ? validatePrivilege() : true;
};
const onDialogHelp= () => {
@@ -334,21 +305,17 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
});
return (
- <>
-
{gettext('Grant Wizard')}
+
-
+
-
-
+
+
+
+
+ className={clsx(classes.privilegeStep)}>
{privSchemaInstance &&
- { }}
- viewHelperProps={{ mode: 'create' }}
- schema={privSchemaInstance}
- showFooter={false}
- isTabView={false}
- onDataChange={(isChanged, changedData) => {
- setSelectedAcl(changedData);
- }}
- />
+ { }}
+ viewHelperProps={{ mode: 'create' }}
+ schema={privSchemaInstance}
+ showFooter={false}
+ isTabView={false}
+ onDataChange={(isChanged, changedData) => {
+ setSelectedAcl(changedData);
+ }}
+ />
}
+ stepId={2}>
{gettext('The SQL below will be executed on the database server to grant the selected privileges. Please click on Finish to complete the process.')}
- >
+
);
}