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] Modify the search bar info box content for sql/ppl #8708

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

RyanL1997
Copy link
Contributor

@RyanL1997 RyanL1997 commented Oct 26, 2024

Description

  • Modify the search bar info box content for sql/ppl
  • The info box will only show up when it is user's first time to select SQL/PPL
  • Change the language picker's title from "SQL" into "OpenSearch SQL"

Issues Resolved

Screenshot

Screen.Recording.2024-10-26.at.2.32.25.AM.mov

Testing the changes

Changelog

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

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Copy link

codecov bot commented Oct 26, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 10 lines in your changes missing coverage. Please review.

Project coverage is 60.73%. Comparing base (463a6c0) to head (f332b91).

Files with missing lines Patch % Lines
...string/language_service/lib/language_reference.tsx 9.09% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8708      +/-   ##
==========================================
- Coverage   60.75%   60.73%   -0.03%     
==========================================
  Files        3798     3798              
  Lines       90650    90659       +9     
  Branches    14254    14259       +5     
==========================================
- Hits        55076    55062      -14     
- Misses      32079    32102      +23     
  Partials     3495     3495              
Flag Coverage Δ
Linux_1 29.06% <9.09%> (-0.01%) ⬇️
Linux_2 56.39% <ø> (ø)
Linux_3 37.57% <9.09%> (-0.01%) ⬇️
Linux_4 29.83% <9.09%> (-0.01%) ⬇️
Windows_1 29.08% <9.09%> (-0.03%) ⬇️
Windows_2 56.35% <ø> (ø)
Windows_3 37.57% <9.09%> (-0.01%) ⬇️
Windows_4 29.83% <9.09%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Ryan Liang <[email protected]>
Signed-off-by: Jialiang Liang <[email protected]>
Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

@RyanL1997
Copy link
Contributor Author

Unit testing is WIP. I'd gather some feedback first

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Signed-off-by: Jialiang Liang <[email protected]>
Comment on lines +21 to +35
useEffect(() => {
if (
props.selectedLanguage === 'SQL' &&
window.localStorage.getItem('hasSeenSQLInfoBox') === 'false'
) {
setIsLanguageReferenceOpen(true);
window.localStorage.setItem('hasSeenSQLInfoBox', 'true');
} else if (
props.selectedLanguage === 'PPL' &&
window.localStorage.getItem('hasSeenPPLInfoBox') === 'false'
) {
setIsLanguageReferenceOpen(true);
window.localStorage.setItem('hasSeenPPLInfoBox', 'true');
}
}, [props.selectedLanguage]);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to specify this here? can we make it generic. Something like this?

Suggested change
useEffect(() => {
if (
props.selectedLanguage === 'SQL' &&
window.localStorage.getItem('hasSeenSQLInfoBox') === 'false'
) {
setIsLanguageReferenceOpen(true);
window.localStorage.setItem('hasSeenSQLInfoBox', 'true');
} else if (
props.selectedLanguage === 'PPL' &&
window.localStorage.getItem('hasSeenPPLInfoBox') === 'false'
) {
setIsLanguageReferenceOpen(true);
window.localStorage.setItem('hasSeenPPLInfoBox', 'true');
}
}, [props.selectedLanguage]);
useEffect(() => {
if (autoShow) {
const storageKey = `hasSeenInfoBox_${selectedLanguage}`;
const hasSeenInfoBox = window.localStorage.getItem(storageKey);
if (hasSeenInfoBox === 'false') {
setIsLanguageReferenceOpen(true);
window.localStorage.setItem(storageKey, 'true');
}
}
}, [props.selectedLanguage]);

Comment on lines +46 to +52
// Initialize local storage keys when the plugin loads, if they don't exist
if (!window.localStorage.getItem('hasSeenSQLInfoBox')) {
window.localStorage.setItem('hasSeenSQLInfoBox', 'false');
}
if (!window.localStorage.getItem('hasSeenPPLInfoBox')) {
window.localStorage.setItem('hasSeenPPLInfoBox', 'false');
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we ned this? why not just use undefined as the intiial state. If the key does not exist, its false by default

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.

2 participants