mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[Security Solution] Invalid kql query timeline refresh bug (#105525)
* poc test * adds disable for refresh button Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
591c11988d
commit
a34a15ea3d
3 changed files with 34 additions and 11 deletions
|
@ -91,6 +91,7 @@ export const SuperDatePickerComponent = React.memo<SuperDatePickerProps>(
|
||||||
timelineId,
|
timelineId,
|
||||||
toStr,
|
toStr,
|
||||||
updateReduxTime,
|
updateReduxTime,
|
||||||
|
disabled,
|
||||||
}) => {
|
}) => {
|
||||||
const [recentlyUsedRanges, setRecentlyUsedRanges] = useState<EuiSuperDatePickerRecentRange[]>(
|
const [recentlyUsedRanges, setRecentlyUsedRanges] = useState<EuiSuperDatePickerRecentRange[]>(
|
||||||
[]
|
[]
|
||||||
|
@ -201,6 +202,7 @@ export const SuperDatePickerComponent = React.memo<SuperDatePickerProps>(
|
||||||
refreshInterval={duration}
|
refreshInterval={duration}
|
||||||
showUpdateButton={true}
|
showUpdateButton={true}
|
||||||
start={startDate}
|
start={startDate}
|
||||||
|
isDisabled={disabled}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -216,6 +218,7 @@ export const SuperDatePickerComponent = React.memo<SuperDatePickerProps>(
|
||||||
prevProps.startAutoReload === nextProps.startAutoReload &&
|
prevProps.startAutoReload === nextProps.startAutoReload &&
|
||||||
prevProps.stopAutoReload === nextProps.stopAutoReload &&
|
prevProps.stopAutoReload === nextProps.stopAutoReload &&
|
||||||
prevProps.timelineId === nextProps.timelineId &&
|
prevProps.timelineId === nextProps.timelineId &&
|
||||||
|
prevProps.disabled === nextProps.disabled &&
|
||||||
prevProps.toStr === nextProps.toStr &&
|
prevProps.toStr === nextProps.toStr &&
|
||||||
prevProps.updateReduxTime === nextProps.updateReduxTime &&
|
prevProps.updateReduxTime === nextProps.updateReduxTime &&
|
||||||
deepEqual(prevProps.kqlQuery, nextProps.kqlQuery) &&
|
deepEqual(prevProps.kqlQuery, nextProps.kqlQuery) &&
|
||||||
|
|
|
@ -220,14 +220,21 @@ export const QueryTabContentComponent: React.FC<Props> = ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const isBlankTimeline: boolean =
|
const isBlankTimeline: boolean =
|
||||||
isEmpty(dataProviders) && isEmpty(filters) && isEmpty(kqlQuery.query);
|
isEmpty(dataProviders) &&
|
||||||
|
isEmpty(filters) &&
|
||||||
|
isEmpty(kqlQuery.query) &&
|
||||||
|
combinedQueries?.filterQuery === undefined;
|
||||||
|
|
||||||
const canQueryTimeline = () =>
|
const canQueryTimeline = useMemo(
|
||||||
combinedQueries != null &&
|
() =>
|
||||||
loadingSourcerer != null &&
|
combinedQueries != null &&
|
||||||
!loadingSourcerer &&
|
loadingSourcerer != null &&
|
||||||
!isEmpty(start) &&
|
!loadingSourcerer &&
|
||||||
!isEmpty(end);
|
!isEmpty(start) &&
|
||||||
|
!isEmpty(end) &&
|
||||||
|
combinedQueries?.filterQuery !== undefined,
|
||||||
|
[combinedQueries, end, loadingSourcerer, start]
|
||||||
|
);
|
||||||
|
|
||||||
const getTimelineQueryFields = () => {
|
const getTimelineQueryFields = () => {
|
||||||
const columnsHeader = isEmpty(columns) ? defaultHeaders : columns;
|
const columnsHeader = isEmpty(columns) ? defaultHeaders : columns;
|
||||||
|
@ -264,7 +271,7 @@ export const QueryTabContentComponent: React.FC<Props> = ({
|
||||||
limit: itemsPerPage,
|
limit: itemsPerPage,
|
||||||
filterQuery: combinedQueries?.filterQuery,
|
filterQuery: combinedQueries?.filterQuery,
|
||||||
startDate: start,
|
startDate: start,
|
||||||
skip: !canQueryTimeline() || combinedQueries?.filterQuery === undefined,
|
skip: !canQueryTimeline,
|
||||||
sort: timelineQuerySortField,
|
sort: timelineQuerySortField,
|
||||||
timerangeKind,
|
timerangeKind,
|
||||||
});
|
});
|
||||||
|
@ -290,6 +297,10 @@ export const QueryTabContentComponent: React.FC<Props> = ({
|
||||||
);
|
);
|
||||||
}, [loadingSourcerer, timelineId, isQueryLoading, dispatch]);
|
}, [loadingSourcerer, timelineId, isQueryLoading, dispatch]);
|
||||||
|
|
||||||
|
const isDatePickerDisabled = useMemo(() => {
|
||||||
|
return (combinedQueries && combinedQueries.kqlError != null) || false;
|
||||||
|
}, [combinedQueries]);
|
||||||
|
|
||||||
const leadingControlColumns: ControlColumnProps[] = [defaultControlColumn];
|
const leadingControlColumns: ControlColumnProps[] = [defaultControlColumn];
|
||||||
const trailingControlColumns: ControlColumnProps[] = [];
|
const trailingControlColumns: ControlColumnProps[] = [];
|
||||||
|
|
||||||
|
@ -304,6 +315,7 @@ export const QueryTabContentComponent: React.FC<Props> = ({
|
||||||
inspect={inspect}
|
inspect={inspect}
|
||||||
loading={isQueryLoading}
|
loading={isQueryLoading}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
|
skip={!canQueryTimeline}
|
||||||
/>
|
/>
|
||||||
<FullWidthFlexGroup gutterSize="none">
|
<FullWidthFlexGroup gutterSize="none">
|
||||||
<ScrollableFlexItem grow={2}>
|
<ScrollableFlexItem grow={2}>
|
||||||
|
@ -323,7 +335,11 @@ export const QueryTabContentComponent: React.FC<Props> = ({
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<DatePicker grow={1}>
|
<DatePicker grow={1}>
|
||||||
<SuperDatePicker id="timeline" timelineId={timelineId} />
|
<SuperDatePicker
|
||||||
|
id="timeline"
|
||||||
|
timelineId={timelineId}
|
||||||
|
disabled={isDatePickerDisabled}
|
||||||
|
/>
|
||||||
</DatePicker>
|
</DatePicker>
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<TimelineDatePickerLock />
|
<TimelineDatePickerLock />
|
||||||
|
|
|
@ -18,6 +18,7 @@ export interface TimelineRefetchProps {
|
||||||
inspect: inputsModel.InspectQuery | null;
|
inspect: inputsModel.InspectQuery | null;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
refetch: inputsModel.Refetch;
|
refetch: inputsModel.Refetch;
|
||||||
|
skip?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TimelineRefetchComponent: React.FC<TimelineRefetchProps> = ({
|
const TimelineRefetchComponent: React.FC<TimelineRefetchProps> = ({
|
||||||
|
@ -26,12 +27,15 @@ const TimelineRefetchComponent: React.FC<TimelineRefetchProps> = ({
|
||||||
inspect,
|
inspect,
|
||||||
loading,
|
loading,
|
||||||
refetch,
|
refetch,
|
||||||
|
skip,
|
||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(inputsActions.setQuery({ id, inputId, inspect, loading, refetch }));
|
if (!skip) {
|
||||||
}, [dispatch, id, inputId, loading, refetch, inspect]);
|
dispatch(inputsActions.setQuery({ id, inputId, inspect, loading, refetch }));
|
||||||
|
}
|
||||||
|
}, [dispatch, id, inputId, loading, refetch, inspect, skip]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue