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

Add data2summary check in data summary panel in discover #8716

Merged
merged 13 commits into from
Jan 17, 2025

Conversation

Qxisylolo
Copy link
Contributor

@Qxisylolo Qxisylolo commented Oct 28, 2024

Description

This pr adds data2summary agent check in data summary panel in discover.
if there is a query assistant agent but not to summary agent then the summary also won’t be displayed

Screenshot

no agent:
截屏2024-10-28 11 39 23

local:
截屏2024-10-28 11 41 45

data2summary agent
截屏2024-10-28 11 39 36

2024-10-28.14.51.26.1.mov

Changelog

  • feat: adds data2summary agent check in data summary panel in discover.

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

opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 28, 2024
@Qxisylolo Qxisylolo force-pushed the feat/hide_olly_overlay branch 2 times, most recently from f28a766 to 1edd20d Compare October 28, 2024 04:34
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 28, 2024
@Qxisylolo Qxisylolo force-pushed the feat/hide_olly_overlay branch from bfdd348 to f48615a Compare October 28, 2024 06:50
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 28, 2024
@Qxisylolo Qxisylolo marked this pull request as ready for review October 28, 2024 06:55
Signed-off-by: Qxisylolo <[email protected]>
@Qxisylolo Qxisylolo force-pushed the feat/hide_olly_overlay branch from 042044a to 38e53bd Compare October 30, 2024 04:08
ruanyl
ruanyl previously approved these changes Oct 30, 2024
Copy link
Member

@ruanyl ruanyl left a comment

Choose a reason for hiding this comment

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

Approved with a minor comment

@@ -7,6 +7,7 @@ export const PLUGIN_ID = 'queryEnhancements';
export const PLUGIN_NAME = 'queryEnhancements';

export const BASE_API = '/api/enhancements';
export const BASE_API_AGENT = '/api/assistant';
Copy link
Member

Choose a reason for hiding this comment

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

Nit

Suggested change
export const BASE_API_AGENT = '/api/assistant';
export const BASE_API_ASSISTANT = '/api/assistant';

});
return response;
} catch (error) {
throw error;
Copy link
Member

Choose a reason for hiding this comment

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

btw, I don't see the purpose of this catch because it throws it immediately which is the same as not having the try-catch block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I see. thank you

opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
opensearch-changeset-bot bot added a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
Signed-off-by: Qxisylolo <[email protected]>
@Qxisylolo Qxisylolo force-pushed the feat/hide_olly_overlay branch from 788f842 to 4fcec84 Compare October 30, 2024 07:05
ruanyl
ruanyl previously approved these changes Oct 30, 2024
@ruanyl ruanyl added the v2.19.0 label Oct 31, 2024
export async function checkAgentsExist(
http: HttpSetup,
agentConfigName: string | string[],
dataSourceId: string
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: dataSourceId should be optional

Comment on lines 215 to 216
if (selectedDataset.current?.dataSource?.id) {
try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should support datasource not enabled case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comments, updated

Copy link
Member

Choose a reason for hiding this comment

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

We may not need to have if (selectedDataset.current?.dataSource?.id), call await checkAgentsExist() with selectedDataset.current?.dataSource?.id directly should be good. because:

  1. when data source is not enabled, the selectedDataset.dataSource is undefined, in such case, we passed undefined to checkAgentsExist, this will make it to check local cluster
  2. when data source is enabled, but the selected dataset is a local cluster, the selectedDataset.dataSource is undefined as well, in this case, we passed undefined to checkAgentsExist which makes it to call local cluster.

Signed-off-by: Qxisylolo <[email protected]>
queryParams.append('dataSourceId', dataSourceId);

const response = await http.get(API.AGENT_API.CONFIG_EXISTS, {
query: Object.fromEntries(queryParams),
Copy link
Member

@ruanyl ruanyl Dec 25, 2024

Choose a reason for hiding this comment

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

There might be problem to call Object.fromEntries(queryParams), for example:

// if calling append two times
queryParams.append('agentConfigName', 'name1')
queryParams.append('agentConfigName', 'name2')
// this returns {agentConfigName: 'name2'}, which name1 is missing
Object.fromEntries(queryParams),

I think you can simply call in this way

  const response = await http.get(API.AGENT_API.CONFIG_EXISTS, {
    query: { agentConfigName, dataSourceId },
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the advice,already updated~

ruanyl
ruanyl previously approved these changes Dec 26, 2024
console.error(error);
}
};
fetchSummaryAgent();
Copy link
Member

Choose a reason for hiding this comment

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

Should we call this method only when isEnabledByCapability is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder, added it

Signed-off-by: Qxisylolo <[email protected]>
@ruanyl ruanyl merged commit d159d75 into opensearch-project:main Jan 17, 2025
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 17, 2025
* basiclly work

Signed-off-by: Qxisylolo <[email protected]>

* remove comments

Signed-off-by: Qxisylolo <[email protected]>

* add tests

Signed-off-by: Qxisylolo <[email protected]>

* call api

Signed-off-by: Qxisylolo <[email protected]>

* resolve comments

Signed-off-by: Qxisylolo <[email protected]>

* add new tests

Signed-off-by: Qxisylolo <[email protected]>

* update name

Signed-off-by: Qxisylolo <[email protected]>

* Changeset file for PR #8716 created/updated

* resolve new comments

Signed-off-by: Qxisylolo <[email protected]>

* new resolve comments

Signed-off-by: Qxisylolo <[email protected]>

* add isEnabledByCapability

Signed-off-by: Qxisylolo <[email protected]>

---------

Signed-off-by: Qxisylolo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit d159d75)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
d-buckner pushed a commit to d-buckner/OpenSearch-Dashboards that referenced this pull request Jan 17, 2025
…project#8716)

* basiclly work

Signed-off-by: Qxisylolo <[email protected]>

* remove comments

Signed-off-by: Qxisylolo <[email protected]>

* add tests

Signed-off-by: Qxisylolo <[email protected]>

* call api

Signed-off-by: Qxisylolo <[email protected]>

* resolve comments

Signed-off-by: Qxisylolo <[email protected]>

* add new tests

Signed-off-by: Qxisylolo <[email protected]>

* update name

Signed-off-by: Qxisylolo <[email protected]>

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

* resolve new comments

Signed-off-by: Qxisylolo <[email protected]>

* new resolve comments

Signed-off-by: Qxisylolo <[email protected]>

* add isEnabledByCapability

Signed-off-by: Qxisylolo <[email protected]>

---------

Signed-off-by: Qxisylolo <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jan 22, 2025
* basiclly work



* remove comments



* add tests



* call api



* resolve comments



* add new tests



* update name



* Changeset file for PR #8716 created/updated

* resolve new comments



* new resolve comments



* add isEnabledByCapability



---------



(cherry picked from commit d159d75)

Signed-off-by: Qxisylolo <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.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.

7 participants