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

[Data Explorer][Discover 2.0] Fix issues when change index pattern #4875

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Aug 31, 2023

Description

  • side nav only shows the selected index pattern fields after switch index pattern
Screenshot 2023-08-31 at 09 23 24
  • allow reset column state when switch index pattern

There are two conditions: 1) If there is common field, common field will be saved.
Screenshot 2023-08-31 at 09 23 51

Screenshot 2023-08-31 at 09 23 59
  1. if no common field, will show _source after switch
Screenshot 2023-08-31 at 09 23 34 Screenshot 2023-08-31 at 09 23 43

Issues Resolved

#4840 #4846

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #4875 (9e23490) into main (b846e80) will decrease coverage by 0.04%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #4875      +/-   ##
==========================================
- Coverage   66.42%   66.39%   -0.04%     
==========================================
  Files        3398     3397       -1     
  Lines       64893    64804      -89     
  Branches    10359    10360       +1     
==========================================
- Hits        43108    43028      -80     
+ Misses      19225    19217       -8     
+ Partials     2560     2559       -1     
Flag Coverage Δ
Linux_1 34.85% <ø> (ø)
Linux_2 55.15% <ø> (ø)
Linux_3 44.24% <100.00%> (+<0.01%) ⬆️
Linux_4 34.92% <ø> (-0.15%) ⬇️
Windows_1 34.87% <ø> (ø)
Windows_2 55.12% <ø> (ø)
Windows_3 44.24% <100.00%> (+<0.01%) ⬆️
Windows_4 34.92% <ø> (-0.15%) ⬇️

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

Files Changed Coverage Δ
...pplication/view_components/utils/filter_columns.ts 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

@ananzh ananzh added the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Aug 31, 2023
* Helper function to filter columns based on the fields of the index pattern.
* This function is used when we switch between index patterns. We want to keep the columns that are
* still available in the new index pattern and remove the ones that are not.
* If the resulting array is empty, it provides a fallback to a single '_source' column.
Copy link
Member

Choose a reason for hiding this comment

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

We should use the default column from advanced settings and not hardcode _source. DEFAULT_COLUMNS_SETTING

Copy link
Member Author

Choose a reason for hiding this comment

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

will update

const filteredColumns = filterColumns(columns, indexPattern);
const dispatch = useDispatch();

const prevColumns = useRef(filteredColumns);
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't look like we are using this. Do we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

will remove.

* allow side nav show only selected index pattern fields when switch
* allow reset column state when switch index pattern

Issue Resolve:
opensearch-project#4840
opensearch-project#4846

Signed-off-by: ananzh <ananzh@amazon.com>
@ashwin-pc ashwin-pc merged commit 9958799 into opensearch-project:main Aug 31, 2023
54 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 31, 2023
…4875)

* allow side nav show only selected index pattern fields when switch
* allow reset column state when switch index pattern

Issue Resolve:
#4840
#4846

Signed-off-by: ananzh <ananzh@amazon.com>
(cherry picked from commit 9958799)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
AMoo-Miki pushed a commit that referenced this pull request Sep 1, 2023
…4875) (#4885)

* allow side nav show only selected index pattern fields when switch
* allow reset column state when switch index pattern

Issue Resolve:
#4840
#4846


(cherry picked from commit 9958799)

Signed-off-by: ananzh <ananzh@amazon.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>
MadaniKK added a commit to MadaniKK/OpenSearch-Dashboards that referenced this pull request Nov 18, 2023
ashwin-pc added a commit that referenced this pull request Dec 21, 2023
…CH (#5508)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 21, 2023
…CH (#5508)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 26, 2024
…CH (#5508)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
manasvinibs pushed a commit that referenced this pull request Jan 31, 2024
…CH (#5508)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
manasvinibs pushed a commit that referenced this pull request Jan 31, 2024
…CH (#5508)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
manasvinibs pushed a commit that referenced this pull request Jan 31, 2024
…CH (#5508) (#5746)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
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>
ashwin-pc pushed a commit that referenced this pull request Feb 5, 2024
…CH (#5508) (#5638)

* Revert "[Data Explorer][Discover 2.0] Fix issues when change index pattern (#4875) (#4885)"

This reverts commit 0102a32.
try revert:

* [osci23] implmented advance setting in Dicover: MODIFY_COLUMN_ON_SWITCH

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* fix deps

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* modify to match discover legacy behavior, columns from previous column are only shown in canvas area

Signed-off-by: qiwen li <qiwen_li@brown.edu>

* Update CHANGELOG.md

Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

* removed unused variables, added comments and @param

Signed-off-by: Qiwen Li <qiwen_li@brown.edu>

---------

Signed-off-by: qiwen li <qiwen_li@brown.edu>
Signed-off-by: Qiwen Li <qiwen_li@brown.edu>
Signed-off-by: Anan Zhuang <ananzh@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com>
(cherry picked from commit 34994f8)
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
Labels
backport 2.x data explorer Issues related to the Data Explorer project discover for discover reinvent distinguished-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants