Skip to content

Commit

Permalink
Merge pull request #5856 from kyoto/query-browser-persist-timespan
Browse files Browse the repository at this point in the history
Bug 1842756: Monitoring: Persist timespan when graph is hidden
  • Loading branch information
openshift-merge-robot committed Jun 30, 2020
2 parents e1fc274 + 33ca705 commit a764692
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
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

0 comments on commit a764692

Please sign in to comment.