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