From dcd3d47c2bd8794825f1c4c418c4a6aec90e3fcd Mon Sep 17 00:00:00 2001 From: Mayur Singal <39544459+ulixius9@users.noreply.github.com> Date: Thu, 25 Jan 2024 19:56:49 +0530 Subject: [PATCH] Fix #14590: Improve airflow plugin error message (#14839) * Fix #14590: Improve airflow plugin error message * Update openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/airflow/AirflowRESTClient.java Co-authored-by: Ayush Shah * Update msg * Update RichTextEditorPreviewer in AirflowMessageBanner component --------- Co-authored-by: Ayush Shah Co-authored-by: Pere Miquel Brull Co-authored-by: Sachin Chaurasiya --- .../pipeline/airflow/AirflowRESTClient.java | 18 +++++++++++++----- .../AirflowMessageBanner.tsx | 8 ++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/airflow/AirflowRESTClient.java b/openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/airflow/AirflowRESTClient.java index 81472e836a9..66906b94acc 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/airflow/AirflowRESTClient.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/clients/pipeline/airflow/AirflowRESTClient.java @@ -54,6 +54,8 @@ public class AirflowRESTClient extends PipelineServiceClient { private static final String TIMEOUT_KEY = "timeout"; private static final String TRUSTSTORE_PATH_KEY = "truststorePath"; private static final String TRUSTSTORE_PASSWORD_KEY = "truststorePassword"; + private static final String DOCS_LINK = + "Follow [this guide](https://docs.open-metadata.org/deployment/ingestion/openmetadata) for further details."; protected final String username; protected final String password; @@ -292,7 +294,9 @@ public class AirflowRESTClient extends PipelineServiceClient { // APIs URL not found if (response.statusCode() == 404) { return buildUnhealthyStatus( - "Airflow APIs not found. Please follow the installation guide."); + String.format( + "Airflow APIs not found. Please validate if the OpenMetadata Airflow plugin is installed correctly. %s", + DOCS_LINK)); } return buildUnhealthyStatus( @@ -301,12 +305,16 @@ public class AirflowRESTClient extends PipelineServiceClient { response.statusCode(), response.body())); } catch (IOException | URISyntaxException e) { - return buildUnhealthyStatus( - String.format("Failed to get REST status due to [%s].", e.getMessage())); + String exceptionMsg; + if (e.getMessage() != null) { + exceptionMsg = String.format("Failed to get Airflow status due to [%s].", e.getMessage()); + } else { + exceptionMsg = "Failed to connect to Airflow."; + } + return buildUnhealthyStatus(String.format("%s %s", exceptionMsg, DOCS_LINK)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); - return buildUnhealthyStatus( - String.format("Failed to get REST status due to [%s].", e.getMessage())); + return buildUnhealthyStatus(String.format("Failed to connect to Airflow. %s", DOCS_LINK)); } } diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/AirflowMessageBanner/AirflowMessageBanner.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/AirflowMessageBanner/AirflowMessageBanner.tsx index f2f9c36d960..c457865a22c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/AirflowMessageBanner/AirflowMessageBanner.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/AirflowMessageBanner/AirflowMessageBanner.tsx @@ -10,12 +10,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Space, SpaceProps, Typography } from 'antd'; +import { Space, SpaceProps } from 'antd'; import classNames from 'classnames'; import { isEmpty } from 'lodash'; import React, { FC } from 'react'; import { ReactComponent as IconRetry } from '../../../assets/svg/ic-retry-icon.svg'; import { useAirflowStatus } from '../../../hooks/useAirflowStatus'; +import RichTextEditorPreviewer from '../../common/RichTextEditor/RichTextEditorPreviewer'; import './airflow-message-banner.less'; const AirflowMessageBanner: FC = ({ className }) => { @@ -32,7 +33,10 @@ const AirflowMessageBanner: FC = ({ className }) => { data-testid="no-airflow-placeholder" size={16}> - {reason} + ); };