From f94759b67379e2eb112857483ced2d7e084469d3 Mon Sep 17 00:00:00 2001 From: jennypavlova Date: Mon, 18 Nov 2024 13:30:32 +0100 Subject: [PATCH] [Infra] Change order of the errors shown on Infra pages (#200531) Closes #200190 ## Summary This PR fixes the issue with the errors shown on the metrics explorer page - when the metrics indices can't be fetched we should show the error returned and if there is no fetch error and a remote cluster configured but no connection is possible we should show the remote cluster error: - Example with 504 error ![image](https://github.com/user-attachments/assets/65cd8226-8c81-4c64-b043-c9db5a93d3e0) - Example with remote cluster error ![image](https://github.com/user-attachments/assets/e024a3f8-76e0-4ad7-8aa6-e35ad5c1112a) ## Testing Couldn't find a way to reproduce this so I "faked" the API response to be an error and checked several cases - API returns an error, we should show the error: https://github.com/user-attachments/assets/c1086b22-1ff5-4333-97a5-b3d1dca16afe - API doesn't return an error but the remote cluster connection wasn't possible, we should show the remote cluster error: https://github.com/user-attachments/assets/151b3ae4-5ca1-4d54-bd58-2729db202cdb - If no remote cluster is used/or a remote cluster is connected and the API response is not returning an error the page should load correctly: https://github.com/user-attachments/assets/f9ef1066-3dfd-4957-8b46-878bf58d2f1c (cherry picked from commit 46d4c84f2cb3f778d3b0eca83d0cfa4f25a602c4) # Conflicts: # x-pack/plugins/observability_solution/infra/public/pages/metrics/page_template.tsx --- .../infra/public/pages/metrics/page_template.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/page_template.tsx b/x-pack/plugins/observability_solution/infra/public/pages/metrics/page_template.tsx index d48b77404767d..85c91b7eac851 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/page_template.tsx +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/page_template.tsx @@ -95,12 +95,12 @@ export const MetricsPageTemplate: React.FC = if (isLoading && !source) return ; - if (!remoteClustersExist) { - return ; + if (sourceError) { + return ; } - if (sourceError) { - ; + if (!isLoading && !remoteClustersExist) { + return ; } if (dataViewLoadError) {