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

[Embeddables] Update EmbeddablePanel component to trigger edit panel action on error click #140205

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

dokmic
Copy link
Contributor

@dokmic dokmic commented Sep 7, 2022

Summary

Resolves #138608.

Embeddable.Error.Click.mov

Checklist

@dokmic dokmic added review Feature:Embedding Embedding content via iFrame release_note:skip Skip the PR/issue when compiling release notes Team:AppServicesUx v8.5.0 labels Sep 7, 2022
@dokmic dokmic marked this pull request as ready for review September 8, 2022 07:13
@dokmic dokmic requested review from a team as code owners September 8, 2022 07:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesUx)

Copy link
Contributor

@vadimkibana vadimkibana left a comment

Choose a reason for hiding this comment

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

LGTM

@MichaelMarcialis
Copy link
Contributor

@dokmic: Would you mind adding some screenshots or a short gif/video of the changes? Thanks!

@dokmic
Copy link
Contributor Author

dokmic commented Sep 13, 2022

@MichaelMarcialis I've updated the summary to show a video. Would you mind taking another look?

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for adding that video, @dokmic. I've added a couple of questions and comments for your review below. Let me know if you have any questions.

Comment on lines +77 to +87
<EuiPanel
element="div"
className="embPanel__content embPanel__content--error"
color="transparent"
paddingSize="none"
data-test-subj="embeddableError"
panelRef={ref}
role={isEditable ? 'button' : undefined}
aria-label={isEditable ? ariaLabel : undefined}
onClick={handleErrorClick}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than making a clickable EuiPanel, would it be better to use an EuiEmptyPrompt with an EuiButton in the actions prop (see examples in EUI docs)? I imagine that a dedicated button that notifies the user that they will be taken to edit the erroneous visualization would be a more user-friendly experience. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MichaelMarcialis I've checked the component and the example. I don't think it is applicable in our case:

  • The panel here is just a dummy element we use as a placeholder for the UI -- embeddable widgets may render their custom error component. So that we cannot place a button here as it will not be shown in most of the cases.
  • This change introduces a generic click handler and doesn't touch any UI.
  • The UI present in the video comes from the Visualizations plugin, and it's made in a way to look similar to the error message from the Lens plugin.
  • If we would like to change the way it looks, we should create a separate issue that will request updates of the error appearance in three different places at the same time: Lens, Visualizations, and generic Embeddables.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for that explanation, @dokmic. Just to be sure I'm understanding, you're saying that EmbeddablePanelError is a placeholder that can be swapped out with a custom error component, correct? Is the swapping out with a custom error component required? Or is it optional, leaving the possibility for this "placeholder" error message to show instead?

If the swapping out of the EmbeddablePanelError component is optional (leaving the possibility for this "placeholder" error panel to be shown to users), I'm inclined to maintain my suggestion that we should instead utilize EuiEmptyPrompt here (with a conditional EuiButton that takes users to edit the visualization). Visually, I believe EuiEmptyPrompt can be styled to look the same as the error message shown in your example (for the sake of consistency with other error messages), just with the addition of the button for better usability.

Let me know if that makes sense or if I'm misunderstanding anything. CCing @flash1293, in case he has any thoughts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not holding this opinion strongly but I expected to use the context menu for this - click the cogwheel and select the edit action from there.

Copy link
Contributor Author

@dokmic dokmic Sep 21, 2022

Choose a reason for hiding this comment

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

@MichaelMarcialis

EmbeddablePanelError is a placeholder that can be swapped out with a custom error component, correct? Is the swapping out with a custom error component required?

Yes, that's correct. It is optional but is overridden in majority of the places.

If the swapping out of the EmbeddablePanelError component is optional (leaving the possibility for this "placeholder" error panel to be shown to users), I'm inclined to maintain my suggestion that we should instead utilize EuiEmptyPrompt here (with a conditional EuiButton that takes users to edit the visualization).

I've checked the code once again, and the change seems impossible at the moment without a significant refactoring. The problem is that we have some internal service to open the panel for edit. It would be tricky to initialize that from Lens or Visualizations. The best solution is to get rid of the custom error components that look similar and use the fallback. But that should be done separately as it requires more work than the original issue and involves more parties.

Is that okay if I create a separate ticket to address that?

Comment on lines +33 to +38
.embPanel__content--error {
&:hover {
box-shadow: none;
transform: none;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If taking my suggestion to use an EuiEmptyPrompt with EuiButton, these styles will likely no longer be necessary.

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

I've checked the code once again, and the change seems impossible at the moment without a significant refactoring. The problem is that we have some internal service to open the panel for edit. It would be tricky to initialize that from Lens or Visualizations. The best solution is to get rid of the custom error components that look similar and use the fallback. But that should be done separately as it requires more work than the original issue and involves more parties.

Is that okay if I create a separate ticket to address that?

Thanks, @dokmic. If ya'll are willing to create that separate issue to help implement the above design suggestions, that sounds like a reasonable approach to me. Approving now so I don't hold you up further.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
embeddable 83 84 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
embeddable 415 412 -3

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
embeddable 69.2KB 70.0KB +835.0B
Unknown metric groups

API count

id before after diff
embeddable 515 512 -3

History

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

@dokmic
Copy link
Contributor Author

dokmic commented Sep 23, 2022

I've created #141676 to address the UI updates as it was discussed above.

cc @MichaelMarcialis

@dokmic dokmic merged commit 48b2ee4 into elastic:main Sep 23, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Sep 23, 2022
@dokmic dokmic deleted the feature/138608 branch September 23, 2022 16:17
jennypavlova pushed a commit to jennypavlova/kibana that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Embedding Embedding content via iFrame release_note:skip Skip the PR/issue when compiling release notes review v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ErrorEmbeddable] add support for going to the editor to fix the issue
7 participants