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

[Discuss] Syncing filters & time with URL using new state management utils #55339

Closed
Dosant opened this issue Jan 20, 2020 · 4 comments
Closed

Comments

@Dosant
Copy link
Contributor

Dosant commented Jan 20, 2020

In scope of: #54105 and #55158 AppState and GlobalState were replaced by state syncing utilities in Dashboard app. It was done "in place" without refactoring, by just replacing old angular dependant objects for new approach.

We still have to decide how to abstract syncing of Filters and Time to Url away from applications.
And also what to do with not pinned, application level filters, which are currently synced to url together with other app state information.

On this high-level diagram you can see how filters are syncing between different components in Dashboard App as of in #55158:
g on a relation represents only "global" filters
a- only "app" filters
g+a - both

 Blank UML-2

As seen on a diagram syncing g filters to url is decoupled from other pieces and in #55158 implemented by: https://github.com/elastic/kibana/pull/55158/files#diff-5e89f9f26cbd7f233495a2e97789a306R51
Looks like this piece can mostly stay as is and probably moved somewhere close to data/ plugin.

On the other syncing application filters with a is on application's shoulders on this point...

Parent issue #44151

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant
Copy link
Contributor Author

Dosant commented Jan 21, 2020

@lizozom, @ppisljar,

As discussed, what if FilterManager also sync _a filters to URL:

Copy of  Blank UML

  1. Doesn't look like this particular scheme became simpler
  2. Additional complexity to implement in our state syncing utils: Now we can't want just for state changes in query by key (?_a), but we also need to be able to watch for specific slice of state.

@lizozom
Copy link
Contributor

lizozom commented Jan 22, 2020

Dropping a note here after our session with @ppisljar and @Dosant

The workflow we should strive for should be:

  1. core loads data plugin first time
  • filter manager has its filter state (ATM array)
  1. core loads dashboard
  • dashboard populates its state container from URL (from _a and _g) using state utils
  • data plugin should expose a method that looks something likes this const observable$ = data.connectToState(stateContainer). This method would set the global \ app state and then trigger a single time every time filters \ time \ query changes.
  1. `dashboard should subscribe to changes on that observable and trigger syncState when it changes.
  2. When a user pins a filter, magic happens something watches the URL and updates the side nav links
  3. navigate to discover repeats steps (2-4)
  4. navigate to maps
  5. Since maps doesn't use URL state, the flow here is different. What happens if maps sets global filters?

@Dosant
Copy link
Contributor Author

Dosant commented Apr 1, 2020

Closing together with #44151
Intermediate data plugin query syncing helpers was implemented to support current behaviour and used in discover, visualise, dashboard.

@Dosant Dosant closed this as completed Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants