Skip to content

Commit

Permalink
feat(ownership): add button to copy urn of an Ownership Type (datahub…
Browse files Browse the repository at this point in the history
  • Loading branch information
Salman-Apptware authored Dec 13, 2023
1 parent eb8cbd8 commit 5af799e
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -106,13 +110,25 @@ export const ActionsColumn = ({ ownershipType, setIsOpen, setOwnershipType, refe
</Popconfirm>
),
},
{
key: 'copy',
icon: (
<MenuButtonContainer>
<CopyOutlined />
<MenuButtonText>Copy Urn</MenuButtonText>
</MenuButtonContainer>
),
},
];

const onClick: MenuProps['onClick'] = (e) => {
const key = e.key as string;
if (key === 'edit') {
editOnClick();
}
else if( key === 'copy') {
onCopy();
}
};

const menuProps: MenuProps = {
Expand Down

0 comments on commit 5af799e

Please sign in to comment.