mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-11 00:42:29 +00:00
fix(react): Removing a user having multiple role from owner tab also remove the other roles associated to that user (#2570)
* 2567 | Removing a user having multiple role from owner tab also remove the other roles associated to that user
This commit is contained in:
parent
4958febed5
commit
a5dfa7fa62
@ -105,13 +105,14 @@ export const Ownership: React.FC<Props> = ({ owners, lastModifiedAt, updateOwner
|
|||||||
setStagedOwners(newStagedOwners);
|
setStagedOwners(newStagedOwners);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDelete = (urn: string) => {
|
const onDelete = (urn: string, role: OwnershipType) => {
|
||||||
const updatedOwners = owners
|
const updatedOwners = owners
|
||||||
.filter((owner) => !(owner.owner.urn === urn))
|
.filter((owner) => !(owner.owner.urn === urn && owner.type === role))
|
||||||
.map((owner) => ({
|
.map((owner) => ({
|
||||||
owner: owner.owner.urn,
|
owner: owner.owner.urn,
|
||||||
type: owner.type,
|
type: owner.type,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
updateOwnership({ owners: updatedOwners });
|
updateOwnership({ owners: updatedOwners });
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -291,7 +292,11 @@ export const Ownership: React.FC<Props> = ({ owners, lastModifiedAt, updateOwner
|
|||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button type="link" style={{ color: 'red' }} onClick={() => onDelete(record.urn)}>
|
<Button
|
||||||
|
type="link"
|
||||||
|
style={{ color: 'red' }}
|
||||||
|
onClick={() => onDelete(record.urn, record.role)}
|
||||||
|
>
|
||||||
Remove
|
Remove
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user