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

[workspace] fix set as default error in data source and index pattern #9187

Merged

Conversation

Qxisylolo
Copy link
Contributor

@Qxisylolo Qxisylolo commented Jan 15, 2025

Description

When a user has read-only access to a workspace
the user shouldn't:

  1. set an index pattern as default
  2. set a data source as default

Screenshot

  1. read-only user try to set an index pattern as default
2025-01-15.14.19.36.mov
  1. read-only user try to set a data source as default
2025-01-15.14.20.08.mov

Changelog

  • fix: fix set as default error in data source and index pattern

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

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

codecov bot commented Jan 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.01%. Comparing base (9b5ce68) to head (6663d36).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9187      +/-   ##
==========================================
- Coverage   61.02%   61.01%   -0.02%     
==========================================
  Files        3813     3813              
  Lines       91401    91400       -1     
  Branches    14443    14443              
==========================================
- Hits        55782    55772      -10     
- Misses      32056    32067      +11     
+ Partials     3563     3561       -2     
Flag Coverage Δ
Linux_1 29.08% <ø> (ø)
Linux_2 56.45% <ø> (ø)
Linux_3 38.03% <100.00%> (?)
Linux_4 29.03% <ø> (ø)
Windows_1 29.09% <ø> (-0.02%) ⬇️
Windows_2 56.40% <ø> (ø)
Windows_3 38.03% <100.00%> (+<0.01%) ⬆️
Windows_4 29.03% <ø> (ø)

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: Qxisylolo <[email protected]>
Signed-off-by: Qxisylolo <[email protected]>
@Qxisylolo Qxisylolo requested a review from huyaboo as a code owner January 15, 2025 09:08
Comment on lines 99 to 100
const isSuccess = await uiSettings.set(DEFAULT_DATA_SOURCE_UI_SETTINGS_ID, dataSourceID);
return isSuccess;
Copy link
Member

@SuZhou-Joe SuZhou-Joe Jan 15, 2025

Choose a reason for hiding this comment

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

Suggested change
const isSuccess = await uiSettings.set(DEFAULT_DATA_SOURCE_UI_SETTINGS_ID, dataSourceID);
return isSuccess;
return await uiSettings.set(DEFAULT_DATA_SOURCE_UI_SETTINGS_ID, dataSourceID);

Nit: perhaps we can make it Concise.

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~

Signed-off-by: Qxisylolo <[email protected]>
@SuZhou-Joe SuZhou-Joe merged commit 5a290a4 into opensearch-project:main Jan 16, 2025
73 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 16, 2025
…#9187)

* fix set as default error

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

* Changeset file for PR #9187 created/updated

* add tests

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

* fix tests

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

* resolve comments

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 5a290a4)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe added a commit that referenced this pull request Jan 17, 2025
…#9187) (#9195)

* fix set as default error



* Changeset file for PR #9187 created/updated

* add tests



* fix tests



* resolve comments



---------



(cherry picked from commit 5a290a4)

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>
Co-authored-by: SuZhou-Joe <[email protected]>
d-buckner pushed a commit to d-buckner/OpenSearch-Dashboards that referenced this pull request Jan 17, 2025
…opensearch-project#9187)

* fix set as default error

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

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

* add tests

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

* fix tests

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

* resolve comments

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>
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.

3 participants