Skip to content

Remove unsupported languages for dataset#8100

Merged
ashwin-pc merged 4 commits intoopensearch-project:mainfrom
abbyhu2000:remove_unsupported_dataset_type
Sep 11, 2024
Merged

Remove unsupported languages for dataset#8100
ashwin-pc merged 4 commits intoopensearch-project:mainfrom
abbyhu2000:remove_unsupported_dataset_type

Conversation

@abbyhu2000
Copy link
Copy Markdown
Member

Description

Remove unsupported languages for dataset in language selector

Issues Resolved

Screenshot

Testing the changes

Changelog

  • fix: Remove unsupported languages for dataset

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

const queryString = getQueryService().queryString;
const languageService = queryString.getLanguageService();

const type = queryString.getDatasetService().getType(props.dataset!.type);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try to avoid non-null assertion as it's one of the major cause of runtime exception.

Suggested change
const type = queryString.getDatasetService().getType(props.dataset!.type);
const type = props.dataset ? queryString.getDatasetService().getType(props.dataset.type) : undefined

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changed to use conditional operator

languageService.getUserQueryLanguageBlocklist().includes(language?.id)
)
return;
languageOptions.unshift(mapExternalLanguageToOptions(language!));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems you don't need non-null assertion here

Suggested change
languageOptions.unshift(mapExternalLanguageToOptions(language!));
languageOptions.unshift(mapExternalLanguageToOptions(language));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.84%. Comparing base (22f1d46) to head (7392a6f).
Report is 34 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8100      +/-   ##
==========================================
+ Coverage   63.71%   63.84%   +0.13%     
==========================================
  Files        3738     3738              
  Lines       88682    88702      +20     
  Branches    13788    13795       +7     
==========================================
+ Hits        56501    56631     +130     
+ Misses      31593    31474     -119     
- Partials      588      597       +9     
Flag Coverage Δ
Linux_1 29.96% <ø> (+<0.01%) ⬆️
Linux_2 58.79% <ø> (ø)
Linux_3 40.27% <100.00%> (+0.21%) ⬆️
Linux_4 31.20% <ø> (ø)
Windows_1 29.97% <ø> (+<0.01%) ⬆️
Windows_2 58.74% <ø> (ø)
Windows_3 40.27% <100.00%> (+0.21%) ⬆️
Windows_4 31.20% <ø> (ø)

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.

abbyhu2000 and others added 3 commits September 10, 2024 18:14
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
onSelectLanguage: (newLanguage: string) => void;
anchorPosition?: PopoverAnchorPosition;
appName?: string;
dataset?: Dataset;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doesnt the query object already contain the dataset?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, removed extra prop

sejli
sejli previously approved these changes Sep 10, 2024
Comment on lines +72 to +77
.forEach((language) => {
if (
(language && props.appName && !language.editorSupportedAppNames?.includes(props.appName)) ||
languageService.getUserQueryLanguageBlocklist().includes(language?.id)
)
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this be in filter(), since it's basically just filtering it again but in the forEach() loop? Then, we can pass the mapExternalLanguageOptions() function into a .map() instead of a for loop. Not a blocking comment, just something that might make it a bit easier more readable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

combined forEach and filter

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
@ashwin-pc ashwin-pc merged commit 42317f1 into opensearch-project:main Sep 11, 2024
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 11, 2024
* remove unsupported languages

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Changeset file for PR #8100 created/updated

* address comments

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* address comments

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

---------

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 42317f1)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 added a commit that referenced this pull request Sep 12, 2024
* remove unsupported languages



* Changeset file for PR #8100 created/updated

* address comments



* address comments



---------



(cherry picked from commit 42317f1)

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
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>
Co-authored-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 20, 2024
* remove unsupported languages

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* Changeset file for PR #8100 created/updated

* address comments

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

* address comments

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>

---------

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 42317f1)
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
* remove unsupported languages



* Changeset file for PR #8100 created/updated

* address comments



* address comments



---------



(cherry picked from commit 42317f1)

Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
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>
abbyhu2000 added a commit to abbyhu2000/OpenSearch-Dashboards that referenced this pull request Sep 24, 2024
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.

4 participants