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

[query assist] use badge to show agent errors #7998

Merged
merged 22 commits into from
Sep 11, 2024

Conversation

joshuali925
Copy link
Member

@joshuali925 joshuali925 commented Sep 4, 2024

Description

this PR fixes some bugs caused by dataset and ml-commons api change, and adds error to badge on UI

  • enable query assist for index patterns without data source
  • add agent error parsing utils
  • update ml-commons response schema processing
    • previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
  • use badge to show query assist error if possible
  • add unit tests

Issues Resolved

Screenshot

image

Testing the changes

Changelog

  • skip

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

@AMoo-Miki
Copy link
Collaborator

AMoo-Miki commented Sep 10, 2024

2. **using css to change background on focus**: this is less hacky because it doesn't involve math calculations. The downside is that it doesn't look perfect as the mocks (suggestions not full width and no animation for the append section), but i think it's good enough as a compromise

Thanks a ton for this. I too believe this is a good compromise until we can update the underlying component. While it is not perfect, it will prevent us from adding hackiness.

@AMoo-Miki
Copy link
Collaborator

Another option is hide the Error on focus.

@joshuali925
Copy link
Member Author

Another option is hide the Error on focus.

i actually like it better. showing "Error" when user writes the question doesn't really help, and hiding it gives more horizontal space
Sep-10-2024 14-30-32

It would be ideal to add a feature in OUI text field so that it can
append element inside itself. For now we have 2 workarounds:
- calculate padding using dynamic width: it is hacky because it involves
dynamically retrieving badge width and doing math to compute the correct
padding. The math won't make sense if for example the layout changes, or
text field size changes.
- using css to change background on focus (implemented): this is less
hacky because it doesn't involve math calculations. The downside is that
it doesn't look perfect as the mocks.

Signed-off-by: Joshua Li <[email protected]>
Signed-off-by: Joshua Li <[email protected]>
@kgcreative
Copy link
Member

kgcreative commented Sep 11, 2024

There is a very limited subset of errors that would show up in the input; i would imagine they are mostly around illegal characters that we might underline in red in some way, or submit or connection errors where there is a failure before a query or a summary is generated

We also need to think about where we might show query errors, or summary errors. Those should be in the query area and the summary area respectively.

We should truncate the text when it's a single line and not in focus Some query that's trunc... [1 error | N errors] , and expand the input to full width and hide the error count on focus

>
<EuiText size="s" className="queryAssist__popoverText">
<dl>
<dd id="queryAssistErrorTitle">
Copy link
Collaborator

@AMoo-Miki AMoo-Miki Sep 11, 2024

Choose a reason for hiding this comment

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

This should use <EuiIcon type="alert" /> as opposed to having CSS add a different icon that the prescribed one.

@joshuali925 joshuali925 merged commit 461a395 into opensearch-project:main Sep 11, 2024
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 11, 2024
- enable query assist for index patterns without data source
- add agent error parsing utils
- update ml-commons response schema processing
   - previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
- use badge to show query assist error if possible
- add unit tests

Signed-off-by: Joshua Li <[email protected]>
(cherry picked from commit 461a395)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kavilla pushed a commit that referenced this pull request Sep 12, 2024
- enable query assist for index patterns without data source
- add agent error parsing utils
- update ml-commons response schema processing
   - previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
- use badge to show query assist error if possible
- add unit tests


(cherry picked from commit 461a395)

Signed-off-by: Joshua Li <[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>
@ashwin-pc ashwin-pc added 2.17.1 and removed v2.18.0 labels Sep 17, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 20, 2024
- enable query assist for index patterns without data source
- add agent error parsing utils
- update ml-commons response schema processing
   - previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
- use badge to show query assist error if possible
- add unit tests

Signed-off-by: Joshua Li <[email protected]>
(cherry picked from commit 461a395)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this pull request Sep 21, 2024
- enable query assist for index patterns without data source
- add agent error parsing utils
- update ml-commons response schema processing
   - previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
- use badge to show query assist error if possible
- add unit tests


(cherry picked from commit 461a395)

Signed-off-by: Joshua Li <[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>
abbyhu2000 added a commit to abbyhu2000/OpenSearch-Dashboards that referenced this pull request Sep 24, 2024
SuZhou-Joe pushed a commit to SuZhou-Joe/OpenSearch-Dashboards that referenced this pull request Oct 3, 2024
… (opensearch-project#8146)

- enable query assist for index patterns without data source
- add agent error parsing utils
- update ml-commons response schema processing
   - previously ml-commons returns error.body as a string, now it is a JSON object. Ideally frontend should keep it as is to reduce serializing/deserializing, but since older version of ml-commons can be used through MDS, we'll keep it as a string for consistency
- use badge to show query assist error if possible
- add unit tests


(cherry picked from commit 461a395)

Signed-off-by: Joshua Li <[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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.17.1 backport 2.x backport 2.17 discover for discover reinvent in-next seasoned-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants