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
Implement download button feature for logs #77
Implement download button feature for logs #77
Conversation
Can we title this button in verb + noun format?
|
@robszumski I thought the same, but went ahead with just 'Download' since that is what is used on the YAML editor tab. If we do use verb+noun format here, we might want to revisit other places where a download feature is provided and make sure we are consistent across the board. |
@TheRealJon Is any reflow needed at mobile? @rhamilto PTAL |
@spadgett I don't think any reflow is needed. I'm not sure what screen widths we need to account for, but this layout works all the way down to ~450px. |
Connecting to | ||
</span> | ||
<Dropdown className="btn-group" items={_.mapValues(containers, nameWithIcon)} title={nameWithIcon(activeContainer || <LoadingInline />)} onChange={this.onChangeContainer} /> | ||
<div className="co-m-pane__top-controls__group--left"> |
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.
BEM suggests you shouldn't nest elements. http://getbem.com/faq/#css-nested-elements
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 like to remove the co-m-pane
from this and just have the top-controls
be the block level class. Then we can just have top-controls
, top-controls__group
, top-controls__item
.
IMO, we need to optimize for screens all the way down to 320px width viewports based on https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions. |
FYI - PF guidance, is to only combine a verb with noun for Add/Create when sitting in a view/area that is clearly labeled (unless it's not associated with the main content of that view/area). In this case, it's clear that we are looking at Logs, so I think Download is works fine. |
frontend/public/style/_common.scss
Outdated
} | ||
} | ||
|
||
.co-m-pane__top-controls__group--center { |
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 appears the center option isn't being used? I recommend removing it and simplifying the layout if it's not in use.
It really feels like this should be two pull requests: One to add the download button, and one to refactor layout/styling. |
@ggreer The style updates that I made were specifically related to adding a right-aligned download button to the top controls, so they go hand in hand. Since the |
@rhamilto I changed the |
Nice improvement, @TheRealJon! I find it a bit odd that "Log streaming..." no longer sits next to the pause button. Is it possible to maintain the button and text on one line? |
frontend/public/style/_common.scss
Outdated
justify-content: flex-end; | ||
} | ||
|
||
.top-controls__item { |
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 suggest we flatten this. We shouldn't need the nesting with BEM.
Sweet, thanks @TheRealJon LGTM! |
@@ -6,6 +6,10 @@ | |||
width: 32px; | |||
padding: 0; | |||
|
|||
&--space-r { |
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'm not a big fan of class names that describe what they do. I would rather see a class name that semantically describes the content rather than the presentation. Additionally, you could just put the margin right on ToggleButton without using the modifier as the other context that uses ToggleButton has an override that sets the margin to 0.
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.
Yeah, I was trying to avoid adding a new class just for this context since this pattern might be used elsewhere. One option would be to make the status message an optional property of the TogglePlay component itself so that we can include styling in that component.
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.
Split this into two pull requests: One to add the download button, and one to refactor layout/styling.
The PR is < 100 lines and has already been reviewed. Also you can't position the download button without changing the layout. Is this needed? |
Matt and I spent close to an hour trying to figure out the implications of this markup and styling. The combination of flexbox, media queries, nested elements, and padding tweaks... it all made us kinda give up trying to understand the exact differences regarding what users would see. I also wondered whether bootstrap or patternfly already had the necessary functionality. If not, perhaps we should choose a different UI pattern. That said: The code behind the download functionality looks good, and this is a desirable feature. Had it been in its own PR with sub-optimal styling (along with a promise of a follow-up styling fix), I'm sure it would have been merged already. But when these two changes are coupled in the same PR, it tends to cause people to want to merge prematurely. (Since the sooner it's merged, the sooner the desirable feature ships.) I want to avoid that. |
jenkins rebuild |
@ggreer Do you have specific suggestions for how to make this simpler? We were looking at it this morning, and flexbox seems reasonable. I'm not sure we can achieve the same layout with say Bootstrap grid. The intent is to make top-controls reusable for other pages so we only solve this once. |
|
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 pending squash.
Here's a commit that gives the same behavior: fbb65d2 I pushed an image built with this commit ( |
Thanks @ggreer. Appreciate that. It's less code, but I have to point out that it doesn't reflow well, which is one of the problems we wanted to solve. Also the "Log streaming..." text isn't vertically centered: |
Oops, here's a revised commit with the log streaming text centered: bebb600 I pushed an image built with this commit (quay.io/coreos/tectonic-console:bebb60063127e4dca7cb28bf5ce1b0e75d470e04) and deployed it to teamui. I realize the mobile styling isn't great, but log view on mobile has much bigger problems than the padding between buttons. For example, the viewable log area is barely larger than a postage stamp. |
@tlwu2013 We had this same debate while you were out and I believe ended up with a button to be consistent with Tectonic for now, but intended to revisit in the near future when we add other functionality like expand. Not sure we realized there was already some precedent for using links like this in Tectonic though. Having seen the screens you reference, I agree we could just go with a link from the start! @serenamarie125 @cshinn Thoughts? |
@TheRealJon Can you take @ggreer's latest commit for the styling? The only issue I see is that there's no margin between the items when they stack, but I think that shouldn't be too difficult to fix (either in this PR or a follow on). @tlwu2013 I like using a link. If we change it here, should we change the download button on the YAML page, too? I notice the case is different in "Reveal Values" compared to the others ("View samples"). I think we should fix that for consistency. |
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
Let's address any other changes in a follow on to get this merged.
return <div className="co-m-pane__top-controls"> | ||
{ status === 'loading' && <span className="co-icon-space-l"><LoadingInline /></span> } | ||
{ ['streaming', 'paused'].includes(status) && <span className="log-stream-control"><TogglePlay active={status === 'streaming'} onClick={toggleStreaming}/></span>} | ||
<span className="log-container-selector__text"> | ||
{logStatusMessages[status]} | ||
</span> | ||
{dropdown && <span>{dropdown}</span>} | ||
{dropdown && <span style={{flexGrow: 1}}>{dropdown}</span>} |
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.
We should avoid inline styles. (I know this was in @ggreer's commit.)
{dropdown && <span>{dropdown}</span>} | ||
{dropdown && <span style={{flexGrow: 1}}>{dropdown}</span>} | ||
<button className="btn btn-default" onClick={onDownload}> | ||
<i className="fa fa-download"></i> Download |
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.
aria-hidden="true"
Merge blocking on the branch for this repo is causing our merge infrastructure to crash on this PR:
If you want merge automation we need to allow the bot to merge. |
/hold (so the bot leaves it alone) |
/hold cancel |
Add tests for Add Capacity and Storage System List Page
Description
Log content can be downloaded via a download button on the top right corner of the log window. This downloads the currently displayed content (up to the last 1000 lines of the log).
Changes
co-m-pane__top-controls
totop-controls
and now uses flexbox.top-controls__group
and modifierstop-controls__group--right
, and--left
can now be used as children to distribute control item groups across the top controls element. Items within these groups are aligned as the class name suggests (center by default). This is a wrapper for a group of control items in the top control element.top-controls__item
should be used as a child of a top controls group element and are automatically vertically centered, and spaced 15px apart horizontally. This is a wrapper for each control item in a top controls group element._resource-log.scss
. Top controls style refactoring made these styles unnecessary.Screenshots
320px screen width
@openshift/team-ux-review