Added warnings into react Panel on the Graph page (#8427)

Signed-off-by: Alex Petrov <alex.petrov.vt@gmail.com>
This commit is contained in:
alex-petrov-vt 2021-01-31 07:48:32 -05:00 committed by GitHub
parent 275f7e7766
commit 91eef5e3bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,6 +29,7 @@ interface PanelState {
data: any; // TODO: Type data. data: any; // TODO: Type data.
lastQueryParams: QueryParams | null; lastQueryParams: QueryParams | null;
loading: boolean; loading: boolean;
warnings: string[] | null;
error: string | null; error: string | null;
stats: QueryStats | null; stats: QueryStats | null;
exprInputValue: string; exprInputValue: string;
@ -67,6 +68,7 @@ class Panel extends Component<PanelProps, PanelState> {
data: null, data: null,
lastQueryParams: null, lastQueryParams: null,
loading: false, loading: false,
warnings: null,
error: null, error: null,
stats: null, stats: null,
exprInputValue: props.options.expr, exprInputValue: props.options.expr,
@ -156,6 +158,7 @@ class Panel extends Component<PanelProps, PanelState> {
this.setState({ this.setState({
error: null, error: null,
data: json.data, data: json.data,
warnings: json.warnings,
lastQueryParams: { lastQueryParams: {
startTime, startTime,
endTime, endTime,
@ -245,6 +248,11 @@ class Panel extends Component<PanelProps, PanelState> {
<Row> <Row>
<Col>{this.state.error && <Alert color="danger">{this.state.error}</Alert>}</Col> <Col>{this.state.error && <Alert color="danger">{this.state.error}</Alert>}</Col>
</Row> </Row>
{this.state.warnings?.map((warning, index) => (
<Row key={index}>
<Col>{warning && <Alert color="warning">{warning}</Alert>}</Col>
</Row>
))}
<Row> <Row>
<Col> <Col>
<Nav tabs> <Nav tabs>