Open majagrubic opened 2 years ago
I see how this idea tackles specifically the "No data" screens. Can this proposal also generally apply to the page layouts that have data?
Can you clarify which pages do you mean exactly?
The KibanaPageTemplate
component is currently used by all solutions (with the exception of a few like Discover). If we refactor, it will affect all page layouts, not just the "No data" screens.
For example all the listing pages use it:
Observability wraps it creating a specific Observability Page template to handle side navigation and loading states:
This proposal only specifies getting/setting the no data configuration, but there's a lot more that the KibanaPageTemplate handles by passing through to EuiPageTemplate like pageHeader
content and sidebar
configurations. I'm just wondering what the proposal is to continue to support all these settings per page.
Thanks for clarifying. My goal is not to tamper with PageTemplate
at all for now, I'd just like to extract the "no data" part into a separate component, that would be as lightweight as possible. So to answer your initial question - no, it won't affect the layouts that have data.
Current state
The problem with the current
PageTemplate
component is that the logic for rendering its layout is closely tied to specific solutions. Eg:We'd like to create a component that is a bit more lightweight, with the data needed for rendering decoupled from the layout itself.
Proposal
The idea is to create a registry, that could be accessed by a certain plugin. The registry would contain two pieces of information:
The registry would have 2 corresponding setters and 2 corresponding getters, eg.
The component to render empty state would then only take
name
as a prop and would renderEuiTemplate
with appropriate props and aNoDataPage
with the appropriate config, both obtained from the register.The appropriate plugins would need to call the registry at setup time, and add their appropriate configs to the registry. This requires a bit more work on each solution's side than just 1-1 mapping to the new page.