Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.13] Fix DSL router, update UI for query assist #1620

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions public/components/event_analytics/explorer/query_assist/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import {
EuiButton,
EuiButtonIcon,
EuiCallOut,
EuiComboBoxOptionOption,
EuiFieldText,
Expand Down Expand Up @@ -57,7 +56,7 @@
handleTimeRangePickerRefresh: (availability?: boolean, setSummaryStatus?: boolean) => void;
handleTimePickerChange: (timeRange: string[]) => Promise<void>;
tabId: string;
setNeedsUpdate: any;

Check warning on line 59 in public/components/event_analytics/explorer/query_assist/input.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
selectedIndex: Array<EuiComboBoxOptionOption<string | number | string[] | undefined>>;
nlqInput: string;
setNlqInput: React.Dispatch<React.SetStateAction<string>>;
Expand Down Expand Up @@ -96,6 +95,7 @@
size="s"
color="danger"
iconType="alert"
dismissible
/>
);

Expand All @@ -106,6 +106,18 @@
size="s"
color="warning"
iconType="iInCircle"
dismissible
/>
);

const pplGenerated = (
<EuiCallOut
data-test-subj="query-assist-ppl-callout"
title="PPL query generated"
size="s"
color="success"
iconType="check"
dismissible
/>
);

Expand Down Expand Up @@ -138,7 +150,7 @@
if (explorerData.total > 0 || summaryData.responseForSummaryStatus === 'failure')
generateSummary();
})();
}, [summaryData.responseForSummaryStatus]);

Check warning on line 153 in public/components/event_analytics/explorer/query_assist/input.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has missing dependencies: 'dispatch', 'explorerData.total', 'generateSummary', 'props.nlqInput', and 'props.tabId'. Either include them or remove the dependency array

const dispatch = useDispatch();

Expand All @@ -154,7 +166,7 @@
} else if (queryRedux.ollyQueryAssistant.length > 0) {
setAutoRun(true);
}
}, [queryRedux.ollyQueryAssistant]);

Check warning on line 169 in public/components/event_analytics/explorer/query_assist/input.tsx

View workflow job for this annotation

GitHub Actions / Lint

React Hook useEffect has missing dependencies: 'autoRun' and 'runAndSummarize'. Either include them or remove the dependency array

// hide if not in a tab
if (props.tabId === '') return <>{props.children}</>;
Expand All @@ -176,6 +188,7 @@
},
})
);
setCallOut(pplGenerated);
return generatedPPL;
};
const formatError = (error: ResponseError | Error): Error => {
Expand Down Expand Up @@ -366,16 +379,6 @@
</EuiListGroup>
</EuiInputPopover>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="returnKey"
display={props.lastFocusedInput === 'nlq_input' ? 'fill' : 'base'}
isDisabled={loading}
onClick={runAndSummarize}
size="m"
aria-label="submit-question"
/>
</EuiFlexItem>
</EuiFlexGroup>
{callOut}
{props.children && <EuiSpacer size="s" />}
Expand Down
2 changes: 1 addition & 1 deletion server/routes/dsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function registerDslRoute({ router }: { router: IRouter; facet: DSLFacet
validate: {
query: schema.object({
format: schema.string(),
index: schema.string(),
index: schema.maybe(schema.string()),
}),
},
},
Expand Down
Loading