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

[Discover-next] add query enhancements plugin as a core plugin #7212

Merged
merged 75 commits into from
Jul 16, 2024

Conversation

kavilla
Copy link
Member

@kavilla kavilla commented Jul 9, 2024

NOTE: Will update this and move some of the stuff that was added if it was a 3rd party plugin and will add justifications based on this rubric:

#7081 (comment)

Also need to swap the default values around.

Description

Introduces the addition of a new core plugin called Query Enhancements

This plugin seems to be focused on enhancing query capabilities, particularly in areas like PPL (Piped Processing Language), SQL, and natural language query assistance.

Plugin Configuration and Setup

The plugin is set up with the necessary configuration files:

  • src/plugins/query_enhancements/opensearch_dashboards.json: Defines the plugin's metadata and dependencies.
  • src/plugins/query_enhancements/common/config.ts: Contains the configuration schema for the plugin.
  • src/plugins/query_enhancements/public/plugin.tsx: The main plugin file that sets up the public-facing part of the plugin.
  • src/plugins/query_enhancements/server/plugin.ts: The server-side setup for the plugin.

Query Assist Feature

A significant part of the plugin is dedicated to a "Query Assist" feature:

  • src/plugins/query_enhancements/public/query_assist/: This directory contains components, hooks, and utilities for the Query Assist feature.
  • src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx: A React component for the Query Assist bar.
  • src/plugins/query_enhancements/server/routes/query_assist/: Server-side routing for Query Assist functionality.

Search Interceptors

The plugin introduces several search interceptors:

  • src/plugins/query_enhancements/public/search/ppl_search_interceptor.ts
  • src/plugins/query_enhancements/public/search/sql_search_interceptor.ts
  • src/plugins/query_enhancements/public/search/sql_async_search_interceptor.ts

These interceptors likely modify or enhance the search functionality for different query languages.

Data Source Connection

There's a new feature for data source connections:

  • src/plugins/query_enhancements/public/data_source_connection/: This directory contains components and services for managing data source connections.

Server-side Search Strategies

The plugin implements server-side search strategies for different query types:

  • src/plugins/query_enhancements/server/search/ppl_search_strategy.ts
  • src/plugins/query_enhancements/server/search/sql_search_strategy.ts
  • src/plugins/query_enhancements/server/search/sql_async_search_strategy.ts

Modifications to Existing Files

There are some modifications to existing files outside the new plugin directory:

  • src/plugins/data/public/index.ts: Exports new types and interfaces.
  • src/plugins/data/public/ui/index.ts: Exports new UI components.
  • src/plugins/data/public/ui/query_editor/index.tsx: Modifies the QueryEditor component.

Testing

The plugin includes a comprehensive test setup:

  • src/plugins/query_enhancements/test/: Contains Jest configuration and setup files for testing.

Acknowledgements

Contains work by @sejli @joshuali925 @Swiddis @paulstn @mengweieric
Thx @ashwin-pc for the description summary

Issues Related

#6072
#6074
#6075

Changelog

  • feat: add query enhancements plugin as a core plugin

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

kavilla and others added 30 commits June 11, 2024 18:32
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Sean Li <lnse@amazon.com>
* Update plugin.ts to comment out SQL Async and disable filters to SQL
* Remove target directory

Signed-off-by: Sean Li <lnse@amazon.com>
Signed-off-by: Sean Li <lnse@amazon.com>
Add target and build directories to .gitignore

Signed-off-by: Sean Li <lnse@amazon.com>
Going for the light weight solution for 2.15. So took out what wasn't
required deliverable.

However, I created a branch `feature/discover-next` which has the state
where all the features where added so we can port it over post 2.15.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Sean Li <lnse@amazon.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Some clean up to reduce file count
…arch-project#6895)

it adds query assist specific logic in query enhancements plugin to show a UI above the PPL search bar if user has configured PPL agent.

Issues Resolved: opensearch-project#6820

* add query assist to query enhancements

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* align language to uppercase

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* pick PR 6167

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* use useState hooks for query assist

There is a bug in data explorer `AppContainer` where memorized
`DiscoverCanvas` gets unmounted after `setQuery`. PR 6167 works around
it by memorizing `AppContainer`. As query assist is no longer being
unmounted, we can use proper hooks to persist state now.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Revert "pick PR 6167"

This reverts commit acb0d41.

Wait for official 6167 to merge to avoid conflict

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* address comments for PR 6894

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 016e0f2)
…assist (opensearch-project#6933)

* pass dependencies to isEnabled func

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add lazy and memo to search bar extensions

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* move ppl specific string out from query assist

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* prevent setstate after hook unmounts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add max-height to search bar extensions

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* prevent setstate after component unmounts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* move ml-commons API to common/index.ts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* improve i18n and accessibility usages

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add hard-coded suggestions for sample data indices

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 4aade0f)
…ject#6972)

