mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue where delete button in Users data was enabled for incorrect rows. #7616
This commit is contained in:
parent
d0b2752fea
commit
44d40f0785
@ -45,4 +45,5 @@ Bug fixes
|
|||||||
| `Issue #7542 <https://github.com/pgadmin-org/pgadmin4/issues/7542>`_ - Fixed incorrect sorting of size in statistics tab.
|
| `Issue #7542 <https://github.com/pgadmin-org/pgadmin4/issues/7542>`_ - Fixed incorrect sorting of size in statistics tab.
|
||||||
| `Issue #7555 <https://github.com/pgadmin-org/pgadmin4/issues/7555>`_ - Fixed an issue where query tool shortcuts for find/replace are not working.
|
| `Issue #7555 <https://github.com/pgadmin-org/pgadmin4/issues/7555>`_ - Fixed an issue where query tool shortcuts for find/replace are not working.
|
||||||
| `Issue #7556 <https://github.com/pgadmin-org/pgadmin4/issues/7556>`_ - Fixed migration failure while using external database.
|
| `Issue #7556 <https://github.com/pgadmin-org/pgadmin4/issues/7556>`_ - Fixed migration failure while using external database.
|
||||||
| `Issue #7593 <https://github.com/pgadmin-org/pgadmin4/issues/7593>`_ - Fixed an issue where query tool auto-complete stops working after connection change.
|
| `Issue #7593 <https://github.com/pgadmin-org/pgadmin4/issues/7593>`_ - Fixed an issue where query tool auto-complete stops working after connection change.
|
||||||
|
| `Issue #7616 <https://github.com/pgadmin-org/pgadmin4/issues/7616>`_ - Fixed an issue where delete button in Users data was enabled for incorrect rows.
|
@ -139,7 +139,7 @@ function DataTableRow({index, row, totalRows, isResizing, isHovered, schema, sch
|
|||||||
* If table data changes, then react-table re-renders the complete tables
|
* If table data changes, then react-table re-renders the complete tables
|
||||||
* We can avoid re-render by if row data is not changed
|
* We can avoid re-render by if row data is not changed
|
||||||
*/
|
*/
|
||||||
let depsMap = _.values(row.original, Object.keys(row.original).filter((k)=>!k.startsWith('btn')));
|
let depsMap = [JSON.stringify(row.original)];
|
||||||
const externalDeps = useMemo(()=>{
|
const externalDeps = useMemo(()=>{
|
||||||
let retVal = [];
|
let retVal = [];
|
||||||
/* Calculate the fields which depends on the current field
|
/* Calculate the fields which depends on the current field
|
||||||
@ -241,7 +241,7 @@ function DataTableRow({index, row, totalRows, isResizing, isHovered, schema, sch
|
|||||||
drop(rowRef);
|
drop(rowRef);
|
||||||
|
|
||||||
return useMemo(()=>
|
return useMemo(()=>
|
||||||
<PgReactTableRowContent ref={rowRef} row={row} data-handler-id={handlerId} className={isHovered ? 'DataGridView-tableRowHovered' : null} data-test='data-table-row' style={{position: 'initial'}}>
|
<PgReactTableRowContent ref={rowRef} data-handler-id={handlerId} className={isHovered ? 'DataGridView-tableRowHovered' : null} data-test='data-table-row' style={{position: 'initial'}}>
|
||||||
{row.getVisibleCells().map((cell) => {
|
{row.getVisibleCells().map((cell) => {
|
||||||
let {modeSupported} = cell.column.field ? getFieldMetaData(cell.column.field, schemaRef.current, {}, viewHelperProps) : {modeSupported: true};
|
let {modeSupported} = cell.column.field ? getFieldMetaData(cell.column.field, schemaRef.current, {}, viewHelperProps) : {modeSupported: true};
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ export default function DataGridView({
|
|||||||
cell: ({row})=>{
|
cell: ({row})=>{
|
||||||
let canEditRow = true;
|
let canEditRow = true;
|
||||||
if(props.canEditRow) {
|
if(props.canEditRow) {
|
||||||
canEditRow = evalFunc(schemaRef.current, props.canEditRow, row || {});
|
canEditRow = evalFunc(schemaRef.current, props.canEditRow, row.original || {});
|
||||||
}
|
}
|
||||||
return <PgIconButton data-test="expand-row" title={gettext('Edit row')} icon={<EditRoundedIcon fontSize="small" />} className='DataGridView-gridRowButton'
|
return <PgIconButton data-test="expand-row" title={gettext('Edit row')} icon={<EditRoundedIcon fontSize="small" />} className='DataGridView-gridRowButton'
|
||||||
onClick={()=>{
|
onClick={()=>{
|
||||||
@ -376,7 +376,7 @@ export default function DataGridView({
|
|||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
let canDeleteRow = true;
|
let canDeleteRow = true;
|
||||||
if(props.canDeleteRow) {
|
if(props.canDeleteRow) {
|
||||||
canDeleteRow = evalFunc(schemaRef.current, props.canDeleteRow, row || {});
|
canDeleteRow = evalFunc(schemaRef.current, props.canDeleteRow, row.original || {});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -392,7 +392,7 @@ export default function DataGridView({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (props.onDelete){
|
if (props.onDelete){
|
||||||
props.onDelete(row || {}, deleteRow);
|
props.onDelete(row.original || {}, deleteRow);
|
||||||
} else {
|
} else {
|
||||||
pgAdmin.Browser.notifier.confirm(
|
pgAdmin.Browser.notifier.confirm(
|
||||||
props.customDeleteTitle || gettext('Delete Row'),
|
props.customDeleteTitle || gettext('Delete Row'),
|
||||||
|
Loading…
Reference in New Issue
Block a user