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 editor extensions #7034

Merged
merged 10 commits into from
Jun 20, 2024

Commits on Jun 14, 2024

  1. [Discover-next] Add search bar extensions (opensearch-project#6894)

    A search bar extension can display a UI component above the query bar. The component has the ability to read and write discover search bar states to enhance the search experience for users. The configuration is part of Query Enhancements.
    
    ```ts
    export interface SearchBarExtensionDependencies {
      /**
       * Currently selected index patterns.
       */
      indexPatterns?: IIndexPattern[];
    }
    
    export interface SearchBarExtensionConfig {
      /**
       * The id for the search bar extension.
       */
      id: string;
      /**
       * Lower order indicates higher position on UI.
       */
      order: number;
      /**
       * A function that determines if the search bar extension is enabled and should be rendered on UI.
       * @returns whether the extension is enabled.
       */
      isEnabled: () => Promise<boolean>;
      /**
       * A function that returns the mount point for the search bar extension.
       * @param dependencies - The dependencies required for the extension.
       * @returns The mount point for the search bar extension.
       */
      getComponent: (dependencies: SearchBarExtensionDependencies) => React.ReactElement;
    }
    
    export interface QueryEnhancement {
      ...
      searchBar?: {
        ...
        extensions?: SearchBarExtensionConfig[];
      };
    }
    
    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    (cherry picked from commit e748e81)
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    71bba11 View commit details
    Browse the repository at this point in the history
  2. [Discover-next] add query assist to query enhancements plugin (opense…

    …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)
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    d90734a View commit details
    Browse the repository at this point in the history
  3. [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)
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    08a81e0 View commit details
    Browse the repository at this point in the history
  4. [Discover-next] Support data sources for query assist (opensearch-pro…

    …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)
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    5b2ad95 View commit details
    Browse the repository at this point in the history
  5. partially revert 5b2ad95

    SearchBar extensions depend on the currently selected dataSource, which
    depends on
    opensearch-project#6833 to
    be ported to main
    
    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    84a2013 View commit details
    Browse the repository at this point in the history
  6. add changelog fragment

    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    e798287 View commit details
    Browse the repository at this point in the history
  7. separate searchBarExtensions from queryEnhancements

    To support bannar callout for query assist in un-supported languages and
    notify user the feature, the search bar extensions need to be enabled
    for all languages.
    
    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 14, 2024
    Configuration menu
    Copy the full SHA
    8b0af9d View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2024

  1. refactor search bar extensions

    move SearchBarExtensions to QueryEditorExtensions and change config
    settings from list to map.
    
    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    edb0390 View commit details
    Browse the repository at this point in the history
  2. address comments

    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    886ace5 View commit details
    Browse the repository at this point in the history
  3. change query editor extension configs from map to record

    Signed-off-by: Joshua Li <joshuali925@gmail.com>
    joshuali925 committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    7f0e39e View commit details
    Browse the repository at this point in the history