* disable query assist for non-default datasource

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* disable query assist input when loading

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* support MDS for query assist

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add unit tests for agents

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Revert "add unit tests for agents"

This reverts commit 983514e.
The test configs are not yet setup in query_enhancements plugins.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 328e08e)
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
This is a temporary solution given that in discover the index pattern
selector will be removed. Before datasource and dataset selectors are
added, query assist will rely on this index pattern selector to
determine which index user wants to query.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Utilizing the work from MDS to make PPL and SQL calls to a remote
cluster.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
This PR picks

[Discover-next] add query assist to query enhancements plugin opensearch-project#6895
[Discover-next] Address comments for search bar extensions and query assist opensearch-project#6933
[Discover-next] Support data sources for query assist opensearch-project#6972
adds query assist banner

    a callout that advertises query assist when user has at least 1 language with query assist configured and is not on a configured language

adds index selector for local cluster only

    This is a temporary solution given that in discover the index pattern
    selector will be removed. Before datasource and dataset selectors are
    added, query assist will rely on this index pattern selector to
    determine which index user wants to query.

Signed-off-by: Joshua Li <joshuali925@gmail.com>
Utilizing the work from MDS to make PPL and SQL calls to a remote cluster.

Uses:
https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7092/files
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Add missing license headers
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
@xluo-aws
Copy link
Member

@kavilla Do we allow OSD core call plugin APIs?

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall no major blockers. Had a few comments though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Readme could use more data.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add tests for these?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for now, but consider moving these into a custom hook with tests once the dataset work is complete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this should be tossed once data set is added

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need so many obsrvables? Cant we combine the whole connection state into one observable and share it?

e.g.

import { BehaviorSubject, Observable } from 'rxjs';
import { CoreStart, CoreSetup } from 'opensearch-dashboards/public';
import { Connection, ConnectionsServiceDeps } from '../../types';
import { API } from '../../../common';

interface ConnectionsState {
  isDataSourceEnabled: boolean;
  selectedConnection?: Connection;
  uiService?: DataPublicPluginStart['ui'];
}

export class ConnectionsService {
  private http: CoreSetup['http'];
  private savedObjects: CoreStart['savedObjects'];
  private state$ = new BehaviorSubject<ConnectionsState>({
    isDataSourceEnabled: false,
    selectedConnection: undefined,
    uiService: undefined,
  });

  constructor(deps: ConnectionsServiceDeps) {
    deps.startServices.then(([coreStart, depsStart]) => {
      this.http = deps.http;
      this.savedObjects = coreStart.savedObjects;
      this.updateState({
        uiService: depsStart.data.ui,
        isDataSourceEnabled: depsStart.dataSource?.dataSourceEnabled || false,
      });
    });
  }

  private updateState(newState: Partial<ConnectionsState>) {
    this.state$.next({ ...this.state$.value, ...newState });
  }

  getState$(): Observable<ConnectionsState> {
    return this.state$.asObservable();
  }

  getSavedObjects() {
    return this.savedObjects;
  }

  async getConnections(): Promise<Connection[]> {
    return this.http.get(API.DATA_SOURCE.CONNECTIONS);
  }

  async getConnectionById(id: string): Promise<Connection> {
    return this.http.get(`${API.DATA_SOURCE.CONNECTIONS}/${id}`);
  }

  setSelectedConnection(connection: Connection | undefined) {
    this.updateState({ selectedConnection: connection });
  }
}

And use it like:

const ConnectionsBar: React.FC<ConnectionsProps> = ({ connectionsService, toasts }) => {
  const [state, setState] = useState<ConnectionsState>({
    isDataSourceEnabled: false,
    selectedConnection: undefined,
    uiService: undefined,
  });

  useEffect(() => {
    const subscription = connectionsService.getState$().subscribe(setState);
    return () => subscription.unsubscribe();
  }, [connectionsService]);

  // ... rest of the logic
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service also needs unit tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also i dont think this should be an extention. The dataset selection should be a core part of the querybar. We dont need to make this an extension. I see the query bar being split into 2 parts:

  • Query Header
  • Query Body

The dataset selector and other connection related stuff can then go into the QueryBar header.

e.g.

// Generic QueryContainer Component
const QueryContainer = ({ title, children }) => {
  const [isExpanded, setIsExpanded] = useState(false);
  return (
    <div>
      <QueryHeader onToggleExpand={() => setIsExpanded(!isExpanded)} isExpanded={isExpanded} title={title} />
      {isExpanded && <QueryBody>{children}</QueryBody>}
    </div>
  );
};

// Generic QueryHeader Component
const QueryHeader = ({ onToggleExpand, isExpanded, title }) => (
  <div>
    <button onClick={onToggleExpand}>{isExpanded ? 'v' : '>'} {title}</button>
    <DatasetSelector />
    <LanguageSelector />
    <QueryActions />
  </div>
);

// Generic QueryBody Component
const QueryBody = ({ children }) => (
  <div>
    {children}
  </div>
);

}

