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

Bug 1842756: Monitoring: Persist timespan when graph is hidden #5856

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions frontend/public/components/monitoring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import store, { RootState } from '../redux';
import { RowFunction, Table, TableData, TableRow, TextFilter } from './factory';
import { confirmModal } from './modals';
import MonitoringDashboardsPage from './monitoring/dashboards';
import { graphStateToProps, QueryBrowserPage, ToggleGraph } from './monitoring/metrics';
import { QueryBrowserPage, ToggleGraph } from './monitoring/metrics';
import { PrometheusLabels } from './graphs';
import { QueryBrowser, QueryObj } from './monitoring/query-browser';
import { CheckBoxes } from './row-filter';
Expand Down Expand Up @@ -315,7 +315,6 @@ const queryBrowserURL = (query: string) =>
const Graph_: React.FC<GraphProps> = ({
deleteAll,
filterLabels = undefined,
hideGraphs,
patchQuery,
rule,
}) => {
Expand All @@ -331,10 +330,6 @@ const Graph_: React.FC<GraphProps> = ({

const queries = React.useMemo(() => [query], [query]);

if (hideGraphs) {
return null;
}

// 3 times the rule's duration, but not less than 30 minutes
const timespan = Math.max(3 * duration, 30 * 60) * 1000;

Expand All @@ -349,7 +344,7 @@ const Graph_: React.FC<GraphProps> = ({
/>
);
};
const Graph = connect(graphStateToProps, {
const Graph = connect(null, {
deleteAll: UIActions.queryBrowserDeleteAllQueries,
patchQuery: UIActions.queryBrowserPatchQuery,
})(Graph_);
Expand Down Expand Up @@ -1941,7 +1936,6 @@ type AlertingPageProps = {
type GraphProps = {
deleteAll: () => never;
filterLabels?: PrometheusLabels;
hideGraphs: boolean;
patchQuery: (index: number, patch: QueryObj) => any;
rule: Rule;
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/monitoring/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const HeaderPrometheusLink_ = ({ url }) => {
};
const HeaderPrometheusLink = connect(headerPrometheusLinkStateToProps)(HeaderPrometheusLink_);

export const graphStateToProps = ({ UI }: RootState) => ({
const graphStateToProps = ({ UI }: RootState) => ({
hideGraphs: !!UI.getIn(['monitoring', 'hideGraphs']),
});

Expand Down