Skip to content

Conversation

@lizozom
Copy link
Contributor

@lizozom lizozom commented Jun 9, 2020

Summary

This PR is an enhancement based on @mdefazio mocks for Make it Slow.

In visualize_embeddable and search_embeddable UI, we now:

  • Gray out previous visualization data while loading new data (Thanks @markov00 for the idea)
  • Gray out the panel title while loading
  • On error, keep data grayed out and show an Error or a Aborted label to each visualization. Users can simply use the back button if they wish to return to the old search config.

ezgif-4-ccb4b477015c

Note that other app behavior did not change and still shows an error toast notification in discover and visualize.

These changes can be easily applied to other embeddables (Lens @elastic/kibana-app and Maps @elastic/kibana-gis for example) to create a uniform user experience. This can be achieved by using the embeddable's output and setting it to:

  • Loading: this.updateOutput({ loading: true, error: undefined });
  • Complete: this.updateOutput({ loading: false, error: undefined });
  • Error: this.updateOutput({ loading: false, error });

Added benefits

  • Any individual embeddable error will be now handled by the embeddable, instead of being output into the toasts area. This change partially resolves a known issue where on search cancellation \ errors we trigger multiple toasts.
  • This PR also resolves an issue where a user aborts a search using search_interceptor, but the expression's AbortController is not cancelled properly (it didn't have any implications ATM, but would have them with Make it Slow).

Checklist

Delete any items that are not applicable to this PR.

For maintainers

