-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Reactify visualize app #67848
Reactify visualize app #67848
Conversation
11eca48
to
ba5ac21
Compare
@@ -17,12 +17,8 @@ | |||
* under the License. | |||
*/ | |||
|
|||
import { i18n } from '@kbn/i18n'; | |||
|
|||
export const defaultFeedbackMessage = i18n.translate('kibana_utils.defaultFeedbackMessage', { |
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.
Instead of exporting defaultFeedbackMessage
from kibana_utils
to every experimental vis (input_control
, vega
, metrics
), I moved it into visualize: https://github.com/elastic/kibana/pull/67848/files#diff-1d6c318a6f1b7dcab619931a74884297
@@ -104,12 +110,12 @@ function DefaultEditorSideBar({ | |||
aggs: state.data.aggs ? (state.data.aggs.aggs.map((agg) => agg.toJSON()) as any) : [], | |||
}, | |||
}); | |||
eventEmitter.emit('updateVis'); | |||
embeddableHandler.reload(); |
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.
@elasticmachine merge upstream |
merge conflict between base and head |
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.
Not finished yet, will continue tomorrow
@@ -56,7 +56,7 @@ export function createSavedVisLoader(services: SavedObjectKibanaServicesWithVisu | |||
source.icon = source.type.icon; | |||
source.image = source.type.image; | |||
source.typeTitle = source.type.title; | |||
source.editUrl = `#/edit/${id}`; | |||
source.editUrl = `/edit/${id}`; |
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.
Seems like this should be #/edit/${id}
for now as the PR isn't switching to path routing yet.
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.
If I'm not wrong, this is used only used in visualize for navigating to a visualization from the listing page. In new implementation, history.push
is used for navigating, where the history
object is a hash history object, so it accepts paths without leading #
.
Apart from this case, I didn't find any usages of this.
Navigating from other apps (e.x. from discover/dashboard/canvas) works well.
If I missed smth, please let me know! 🙂
> | ||
<VisualizeListing /> | ||
</Route> | ||
<Redirect to={VisualizeConstants.LANDING_PAGE_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.
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.
Replaced with the VisualizeNoMatch
component
src/plugins/visualize/public/application/utils/use/use_chrome.ts
Outdated
Show resolved
Hide resolved
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.
src/plugins/visualize/public/application/components/visualize_listing.tsx
Outdated
Show resolved
Hide resolved
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.
UI state is not persisted:
- Create area chart with multiple series
- Change color of one series by clicking the dot in the legend and selecting another color
- Save vis
- Go to listing page
- Select vis again
- Color is not selected anymore
Same for table sorting in TSVB
# Conflicts: # src/plugins/visualize/public/application/legacy_app.js
Good question. @timroes do you know what's up with that? |
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.
Code seems LGTM to me, but I haven't tested it yet. Will continue it asap. I can confirm so far that #68509 is fixed 🍰
src/plugins/visualize/public/application/components/visualize_editor.tsx
Outdated
Show resolved
Hide resolved
src/plugins/visualize/public/application/utils/get_table_columns.tsx
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
Tested on Chrome, seems LGTM
@elasticmachine merge upstream |
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.
SASS files LGTM
# Conflicts: # src/plugins/visualize/public/application/editor/editor.js # src/plugins/visualize/public/application/legacy_app.js # src/plugins/visualize/public/kibana_services.ts # src/plugins/visualize/public/plugin.ts
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.
Only tested the legacy redirect logic in Chrome and Firefox, works like a charm. LGTM 👍
It even fixes the back button breakage on paths that are normalized on the fly 💯
@majagrubic @ThomThomson This PR is a great blueprint for doing the same thing in Dashboard
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.
AppArch code changes LGTM.
…lize # Conflicts: # src/plugins/visualize/public/application/editor/editor.js
…nto np/reactify_visualize
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
History
To update your PR or re-run it, just comment with: |
* Reactify visualize app * Fix typescript failures after merging master * Make sure refresh button works * Subscribe filter manager fetches * Use redirect to landing page * Update savedSearch type * Add check for TSVB is loaded * Fix comments * Fix uiState persistence on vis load * Remove extra div around TableListView * Update DTS selectors * Add error handling for embeddable * Remove extra argument from useEditorUpdates effect * Update comments, fix typos * Remove extra div wrapper * Apply design suggestions * Revert accidental config changes * Apply navigating to dashboard * Apply redirect legacy urls * Apply incoming changes * Apply incoming changes Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* Reactify visualize app * Fix typescript failures after merging master * Make sure refresh button works * Subscribe filter manager fetches * Use redirect to landing page * Update savedSearch type * Add check for TSVB is loaded * Fix comments * Fix uiState persistence on vis load * Remove extra div around TableListView * Update DTS selectors * Add error handling for embeddable * Remove extra argument from useEditorUpdates effect * Update comments, fix typos * Remove extra div wrapper * Apply design suggestions * Revert accidental config changes * Apply navigating to dashboard * Apply redirect legacy urls * Apply incoming changes * Apply incoming changes Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
De-Angularize Visualize app
Closes #59811
Closes #65613
Closes #68509 , can't reproduce it with these changes.
The main aim of the PR is to get rid of Angular and use React & React-Router in Visualize.
Visualize still uses hash router internally; moving it to browser router which uses the
ScopedHistory
object under the hood is a separate task, since it will cause a lot of changes in other places.Visual changes
I've mostly tried to save existing behavior, but eventually added a few changes.
Here they are:
experimental vis info banner was changed to use
EuiCallOut
:navigation to nonexistent route now is redirected to the visualize landing page (instead of using
kibanaLegacy.navigateToDefaultApp()
) and is accompanied by a banner message:Other changes(enhancements)
Note: Unit tests will be provided in a separate PR to decouple reviewers work 🙂
Checklist
Delete any items that are not applicable to this PR.
For maintainers