From 4b9e09a3c34289d953ed62501d369d89a59e844e Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Sun, 13 Nov 2022 08:13:28 +0200 Subject: [PATCH 1/8] Enable copying DagRun JSON to clipboard --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index c22316cf389b6..e549279dd497f 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -192,7 +192,7 @@ const DagRun = ({ runId }: Props) => { iconStyle="triangle" indentWidth={2} displayDataTypes={false} - enableClipboard={false} + enableClipboard={true} style={{ backgroundColor: 'inherit' }} /> From 46e1e60507a9f869774757e16672080b0fc78488 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Sun, 13 Nov 2022 10:27:22 +0200 Subject: [PATCH 2/8] Truthy values can be implicitly assigned --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index e549279dd497f..0e517a2b8aac9 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -192,8 +192,8 @@ const DagRun = ({ runId }: Props) => { iconStyle="triangle" indentWidth={2} displayDataTypes={false} - enableClipboard={true} style={{ backgroundColor: 'inherit' }} + enableClipboard /> ) From 14c0c5aa9798d88d5c9643c381be9cf0c1397796 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 14 Nov 2022 16:11:46 +0200 Subject: [PATCH 3/8] added copy functionality using useClipboard --- .../static/js/dag/details/dagRun/index.tsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index 0e517a2b8aac9..a8d4cfd014a4d 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -24,10 +24,12 @@ import { Button, Link, Divider, + Spacer, Table, Tbody, Tr, Td, + useClipboard, } from '@chakra-ui/react'; import { MdOutlineAccountTree } from 'react-icons/md'; @@ -78,6 +80,7 @@ const DagRun = ({ runId }: Props) => { execution_date: executionDate, }).toString(); const graphLink = appendSearchParams(graphUrl, graphParams); + const { onCopy, value, setValue, hasCopied } = useClipboard(conf); return ( <> @@ -185,16 +188,20 @@ const DagRun = ({ runId }: Props) => { confIsJson ? ( - + + + + + ) : {conf ?? 'None'} From 64bb624508c38ec2f56fe78ceed4966894b3049d Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Sun, 13 Nov 2022 08:13:28 +0200 Subject: [PATCH 4/8] Enable copying DagRun JSON to clipboard --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index c22316cf389b6..e549279dd497f 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -192,7 +192,7 @@ const DagRun = ({ runId }: Props) => { iconStyle="triangle" indentWidth={2} displayDataTypes={false} - enableClipboard={false} + enableClipboard={true} style={{ backgroundColor: 'inherit' }} /> From b44c18591b224774e225da951c836d402c29ff5f Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Sun, 13 Nov 2022 10:27:22 +0200 Subject: [PATCH 5/8] Truthy values can be implicitly assigned --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index e549279dd497f..0e517a2b8aac9 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -192,8 +192,8 @@ const DagRun = ({ runId }: Props) => { iconStyle="triangle" indentWidth={2} displayDataTypes={false} - enableClipboard={true} style={{ backgroundColor: 'inherit' }} + enableClipboard /> ) From 01c005f51e47cc60067c190f6b3a612bb2bcace2 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 14 Nov 2022 16:11:46 +0200 Subject: [PATCH 6/8] added copy functionality using useClipboard --- .../static/js/dag/details/dagRun/index.tsx | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index 0e517a2b8aac9..a8d4cfd014a4d 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -24,10 +24,12 @@ import { Button, Link, Divider, + Spacer, Table, Tbody, Tr, Td, + useClipboard, } from '@chakra-ui/react'; import { MdOutlineAccountTree } from 'react-icons/md'; @@ -78,6 +80,7 @@ const DagRun = ({ runId }: Props) => { execution_date: executionDate, }).toString(); const graphLink = appendSearchParams(graphUrl, graphParams); + const { onCopy, value, setValue, hasCopied } = useClipboard(conf); return ( <> @@ -185,16 +188,20 @@ const DagRun = ({ runId }: Props) => { confIsJson ? ( - + + + + + ) : {conf ?? 'None'} From fa47b5b12027317b511121338f9f435a49a05352 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 14 Nov 2022 16:15:58 +0200 Subject: [PATCH 7/8] added copy functionality using useClipboard --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index a8d4cfd014a4d..da34db63e931e 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -80,7 +80,7 @@ const DagRun = ({ runId }: Props) => { execution_date: executionDate, }).toString(); const graphLink = appendSearchParams(graphUrl, graphParams); - const { onCopy, value, setValue, hasCopied } = useClipboard(conf); + const { onCopy, hasCopied } = useClipboard(conf); return ( <> From 7e49c45be967d9393704a06c451cafdb8d176772 Mon Sep 17 00:00:00 2001 From: Dov Benyomin Sohacheski Date: Mon, 14 Nov 2022 16:55:38 +0200 Subject: [PATCH 8/8] moved react hooks out of conditionally run block --- airflow/www/static/js/dag/details/dagRun/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx b/airflow/www/static/js/dag/details/dagRun/index.tsx index da34db63e931e..d2f1b8d3c8b68 100644 --- a/airflow/www/static/js/dag/details/dagRun/index.tsx +++ b/airflow/www/static/js/dag/details/dagRun/index.tsx @@ -61,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, @@ -80,7 +81,6 @@ const DagRun = ({ runId }: Props) => { execution_date: executionDate, }).toString(); const graphLink = appendSearchParams(graphUrl, graphParams); - const { onCopy, hasCopied } = useClipboard(conf); return ( <>