Skip to content

Commit

Permalink
ui: Added back support for warnings printed in info level. (#5860)
Browse files Browse the repository at this point in the history
Signed-off-by: bwplotka <[email protected]>

Signed-off-by: bwplotka <[email protected]>
  • Loading branch information
bwplotka authored Nov 4, 2022
1 parent 71ce579 commit ced643a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 40 deletions.
80 changes: 40 additions & 40 deletions pkg/ui/bindata.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions pkg/ui/react-app/src/pages/graph/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface PanelState {
lastQueryParams: QueryParams | null;
loading: boolean;
error: string | null;
warnings: string[] | null;
stats: QueryStats | null;
exprInputValue: string;
}
Expand Down Expand Up @@ -83,6 +84,7 @@ class Panel extends Component<PanelProps & PathPrefixProps, PanelState> {
data: null,
lastQueryParams: null,
loading: false,
warnings: null,
error: null,
stats: null,
exprInputValue: props.options.expr,
Expand Down Expand Up @@ -206,6 +208,7 @@ class Panel extends Component<PanelProps & PathPrefixProps, PanelState> {
endTime,
resolution,
},
warnings: json.warnings,
stats: {
loadTime: Date.now() - queryStart,
resolution,
Expand Down Expand Up @@ -284,6 +287,10 @@ class Panel extends Component<PanelProps & PathPrefixProps, PanelState> {
this.setState({ error: null });
};

handleToggleWarn = (): void => {
this.setState({ warnings: null });
};

render(): JSX.Element {
const { pastQueries, metricNames, options, id, stores } = this.props;
return (
Expand Down Expand Up @@ -311,6 +318,18 @@ class Panel extends Component<PanelProps & PathPrefixProps, PanelState> {
</UncontrolledAlert>
</Col>
</Row>
<Row>
<Col>
<UncontrolledAlert
isOpen={this.state.warnings || false}
toggle={this.handleToggleWarn}
color="info"
style={{ whiteSpace: 'break-spaces' }}
>
{this.state.warnings}
</UncontrolledAlert>
</Col>
</Row>
<Row>
<Col>
<Checkbox
Expand Down

0 comments on commit ced643a

Please sign in to comment.