Skip to content

Commit

Permalink
fixing language switching bug
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Li <[email protected]>
  • Loading branch information
sejli committed Jun 12, 2024
1 parent eb8cc68 commit e04f857
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ export default function QueryEditorTopRow(props: QueryEditorTopRowProps) {
);

function onClickSubmitButton(event: React.MouseEvent<HTMLButtonElement>) {
if (persistedLog && props.query) {
if (
persistedLog &&
props.query &&
(props.query.language === 'kuery' || props.query.language.toLowerCase() === 'lucene')
) {
persistedLog.add(props.query.query);
}
event.preventDefault();
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/data/public/ui/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class Settings {
setUserQueryEnhancementsEnabled(enabled: boolean) {
if (!this.config.enabled) return;
this.storage.set('opensearchDashboards.userQueryEnhancementsEnabled', enabled);
if (!enabled) {
this.storage.remove('opensearchDashboards.userQueryLanguage');
this.storage.remove('opensearchDashboards.userQueryString');
}
this.enabledQueryEnhancementsUpdated$.next(enabled);
return true;
}
Expand Down

0 comments on commit e04f857

Please sign in to comment.