From 2b263041d969b8f5270ac6876b5333271f7dbef7 Mon Sep 17 00:00:00 2001 From: darth-coder00 <86726556+darth-coder00@users.noreply.github.com> Date: Tue, 5 Oct 2021 23:18:48 +0530 Subject: [PATCH] Integration for Pipeline services (#674) --- .../AddServiceModal/AddServiceModal.tsx | 48 ++++++++++++++++++- .../ui/src/constants/services.const.ts | 2 +- .../resources/ui/src/pages/services/index.tsx | 16 ++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx b/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx index 564858630a5..e749634c4c6 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx @@ -58,6 +58,7 @@ export type DataObj = { api_version?: string; server?: string; env?: string; + pipelineUrl?: string; }; // type DataObj = CreateDatabaseService & @@ -115,6 +116,7 @@ type ErrorMsg = { siteName?: boolean; apiVersion?: boolean; server?: boolean; + pipelineUrl?: boolean; }; type EditorContentRef = { getEditorContent: () => string; @@ -211,6 +213,7 @@ export const AddServiceModal: FunctionComponent = ({ const [apiVersion, setApiVersion] = useState(data?.api_version || ''); const [server, setServer] = useState(data?.server || ''); const [env, setEnv] = useState(data?.env || ''); + const [pipelineUrl, setPipelineUrl] = useState(data?.pipelineUrl || ''); const [frequency, setFrequency] = useState( fromISOString(data?.ingestionSchedule?.repeatFrequency) ); @@ -228,6 +231,7 @@ export const AddServiceModal: FunctionComponent = ({ siteName: false, apiVersion: false, server: false, + pipelineUrl: false, }); const [sameNameError, setSameNameError] = useState(false); const markdownRef = useRef(); @@ -314,6 +318,7 @@ export const AddServiceModal: FunctionComponent = ({ siteName, apiVersion, server, + pipelineUrl, } = value; return ( @@ -329,7 +334,8 @@ export const AddServiceModal: FunctionComponent = ({ !apiKey && !siteName && !apiVersion && - !server + !server && + !pipelineUrl ); }; @@ -399,6 +405,15 @@ export const AddServiceModal: FunctionComponent = ({ } } + break; + case ServiceCategory.PIPELINE_SERVICES: + { + setMsg = { + ...setMsg, + pipelineUrl: !pipelineUrl, + }; + } + break; default: break; @@ -488,6 +503,15 @@ export const AddServiceModal: FunctionComponent = ({ } } + break; + case ServiceCategory.PIPELINE_SERVICES: + { + dataObj = { + ...dataObj, + pipelineUrl: pipelineUrl, + }; + } + break; default: break; @@ -814,6 +838,26 @@ export const AddServiceModal: FunctionComponent = ({ return elemFields; }; + const getPipelineFields = (): JSX.Element => { + return ( +
+ + setPipelineUrl(e.target.value)} + /> + {showErrorMsg.pipelineUrl && errorMsg('Url is required')} +
+ ); + }; + const getOptionalFields = (): JSX.Element => { switch (serviceName) { case ServiceCategory.DATABASE_SERVICES: @@ -822,6 +866,8 @@ export const AddServiceModal: FunctionComponent = ({ return getMessagingFields(); case ServiceCategory.DASHBOARD_SERVICES: return getDashboardFields(); + case ServiceCategory.PIPELINE_SERVICES: + return getPipelineFields(); default: return <>; } diff --git a/catalog-rest-service/src/main/resources/ui/src/constants/services.const.ts b/catalog-rest-service/src/main/resources/ui/src/constants/services.const.ts index e1247825db2..d35b6df04c0 100644 --- a/catalog-rest-service/src/main/resources/ui/src/constants/services.const.ts +++ b/catalog-rest-service/src/main/resources/ui/src/constants/services.const.ts @@ -77,7 +77,7 @@ export const serviceTypes: Record> = { ], messagingServices: ['Kafka'], dashboardServices: ['Superset', 'Looker', 'Tableau', 'Redash'], - pipelineServices: ['Airflow', 'Prefect'], + pipelineServices: ['Airflow'], }; export const arrServiceTypes: Array = [ diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx index 5c7b11479c5..45c9018d394 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/services/index.tsx @@ -119,6 +119,7 @@ const ServicesPage = () => { serviceRecord[serviceName] as unknown as Array ); } + setIsLoading(false); } ); } @@ -293,6 +294,20 @@ const ServicesPage = () => { ); } + case ServiceCategory.PIPELINE_SERVICES: { + const pipelineService = service as unknown as PipelineService; + + return ( + <> +
+ + + {pipelineService.pipelineUrl} + +
+ + ); + } default: { return <>; } @@ -311,7 +326,6 @@ const ServicesPage = () => { value: service.collection.name, }; }); - setIsLoading(false); } else { setIsLoading(false); }