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

[Console] Progress bar #56628

Merged

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Feb 3, 2020

Summary

Fix #24157

Gif

console_progress_bar

How to review code

  • Review the new network status bar component
  • Review SCSS, currently the network status bar is rendered inside of the editor output component and relatively positioned just outside of the output pane. We could place next to the History and Settings controls but this causes the underline to not stretch the full width of the editor.

How to review UX

  • Start Kibana via yarn start with an ES node running (e.g., yarn es snapshot)
  • If in chrome, open Dev tools, switch to the network tab, expand the "Online" dropdown and simulate a slow 3G connection.
  • Run a request

Release note

We also enhanced the Console UI with a spinner and more information about how a network request to ES went.

Final Gif

progress_spinner_latest

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@jloleysens jloleysens requested a review from cjcenizal February 3, 2020 14:48
@jloleysens jloleysens requested a review from a team as a code owner February 3, 2020 14:48
@jloleysens jloleysens added Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:enhancement v7.7.0 v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Feb 3, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

This looks fantastic @jloleysens! I like the UI and UX decisions you made here. I had a few suggestions and questions, but the only thing I'd like to block on is my concern about the UX regarding sending a request while there's already a request in flight.

</PanelsContainer>
<>
{requestInFlight ? (
<div style={{ position: 'relative', zIndex: 2000 }}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use a class name here instead? I'm not sure if our CSP disallows inline styles, but I think we are moving in that direction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an interesting point! Do you know whether this is the current CSP src/core/server/csp/config.ts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh cool, didn't know about that file! I'm not sure but it looks like it would be.

@@ -0,0 +1,5 @@
.conApp__outputNetworkRequestStatusBar {
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

Can we use an EuiFlexGroup to handle layout instead of custom classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally, I did use an EuiFlexGroup, but found the padding on bottom and top too big. Given your suggested changes below I am happy to change this!

>
<EuiFlexItem
grow={false}
className="conApp__outputNetworkRequestStatusBar__item conApp__outputNetworkRequestStatusBar__badge"
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

Is conApp__outputNetworkRequestStatusBar__badge defined anywhere?

Also if we remove the conApp__outputNetworkRequestStatusBar__item class and set gutterSize="s" on the EuiFlexGroup on line 63, we'll get this layout which I think looks a bit better:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will clean that up!

if (jqXHR.status === 0) {
jqXHR.responseText =
"\n\nFailed to connect to Console's backend.\nPlease check the Kibana server is up and running";
}
wrappedDfd.rejectWith(this, [jqXHR, textStatus, errorThrown]);
}
wrappedDfd.rejectWith({}, [jqXHR, textStatus, errorThrown]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying to understand why this file was changed. Was this line the only material change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mainly it was convernted to .ts. That particular change is for the this object of the callback handler - which should actually not be anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

<>
{lastDatum ? (
<div className="conApp__networkRequestContainer">
<NetworkRequestStatusBar
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

It looks like the location of this component causes some rendering problems when you open the "History" dropdown:

image

In terms of component hierarchy, I'd also expect to find it located near the tabs in the code, since it's located near the tabs visually. If we change https://github.com/elastic/kibana/blob/master/src/plugins/console/public/application/containers/main/main.tsx#L70 to this:

        <EuiFlexItem grow={false}>
          <EuiTitle className="euiScreenReaderOnly">
            <h1>
              {i18n.translate('console.pageHeading', {
                defaultMessage: 'Console',
              })}
            </h1>
          </EuiTitle>

          <EuiFlexGroup gutterSize="none">
            <EuiFlexItem grow={false}>
              <TopNavMenu
                disabled={!done}
                items={getTopNavConfig({
                  onClickHistory: () => setShowHistory(!showingHistory),
                  onClickSettings: () => setShowSettings(true),
                  onClickHelp: () => setShowHelp(!showHelp),
                })}
              />
            </EuiFlexItem>

            <EuiFlexItem className="conApp__tabsExtension">
              <NetworkRequestStatusBar
                method={'GET'}
                endpoint={'/the_last_starfighter'}
                statusCode={200}
                statusText={':)'}
                timeElapsedMs={'411'}
              />
            </EuiFlexItem>
          </EuiFlexGroup>
        </EuiFlexItem>

And add this class somewhere:

.conApp__tabsExtension {
  border-bottom: $euiBorderThin;
}

Then the rendered output is correct and the two components will be colocated:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome! Happy with these changes, I was a bit stuck on this one 👍

}`}</EuiText>
}
>
<EuiBadge color={mapStatusCodeToBadgeColor(statusCode)}>
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

What do you think of hiding the second badge and replacing this one with a hollow one that says "Request in flight" while the request is in flight? I think it improves usability by 1) acting as a placeholder for the request results so you know where to look for them and 2) explaining the purpose of the strobing progress indicator.

image

const dispatch = useRequestActionContext();

return useCallback(async () => {
if (requestInFlight) {
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

I might be missing something, but I think this condition introduces a UX problem. Current behavior in master is that the latest request supersedes older in-flight requests. So, if you have a long-running request and then dispatch a new request, it will appear as if the long-running request was cancelled because the new request's response will appear instead. This is useful in case you get frustrated with a long-running request and want to try something different.

With the change made here, the user is forced to sit through a long-running request and has to reload Console to "cancel" it. Was there another problem this change was intended to fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are totally correct, this is an artefact that should have been removed!!

dispatch({ type: 'sendRequest', payload: undefined });
try {
const editor = registry.getInputEditor();
const requests = await editor.getRequestsInRange();
if (!requests.length) {
dispatch({
type: 'requestFail',
payload: { value: 'No requests in range', contentType: 'text/plain' },
payload: {
Copy link
Contributor

@cjcenizal cjcenizal Feb 4, 2020

Choose a reason for hiding this comment

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

I feel like the way this is represented in the UI isn't particularly useful. I didn't actually send a request to an endpoint, and there was no real response nor elapsed time, so this information in the top-right corner doesn't seem relevant:

image

Can we explore ways to make this more useful? How about we preserve the existing information from the prior request (i.e. the response payload in the output pane as well as the status and elapsed time badges), and instead just show a neutral toast to let the user know that they need to move their cursor inside of a request or highlight multiple requests in order to execute them?

- Clean up unused class names
- Move the network request status bar to next to the nav bar with a grey line under it
- Added the request in progress badge in the network request status bar
- Removed logic forcing one request at a time!
- Added notification for when a user is sending a request from a line with no request on it (no more 0 - None status). Also preserve the previuous request in this case
…ext area!! This can be backported to 7.6 as it causes

when a request is selected at the bottom of a large text buffer and the history viewer is opened.
Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

@jloleysens the code looks great. I agree with @cjceniza, you made very good design decisions! 🎉

position: absolute;
min-width: 200px;
width: 100%;

Copy link
Contributor

Choose a reason for hiding this comment

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

I would just remove this empty space.


height: 30px;
top: -30px;

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also remove this empty space.

Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

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

Looks great! Had one copy suggestion.

notifications.toasts.add(
i18n.translate('console.notification.noReqeustSelectedTitle', {
defaultMessage:
'It looks like your cursor is not on a request. Please select a request by placing your cursor on it.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think our copywriting guide discourages phrases like "it looks like" and niceties like "please". My suggestion is: "No request selected. Select a request by placing the cursor inside it."

Remove unused SCSS
@cjcenizal
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@elizabetdev elizabetdev left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@jloleysens jloleysens merged commit d20a7d0 into elastic:master Feb 6, 2020
@jloleysens jloleysens deleted the feature/console/ui-progress-bar branch February 6, 2020 07:47
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 6, 2020
* First round of UI updates
 - progress bar loader for in flight request
 - Network request status bar

* Add notification about in flight request

* Use nbsp; and update the EuiCode to use EuiBadge

* Address PR feedback:

- Clean up unused class names
- Move the network request status bar to next to the nav bar with a grey line under it
- Added the request in progress badge in the network request status bar
- Removed logic forcing one request at a time!
- Added notification for when a user is sending a request from a line with no request on it (no more 0 - None status). Also preserve the previuous request in this case

* [NB] Fix for floating tools when request is past bottom of rendered text area!! This can be backported to 7.6 as it causes
when a request is selected at the bottom of a large text buffer and the history viewer is opened.

* Fix types

* Update copy
Remove unused SCSS

Co-authored-by: Elastic Machine <[email protected]>
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

jloleysens added a commit that referenced this pull request Feb 6, 2020
…ix] (#56948)

* [NB] Fix for floating tools when request is past bottom of rendered text area!! This can be backported to 7.6 as it causes
when a request is selected at the bottom of a large text buffer and the history viewer is opened.

* 'unset' -> 'auto'
jloleysens added a commit that referenced this pull request Feb 6, 2020
* [Console] Progress bar (#56628)

* First round of UI updates
 - progress bar loader for in flight request
 - Network request status bar

* Add notification about in flight request

* Use nbsp; and update the EuiCode to use EuiBadge

* Address PR feedback:

- Clean up unused class names
- Move the network request status bar to next to the nav bar with a grey line under it
- Added the request in progress badge in the network request status bar
- Removed logic forcing one request at a time!
- Added notification for when a user is sending a request from a line with no request on it (no more 0 - None status). Also preserve the previuous request in this case

* [NB] Fix for floating tools when request is past bottom of rendered text area!! This can be backported to 7.6 as it causes
when a request is selected at the bottom of a large text buffer and the history viewer is opened.

* Fix types

* Update copy
Remove unused SCSS

Co-authored-by: Elastic Machine <[email protected]>

* 'unset' -> 'auto'

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Console] - Better indicator of running request and elapsed time
5 participants