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

[ML] Replacing angular routing #51842

Merged
merged 44 commits into from
Dec 11, 2019

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Nov 27, 2019

Replaces angular routing layer with a react routing layer.
To aid transition to the new routing type I've copied angular's idea of having a resolving step before each page load. As before, this takes a collection of promise returning functions.

AppState and GlobalState are implemented entirely. I've created a dummy AppState class to be passed into the observables so not to change them, but any updates to the page are not reflected in the URL.
On page load the _g and _a are parsed and passed to the page as before.

Saved searches are now saved objects, rather than a SavedSearch object from Discover.
IndexPatterns are injected from the data plugin.

There are still more includes that need to be shimmed, but this will happen in follow up PRs.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jgowdyelastic jgowdyelastic marked this pull request as ready for review December 6, 2019 10:50
@jgowdyelastic jgowdyelastic requested review from a team as code owners December 6, 2019 10:50
@jgowdyelastic jgowdyelastic self-assigned this Dec 6, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@jgowdyelastic jgowdyelastic added non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes review v7.6.0 v8.0.0 labels Dec 6, 2019
@jgowdyelastic
Copy link
Member Author

jgowdyelastic commented Dec 6, 2019

@elastic/kibana-design no style changes have been made in this PR. you've been flagged because i've moved a scss file.

@jgowdyelastic
Copy link
Member Author

jgowdyelastic commented Dec 10, 2019

Because the directives are gone, this PR removes the /test/directive. files. It would be great if the new corresponding PageWrapper components had a similar jest test.

Page loading is covered by functional tests, but if we do still feel that tests for PageWrapper would be useful I can add them in a follow up.
I think they will not be trivial due to the amount of mocking that will be needed for the resolvers.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edits, and all LGTM.

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM. I left another comment about the setTimeout(), it might be worth revisiting in a follow up. Regarding the mocha tests: You're right, let's skip those jest tests. The directive mocha tests were run in a browser environment just to check if everything would load without errors which is now covered by functional tests like you said.

path={route.path}
exact
render={props => {
window.setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe something for a follow up: Does render= take a component? If so maybe the side effect could be done within here using useEffect(() => { setBreamcrumbs(route.breadcrumbs); }, []); - we had a similar discussion around the EuiDataGrid which uses a similar approach, have a look for renderCellValue in the data grid docs here: https://elastic.github.io/eui/#/tabular-content/data-grid

When using setTimeout() for a similar case with data grid we found an issue where the callback for the timeout could trigger an error if the wrapping component got unmounted while the callback was called.

@jgowdyelastic
Copy link
Member Author

@walterra i just tested moving the setBreadcrumbs call to a useEffect inside each PageWrapper and it works! great idea!
It means setBreadcrumbs needs to be passed down through the render function, but that is fine.
As this PR is green and has been reviewed, I'd suggest I make this change in a follow up PR.

@jgowdyelastic jgowdyelastic merged commit 4f2a6f8 into elastic:master Dec 11, 2019
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Dec 11, 2019
* [ML] Replacing angular routing

* removing old files

* changing overview

* renaming overview route

* adding df analytics routes

* adding timeseriesexplorer route

* removing old files

* adding route for explorer

* adding access denied page

* adding module view or create redirect

* fixing job cloning

* adding breadcrumb system

* removing old breadcrumbs files

* fix include

* enabling management section

* injecting app dependencies

* fixing missed dependencies

* fixing saved searches

* fixing type errors

* removing included data start

* code clean up

* updating translations

* fixing router test failures

* fixing functional tests

* removing last use of SavedSearch

* removing comment

* fixing bug in line chart query

* improving saved search jobs

* fixing data viz functional test

* adding comment

* dealing with time range error

* removing unnecessary chrome imports

* cleaning up code

* moving resolver to own file

* changes based on review

* fixing index data viz on basic license

* fixing edit calendar

* adding create job breadcrumb

* fixing results appstate

* fixing management links

* updating new job constants file

* fixing rebase conflicts

* removing commented out code

* adding additional text to the resolver error
jgowdyelastic added a commit that referenced this pull request Dec 11, 2019
* [ML] Replacing angular routing

* removing old files

* changing overview

* renaming overview route

* adding df analytics routes

* adding timeseriesexplorer route

* removing old files

* adding route for explorer

* adding access denied page

* adding module view or create redirect

* fixing job cloning

* adding breadcrumb system

* removing old breadcrumbs files

* fix include

* enabling management section

* injecting app dependencies

* fixing missed dependencies

* fixing saved searches

* fixing type errors

* removing included data start

* code clean up

* updating translations

* fixing router test failures

* fixing functional tests

* removing last use of SavedSearch

* removing comment

* fixing bug in line chart query

* improving saved search jobs

* fixing data viz functional test

* adding comment

* dealing with time range error

* removing unnecessary chrome imports

* cleaning up code

* moving resolver to own file

* changes based on review

* fixing index data viz on basic license

* fixing edit calendar

* adding create job breadcrumb

* fixing results appstate

* fixing management links

* updating new job constants file

* fixing rebase conflicts

* removing commented out code

* adding additional text to the resolver error
@jgowdyelastic jgowdyelastic deleted the replacing-angular-routing branch December 11, 2019 17:49
@walterra walterra mentioned this pull request Dec 13, 2019
21 tasks
timductive pushed a commit to timductive/kibana that referenced this pull request Dec 16, 2019
* [ML] Replacing angular routing

* removing old files

* changing overview

* renaming overview route

* adding df analytics routes

* adding timeseriesexplorer route

* removing old files

* adding route for explorer

* adding access denied page

* adding module view or create redirect

* fixing job cloning

* adding breadcrumb system

* removing old breadcrumbs files

* fix include

* enabling management section

* injecting app dependencies

* fixing missed dependencies

* fixing saved searches

* fixing type errors

* removing included data start

* code clean up

* updating translations

* fixing router test failures

* fixing functional tests

* removing last use of SavedSearch

* removing comment

* fixing bug in line chart query

* improving saved search jobs

* fixing data viz functional test

* adding comment

* dealing with time range error

* removing unnecessary chrome imports

* cleaning up code

* moving resolver to own file

* changes based on review

* fixing index data viz on basic license

* fixing edit calendar

* adding create job breadcrumb

* fixing results appstate

* fixing management links

* updating new job constants file

* fixing rebase conflicts

* removing commented out code

* adding additional text to the resolver error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration :ml non-issue Indicates to automation that a pull request should not appear in the release notes release_note:skip Skip the PR/issue when compiling release notes review v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants