Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality to copy fieldpath and urn of each column #6398

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import React from 'react';
import { VscGraphLeft } from 'react-icons/vsc';
import { CopyOutlined } from '@ant-design/icons';
import styled from 'styled-components/macro';
import { Dropdown, Menu } from 'antd';
import { MenuIcon } from '../../../../EntityDropdown/EntityDropdown';
import { useRouteToTab } from '../../../../EntityContext';
import { useEntityData, useRouteToTab } from '../../../../EntityContext';
import { SchemaField } from '../../../../../../../types.generated';

export const ImpactAnalysisIcon = styled(VscGraphLeft)`
transform: scaleX(-1);
font-size: 18px;
`;

export const CopyOutlinedIcon = styled(CopyOutlined)`
transform: scaleX(-1);
font-size: 16px;
`;

const MenuItem = styled.div`
align-items: center;
display: flex;
Expand All @@ -25,6 +31,7 @@ interface Props {

export default function MenuColumn({ field }: Props) {
const routeToTab = useRouteToTab();
const { urn } = useEntityData();

return (
<Dropdown
Expand All @@ -37,6 +44,28 @@ export default function MenuColumn({ field }: Props) {
<ImpactAnalysisIcon /> &nbsp; See Column Lineage
</MenuItem>
</Menu.Item>
{navigator.clipboard && (
<Menu.Item key="1">
<MenuItem
onClick={() => {
navigator.clipboard.writeText(field.fieldPath);
}}
>
<CopyOutlinedIcon /> &nbsp; Copy Column Field Path
</MenuItem>
</Menu.Item>
)}
{navigator.clipboard && (
<Menu.Item key="2">
<MenuItem
onClick={() => {
navigator.clipboard.writeText(urn);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that this is going to copy the entity urn not the column urn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Using generateSchemaFieldUrn function to get the URN of the column.

}}
>
<CopyOutlinedIcon /> &nbsp; Copy Column Urn
</MenuItem>
</Menu.Item>
)}
</Menu>
}
trigger={['click']}
Expand Down