Skip to content
27 changes: 17 additions & 10 deletions airflow/www/static/js/dag/details/dagRun/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import {
Button,
Link,
Divider,
Spacer,
Table,
Tbody,
Tr,
Td,
useClipboard,
} from '@chakra-ui/react';

import { MdOutlineAccountTree } from 'react-icons/md';
Expand Down Expand Up @@ -59,6 +61,7 @@ interface Props {
const DagRun = ({ runId }: Props) => {
const { data: { dagRuns } } = useGridData();
const run = dagRuns.find((dr) => dr.runId === runId);
const { onCopy, hasCopied } = useClipboard(run?.conf || '');
if (!run) return null;
const {
executionDate,
Expand Down Expand Up @@ -185,16 +188,20 @@ const DagRun = ({ runId }: Props) => {
confIsJson
? (
<Td>
<ReactJson
src={JSON.parse(conf ?? '')}
name={false}
theme="rjv-default"
iconStyle="triangle"
indentWidth={2}
displayDataTypes={false}
enableClipboard={false}
style={{ backgroundColor: 'inherit' }}
/>
<Flex>
<ReactJson
src={JSON.parse(conf ?? '')}
name={false}
theme="rjv-default"
iconStyle="triangle"
indentWidth={2}
displayDataTypes={false}
enableClipboard={false}
style={{ backgroundColor: 'inherit' }}
/>
<Spacer />
<Button aria-label="Copy" onClick={onCopy}>{hasCopied ? 'Copied!' : 'Copy'}</Button>
</Flex>
</Td>
)
: <Td>{conf ?? 'None'}</Td>
Expand Down