mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
parent
2562c5866b
commit
2eb2e17e07
1 changed files with 22 additions and 4 deletions
|
@ -55,13 +55,18 @@ interface UpdateReduxTime extends OnTimeChangeProps {
|
|||
timelineId?: string;
|
||||
}
|
||||
|
||||
interface ReturnUpdateReduxTime {
|
||||
kqlHaveBeenUpdated: boolean;
|
||||
}
|
||||
|
||||
export type DispatchUpdateReduxTime = ({
|
||||
end,
|
||||
id,
|
||||
isQuickSelection,
|
||||
kql,
|
||||
start,
|
||||
timelineId,
|
||||
}: UpdateReduxTime) => void;
|
||||
}: UpdateReduxTime) => ReturnUpdateReduxTime;
|
||||
|
||||
interface SuperDatePickerDispatchProps {
|
||||
setDuration: ({ id, duration }: { id: InputsModelId; duration: number }) => void;
|
||||
|
@ -105,7 +110,7 @@ export const SuperDatePickerComponent = React.memo<SuperDatePickerProps>(
|
|||
);
|
||||
const onRefresh = useCallback(
|
||||
({ start: newStart, end: newEnd }: OnRefreshProps): void => {
|
||||
updateReduxTime({
|
||||
const { kqlHaveBeenUpdated } = updateReduxTime({
|
||||
end: newEnd,
|
||||
id,
|
||||
isInvalid: false,
|
||||
|
@ -118,7 +123,10 @@ export const SuperDatePickerComponent = React.memo<SuperDatePickerProps>(
|
|||
const currentEnd = isQuickSelection
|
||||
? formatDate(newEnd, { roundUp: true })
|
||||
: formatDate(newEnd);
|
||||
if (!isQuickSelection || (start === currentStart && end === currentEnd)) {
|
||||
if (
|
||||
!kqlHaveBeenUpdated &&
|
||||
(!isQuickSelection || (start === currentStart && end === currentEnd))
|
||||
) {
|
||||
refetchQuery(queries);
|
||||
}
|
||||
},
|
||||
|
@ -217,9 +225,10 @@ export const dispatchUpdateReduxTime = (dispatch: Dispatch) => ({
|
|||
end,
|
||||
id,
|
||||
isQuickSelection,
|
||||
kql,
|
||||
start,
|
||||
timelineId,
|
||||
}: UpdateReduxTime): void => {
|
||||
}: UpdateReduxTime): ReturnUpdateReduxTime => {
|
||||
const fromDate = formatDate(start);
|
||||
let toDate = formatDate(end, { roundUp: true });
|
||||
if (isQuickSelection) {
|
||||
|
@ -251,6 +260,15 @@ export const dispatchUpdateReduxTime = (dispatch: Dispatch) => ({
|
|||
})
|
||||
);
|
||||
}
|
||||
if (kql) {
|
||||
return {
|
||||
kqlHaveBeenUpdated: kql.refetch(dispatch),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
kqlHaveBeenUpdated: false,
|
||||
};
|
||||
};
|
||||
|
||||
export const makeMapStateToProps = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue