-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Console] Progress bar #56628
Conversation
- progress bar loader for in flight request - Network request status bar
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
@elasticmachine merge upstream |
There was a problem hiding this 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 }}> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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:
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:
There was a problem hiding this comment.
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)}> |
There was a problem hiding this comment.
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.
const dispatch = useRequestActionContext(); | ||
|
||
return useCallback(async () => { | ||
if (requestInFlight) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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:
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.
There was a problem hiding this 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%; | ||
|
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this 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.', |
There was a problem hiding this comment.
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
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
* 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]>
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…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'
* [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]>
Summary
Fix #24157
Gif
How to review code
History
andSettings
controls but this causes the underline to not stretch the full width of the editor.How to review UX
yarn start
with an ES node running (e.g.,yarn es snapshot
)Release note
We also enhanced the Console UI with a spinner and more information about how a network request to ES went.
Final Gif
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.Any text added follows EUI's writing guidelines, uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md]Documentation was added for features that require explanation or tutorialsUnit or functional tests were updated or added to match the most common scenariosFor maintainers