mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-13 01:48:33 +00:00
fea(ui): Add menu action for copying the full name of the asset (#13224)
Co-authored-by: John Joyce <john@Mac-2465.lan> Co-authored-by: John Joyce <john@Mac-1293.lan>
This commit is contained in:
parent
0817041232
commit
c9e6831f08
@ -353,6 +353,7 @@ const EntityDropdown = (props: Props) => {
|
|||||||
undefined
|
undefined
|
||||||
}
|
}
|
||||||
name={entityData?.name}
|
name={entityData?.name}
|
||||||
|
qualifiedName={entityData?.properties?.qualifiedName}
|
||||||
/>
|
/>
|
||||||
</StyledSubMenu>
|
</StyledSubMenu>
|
||||||
)}{' '}
|
)}{' '}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import CopyLinkMenuItem from '@app/shared/share/v2/items/CopyLinkMenuItem';
|
import CopyLinkMenuItem from '@app/shared/share/v2/items/CopyLinkMenuItem';
|
||||||
|
import CopyNameMenuItem from '@app/shared/share/v2/items/CopyNameMenuItem';
|
||||||
import CopyUrnMenuItem from '@app/shared/share/v2/items/CopyUrnMenuItem';
|
import CopyUrnMenuItem from '@app/shared/share/v2/items/CopyUrnMenuItem';
|
||||||
import EmailMenuItem from '@app/shared/share/v2/items/EmailMenuItem';
|
import EmailMenuItem from '@app/shared/share/v2/items/EmailMenuItem';
|
||||||
import { useEntityRegistry } from '@app/useEntityRegistry';
|
import { useEntityRegistry } from '@app/useEntityRegistry';
|
||||||
@ -12,9 +13,10 @@ interface ShareButtonMenuProps {
|
|||||||
entityType: EntityType;
|
entityType: EntityType;
|
||||||
subType?: string | null;
|
subType?: string | null;
|
||||||
name?: string | null;
|
name?: string | null;
|
||||||
|
qualifiedName?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ShareButtonMenu({ urn, entityType, subType, name }: ShareButtonMenuProps) {
|
export default function ShareButtonMenu({ urn, entityType, subType, name, qualifiedName }: ShareButtonMenuProps) {
|
||||||
const entityRegistry = useEntityRegistry();
|
const entityRegistry = useEntityRegistry();
|
||||||
|
|
||||||
const displayName = name || urn;
|
const displayName = name || urn;
|
||||||
@ -26,7 +28,16 @@ export default function ShareButtonMenu({ urn, entityType, subType, name }: Shar
|
|||||||
|
|
||||||
{navigator.clipboard && <CopyUrnMenuItem key="1" urn={urn} type={displayType} />}
|
{navigator.clipboard && <CopyUrnMenuItem key="1" urn={urn} type={displayType} />}
|
||||||
|
|
||||||
<EmailMenuItem key="2" urn={urn} name={displayName} type={displayType} />
|
{navigator.clipboard && (
|
||||||
|
<CopyNameMenuItem
|
||||||
|
key="2"
|
||||||
|
name={displayName}
|
||||||
|
type={displayType}
|
||||||
|
qualifiedName={qualifiedName || undefined}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<EmailMenuItem key="4" urn={urn} name={displayName} type={displayType} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,13 @@ export default function ShareMenuAction() {
|
|||||||
trigger={['hover']}
|
trigger={['hover']}
|
||||||
overlay={
|
overlay={
|
||||||
<StyledMenu selectable={false}>
|
<StyledMenu selectable={false}>
|
||||||
<ShareButtonMenu urn={urn} entityType={entityType} subType={subType} name={name} />
|
<ShareButtonMenu
|
||||||
|
urn={urn}
|
||||||
|
entityType={entityType}
|
||||||
|
subType={subType}
|
||||||
|
name={name}
|
||||||
|
qualifiedName={entityData?.properties?.qualifiedName}
|
||||||
|
/>
|
||||||
</StyledMenu>
|
</StyledMenu>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
import { CheckOutlined, CopyOutlined } from '@ant-design/icons';
|
||||||
|
import { Tooltip } from '@components';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
import { StyledMenuItem } from '@app/shared/share/v2/styledComponents';
|
||||||
|
|
||||||
|
interface CopyNameMenuItemProps {
|
||||||
|
key: string;
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
qualifiedName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TextSpan = styled.span`
|
||||||
|
padding-left: 12px;
|
||||||
|
margin-left: 0px !important;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default function CopyNameMenuItem({ key, type, name, qualifiedName }: CopyNameMenuItemProps) {
|
||||||
|
/**
|
||||||
|
* Whether button has been clicked
|
||||||
|
*/
|
||||||
|
const [isClicked, setIsClicked] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<StyledMenuItem
|
||||||
|
key={key}
|
||||||
|
onClick={() => {
|
||||||
|
if (qualifiedName) {
|
||||||
|
navigator.clipboard.writeText(qualifiedName);
|
||||||
|
} else {
|
||||||
|
navigator.clipboard.writeText(name);
|
||||||
|
}
|
||||||
|
setIsClicked(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Tooltip title={`Copy the full name of the ${type}`}>
|
||||||
|
{isClicked ? <CheckOutlined /> : <CopyOutlined />}
|
||||||
|
<TextSpan>
|
||||||
|
<b>Copy Name</b>
|
||||||
|
</TextSpan>
|
||||||
|
</Tooltip>
|
||||||
|
</StyledMenuItem>
|
||||||
|
);
|
||||||
|
}
|
@ -9,6 +9,7 @@ query getContainer($urn: String!) {
|
|||||||
}
|
}
|
||||||
properties {
|
properties {
|
||||||
name
|
name
|
||||||
|
qualifiedName
|
||||||
description
|
description
|
||||||
externalUrl
|
externalUrl
|
||||||
customProperties {
|
customProperties {
|
||||||
|
@ -409,6 +409,7 @@ fragment nonRecursiveDatasetFields on Dataset {
|
|||||||
platformNativeType
|
platformNativeType
|
||||||
properties {
|
properties {
|
||||||
name
|
name
|
||||||
|
qualifiedName
|
||||||
description
|
description
|
||||||
customProperties {
|
customProperties {
|
||||||
key
|
key
|
||||||
|
@ -610,6 +610,7 @@
|
|||||||
{
|
{
|
||||||
"com.linkedin.pegasus2avro.dataset.DatasetProperties": {
|
"com.linkedin.pegasus2avro.dataset.DatasetProperties": {
|
||||||
"description": "table where each row represents a single log event",
|
"description": "table where each row represents a single log event",
|
||||||
|
"qualifiedName": "a.b.c",
|
||||||
"uri": null,
|
"uri": null,
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"customProperties": {
|
"customProperties": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user