Skip to content

Commit

Permalink
Merge pull request #9863 from vikram-raj/odc-6275
Browse files Browse the repository at this point in the history
Bug 1997079: Fix moitoring custom time range
  • Loading branch information
openshift-merge-robot committed Aug 25, 2021
2 parents 5190d0f + 472b859 commit 8d861e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -7,7 +7,6 @@ import { useDispatch, useSelector } from 'react-redux';

import { DatePicker, TimePicker } from '@patternfly/react-core';

import { useActivePerspective } from '@console/shared';
import {
monitoringDashboardsSetEndTime,
monitoringDashboardsSetTimespan,
Expand All @@ -23,10 +22,10 @@ import {
import { toISODateString, twentyFourHourTime } from '../../utils/datetime';
import { setQueryArguments } from '../../utils';

const CustomTimeRangeModal = ({ cancel, close }: ModalComponentProps) => {
const { t } = useTranslation();
const [activePerspective] = useActivePerspective();
type CustomTimeRangeModalProps = ModalComponentProps & { activePerspective: string };

const CustomTimeRangeModal = ({ cancel, close, activePerspective }: CustomTimeRangeModalProps) => {
const { t } = useTranslation();
const dispatch = useDispatch();
const endTime = useSelector(({ UI }: RootState) =>
UI.getIn(['monitoringDashboards', activePerspective, 'endTime']),
Expand Down
Expand Up @@ -38,7 +38,7 @@ const TimespanDropdown: React.FC = () => {
const onChange = React.useCallback(
(v: string) => {
if (v === CUSTOM_TIME_RANGE_KEY) {
customTimeRangeModal({});
customTimeRangeModal({ activePerspective });
} else {
setQueryArgument('timeRange', parsePrometheusDuration(v).toString());
removeQueryArgument('endTime');
Expand Down

0 comments on commit 8d861e2

Please sign in to comment.