Gray out loading \ errored results
@lizozom lizozom added Feature:Search Querying infrastructure in Kibana enhancement New value added to drive a business result v8.0.0 Team:AppArch release_note:skip Skip the PR/issue when compiling release notes v7.9.0 labels Jun 9, 2020
@lizozom lizozom requested review from a team as code owners June 9, 2020 08:44
@lizozom lizozom self-assigned this Jun 9, 2020
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Jun 9, 2020
@lizozom lizozom requested a review from mdefazio June 9, 2020 08:52
@lizozom lizozom removed the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Jun 9, 2020
this.handler = new expressions.ExpressionLoader(this.domNode);
this.handler = new expressions.ExpressionLoader(this.domNode, '', {
onRenderError: (element: HTMLElement, error: RenderError) => {
this.onContainerError(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't test yet, but I wonder:

considering very recent fixes around race conditions in this file, could this callback become another source for possible race condition?

Like for example: there is already a new request finished and new vis rendered, but somehow error from previous request popped up and replaced actual visualization with older error?

There are some checks happening in updateHander, but it relies on reference to older abort controller.

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 callback is called exactly the same way it was previously - just with different UI logic.

See src/plugins/expressions/public/render.ts line 68.

We used to use defaultRenderErrorHandler before, and it would output the errors as toasts. Since we now pass a custom error handler - it gets called instead when an error occurs.

There are no other changes in flow. I just extracted the state handling into meaningful callbacks to make it more readable.

Copy link
Contributor

@Dosant Dosant Jun 9, 2020

Choose a reason for hiding this comment

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

I think there is a slight difference:

  1. Previously we just showed a popup on the right and error didn't affect the visualisation embeddable.
  2. Now if older error pops up we will show "error" label near the visualisation in actual state.

I still haven't reproduced what I am worrying about here :(
Just being extra cautions because of recent experience with cancelations :(
Don't have a particular action item here now

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Jun 9, 2020
@Dosant
Copy link
Contributor

Dosant commented Jun 9, 2020

Is this graying out change OK from a11y perspective? Maybe someone have to look at it if haven't yet?
I don’t have experience with compliance in this field, etc, so I can't tell..
I guess, if we treat it as an enchantment, it is fine.
Just rising some concerns I am not 100% sure about:

  1. Not everyone would recognise the difference loading and not loading state?
    1.1 because of that I guess we still have to add loading indicator on top of embeddable panel?
  2. Could it be harmful for someone that we change color palette on a fly that quickly? This especially could cause major color shifts on a dashboard, where we have a lot of visualisations

On a dashboard only visualizations will use this gray behaviour. but not lens, maps, etc. Is this an issue?

};

onContainerError = (error: RenderError) => {
if (this.abortController) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is related to: https://github.com/elastic/kibana/pull/68623/files#r437278595

I guess here could be a race condition, that when error pops up, this.abortController is actually an abortController for new on-going request which haven't finished yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The graying out will actually prevent the user from applying a filter while another search is running, reducing the chances of this happening.

@lizozom
Copy link
Contributor Author

lizozom commented Jun 9, 2020

@elasticmachine merge upstream

@cchaos
Copy link
Contributor

cchaos commented Jun 9, 2020

The general rule of thumb with a11y is that if something is disabled (can’t interact with it) or in this case doesn’t actually represent any (current) data, you don’t really need to adhere to contrast levels. Though we tend to try to ensure at least a 2.0 ratio. As long as there is an indicator as to why there’s no content or grayed content, such as your label, it should be ok for a11y with regards to color.

What you might need to look into is ensuring that for screen-readers, it is announced appropriately as either loading, incomplete, or has error.

@lizozom lizozom changed the title Add label on visualize embeddable errors Improve Embeddable loading and error handling UI Jun 10, 2020
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Code-wise this LGTM, but I'm going to defer the design review to @mdefazio.

@mdefazio
Copy link
Contributor

Design looks good. I think one update we need to look into is also dimming the title as well. For non-visual panels, there won't be any difference between loading/loaded. So the idea is that this would help here. I don't know that there is enough difference with the Text Dark shade, so I think I'd try $euiColorMediumShade.

Liza K added 2 commits June 10, 2020 18:29
Integrate with search embeddable
Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Design LGTM!

@lizozom lizozom removed the request for review from lukeelmers June 10, 2020 16:02
@lizozom lizozom requested a review from a team June 11, 2020 10:53
@lizozom
Copy link
Contributor Author

lizozom commented Jun 11, 2020

@elasticmachine merge upstream

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

LGTM

What's especially nice is the instant feedback given on user action. The greyed out chart/title says "I'm working, give me a second" which makes everything feel snappier.

One thing to consider though, are situations in which the embeddable panel might be loading, but not because of direct user action. Such as an auto-refresh. In some use-cases, it's just expected that the data is up to date, and a distinct loading state just adds noise.

Not urgent, and shouldn't get in the way of merging this, but I wonder if it would be worth adding some kind of tag that determines when to show the loading state.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@lizozom lizozom merged commit 5348110 into elastic:master Jun 12, 2020
lizozom added a commit to lizozom/kibana that referenced this pull request Jun 13, 2020
* Add error label on visualize embeddable error
Gray out loading \ errored results

* Translate label

* code review

* Rename ExpressionRenderError, better scss

* oopsy

* Generalize solution to be used by other embeddables

* Cleanup

* css fix

* Move wrapper div into label component

* Lighten panel title while loading
Integrate with search embeddable

* translations

* Error notification in visualize app

* Update render count on error

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
lizozom added a commit that referenced this pull request Jun 13, 2020
* Add error label on visualize embeddable error
Gray out loading \ errored results

* Translate label

* code review

* Rename ExpressionRenderError, better scss

* oopsy

* Generalize solution to be used by other embeddables

* Cleanup

* css fix

* Move wrapper div into label component

* Lighten panel title while loading
Integrate with search embeddable

* translations

* Error notification in visualize app

* Update render count on error

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@piyushabad88
Copy link

Hi Team,

In which stable version this issue fixed. we are using 7.9.3 and facing same issue. Looking for prompt response .

@markov00
Copy link
Member

markov00 commented Feb 16, 2021

Hi @piyushabad88, looks like it's released on 7.9 at least. Is your issue related to #71369 or #82110?
If not please can you open a GH issue linking to this PR? thanks
cc @lizozom

Hi Team,

In which stable version this issue fixed. we are using 7.9.3 and facing same issue. Looking for prompt response .

@piyushabad88
Copy link

piyushabad88 commented Feb 17, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New value added to drive a business result Feature:Embedding Embedding content via iFrame Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes v7.9.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.