Skip to content

Commit

Permalink
chore(CHYT): allow to copy alias/operationId [YTFRONT-3863]
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-efremoff committed Nov 29, 2023
1 parent fad8c8f commit 2e394d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.yt-clipboard-button {
color: var(--g-color-text-secondary);

&_inline-margins {
margin: -5px 1ex;
&_inline-margin {
& .yt-tooltip {
margin: -5px 1ex;
}
}
}

Expand Down
23 changes: 20 additions & 3 deletions packages/ui/src/ui/components/OperationId/OperationId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,41 @@ import {Text} from '@gravity-ui/uikit';
import Link from '../../components/Link/Link';
import format from '../../common/hammer/format';
import {Page} from '../../../shared/constants/settings';
import ClipboardButton from '../../components/ClipboardButton/ClipboardButton';

export function OperationId({
id,
cluster,
color,
allowCopy,
}: {
id?: string;
color?: 'secondary';
cluster: string;
allowCopy?: boolean;
}) {
const operationId = id && id !== '0-0-0-0' ? id : null;

return (
<Text variant="code-1" color={color}>
{operationId ? (
<Link theme={color} url={`/${cluster}/${Page.OPERATIONS}/${operationId}`} routed>
{operationId}
</Link>
<React.Fragment>
<Link
theme={color}
url={`/${cluster}/${Page.OPERATIONS}/${operationId}`}
routed
>
{operationId}
</Link>
{allowCopy && (
<ClipboardButton
text={operationId}
view="clear"
visibleOnRowHover
inlineMargins
/>
)}
</React.Fragment>
) : (
format.NO_VALUE
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import format from '../../../common/hammer/format';
import DataTableYT, {
DATA_TABLE_YT_SETTINGS_UNDER_TOOLBAR,
} from '../../../components/DataTableYT/DataTableYT';
import ClipboardButton from '../../../components/ClipboardButton/ClipboardButton';
import ColumnHeader from '../../../components/ColumnHeader/ColumnHeader';
import Link from '../../../components/Link/Link';
import {OperationId} from '../../../components/OperationId/OperationId';
Expand Down Expand Up @@ -162,11 +163,18 @@ function useChytListColumns(cluster: string) {
>
{row.alias}
</Link>
<ClipboardButton
text={row.alias}
view="clear"
visibleOnRowHover
inlineMargins
/>
<div>
<OperationId
id={row.yt_operation_id}
cluster={cluster}
color="secondary"
allowCopy
/>
</div>
</div>
Expand Down

0 comments on commit 2e394d6

Please sign in to comment.