From a70cc8d349ca73d2935b9a6aeee00b99b2f7bed0 Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Mon, 29 Apr 2024 16:24:54 -0400 Subject: [PATCH 1/5] fix: move workflow link to source query tab --- .../DataTableViewSourceQuery.scss | 3 +++ .../DataTableViewSourceQuery.tsx | 26 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss index bdb2b5380..b13b2021d 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss @@ -22,4 +22,7 @@ border-radius: var(--border-radius); } } + .DataTableViewSourceQuery-workflow { + margin-bottom: 12px; + } } diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx index 879101c37..3a3fa4b0e 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx @@ -34,6 +34,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ dataJobMetadataById, }) => { const [showOldJobMetadata, setShowOldJobMetadata] = useState(false); + const jobMetadataIds = useMemo( () => Array.from( @@ -74,12 +75,31 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ const loaded = !(dataJobMetadataById[id] as any).__loading; const dataJobMetadata = dataJobMetadataById[id]; return loaded ? ( - + ) : ( ); }); + const customProperties = table.custom_properties ?? {}; + const workflowValue = customProperties['workflow']?.toString() ?? null; + const workflowDOM = workflowValue ? ( +
+
+ + Workflow + +
+ + {workflowValue} + +
+ ) : null; + const errorDOM = jobMetadataIds.length > 0 ? null : ( @@ -100,6 +120,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ return (
{parentDOM} + {workflowDOM} {errorDOM} {showMoreDOM}
@@ -108,7 +129,8 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ const DataJobMetadataInfo: React.FC<{ dataJobMetadata: IDataJobMetadata; -}> = ({ dataJobMetadata }) => { + table: IDataTable; +}> = ({ dataJobMetadata, table }) => { const queryExecutionUrlRows = []; if ( dataJobMetadata.is_adhoc && From b14e6f3ebb0e3a2dca96fc93ca1081695157bde4 Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Mon, 29 Apr 2024 16:24:54 -0400 Subject: [PATCH 2/5] fix: move workflow link to source query tab --- .../DataTableViewSourceQuery.scss | 3 +++ .../DataTableViewSourceQuery.tsx | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss index bdb2b5380..b13b2021d 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.scss @@ -22,4 +22,7 @@ border-radius: var(--border-radius); } } + .DataTableViewSourceQuery-workflow { + margin-bottom: 12px; + } } diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx index 879101c37..ce643e2f4 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx @@ -34,6 +34,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ dataJobMetadataById, }) => { const [showOldJobMetadata, setShowOldJobMetadata] = useState(false); + const jobMetadataIds = useMemo( () => Array.from( @@ -80,6 +81,21 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ ); }); + const customProperties = table.custom_properties ?? {}; + const workflowValue = customProperties['workflow']?.toString() ?? null; + const workflowDOM = workflowValue ? ( +
+
+ + Workflow + +
+ + {workflowValue} + +
+ ) : null; + const errorDOM = jobMetadataIds.length > 0 ? null : ( @@ -100,6 +116,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ return (
{parentDOM} + {workflowDOM} {errorDOM} {showMoreDOM}
From 7fc7092cc2910f752b81853a196253d8c3de92e1 Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Fri, 3 May 2024 11:58:46 -0400 Subject: [PATCH 3/5] address comments --- .../DataTableViewSourceQuery/DataTableViewSourceQuery.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx index ce643e2f4..4c2b39046 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx @@ -85,7 +85,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ const workflowValue = customProperties['workflow']?.toString() ?? null; const workflowDOM = workflowValue ? (
-
+
Workflow @@ -115,8 +115,8 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ return (
- {parentDOM} {workflowDOM} + {parentDOM} {errorDOM} {showMoreDOM}
From 03a4552ef2b98a13389db7835f9a67d6fb5d3a8d Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Fri, 3 May 2024 13:58:07 -0400 Subject: [PATCH 4/5] check link type --- .../DataTableViewSourceQuery.tsx | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx index 4c2b39046..99e11285e 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx @@ -82,19 +82,24 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ }); const customProperties = table.custom_properties ?? {}; - const workflowValue = customProperties['workflow']?.toString() ?? null; - const workflowDOM = workflowValue ? ( -
-
- - Workflow - + const workflowValue = customProperties['workflow']; + const workflowDOM = + workflowValue && typeof workflowValue === 'string' ? ( +
+
+ + Workflow + +
+ {/https?:\/\/[^\s]+/.test(workflowValue.trim()) ? ( + + {workflowValue} + + ) : ( + workflowValue + )}
- - {workflowValue} - -
- ) : null; + ) : null; const errorDOM = jobMetadataIds.length > 0 ? null : ( From 2bca71144fcde2e857cc23e153de7f1ad353a9a2 Mon Sep 17 00:00:00 2001 From: Victor Zhang Date: Fri, 3 May 2024 14:17:36 -0400 Subject: [PATCH 5/5] use util function for url check --- .../DataTableViewSourceQuery/DataTableViewSourceQuery.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx index 99e11285e..ecb833b47 100644 --- a/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx +++ b/querybook/webapp/components/DataTableViewSourceQuery/DataTableViewSourceQuery.tsx @@ -5,6 +5,7 @@ import { IDataTable, ILineageCollection, } from 'const/metastore'; +import { isValidUrl } from 'lib/utils'; import { getAppName } from 'lib/utils/global'; import { getWithinEnvUrl } from 'lib/utils/query-string'; import { Button } from 'ui/Button/Button'; @@ -91,7 +92,7 @@ export const DataTableViewSourceQuery: React.FunctionComponent = ({ Workflow
- {/https?:\/\/[^\s]+/.test(workflowValue.trim()) ? ( + {isValidUrl(workflowValue) ? ( {workflowValue}