Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Added back support for warnings printed in info level. #5860

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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