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

[Stack monitoring] Add global state context and routeInit component #109790

Merged
merged 5 commits into from
Aug 26, 2021

Conversation

estermv
Copy link
Contributor

@estermv estermv commented Aug 24, 2021

Summary

This PR is part of the Angular migration:

  • Adds a GlobalState context. It makes use of the existing GlobalState, which is responsible for storing the global state and keep it in sync with the URL query params.
  • Adds some utilities to maintain query params when URL changes in the react-router
  • Changes the typing for the GlobalState class to make it compatible with React
  • It adds a RouteInit component that requests the clusters and does some redirects based on the response. This replaces the routeInit provider from Angular, used in almost all the routes definitions on the resolve property.

@estermv estermv added v8.0.0 Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes Feature:Stack Monitoring auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 Epic: Stack Monitoring de-angularization labels Aug 24, 2021
@estermv estermv marked this pull request as ready for review August 24, 2021 12:50
@estermv estermv requested a review from a team as a code owner August 24, 2021 12:50
@estermv estermv requested review from a team August 24, 2021 12:50
@elasticmachine
Copy link
Contributor

Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui)

Comment on lines +64 to +71
const isExpired = (license: any): boolean => {
const { expiry_date_in_millis: expiryDateInMillis } = license;

if (expiryDateInMillis !== undefined) {
return new Date().getTime() >= expiryDateInMillis;
}
return false;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comes from the license service in Angular. It stores the license of the cluster viewed.
This service seems to be used in a couple of places, so I don't think is worth it to keep it as part of the state. We can extract this code to a separate file later if it's used in more places

@estermv estermv changed the title [Stack monitoring] Add global state context [Stack monitoring] Add global state context and routeInit component Aug 25, 2021
@estermv
Copy link
Contributor Author

estermv commented Aug 25, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
monitoring 570 573 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
monitoring 761.7KB 766.6KB +4.8KB

History

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

Copy link
Contributor

@phillipb phillipb left a comment

Choose a reason for hiding this comment

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

LGTM

@matschaffer
Copy link
Contributor

let's do this

@estermv estermv merged commit 9c922a0 into elastic:master Aug 26, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Aug 26, 2021
…lastic#109790)

* Add global state to stack monitoring react app

* Add type for state

* Add some todos

* Add route_init migration

Co-authored-by: Kibana Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 26, 2021
…109790) (#110181)

* Add global state to stack monitoring react app

* Add type for state

* Add some todos

* Add route_init migration

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Ester Martí Vilaseca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Epic: Stack Monitoring de-angularization Feature:Stack Monitoring release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants