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

[BUG] Fix bug in data source aggregated view to change it to depend on displayAllCompatibleDataSources property to show the badge value #6291

Merged
merged 6 commits into from
Apr 2, 2024

Conversation

BionIT
Copy link
Collaborator

@BionIT BionIT commented Mar 29, 2024

Description

This change fixes bug in data source aggregated view to change it to depend on displayAllCompatibleDataSources property to show the badge value

Issues Resolved

Screenshot

aggregatebug.mp4

Testing the changes

The following was performed in the recording above:

  1. enable data source
  2. go to maps plugin list page, and should see the data source component mounted correctly and display all data sources
  3. go to maps detail page, and should see the badge number which is the number of data source being used in all layers, add a layer, should see the badge number is updated correctly, remove a layer should reduce 1 in the badge number

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

BionIT added 3 commits March 28, 2024 17:34
Signed-off-by: Lu Yu <nluyu@amazon.com>
Signed-off-by: Lu Yu <nluyu@amazon.com>
Signed-off-by: Lu Yu <nluyu@amazon.com>
BionIT added 2 commits March 29, 2024 05:03
Signed-off-by: Lu Yu <nluyu@amazon.com>
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.47%. Comparing base (8810f08) to head (584c74d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6291   +/-   ##
=======================================
  Coverage   67.47%   67.47%           
=======================================
  Files        3368     3368           
  Lines       65431    65431           
  Branches    10560    10560           
=======================================
+ Hits        44147    44150    +3     
+ Misses      18713    18710    -3     
  Partials     2571     2571           
Flag Coverage Δ
Linux_1 32.14% <ø> (ø)
Linux_2 55.58% <ø> (ø)
Linux_3 44.91% <100.00%> (+<0.01%) ⬆️
Linux_4 35.07% <0.00%> (ø)
Windows_1 32.16% <ø> (ø)
Windows_2 55.55% <ø> (ø)
Windows_3 44.93% <100.00%> (+0.01%) ⬆️
Windows_4 35.07% <0.00%> (ø)

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: Lu Yu <nluyu@amazon.com>
@@ -111,17 +111,17 @@ export class DataSourceAggregatedView extends React.Component<
let items = [];

// only display active data sources
Copy link
Member

Choose a reason for hiding this comment

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

do we need to update the comment here?

disabled: true,
};
});
} else {
items = [...this.state.allDataSourcesIdToTitleMap.values()].map((title) => {
items = this.props.activeDataSourceIds!.map((id) => {
Copy link
Member

@xinruiba xinruiba Apr 2, 2024

Choose a reason for hiding this comment

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

Force unwrap looks a little risky here. Are there any possibilities that activeDataSourceIds will be undefined?

Maybe we can update it in following way to avoid force unwrap:

const activeDataSoureceIds = this.props.activeDataSoruceIds ?? [];
items = activeDataSoureceIds.map() .....

What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, sine the two states start to diverge, I think we can make it simpler by having a separate component for display active. The reason I am hesitate to give a default value is the activeDataSourceIds are required when displayAllCompatibleDataSources is false

@BionIT BionIT added the multiple datasource multiple datasource project label Apr 2, 2024
@BionIT BionIT merged commit f13537c into opensearch-project:main Apr 2, 2024
78 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 3, 2024
…n displayAllCompatibleDataSources property to show the badge value (#6291)

* fix bug

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add tests

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add change log

Signed-off-by: Lu Yu <nluyu@amazon.com>

* fix lint error

Signed-off-by: Lu Yu <nluyu@amazon.com>

---------

Signed-off-by: Lu Yu <nluyu@amazon.com>
(cherry picked from commit f13537c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
BionIT pushed a commit that referenced this pull request Apr 3, 2024
…n displayAllCompatibleDataSources property to show the badge value (#6291) (#6323)

* fix bug

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add tests

Signed-off-by: Lu Yu <nluyu@amazon.com>

* add change log

Signed-off-by: Lu Yu <nluyu@amazon.com>

* fix lint error

Signed-off-by: Lu Yu <nluyu@amazon.com>

---------

Signed-off-by: Lu Yu <nluyu@amazon.com>
(cherry picked from commit f13537c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants