mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 11:49:23 +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);
|
||||
};
|
||||
|
||||
const onDelete = (urn: string) => {
|
||||
const onDelete = (urn: string, role: OwnershipType) => {
|
||||
const updatedOwners = owners
|
||||
.filter((owner) => !(owner.owner.urn === urn))
|
||||
.filter((owner) => !(owner.owner.urn === urn && owner.type === role))
|
||||
.map((owner) => ({
|
||||
owner: owner.owner.urn,
|
||||
type: owner.type,
|
||||
}));
|
||||
|
||||
updateOwnership({ owners: updatedOwners });
|
||||
};
|
||||
|
||||
@ -291,7 +292,11 @@ export const Ownership: React.FC<Props> = ({ owners, lastModifiedAt, updateOwner
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button type="link" style={{ color: 'red' }} onClick={() => onDelete(record.urn)}>
|
||||
<Button
|
||||
type="link"
|
||||
style={{ color: 'red' }}
|
||||
onClick={() => onDelete(record.urn, record.role)}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user