-
Notifications
You must be signed in to change notification settings - Fork 909
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] A bunch of navigation fixes #5168
[Discover] A bunch of navigation fixes #5168
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5168 +/- ##
=======================================
Coverage 66.72% 66.73%
=======================================
Files 3278 3278
Lines 62985 62999 +14
Branches 10029 10031 +2
=======================================
+ Hits 42026 42041 +15
Misses 18488 18488
+ Partials 2471 2470 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
CHANGELOG.md
Outdated
@@ -10,6 +10,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
|
|||
### 🛡 Security | |||
|
|||
- [CVE-2022-25869] Removes angularJS 1.8 ([#5068](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5068)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL takes me to an issue; is there a typo?
Also:
- [CVE-2022-25869] Removes angularJS 1.8 ([#5068](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5068)) | |
- [CVE-2022-25869] Remove AngularJS 1.8 ([#5068](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5068)) | |
- ``` |
CHANGELOG.md
Outdated
@@ -53,6 +55,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
- Correct the generated path for downloading plugins by their names on Windows ([#4953](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4953)) | |||
- [BUG] Fix buildPointSeriesData unit test fails due to local timezone ([#4992](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4992)) | |||
- [BUG][Data Explorer][Discover] Fix total hits issue for no time based data ([#5087](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5087)) | |||
- [BUG][Discover] Fix misc navigation issues ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168)) | |||
- [BUG][Discover] Fixes mobile view ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [BUG][Discover] Fixes mobile view ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168)) | |
- [BUG][Discover] Fix mobile view ([#5168](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5168)) |
CHANGELOG.md
Outdated
@@ -38,6 +39,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
- Adds Data explorer framework and implements Discover using it ([#4806](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4806)) | |||
- [Theme] Use themes' definitions to render the initial view ([#4936](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4936/)) | |||
- [Theme] Make `next` theme the default ([#4854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4854/)) | |||
- [Discover] Updated embeddable for saved searches ([#5081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5081/)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [Discover] Updated embeddable for saved searches ([#5081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5081/)) | |
- [Discover] Update embeddable for saved searches ([#5081](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5081/)) |
@@ -62,6 +80,21 @@ export const getPreloadedStore = async (services: DataExplorerServices) => { | |||
// the store subscriber will automatically detect changes and call handleChange function | |||
const unsubscribe = store.subscribe(handleChange); | |||
|
|||
services.scopedHistory.listen(async (location, action) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hold this for better testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the reason for this is because of the shared data model of OSD where the state is maintained in both the URL and the react memory. So far the assumption i've made is to have redux be the source of truth and update every other place from there. The problem here is that when the user navigates back using browser history, the URL state is no longer in sync with the redux state. The opensearch_dashboard_util
wrappers that do the url state sync do something very similar.
The one big concern I had with this was a race condition. This here is mitigated for both a URL update and Redux store update using the check to see if the url update was a pop action and if the states are identical. I'm open to improvements here but I think we should ship with this given that its a jarring expereince for users who have relied on browser navigation for discover.
if (isEqual(urlState, currentState)) { | ||
return; | ||
} | ||
|
||
// If the url state is different from the current state, then we need to update the store | ||
// the state should have a view property if it was loaded from the url | ||
if (action === 'POP' && urlState.metadata?.view) { | ||
store.dispatch(hydrate(urlState as RootState)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the way this is coded has excellent readability, I wonder if we would get noticeable performance improvement if we moved the isEqual
check inside the action === 'POP' && urlState.metadata?.view
condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a nice improvement :) Will make the change
core.application.navigateToApp('discover', { | ||
path: '#/', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this reload the page if i was already on discover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does :)
<EuiFlexItem> | ||
<DiscoverNoResults timeFieldName={timeField} queryLanguage={''} /> | ||
</EuiFlexItem> | ||
<DiscoverNoResults timeFieldName={timeField} queryLanguage={''} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this appear at the vertical and horizontal center of the page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It spans the width of the container but does not center to the vertical center. The flex was originally added to make the app appear as a full page application. Users have since complained about its usability like that so this change reverts it to a simpler layout allowing for scrolling, so having a centered component would not be really helpful.
[MANUAL CYPRESS TEST RUN RESULTS]✅ Cypress test run succeeded!Inputs:Source repo: Test spec: Link to results:https://github.com/opensearch-project/OpenSearch-Dashboards/actions/runs/6385136186 |
Needs conflict resolution |
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
8fe670a
to
21c71a3
Compare
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5168-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cb6e0f05aa4c8b8f43352d8de0642e059afea093
# Push it to GitHub
git push --set-upstream origin backport/backport-5168-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> Signed-off-by: Leo Deng <leo7deng@gmail.com>
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> Signed-off-by: Leo Deng <leo7deng@gmail.com>
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit cb6e0f0) Signed-off-by: Miki <miki@amazon.com>
* [BUG][Discover] Add onQuerySubmit to top nav and allow force update to embeddable (#5160) * all reload to force update embeddable * add onQuerySubmit to top nav Issue Resolve #5116 #5159 Signed-off-by: ananzh <ananzh@amazon.com> Co-authored-by: Miki <miki@amazon.com> Co-authored-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit 7d89cca) Signed-off-by: Miki <miki@amazon.com> * [Discover] A bunch of navigation fixes (#5168) * Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit cb6e0f0) Signed-off-by: Miki <miki@amazon.com> * [BUG][Data Explorer][Discover] Automatically load solo added default index pattern (#5171) * [BUG][Data Explorer][Discover] Automatically load solo added default index pattern This fix ensures that when add a default index pattern, Discover will automatically select and load its details. Issue Resolve #5128 --------- Signed-off-by: ananzh <ananzh@amazon.com> (cherry picked from commit 9601c6c) Signed-off-by: Miki <miki@amazon.com> * [BUG][Data Explorer][Discover] Allow data grid to auto adjust size based on fetched data count (#5191) * This PR adds a new rows state to the DiscoverCanvas component and updated it whenever the data$ observable emitted new row data. * The DiscoverTable component was then refactored to accept rows as a prop, making it dependent on the parent component to provide the correct set of data. This ensures that the table renders correctly based on the current data and doesn't rely on its internal state, which could be outdated. Issue Resolve #5181 Signed-off-by: ananzh <ananzh@amazon.com> (cherry picked from commit 677fdf5) Signed-off-by: Miki <miki@amazon.com> * Fixes mobile layout (#5195) Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit 0ffd2ab) * [BUG][Data Explorer][Discover] Allow filter and query persist when refresh page or paste url to a new tab (#5206) Issue Resolve #5179 #5071 Signed-off-by: ananzh <ananzh@amazon.com> (cherry picked from commit 5623cef) Signed-off-by: Miki <miki@amazon.com> * fixes DataTable rendering in doscover (#5207) Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit c70125f) --------- Signed-off-by: ananzh <ananzh@amazon.com> Signed-off-by: Miki <miki@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>
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> Signed-off-by: Willie Hung <willie880201044@gmail.com>
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
* Discover: Fixes state persistence after nav * Fixed breadcrumbs and navigation * fixes mobile view --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Description
Noteable fixes here are:
Issues Resolved
closes #5056
closes #5157
closes #5066
closes #5136
Screenshot
Screen.Recording.2023-09-26.at.2.27.21.PM.mov
Testing the changes
Opening a saved search
Creating a new search
Reset
Navigation
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr