From 4912c82ed0ba24389e2236bda8fd7576047c7e6d Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Mon, 23 Oct 2023 14:17:53 +0200 Subject: [PATCH] ui: Pass unexpected boot errors to StartingContent component (#13016) Signed-off-by: Gilles De Mey --- .../src/components/withStartingIndicator.test.tsx | 14 +++++++++++++- .../src/components/withStartingIndicator.tsx | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/web/ui/react-app/src/components/withStartingIndicator.test.tsx b/web/ui/react-app/src/components/withStartingIndicator.test.tsx index 575115ba6a..49416563e7 100644 --- a/web/ui/react-app/src/components/withStartingIndicator.test.tsx +++ b/web/ui/react-app/src/components/withStartingIndicator.test.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { WALReplayData } from '../types/types'; import { StartingContent } from './withStartingIndicator'; -import { Progress } from 'reactstrap'; +import { Alert, Progress } from 'reactstrap'; describe('Starting', () => { describe('progress bar', () => { @@ -52,5 +52,17 @@ describe('Starting', () => { expect(progress.prop('value')).toBe(21); expect(progress.prop('color')).toBe('success'); }); + + it('shows unexpected error', () => { + const status: WALReplayData = { + min: 0, + max: 20, + current: 0, + }; + + const starting = shallow(); + const alert = starting.find(Alert); + expect(alert.prop('color')).toBe('danger'); + }); }); }); diff --git a/web/ui/react-app/src/components/withStartingIndicator.tsx b/web/ui/react-app/src/components/withStartingIndicator.tsx index eb2724ed13..505deab409 100644 --- a/web/ui/react-app/src/components/withStartingIndicator.tsx +++ b/web/ui/react-app/src/components/withStartingIndicator.tsx @@ -51,7 +51,7 @@ export const withStartingIndicator = const { ready, walReplayStatus, isUnexpected } = useFetchReadyInterval(pathPrefix); const staticReady = useReady(); - if (staticReady || ready || isUnexpected) { + if (staticReady || ready) { return ; }