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

Implement download button feature for logs #77

Merged
merged 1 commit into from Jun 4, 2018

Conversation

TheRealJon
Copy link
Member

@TheRealJon TheRealJon commented May 29, 2018

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

  • Refactored co-m-pane__top-controls to top-controls and now uses flexbox.
    • top-controls__group and modifiers top-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.
  • Implemented download functionality in the ResourceLog component
  • Removed obsolete _resource-log.scss. Top controls style refactoring made these styles unnecessary.
  • Update PodExec component to use new top controls styles (only other place where top controls was used).

Screenshots

screenshot-localhost-9000-2018 05 29-12-59-18

320px screen width
screenshot-localhost-9000-2018 05 30-12-15-44

@openshift/team-ux-review

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 29, 2018
@robszumski
Copy link
Contributor

Can we title this button in verb + noun format?

Download logs, Download history, or similar? Thoughts @openshift/team-ux-review?

@TheRealJon
Copy link
Member Author

@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.

@spadgett
Copy link
Member

@TheRealJon Is any reflow needed at mobile?

@rhamilto PTAL

@TheRealJon
Copy link
Member Author

@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">
Copy link
Member

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

Copy link
Member Author

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.

@rhamilto
Copy link
Member

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.

@serenamarie125
Copy link
Contributor

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.

}
}

.co-m-pane__top-controls__group--center {
Copy link
Member

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.

@ggreer
Copy link
Contributor

ggreer commented May 29, 2018

It really feels like this should be two pull requests: One to add the download button, and one to refactor layout/styling.

@TheRealJon
Copy link
Member Author

@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 co-m-pane__top-controls class isn't used in a lot of places, updating these styles didn't have many side effects.

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 30, 2018
@TheRealJon
Copy link
Member Author

@rhamilto I changed the co-m-pane__top-controls class to just top-controls and adjusted the child classes as well. The controls also reflow at mobile widths so that the controls on the left stack. Posted an updated screen shot at 320px width.

@rhamilto
Copy link
Member

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?

justify-content: flex-end;
}

.top-controls__item {
Copy link
Member

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.

@TheRealJon
Copy link
Member Author

TheRealJon commented May 30, 2018

Just updated the styles/structure of the top controls for the ResourceLog component. The message next to the TogglePlay button will not wrap @ mobile anymore. Also flattened the scss classes in _common.scss.

screenshot-localhost-9000-2018 05 30-12-15-44

@rhamilto @spadgett @beanh66

@beanh66
Copy link
Member

beanh66 commented May 30, 2018

Sweet, thanks @TheRealJon LGTM!

@@ -6,6 +6,10 @@
width: 32px;
padding: 0;

&--space-r {
Copy link
Member

@rhamilto rhamilto May 30, 2018

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.

Copy link
Member Author

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.

ggreer
ggreer previously requested changes May 30, 2018
Copy link
Contributor

@ggreer ggreer left a 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.

@spadgett
Copy link
Member

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?

@ggreer
Copy link
Contributor

ggreer commented May 31, 2018

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.

@ggreer
Copy link
Contributor

ggreer commented May 31, 2018

jenkins rebuild

@spadgett
Copy link
Member

@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.

@spadgett
Copy link
Member

pull-right doesn't work well because the vertical alignment is off, which flexbox fixes

Copy link
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

LGTM pending squash.

@ggreer
Copy link
Contributor

ggreer commented May 31, 2018

Here's a commit that gives the same behavior: fbb65d2

I pushed an image built with this commit (quay.io/coreos/tectonic-console:fbb65d276d4f24a9939a488505d9df7057121eda) and deployed it to teamui

@spadgett
Copy link
Member

spadgett commented Jun 1, 2018

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.

rook-operator-84f45dc8b4-fnw6r details tectonic 2018-06-01 12-22-29

rook-operator-84f45dc8b4-fnw6r details tectonic 2018-06-01 12-23-21

Also the "Log streaming..." text isn't vertically centered:

rook-operator-84f45dc8b4-fnw6r details tectonic 2018-06-01 12-25-46

@tlwu2013
Copy link
Contributor

tlwu2013 commented Jun 1, 2018

(Being late to the thread...)

I am wondering if it's better to have that "Download" btn being styled as a btn-link (with download icon)?
See OpenShift App Console, there is another feature for "expand to full screen". I worry if we add another button there will simply become visually too heavy.

See in OpenShift App console:
os_console_log_download_btn-link

In Tectonic Console (and our previous GUI installer), there are also a few use cases for using btn-link. See:
0. Tectonic GUI Installer:
tectonic-gui-installer

  1. YAML sample sidebar:
    tectonic_console_download_yaml_btn-link

  2. YAML sidebar expand/collapse control:
    tectonic_console_view_sample_btn-link

  3. Reveal data btn link Security details (introduced just recently):
    tectonic_console_reveal-value_btn-link

@ggreer
Copy link
Contributor

ggreer commented Jun 2, 2018

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.

@beanh66
Copy link
Member

beanh66 commented Jun 4, 2018

I am wondering if it's better to have that "Download" btn being styled as a btn-link (with download icon)?

@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?

@spadgett
Copy link
Member

spadgett commented Jun 4, 2018

@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.

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 4, 2018
@TheRealJon
Copy link
Member Author

@spadgett @ggreer Switched over to the simplified styles @ggreer suggested.

@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 4, 2018
Copy link
Member

@spadgett spadgett left a 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>}
Copy link
Member

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>&nbsp;Download
Copy link
Member

Choose a reason for hiding this comment

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

aria-hidden="true"

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2018
@stevekuznetsov
Copy link

Merge blocking on the branch for this repo is causing our merge infrastructure to crash on this PR:

{"base-sha":"6805cee966d08b09a8ceee795016b060a6ec6351","branch":"master","component":"tide","controller":"sync","error":"1 review requesting changes and 2 approving reviews by reviewers with write access.","level":"error","msg":"Merge failed: PR is unmergable. How did it pass tests?!","org":"openshift","pr":77,"repo":"console","sha":"2fbd13414a8703c0590be130c8909c1620c14a6b","time":"2018-06-04T16:29:59Z"}

If you want merge automation we need to allow the bot to merge.

@stevekuznetsov
Copy link

/hold

(so the bot leaves it alone)

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2018
@ggreer ggreer dismissed their stale review June 4, 2018 17:13

changes made

@spadgett
Copy link
Member

spadgett commented Jun 4, 2018

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 4, 2018
@openshift-merge-robot openshift-merge-robot merged commit 90f809b into openshift:master Jun 4, 2018
@TheRealJon TheRealJon deleted the download-logs branch March 12, 2019 13:17
christianvogt pushed a commit to christianvogt/console that referenced this pull request May 6, 2019
christianvogt pushed a commit to christianvogt/console that referenced this pull request May 7, 2019
TimothyAsirJeyasing pushed a commit to TimothyAsirJeyasing/console that referenced this pull request Aug 3, 2022
Add tests for Add Capacity and Storage System List Page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet