Skip to content

Commit c8727b6

Browse files
authored
Add copyClipboard button beside index name (#164) (#166)
* Add a Copy to Clipboard button for copying index name * Add updated snapshot
1 parent 57a4336 commit c8727b6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

public/pages/Indices/utils/constants.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
import React from "react";
17-
import { EuiHealth, EuiTableFieldDataColumnType } from "@elastic/eui";
17+
import { EuiButtonEmpty, EuiCopy, EuiHealth, EuiTableFieldDataColumnType } from "@elastic/eui";
1818
import { ManagedCatIndex } from "../../../../server/models/interfaces";
1919
import { SortDirection } from "../../../utils/constants";
2020

@@ -47,7 +47,18 @@ export const indicesColumns: EuiTableFieldDataColumnType<ManagedCatIndex>[] = [
4747
truncateText: false,
4848
textOnly: true,
4949
width: "250px",
50-
render: (index: string) => <span title={index}>{index}</span>,
50+
render: (index: string) => {
51+
return (
52+
<EuiCopy textToCopy={index}>
53+
{(copy) => (
54+
<div>
55+
<EuiButtonEmpty size="xs" flush="right" iconType="copyClipboard" onClick={copy} color="text"></EuiButtonEmpty>
56+
<span title={index}>{index}</span>
57+
</div>
58+
)}
59+
</EuiCopy>
60+
);
61+
},
5162
},
5263
{
5364
field: "health",

public/pages/Rollups/containers/Rollups/__snapshots__/Rollups.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ exports[`<Rollups /> spec renders the component 1`] = `
354354
aria-live="polite"
355355
aria-sort="none"
356356
class="euiTableHeaderCell"
357-
data-test-subj="tableHeaderCell_rollup.rollup.enabled_3"
357+
data-test-subj="tableHeaderCell_rollup.enabled_3"
358358
role="columnheader"
359359
scope="col"
360360
>
@@ -384,7 +384,7 @@ exports[`<Rollups /> spec renders the component 1`] = `
384384
aria-live="polite"
385385
aria-sort="none"
386386
class="euiTableHeaderCell"
387-
data-test-subj="tableHeaderCell_rollup.rollup.continuous_4"
387+
data-test-subj="tableHeaderCell_rollup.continuous_4"
388388
role="columnheader"
389389
scope="col"
390390
>

0 commit comments

Comments
 (0)