public setup(core: CoreSetup, { data, dataSource }: QueryEnhancementsPluginSetupDependencies) {
this.logger.debug('queryEnhancements: Setup');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this?

this.logger.debug('queryEnhancements: Setup');
const router = core.http.createRouter();
// Register server side APIs
const client = core.opensearch.legacy.createClient('opensearch_observability', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we introducing new routes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should write tests for the search strategies

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this for?

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
@kavilla
Copy link
Member Author

kavilla commented Jul 16, 2024

@kavilla Do we allow OSD core call plugin APIs?

yeah. it's actually as simple data.search

@ashwin-pc
Copy link
Member

@kavilla Do we allow OSD core call plugin APIs?

yeah. it's actually as simple data.search

Wait, what now? where did this happen?

@@ -30,7 +30,7 @@ jest.mock('../components/query_assist_banner', () => ({
QueryAssistBanner: jest.fn(() => <div>QueryAssistBanner</div>),
}));

describe('CreateExtension', () => {
describe.skip('CreateExtension', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshuali925 can you help fix this soo so that we dont ignore these tests for 2.16?

coreMock.createInternalStart(),
httpServerMock.createOpenSearchDashboardsRequest()
);
describe.skip('Agents helper functions', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshuali925 Same goes here

Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments will be addressed in a fast follow. Approve=ing this for now so that dependency features can be merged in. The comments here are just for code quality and tests

@joshuali925
Copy link
Member

joshuali925 commented Jul 16, 2024

diff to fix some code and tests in query assist

diff --git a/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx b/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
index 84ac854c980..e87e74ce299 100644
--- a/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
@@ -45,7 +45,7 @@ export const QueryAssistBar: React.FC<QueryAssistInputProps> = (props) => {
     const subscription = props.connectionsService
       .getSelectedConnection$()
       .subscribe((connection) => {
-        dataSourceIdRef.current = connection?.id;
+        dataSourceIdRef.current = connection?.dataSource.id;
       });
     return () => subscription.unsubscribe();
   }, [props.connectionsService]);
diff --git a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
index ea568959152..41fc36dd71c 100644
--- a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
@@ -24,13 +24,10 @@ const httpMock = coreSetupMock.http;
 
 jest.mock('../components', () => ({
   QueryAssistBar: jest.fn(() => <div>QueryAssistBar</div>),
-}));
-
-jest.mock('../components/query_assist_banner', () => ({
   QueryAssistBanner: jest.fn(() => <div>QueryAssistBanner</div>),
 }));
 
-describe.skip('CreateExtension', () => {
+describe('CreateExtension', () => {
   afterEach(() => {
     jest.clearAllMocks();
   });
diff --git a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
index bd990b57f5a..8d51cb8998c 100644
--- a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
@@ -28,7 +28,7 @@ const getAvailableLanguages$ = (
   connectionsService.getSelectedConnection$().pipe(
     distinctUntilChanged(),
     switchMap(async (connection) => {
-      const dataSourceId = connection?.id;
+      const dataSourceId = connection?.dataSource.id;
       const cached = availableLanguagesByDataSource.get(dataSourceId);
       if (cached !== undefined) return cached;
       const languages = await http
@@ -102,6 +102,7 @@ interface QueryAssistWrapperProps {
 
 const QueryAssistWrapper: React.FC<QueryAssistWrapperProps> = (props) => {
   const [visible, setVisible] = useState(false);
 
   useEffect(() => {
     let mounted = true;
@@ -112,6 +113,7 @@ const QueryAssistWrapper: React.FC<QueryAssistWrapperProps> = (props) => {
       props.http
     ).subscribe((languages) => {
       const available = languages.includes(props.dependencies.language);
       if (mounted) setVisible(props.invert ? !available : available);
     });
 
diff --git a/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts b/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
index f22bdb14836..5e31191c9c9 100644
--- a/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
+++ b/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
@@ -5,25 +5,29 @@
 
 import { ApiResponse } from '@opensearch-project/opensearch';
 import { ResponseError } from '@opensearch-project/opensearch/lib/errors';
+import { loggerMock } from '@osd/logging/target/mocks';
 import { RequestHandlerContext } from 'src/core/server';
-// // eslint-disable-next-line @osd/eslint/no-restricted-paths
-// import { CoreRouteHandlerContext } from 'src/core/server/core_route_handler_context';
 import { coreMock } from '../../../../../core/server/mocks';
-import { loggerMock } from '@osd/logging/target/mocks';
 import { getAgentIdByConfig, requestAgentByConfig } from './agents';
 
-describe.skip('Agents helper functions', () => {
-  // const coreContext = new CoreRouteHandlerContext(
-  //   coreMock.createInternalStart(),
-  //   httpServerMock.createOpenSearchDashboardsRequest()
-  // );
+describe('Agents helper functions', () => {
   const coreContext = coreMock.createRequestHandlerContext();
   const client = coreContext.opensearch.client.asCurrentUser;
   const mockedTransport = client.transport.request as jest.Mock;
   const context: RequestHandlerContext = {
     core: coreContext,
+    // @ts-ignore
     dataSource: jest.fn(),
-    query_assist: { dataSourceEnabled: false, logger: loggerMock.create() },
+    query_assist: {
+      dataSourceEnabled: false,
+      logger: loggerMock.create(),
+      configPromise: Promise.resolve({
+        enabled: true,
+        queryAssist: {
+          supportedLanguages: [{ language: 'PPL', agentConfig: 'testConfig' }],
+        },
+      }),
+    },
   };
 
   afterEach(() => {
diff --git a/src/plugins/query_enhancements/server/types.ts b/src/plugins/query_enhancements/server/types.ts
index 2ab716b9892..1a5d962e705 100644
--- a/src/plugins/query_enhancements/server/types.ts
+++ b/src/plugins/query_enhancements/server/types.ts
@@ -51,7 +51,10 @@ export interface FacetRequest {
   };
 }
 
-declare module '../../../core/server' {
+// TODO declare it in core changes the type for every reference. we only need
+// this declaration in query_enhancements, but it doesn't seem possible
+// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4274
+/* declare module '../../../core/server' {
   interface RequestHandlerContext {
     query_assist: {
       logger: Logger;
@@ -64,4 +67,4 @@ declare module '../../../core/server' {
       dataSourceEnabled: boolean;
     };
   }
-}
+} */

@kavilla
Copy link
Member Author

kavilla commented Jul 16, 2024

l will breakdown the fast follows as issues and re-link them here.

@kavilla kavilla merged commit 9194d83 into opensearch-project:main Jul 16, 2024
64 of 67 checks passed
@kavilla
Copy link
Member Author

kavilla commented Jul 16, 2024

diff to fix some code and tests in query assist

diff --git a/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx b/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
index 84ac854c980..e87e74ce299 100644
--- a/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx
@@ -45,7 +45,7 @@ export const QueryAssistBar: React.FC<QueryAssistInputProps> = (props) => {
     const subscription = props.connectionsService
       .getSelectedConnection$()
       .subscribe((connection) => {
-        dataSourceIdRef.current = connection?.id;
+        dataSourceIdRef.current = connection?.dataSource.id;
       });
     return () => subscription.unsubscribe();
   }, [props.connectionsService]);
diff --git a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
index ea568959152..41fc36dd71c 100644
--- a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.test.tsx
@@ -24,13 +24,10 @@ const httpMock = coreSetupMock.http;
 
 jest.mock('../components', () => ({
   QueryAssistBar: jest.fn(() => <div>QueryAssistBar</div>),
-}));
-
-jest.mock('../components/query_assist_banner', () => ({
   QueryAssistBanner: jest.fn(() => <div>QueryAssistBanner</div>),
 }));
 
-describe.skip('CreateExtension', () => {
+describe('CreateExtension', () => {
   afterEach(() => {
     jest.clearAllMocks();
   });
diff --git a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
index bd990b57f5a..8d51cb8998c 100644
--- a/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
+++ b/src/plugins/query_enhancements/public/query_assist/utils/create_extension.tsx
@@ -28,7 +28,7 @@ const getAvailableLanguages$ = (
   connectionsService.getSelectedConnection$().pipe(
     distinctUntilChanged(),
     switchMap(async (connection) => {
-      const dataSourceId = connection?.id;
+      const dataSourceId = connection?.dataSource.id;
       const cached = availableLanguagesByDataSource.get(dataSourceId);
       if (cached !== undefined) return cached;
       const languages = await http
@@ -102,6 +102,7 @@ interface QueryAssistWrapperProps {
 
 const QueryAssistWrapper: React.FC<QueryAssistWrapperProps> = (props) => {
   const [visible, setVisible] = useState(false);
 
   useEffect(() => {
     let mounted = true;
@@ -112,6 +113,7 @@ const QueryAssistWrapper: React.FC<QueryAssistWrapperProps> = (props) => {
       props.http
     ).subscribe((languages) => {
       const available = languages.includes(props.dependencies.language);
       if (mounted) setVisible(props.invert ? !available : available);
     });
 
diff --git a/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts b/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
index f22bdb14836..5e31191c9c9 100644
--- a/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
+++ b/src/plugins/query_enhancements/server/routes/query_assist/agents.test.ts
@@ -5,25 +5,29 @@
 
 import { ApiResponse } from '@opensearch-project/opensearch';
 import { ResponseError } from '@opensearch-project/opensearch/lib/errors';
+import { loggerMock } from '@osd/logging/target/mocks';
 import { RequestHandlerContext } from 'src/core/server';
-// // eslint-disable-next-line @osd/eslint/no-restricted-paths
-// import { CoreRouteHandlerContext } from 'src/core/server/core_route_handler_context';
 import { coreMock } from '../../../../../core/server/mocks';
-import { loggerMock } from '@osd/logging/target/mocks';
 import { getAgentIdByConfig, requestAgentByConfig } from './agents';
 
-describe.skip('Agents helper functions', () => {
-  // const coreContext = new CoreRouteHandlerContext(
-  //   coreMock.createInternalStart(),
-  //   httpServerMock.createOpenSearchDashboardsRequest()
-  // );
+describe('Agents helper functions', () => {
   const coreContext = coreMock.createRequestHandlerContext();
   const client = coreContext.opensearch.client.asCurrentUser;
   const mockedTransport = client.transport.request as jest.Mock;
   const context: RequestHandlerContext = {
     core: coreContext,
+    // @ts-ignore
     dataSource: jest.fn(),
-    query_assist: { dataSourceEnabled: false, logger: loggerMock.create() },
+    query_assist: {
+      dataSourceEnabled: false,
+      logger: loggerMock.create(),
+      configPromise: Promise.resolve({
+        enabled: true,
+        queryAssist: {
+          supportedLanguages: [{ language: 'PPL', agentConfig: 'testConfig' }],
+        },
+      }),
+    },
   };
 
   afterEach(() => {
diff --git a/src/plugins/query_enhancements/server/types.ts b/src/plugins/query_enhancements/server/types.ts
index 2ab716b9892..1a5d962e705 100644
--- a/src/plugins/query_enhancements/server/types.ts
+++ b/src/plugins/query_enhancements/server/types.ts
@@ -51,7 +51,10 @@ export interface FacetRequest {
   };
 }
 
-declare module '../../../core/server' {
+// TODO declare it in core changes the type for every reference. we only need
+// this declaration in query_enhancements, but it doesn't seem possible
+// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4274
+/* declare module '../../../core/server' {
   interface RequestHandlerContext {
     query_assist: {
       logger: Logger;
@@ -64,4 +67,4 @@ declare module '../../../core/server' {
       dataSourceEnabled: boolean;
     };
   }
-}
+} */

thx joshua, I merged this PR into main did you want to open a pr for that fix into the main repo? otherwise i can do that

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7212-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9194d83303879b224a0d416b03be4cadfe855f7f
# Push it to GitHub
git push --set-upstream origin backport/backport-7212-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7212-to-2.x.

@joshuali925
Copy link
Member

i added a PR for the skipped tests #7272

kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Jul 17, 2024
Remove the data config toggle for enhancements and rely on the
UI settings for being enabled.

Issue Followup:
opensearch-project#7212

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
ashwin-pc pushed a commit that referenced this pull request Jul 18, 2024
)

* [Discover-next] remove plugin config toggle for data enhancements

Remove the data config toggle for enhancements and rely on the
UI settings for being enabled.

Issue Followup:
#7212

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* fix url

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* remove read only flag

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Changeset file for PR #7291 created/updated

* set default to false

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

---------

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 18, 2024
)

* [Discover-next] remove plugin config toggle for data enhancements

Remove the data config toggle for enhancements and rely on the
UI settings for being enabled.

Issue Followup:
#7212

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* fix url

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* remove read only flag

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Changeset file for PR #7291 created/updated

* set default to false

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

---------

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 5761207)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.16 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.16 2.16
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.16
# Create a new branch
git switch --create backport/backport-7212-to-2.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 9194d83303879b224a0d416b03be4cadfe855f7f
# Push it to GitHub
git push --set-upstream origin backport/backport-7212-to-2.16
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.16

Then, create a pull request where the base branch is 2.16 and the compare/head branch is backport/backport-7212-to-2.16.

sejli pushed a commit to sejli/OpenSearch-Dashboards that referenced this pull request Jul 23, 2024
…earch-project#7212)

Introduces the addition of a new core plugin called `Query Enhancements`

This plugin seems to be focused on enhancing query capabilities, particularly in areas like PPL (Piped Processing Language), SQL, and natural language query assistance.

The plugin is set up with the necessary configuration files:

- src/plugins/query_enhancements/opensearch_dashboards.json: Defines the plugin's metadata and dependencies.
- src/plugins/query_enhancements/common/config.ts: Contains the configuration schema for the plugin.
- src/plugins/query_enhancements/public/plugin.tsx: The main plugin file that sets up the public-facing part of the plugin.
- src/plugins/query_enhancements/server/plugin.ts: The server-side setup for the plugin.

A significant part of the plugin is dedicated to a "Query Assist" feature:

- src/plugins/query_enhancements/public/query_assist/: This directory contains components, hooks, and utilities for the Query Assist feature.
- src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx: A React component for the Query Assist bar.
- src/plugins/query_enhancements/server/routes/query_assist/: Server-side routing for Query Assist functionality.

The plugin introduces several search interceptors:

- src/plugins/query_enhancements/public/search/ppl_search_interceptor.ts
- src/plugins/query_enhancements/public/search/sql_search_interceptor.ts
- src/plugins/query_enhancements/public/search/sql_async_search_interceptor.ts

These interceptors likely modify or enhance the search functionality for different query languages.

There's a new feature for data source connections:

- src/plugins/query_enhancements/public/data_source_connection/: This directory contains components and services for managing data source connections.

The plugin implements server-side search strategies for different query types:

- src/plugins/query_enhancements/server/search/ppl_search_strategy.ts
- src/plugins/query_enhancements/server/search/sql_search_strategy.ts
- src/plugins/query_enhancements/server/search/sql_async_search_strategy.ts

There are some modifications to existing files outside the new plugin directory:

- src/plugins/data/public/index.ts: Exports new types and interfaces.
- src/plugins/data/public/ui/index.ts: Exports new UI components.
- src/plugins/data/public/ui/query_editor/index.tsx: Modifies the QueryEditor component.

The plugin includes a comprehensive test setup:

- src/plugins/query_enhancements/test/: Contains Jest configuration and setup files for testing.

Contains work by @sejli @joshuali925 @Swiddis @paulstn @mengweieric
Thx @ashwin-pc for the description summary

opensearch-project#6072
opensearch-project#6074
opensearch-project#6075

Commits include:
* init

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* fixing bugs and removing target

Signed-off-by: Sean Li <lnse@amazon.com>

* add target and build to .gitignore

Signed-off-by: Sean Li <lnse@amazon.com>

* Remove SQL Async and Query Assist

Going for the light weight solution for 2.15. So took out what wasn't
required deliverable.

However, I created a branch `feature/discover-next` which has the state
where all the features where added so we can port it over post 2.15.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* adding fix for PPL queries

Signed-off-by: Sean Li <lnse@amazon.com>

* Clean up files and add helper functions

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* final touches

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* [Discover-next] add query assist to query enhancements plugin (opensearch-project#6895)

it adds query assist specific logic in query enhancements plugin to show a UI above the PPL search bar if user has configured PPL agent.

Issues Resolved: opensearch-project#6820

* add query assist to query enhancements

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* align language to uppercase

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* pick PR 6167

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* use useState hooks for query assist

There is a bug in data explorer `AppContainer` where memorized
`DiscoverCanvas` gets unmounted after `setQuery`. PR 6167 works around
it by memorizing `AppContainer`. As query assist is no longer being
unmounted, we can use proper hooks to persist state now.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Revert "pick PR 6167"

This reverts commit acb0d41.

Wait for official 6167 to merge to avoid conflict

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* address comments for PR 6894

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 016e0f2)

* [Discover-next] Address comments for search bar extensions and query assist (opensearch-project#6933)

* pass dependencies to isEnabled func

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add lazy and memo to search bar extensions

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* move ppl specific string out from query assist

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* prevent setstate after hook unmounts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add max-height to search bar extensions

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* prevent setstate after component unmounts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* move ml-commons API to common/index.ts

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* improve i18n and accessibility usages

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add hard-coded suggestions for sample data indices

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 4aade0f)

* [Discover-next] Support data sources for query assist (opensearch-project#6972)

* disable query assist for non-default datasource

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* disable query assist input when loading

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* support MDS for query assist

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add unit tests for agents

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Revert "add unit tests for agents"

This reverts commit 983514e.
The test configs are not yet setup in query_enhancements plugins.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

---------

Signed-off-by: Joshua Li <joshuali925@gmail.com>
(cherry picked from commit 328e08e)

* add query assist banner

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* implement banner rendering logic

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* pick opensearch-project/dashboards-observability/pull/1896

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Conditionally render the data source select config

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* restore no space

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* add basic tests

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* add index selector

This is a temporary solution given that in discover the index pattern
selector will be removed. Before datasource and dataset selectors are
added, query assist will rely on this index pattern selector to
determine which index user wants to query.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* MDS working with PPL and SQL

Utilizing the work from MDS to make PPL and SQL calls to a remote
cluster.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* rename logo to mark

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* extract supported languages to config

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* Add missing license headers

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* initial implementation for async queries

Signed-off-by: Sean Li <lnse@amazon.com>

* remove queryId and sessionId from facet

Signed-off-by: Sean Li <lnse@amazon.com>

* fix: Update call out tests with intl wrapper

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* maintenance: Add and apply lint command

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* changing to observables

Signed-off-by: Sean Li <lnse@amazon.com>

* search interceptor and cleanup

Signed-off-by: Sean Li <lnse@amazon.com>

* moving polling class into plugin

Signed-off-by: Sean Li <lnse@amazon.com>

* Some minor clean ups plus lint

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* test: Add mock-heavy tests for sql search strategy

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* test: add GH workflows

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* More clean ups

Add some props interfaces and consolidated some of the facets

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* chore: apply auto-lints to plugin

Signed-off-by: Simeon Widdis <sawiddis@amazon.com>

* Not done

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* working

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* working and styled

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* add connection service

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Update public/types.ts

Co-authored-by: Joshua Li <joshuali925@gmail.com>

* Update public/plugin.tsx

Co-authored-by: Joshua Li <joshuali925@gmail.com>

* Update public/plugin.tsx

Co-authored-by: Joshua Li <joshuali925@gmail.com>

* fix linter

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* add more tests for query assist (opensearch-project#31)

add more tests for query assist
update eslint config to make it work
increase index selector width

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* fix!: remove dataSource key in get connection response

The `Connection` type does not have the extra `dataSource` object around
response, and most of the time code references connection over
dataSource. remove the redundent object to make response consistent with
type.

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* change isEnabled to an observable based on selected connection

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* protect duplicated calls

Signed-off-by: Joshua Li <joshuali925@gmail.com>

* [build] import via start services

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Changeset file for PR opensearch-project#7212 created/updated

* foobar

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* updating imports still in progress

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Update more imports

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* fix setting of state

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* fixes bugs

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

* Update test

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>

---------

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Sean Li <lnse@amazon.com>
Signed-off-by: Joshua Li <joshuali925@gmail.com>
Signed-off-by: Simeon Widdis <sawiddis@amazon.com>
Co-authored-by: Sean Li <lnse@amazon.com>
Co-authored-by: Joshua Li <joshuali925@gmail.com>
Co-authored-by: Simeon Widdis <sawiddis@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
(cherry picked from commit 9194d83)
Signed-off-by: Sean Li <lnse@amazon.com>
ruanyl pushed a commit that referenced this pull request Jul 23, 2024
#7400)

Introduces the addition of a new core plugin called `Query Enhancements`

This plugin seems to be focused on enhancing query capabilities, particularly in areas like PPL (Piped Processing Language), SQL, and natural language query assistance.

The plugin is set up with the necessary configuration files:

- src/plugins/query_enhancements/opensearch_dashboards.json: Defines the plugin's metadata and dependencies.
- src/plugins/query_enhancements/common/config.ts: Contains the configuration schema for the plugin.
- src/plugins/query_enhancements/public/plugin.tsx: The main plugin file that sets up the public-facing part of the plugin.
- src/plugins/query_enhancements/server/plugin.ts: The server-side setup for the plugin.

A significant part of the plugin is dedicated to a "Query Assist" feature:

- src/plugins/query_enhancements/public/query_assist/: This directory contains components, hooks, and utilities for the Query Assist feature.
- src/plugins/query_enhancements/public/query_assist/components/query_assist_bar.tsx: A React component for the Query Assist bar.
- src/plugins/query_enhancements/server/routes/query_assist/: Server-side routing for Query Assist functionality.

The plugin introduces several search interceptors:

- src/plugins/query_enhancements/public/search/ppl_search_interceptor.ts
- src/plugins/query_enhancements/public/search/sql_search_interceptor.ts
- src/plugins/query_enhancements/public/search/sql_async_search_interceptor.ts

These interceptors likely modify or enhance the search functionality for different query languages.

There's a new feature for data source connections:

- src/plugins/query_enhancements/public/data_source_connection/: This directory contains components and services for managing data source connections.

The plugin implements server-side search strategies for different query types:

- src/plugins/query_enhancements/server/search/ppl_search_strategy.ts
- src/plugins/query_enhancements/server/search/sql_search_strategy.ts
- src/plugins/query_enhancements/server/search/sql_async_search_strategy.ts

There are some modifications to existing files outside the new plugin directory:

- src/plugins/data/public/index.ts: Exports new types and interfaces.
- src/plugins/data/public/ui/index.ts: Exports new UI components.
- src/plugins/data/public/ui/query_editor/index.tsx: Modifies the QueryEditor component.

The plugin includes a comprehensive test setup:

- src/plugins/query_enhancements/test/: Contains Jest configuration and setup files for testing.

Contains work by @sejli @joshuali925 @Swiddis @paulstn @mengweieric
Thx @ashwin-pc for the description summary

#6072
#6074
#6075

Commits include:
* init



* fixing bugs and removing target



* add target and build to .gitignore



* Remove SQL Async and Query Assist

Going for the light weight solution for 2.15. So took out what wasn't
required deliverable.

However, I created a branch `feature/discover-next` which has the state
where all the features where added so we can port it over post 2.15.



* adding fix for PPL queries



* Clean up files and add helper functions



* final touches



* [Discover-next] add query assist to query enhancements plugin (#6895)

it adds query assist specific logic in query enhancements plugin to show a UI above the PPL search bar if user has configured PPL agent.

Issues Resolved: #6820

* add query assist to query enhancements



* align language to uppercase



* pick PR 6167



* use useState hooks for query assist

There is a bug in data explorer `AppContainer` where memorized
`DiscoverCanvas` gets unmounted after `setQuery`. PR 6167 works around
it by memorizing `AppContainer`. As query assist is no longer being
unmounted, we can use proper hooks to persist state now.



* Revert "pick PR 6167"

This reverts commit acb0d41.

Wait for official 6167 to merge to avoid conflict



* address comments for PR 6894



---------


(cherry picked from commit 016e0f2)

* [Discover-next] Address comments for search bar extensions and query assist (#6933)

* pass dependencies to isEnabled func



* add lazy and memo to search bar extensions



* move ppl specific string out from query assist



* prevent setstate after hook unmounts



* add max-height to search bar extensions



* prevent setstate after component unmounts



* move ml-commons API to common/index.ts



* improve i18n and accessibility usages



* add hard-coded suggestions for sample data indices



---------


(cherry picked from commit 4aade0f)

* [Discover-next] Support data sources for query assist (#6972)

* disable query assist for non-default datasource



* disable query assist input when loading



* support MDS for query assist



* add unit tests for agents



* Revert "add unit tests for agents"

This reverts commit 983514e.
The test configs are not yet setup in query_enhancements plugins.



---------


(cherry picked from commit 328e08e)

* add query assist banner



* implement banner rendering logic



* pick opensearch-project/dashboards-observability/pull/1896



* Conditionally render the data source select config



* restore no space



* add basic tests



* add index selector

This is a temporary solution given that in discover the index pattern
selector will be removed. Before datasource and dataset selectors are
added, query assist will rely on this index pattern selector to
determine which index user wants to query.



* MDS working with PPL and SQL

Utilizing the work from MDS to make PPL and SQL calls to a remote
cluster.



* rename logo to mark



* extract supported languages to config



* Add missing license headers



* initial implementation for async queries



* remove queryId and sessionId from facet



* fix: Update call out tests with intl wrapper



* maintenance: Add and apply lint command



* changing to observables



* search interceptor and cleanup



* moving polling class into plugin



* Some minor clean ups plus lint



* test: Add mock-heavy tests for sql search strategy



* test: add GH workflows



* More clean ups

Add some props interfaces and consolidated some of the facets



* chore: apply auto-lints to plugin



* Not done



* working



* working and styled



* add connection service



* Update public/types.ts



* Update public/plugin.tsx



* Update public/plugin.tsx



* fix linter



* add more tests for query assist (#31)

add more tests for query assist
update eslint config to make it work
increase index selector width



* fix!: remove dataSource key in get connection response

The `Connection` type does not have the extra `dataSource` object around
response, and most of the time code references connection over
dataSource. remove the redundent object to make response consistent with
type.



* change isEnabled to an observable based on selected connection



* protect duplicated calls



* [build] import via start services



* Changeset file for PR #7212 created/updated

* foobar



* updating imports still in progress



* Update more imports



* fix setting of state



* fixes bugs



* Update test



---------











(cherry picked from commit 9194d83)

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
Signed-off-by: Sean Li <lnse@amazon.com>
Co-authored-by: Kawika Avilla <kavilla414@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants