feat(ownership): add button to copy urn of an Ownership Type (#9452)

This commit is contained in:
Salman-Apptware 2023-12-13 14:31:24 +05:30 committed by GitHub
parent eb8cbd8b41
commit 5af799ee89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Dropdown, MenuProps, Popconfirm, Typography, message, notification } from 'antd';
import { DeleteOutlined, EditOutlined, MoreOutlined } from '@ant-design/icons';
import { CopyOutlined, DeleteOutlined, EditOutlined, MoreOutlined } from '@ant-design/icons';
import styled from 'styled-components/macro';
import { OwnershipTypeEntity } from '../../../../types.generated';
import { useDeleteOwnershipTypeMutation } from '../../../../graphql/ownership.generated';
@ -48,6 +48,10 @@ export const ActionsColumn = ({ ownershipType, setIsOpen, setOwnershipType, refe
setOwnershipType(ownershipType);
};
const onCopy=() => {
navigator.clipboard.writeText(ownershipType.urn);
}
const [deleteOwnershipTypeMutation] = useDeleteOwnershipTypeMutation();
const onDelete = () => {
@ -106,6 +110,15 @@ export const ActionsColumn = ({ ownershipType, setIsOpen, setOwnershipType, refe
</Popconfirm>
),
},
{
key: 'copy',
icon: (
<MenuButtonContainer>
<CopyOutlined />
<MenuButtonText>Copy Urn</MenuButtonText>
</MenuButtonContainer>
),
},
];
const onClick: MenuProps['onClick'] = (e) => {
@ -113,6 +126,9 @@ export const ActionsColumn = ({ ownershipType, setIsOpen, setOwnershipType, refe
if (key === 'edit') {
editOnClick();
}
else if( key === 'copy') {
onCopy();
}
};
const menuProps: MenuProps = {