Skip to content

Commit

Permalink
(query assist) enforce timerange to QUERY_ASSIST_START_TIME (#1379)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 authored Jan 23, 2024
1 parent 473edac commit f2962ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions public/components/common/search/query_area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useFetchEvents } from '../../event_analytics/hooks/use_fetch_events';
export function QueryArea({
tabId,
handleQueryChange,
handleTimePickerChange,
handleTimeRangePickerRefresh,
runQuery,
tempQuery,
Expand Down Expand Up @@ -66,6 +67,7 @@ export function QueryArea({
<EuiFlexItem>
<QueryAssistInput
tabId={tabId}
handleTimePickerChange={handleTimePickerChange}
handleQueryChange={handleQueryChange}
handleTimeRangePickerRefresh={handleTimeRangePickerRefresh}
setNeedsUpdate={setNeedsUpdate}
Expand Down
1 change: 1 addition & 0 deletions public/components/common/search/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ export const Search = (props: any) => {
<QueryArea
tabId={tabId}
handleQueryChange={handleQueryChange}
handleTimePickerChange={handleTimePickerChange}
handleTimeRangePickerRefresh={handleTimeRangePickerRefresh}
runQuery={query}
tempQuery={tempQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { RAW_QUERY } from '../../../../../common/constants/explorer';
import { QUERY_ASSIST_API } from '../../../../../common/constants/query_assist';
import { QUERY_ASSIST_START_TIME } from '../../../../../common/constants/shared';
import { getOSDHttp } from '../../../../../common/utils';
import { coreRefs } from '../../../../framework/core_refs';
import chatLogo from '../../../datasources/icons/query-assistant-logo.svg';
Expand All @@ -47,6 +48,7 @@ interface SummarizationContext {
interface Props {
handleQueryChange: (query: string) => void;
handleTimeRangePickerRefresh: (availability?: boolean, setSummaryStatus?: boolean) => void;
handleTimePickerChange: (timeRange: string[]) => Promise<void>;
tabId: string;
setNeedsUpdate: any;
selectedIndex: Array<EuiComboBoxOptionOption<string | number | string[] | undefined>>;
Expand Down Expand Up @@ -246,6 +248,7 @@ export const QueryAssistInput: React.FC<Props> = (props) => {
try {
setGeneratingOrRunning(true);
await request();
await props.handleTimePickerChange([QUERY_ASSIST_START_TIME, 'now']);
await props.handleTimeRangePickerRefresh(undefined, true);
} catch (error) {
generateSummary({ isError: true, response: JSON.stringify((error as ResponseError).body) });
Expand Down

0 comments on commit f2962ef

Please sign in to comment.