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

[Lens] [WIP] Switch over index pattern automatically #42427

Closed

Conversation

flash1293
Copy link
Contributor

Switches the assigned index patterns for all layers to the one selected in the data panel if the following conditions hold true:

  • All layers use the same index pattern
  • The operations in all layers work as is on the new index pattern

The isLayerTransferable function and the part of the operations figuring out whether they are transferable or not will be useful to also implement a manual switch on a per layer basis (I will do that in a separate PR).

About the "automatic switching" part:

I'm worried that the UI could be confusing in some situations:

  • The user wants to create one layer with index pattern A and one layer with index pattern B. They configure the first layer and then switch to index pattern B in the data panel -> layer 1 switches to index pattern B as well and the user has to switch it back to A manually.
  • The user creates a layer with index pattern A and switches to index pattern B on the left side. The layer changes the index pattern to B which is what the user expected. Then the user changes to index pattern C which is restricted (rollup indices), expecting the current layer to also switch to C, but that doesn't happen because the current operations are not compatible.

What do you think, @AlonaNadler @cchaos ? Can we make the UI more predictable? I have a feeling this way of doing things tries to be too clever and will fail in some situations.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@flash1293
Copy link
Contributor Author

Jenkins, test this.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@flash1293 flash1293 changed the title [Lens] Switch over index pattern automatically [Lens] [WIP] Switch over index pattern automatically Aug 1, 2019
@flash1293
Copy link
Contributor Author

No need to review that one yet, let's discuss the UX implications first.

@AlonaNadler
Copy link

The user wants to create one layer with index pattern A and one layer with index pattern B. They configure the first layer and then switch to index pattern B in the data panel -> layer 1 switches to index pattern B as well and the user has to switch it back to A manually.

How about we have a popup that says something along the lines of "Lens found the same fields in index B would you like to apply index b on the current visualization? yes change to index B / no do nothing`

The user creates a layer with index pattern A and switches to index pattern B on the left side. The layer changes the index pattern to B which is what the user expected. Then the user changes to index pattern C which is restricted (rollup indices), expecting the current layer to also switch to C, but that doesn't happen because the current operations are not compatible.

How about we have a popup that says you switched index pattern, how would you like to proceed? clear my chart/keep the chart as is and we open a new layer in that case

@flash1293
Copy link
Contributor Author

@AlonaNadler That's a nice way of handling that, but do we want to show a popup each time the user switches the index pattern (which would be implied by your suggestion above)?

How about only showing the popup if we could transfer the layer and just doing nothing if that's not the case? A new layer will be opened automatically once the user drags a field from the new index pattern into the workspace.

To make it less intrusive, @wylieconlon also had the idea to show the popup inline in the data panel (maybe above the field list).

@cchaos
Copy link
Contributor

cchaos commented Aug 2, 2019

I had a similar idea to @wylieconlon's but in the layer panel instead since that's where the "switch" would happen.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💔 Build Failed

@flash1293
Copy link
Contributor Author

Closing this because the switcher will always switch all layers as discussed offline for the first version.

@flash1293 flash1293 closed this Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants