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

[Discover] Migrate to react router #104942

Closed
kertal opened this issue Jul 8, 2021 · 1 comment · Fixed by #107042
Closed

[Discover] Migrate to react router #104942

kertal opened this issue Jul 8, 2021 · 1 comment · Fixed by #107042
Assignees
Labels
Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture

Comments

@kertal
Copy link
Member

kertal commented Jul 8, 2021

These are the 4 steps to get rid of angular router first routes in Discover need:

  1. Migrate Context resolve part of the Angular route to be a hook of the main react component
    resolve: {
    indexPattern: ($route, Promise) => {
    const indexPattern = getServices().indexPatterns.get($route.current.params.indexPatternId);
    return Promise.props({ ip: indexPattern });
    },
    },
  2. Migrate Main resolve part of the Angular route to be a hook of the main react component
    resolve: {
    savedObjects: function ($route, Promise) {
    const history = getHistory();
    const savedSearchId = $route.current.params.id;
    return data.indexPatterns.ensureDefaultIndexPattern(history).then(() => {
    const { appStateContainer } = getState({ history, uiSettings: config });
    const { index } = appStateContainer.getState();
    return Promise.props({
    ip: loadIndexPattern(index, data.indexPatterns, config),
    savedSearch: getServices()
    .getSavedSearchById(savedSearchId)
    .then((savedSearch) => {
    if (savedSearchId) {
    chrome.recentlyAccessed.add(
    savedSearch.getFullPath(),
  3. Apply the new folder structure (This ain't mandatory, but a nice to have) [Discover] Adapt new folder structure #101208
  4. Migrate to react router e.g. like it's done in Visualize
    const app = (
    <Router history={services.history}>
    <KibanaContextProvider services={services}>
    <services.presentationUtil.ContextProvider>
    <services.i18n.Context>
    <VisualizeApp onAppLeave={onAppLeave} />
    </services.i18n.Context>
    </services.presentationUtil.ContextProvider>
    </KibanaContextProvider>
    </Router>
    );
@botelastic botelastic bot added the needs-team Issues missing a team label label Jul 8, 2021
@kertal kertal added Feature:Discover Discover Application and removed needs-team Issues missing a team label labels Jul 8, 2021
@botelastic botelastic bot added the needs-team Issues missing a team label label Jul 8, 2021
@kertal kertal added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Jul 8, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Jul 8, 2021
@kertal kertal added the technical debt Improvement of the software architecture and operational architecture label Jul 8, 2021
@majagrubic majagrubic self-assigned this Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants