Skip to content

Commit

Permalink
ui: Added back support for warnings printed in info level. (thanos-io…
Browse files Browse the repository at this point in the history
…#5860)

Signed-off-by: bwplotka <[email protected]>

Signed-off-by: bwplotka <[email protected]>
  • Loading branch information
bwplotka authored and Nathaniel Graham committed May 18, 2023
1 parent 17f7cf2 commit 49e3491
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 49e3491

Please sign in to comment.