From 6fea07fdbf98320fb7002e8adfe73428a6c9c72b Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Tue, 30 Nov 2021 13:29:54 +0530 Subject: [PATCH] Fix#1379 Creating an ingestion job when airflow is down returns 400. (#1460) * Fix#1379 Creating an ingestion job when airflow is down returns 400. * Fixed typo * Minor fix --- .../common/error/IngestionError.tsx | 84 +++++++++++++++++++ .../IngestionPage/IngestionPage.component.tsx | 41 +++++---- 2 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/components/common/error/IngestionError.tsx diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/error/IngestionError.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/error/IngestionError.tsx new file mode 100644 index 00000000000..504373cd1fc --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/error/IngestionError.tsx @@ -0,0 +1,84 @@ +import { uniqueId } from 'lodash'; +import React from 'react'; + +const stepsData = [ + { + step: 1, + title: 'Step1', + description: + 'Lorem, ipsum dolor sit amet consectetur adipisicing elit. Aliquam, dolores!', + link: 'https://docs.open-metadata.org/install/metadata-ingestion/ingest-sample-data', + }, + { + step: 2, + title: 'Step2', + description: + 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Corporis, quos.', + link: 'https://docs.open-metadata.org/install/metadata-ingestion/ingest-sample-data#index-sample-data-into-elasticsearch', + }, + { + step: 3, + title: 'Step3', + description: + 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Corporis, quos.', + link: 'https://docs.open-metadata.org/install/metadata-ingestion/connectors', + }, + { + step: 4, + title: 'Step4', + description: + 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Corporis, quos.', + link: 'https://slack.open-metadata.org', + }, +]; + +const IngestionError = () => { + return ( +
+
+

+ Welcome to OpenMetadata. + We are unable to access Airflow for ingestion workflow. +

+ +

+ Please follow the instructions here to set up Airflow for ingestion + workflow. +

+
+
+ {stepsData.map((data) => ( +
+
+
+
+ {data.step} +
+
+ +
+ {data.title} +
+ +

+ {data.description} +

+
+ +

+ + Click here >> + +

+
+ ))} +
+
+ ); +}; + +export default IngestionError; diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/IngestionPage/IngestionPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/IngestionPage/IngestionPage.component.tsx index 13d4736c092..0bcb83a315f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/IngestionPage/IngestionPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/IngestionPage/IngestionPage.component.tsx @@ -16,8 +16,9 @@ */ import { AxiosError, AxiosResponse } from 'axios'; +import { toString } from 'lodash'; import { Paging } from 'Models'; -import React, { useEffect, useState } from 'react'; +import React, { Fragment, useEffect, useState } from 'react'; import { addIngestionWorkflow, deleteIngestionWorkflowsById, @@ -26,6 +27,7 @@ import { updateIngestionWorkflow, } from '../../axiosAPIs/ingestionWorkflowAPI'; import { getServices } from '../../axiosAPIs/serviceAPI'; +import IngestionError from '../../components/common/error/IngestionError'; import Ingestion from '../../components/Ingestion/Ingestion.component'; import { IngestionData } from '../../components/Ingestion/ingestion.interface'; import Loader from '../../components/Loader/Loader'; @@ -41,6 +43,8 @@ const IngestionPage = () => { const [ingestions, setIngestions] = useState([]); const [serviceList, setServiceList] = useState>([]); const [paging, setPaging] = useState({} as Paging); + const [isConnectionAvailable, setConnectionAvailable] = + useState(true); const getDatabaseServices = () => { getServices('databaseServices') .then((res: AxiosResponse) => { @@ -178,11 +182,10 @@ const IngestionPage = () => { } }) .catch((err: AxiosError) => { - const msg = err.message; - showToast({ - variant: 'error', - body: msg ?? `Something went wrong`, - }); + const errMsg = toString(err.response?.data?.message) ?? ''; + if (errMsg.includes('Connection refused')) { + setConnectionAvailable(false); + } setIsLoading(false); }); }; @@ -204,16 +207,22 @@ const IngestionPage = () => { {isLoading ? ( ) : ( - + + {isConnectionAvailable ? ( + + ) : ( + + )} + )} );