mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[ML] AIOps: Fix relative time bounds for the change point embeddable (#169794)
## Summary
Fixes https://github.com/elastic/kibana/issues/169736
<img width="1240" alt="image"
src="db86b0b9
-ad29-450c-a973-a6c68b9725e7">
Fixes relative time bounds for the change point embeddable.
This commit is contained in:
parent
5bbae7f14e
commit
8e59304a06
2 changed files with 6 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
|||
import moment from 'moment';
|
||||
import { FilterStateStore, type TimeRange } from '@kbn/es-query';
|
||||
import { type TypedLensByValueInput } from '@kbn/lens-plugin/public';
|
||||
import { getAbsoluteTimeRange } from '@kbn/data-plugin/common';
|
||||
import { useMemo } from 'react';
|
||||
import { useFilerQueryUpdates } from '../../hooks/use_filters_query';
|
||||
import { fnOperationTypeMapping } from './constants';
|
||||
|
@ -38,9 +39,11 @@ export const useCommonChartProps = ({
|
|||
* we need to adjust time bound based on the change point timestamp.
|
||||
*/
|
||||
const chartTimeRange = useMemo<TimeRange>(() => {
|
||||
const absoluteTimeRange = getAbsoluteTimeRange(timeRange);
|
||||
|
||||
return {
|
||||
from: moment.min(moment(timeRange.from), moment(annotation.timestamp)).toISOString(),
|
||||
to: moment.max(moment(timeRange.to), moment(annotation.timestamp)).toISOString(),
|
||||
from: moment.min(moment(absoluteTimeRange.from), moment(annotation.timestamp)).toISOString(),
|
||||
to: moment.max(moment(absoluteTimeRange.to), moment(annotation.timestamp)).toISOString(),
|
||||
};
|
||||
}, [timeRange, annotation.timestamp]);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ export const FilterQueryContextProvider: FC<{ timeRange?: TimeRange }> = ({
|
|||
const [resultFilters, setResultFilter] = useState<Filter[]>(filterManager.getFilters());
|
||||
const [resultQuery, setResultQuery] = useState<Query | AggregateQuery>(queryString.getQuery());
|
||||
|
||||
const timeRangeUpdates = useTimeRangeUpdates(true);
|
||||
const timeRangeUpdates = useTimeRangeUpdates(false);
|
||||
|
||||
useEffect(() => {
|
||||
const sub = filterManager.getUpdates$().subscribe(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue