This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v2-5-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 3cb6fb5de9482d9119a8d737043b54bf3ef35278
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Sun Mar 19 17:51:49 2023 +0100

    Fix copy dag run config in grid detail (#30184)
    
    (cherry picked from commit 732fcd789ddecd5251d391a8d9b72f130bafb046)
---
 airflow/www/static/js/dag/details/dagRun/index.tsx | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/airflow/www/static/js/dag/details/dagRun/index.tsx 
b/airflow/www/static/js/dag/details/dagRun/index.tsx
index 112a4839aa..ae07c95c51 100644
--- a/airflow/www/static/js/dag/details/dagRun/index.tsx
+++ b/airflow/www/static/js/dag/details/dagRun/index.tsx
@@ -60,13 +60,18 @@ interface Props {
   runId: DagRunType['runId'];
 }
 
+const formatConf = (conf: string | null | undefined): string => {
+  if (!conf) {
+    return '';
+  }
+  return JSON.stringify(JSON.parse(conf), null, 4);
+};
+
 const DagRun = ({ runId }: Props) => {
   const { data: { dagRuns } } = useGridData();
   const detailsRef = useRef<HTMLDivElement>(null);
   const run = dagRuns.find((dr) => dr.runId === runId);
-  const { onCopy, hasCopied } = useClipboard(
-    JSON.stringify(JSON.parse(run?.conf || ''), null, 4),
-  );
+  const { onCopy, hasCopied } = useClipboard(formatConf(run?.conf));
   if (!run) return null;
   const {
     executionDate,

Reply via email to