mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-24 22:18:41 +00:00
Fix(UI): Fixed policy implementation issues with team details page (#7133)
* Fixed policy implementation issues with team details page * Worked on comments
This commit is contained in:
parent
6b61c43a0a
commit
0efcf38917
@ -11,10 +11,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Button } from 'antd';
|
||||
import { Button, Tooltip } from 'antd';
|
||||
import Table, { ColumnsType } from 'antd/lib/table';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { NO_PERMISSION_FOR_ACTION } from '../../constants/HelperTextUtil';
|
||||
import { EntityType } from '../../enums/entity.enum';
|
||||
import { EntityReference } from '../../generated/type/entityReference';
|
||||
import { getEntityName } from '../../utils/CommonUtils';
|
||||
@ -29,10 +30,12 @@ const ListEntities = ({
|
||||
list,
|
||||
type,
|
||||
onDelete,
|
||||
hasAccess,
|
||||
}: {
|
||||
list: EntityReference[];
|
||||
type: EntityType;
|
||||
onDelete: (record: EntityReference) => void;
|
||||
hasAccess: boolean;
|
||||
}) => {
|
||||
const columns: ColumnsType<EntityReference> = useMemo(() => {
|
||||
return [
|
||||
@ -82,12 +85,21 @@ const ListEntities = ({
|
||||
key: 'actions',
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<Button
|
||||
data-testid={`remove-action-${getEntityName(record)}`}
|
||||
type="text"
|
||||
onClick={() => onDelete(record)}>
|
||||
<SVGIcons alt="remove" icon={Icons.ICON_REMOVE} title="Remove" />
|
||||
</Button>
|
||||
<Tooltip
|
||||
placement="bottomRight"
|
||||
title={hasAccess ? 'Remove' : NO_PERMISSION_FOR_ACTION}>
|
||||
<Button
|
||||
data-testid={`remove-action-${getEntityName(record)}`}
|
||||
disabled={!hasAccess}
|
||||
type="text"
|
||||
onClick={() => onDelete(record)}>
|
||||
<SVGIcons
|
||||
alt="remove"
|
||||
icon={Icons.ICON_REMOVE}
|
||||
title="Remove"
|
||||
/>
|
||||
</Button>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
@ -874,6 +874,7 @@ const TeamDetailsV1 = ({
|
||||
Add Role
|
||||
</ButtonAntd>
|
||||
<ListEntities
|
||||
hasAccess={entityPermissions.EditAll}
|
||||
list={currentTeam.defaultRoles || []}
|
||||
type={EntityType.ROLE}
|
||||
onDelete={(record) =>
|
||||
@ -904,6 +905,7 @@ const TeamDetailsV1 = ({
|
||||
Add Policy
|
||||
</ButtonAntd>
|
||||
<ListEntities
|
||||
hasAccess={entityPermissions.EditAll}
|
||||
list={currentTeam.policies || []}
|
||||
type={EntityType.POLICY}
|
||||
onDelete={(record) =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user