mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-12 22:37:27 -08:00
ui: Pass unexpected boot errors to StartingContent component (#13016)
Signed-off-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
parent
a807dd1616
commit
4912c82ed0
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import { WALReplayData } from '../types/types';
|
import { WALReplayData } from '../types/types';
|
||||||
import { StartingContent } from './withStartingIndicator';
|
import { StartingContent } from './withStartingIndicator';
|
||||||
import { Progress } from 'reactstrap';
|
import { Alert, Progress } from 'reactstrap';
|
||||||
|
|
||||||
describe('Starting', () => {
|
describe('Starting', () => {
|
||||||
describe('progress bar', () => {
|
describe('progress bar', () => {
|
||||||
|
@ -52,5 +52,17 @@ describe('Starting', () => {
|
||||||
expect(progress.prop('value')).toBe(21);
|
expect(progress.prop('value')).toBe(21);
|
||||||
expect(progress.prop('color')).toBe('success');
|
expect(progress.prop('color')).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('shows unexpected error', () => {
|
||||||
|
const status: WALReplayData = {
|
||||||
|
min: 0,
|
||||||
|
max: 20,
|
||||||
|
current: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const starting = shallow(<StartingContent status={status} isUnexpected={true} />);
|
||||||
|
const alert = starting.find(Alert);
|
||||||
|
expect(alert.prop('color')).toBe('danger');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,7 +51,7 @@ export const withStartingIndicator =
|
||||||
const { ready, walReplayStatus, isUnexpected } = useFetchReadyInterval(pathPrefix);
|
const { ready, walReplayStatus, isUnexpected } = useFetchReadyInterval(pathPrefix);
|
||||||
const staticReady = useReady();
|
const staticReady = useReady();
|
||||||
|
|
||||||
if (staticReady || ready || isUnexpected) {
|
if (staticReady || ready) {
|
||||||
return <Page {...(rest as T)} />;
|
return <Page {...(rest as T)} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue