Fixed an issue while saving grant wizard data with user-defined functions. Fixes #6826

This commit is contained in:
Nikhil Mohite 2021-09-30 10:56:51 +05:30 committed by Akshay Joshi
parent 8ac38a076b
commit 3da85f415d
2 changed files with 50 additions and 2 deletions

View File

@ -100,11 +100,38 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
},
{
Header: 'Name',
accessor: 'name',
accessor: 'name_with_args',
sortble: true,
resizable: true,
disableGlobalFilter: false,
minWidth: 280
},
{
Header: 'parameters',
accessor: 'proargs',
sortble: false,
resizable: false,
disableGlobalFilter: false,
minWidth: 280,
isVisible: false
},
{
Header: 'Name',
accessor: 'name',
sortble: false,
resizable: false,
disableGlobalFilter: false,
minWidth: 280,
isVisible: false
},
{
Header: 'ID',
accessor: 'oid',
sortble: false,
resizable: false,
disableGlobalFilter: false,
minWidth: 280,
isVisible: false
}
];
var steps = ['Object Selection', 'Privilege Selection', 'Review Selection'];
@ -168,6 +195,11 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
element['icon'] = {
'object_type': element.icon
};
if(element.object_type === 'Function') {
element.name_with_args = element.name + '(' + (typeof(element.proargs) != 'undefined' ? element.proargs : '') + ')';
} else {
element.name_with_args = element.name;
}
});
setTableData(data);
setLoaderText('');

View File

@ -118,7 +118,8 @@ export default function PgTable({ columns, data, isSelectRow, ...props }) {
prepareRow,
selectedFlatRows,
state: { selectedRowIds },
setGlobalFilter
setGlobalFilter,
setHiddenColumns
} = useTable(
{
columns,
@ -170,6 +171,21 @@ export default function PgTable({ columns, data, isSelectRow, ...props }) {
}
);
React.useEffect(() => {
setHiddenColumns(
columns
.filter((column) => {
if (column.isVisible === undefined || columns.isVisible === true) {
return false;
} else{
return true;
}
}
)
.map((column) => column.accessor)
);
}, [setHiddenColumns, columns]);
React.useEffect(() => {
if (props.setSelectedRows) {
props.setSelectedRows(selectedFlatRows);