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

Add download option to 'Console output', move 'View as plain text' and 'Copy' buttons to app bar #9169

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

janfaracik
Copy link
Contributor

@janfaracik janfaracik commented Apr 14, 2024

Before
image

After
image

Small MR to add a 'Download' link to the console output, as well as to move the controls to the app bar so that they're grouped. Let me know your thoughts on the updated placement - happy to discuss alternatives.

Testing done

  • Copy button works as before
  • View as plain text works as before
  • Download button downloads the full log

Proposed changelog entries

  • Add download option to 'Console output', move 'View as plain text' and 'Copy' buttons to app bar

Proposed upgrade guidelines

N/A

Submitter checklist

Edit tasklist title
Beta Give feedback Tasklist Submitter checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. The Jira issue, if it exists, is well-described.
    Options
  2. The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
    Options
  3. There is automated testing or an explanation as to why this change has no tests.
    Options
  4. New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
    Options
  5. New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
    Options
  6. New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
    Options
  7. For dependency updates, there are links to external changelogs and, if possible, full differentials.
    Options
  8. For new APIs and extension points, there is a link to at least one consumer.
    Options

Desired reviewers

@jenkinsci/sig-ux

Before the changes are marked as ready-for-merge:

Maintainer checklist

Edit tasklist title
Beta Give feedback Tasklist Maintainer checklist, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. There are at least two (2) approvals for the pull request and no outstanding requests for change.
    Options
  2. Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
    Options
  3. Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
    Options
  4. Proper changelog labels are set so that the changelog can be generated automatically.
    Options
  5. If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
    Options
  6. If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).
    Options

@timja timja added rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted web-ui The PR includes WebUI changes which may need special expertise labels Apr 14, 2024
Copy link
Contributor

@mawinter69 mawinter69 left a comment

Choose a reason for hiding this comment

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

Is the copy option really the best thing as being the one that is directly accessible?
So far I never had really the need to copy the logs. But looking at the log in plain text I do from time to time

<l:copyButton ref="out" label="${%Copy}" />
<l:overflowButton>
<dd:custom>
<a class="jenkins-dropdown__item" href="consoleText" download="${it.displayName}.txt">
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really useful to use the displayname here? If I choose a displayname that contains a / this wouldn't be saveable.
something like
${it.parent.name}-{it.number}.txt would guarantee a valid filename

Copy link
Member

Choose a reason for hiding this comment

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

If I choose a displayname that contains a / this wouldn't be saveable.

Per https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-download

The attribute may have a value; the value, if any, specifies the default filename that the author recommends for use in labeling the resource in a local file system. There are no restrictions on allowed values, but authors are cautioned that most file systems have limitations with regard to what punctuation is supported in filenames, and user agents are likely to adjust filenames accordingly.

Trying this PR and DOM editing in Firefox, I get the file foo_bar_#1.txt from the attribute value foo/bar/#1.txt.

(parent.fullName might still be better though. Unsure whether we should go for display names, there's arguments for and against IMO)

@mawinter69
Copy link
Contributor

mawinter69 commented Apr 14, 2024

Is the copy option really the best thing as being the one that is directly accessible? So far I never had really the need to copy the logs. But looking at the log in plain text I do from time to time

probably OK to have it like proposed.

@uhafner
Copy link
Member

uhafner commented Apr 17, 2024

It took me a while to understand that the result is visible in freestyle jobs only. Isn't the PR that unifies the console in pipelines and freestyle jobs already merged?

I think it is a good idea to move the actions to the app bar. I'm not sure why the copy action is a button (I never use this action, does it copy the whole log or the visible section?), but I very often use the "raw console" link. Maybe we can show the latter as button as well (or only this one). The app bar has a lot of space that is not used yet. Do we have anonymous user statistics about such preferences?

@mawinter69
Copy link
Contributor

but I very often use the "raw console" link

same for me

@daniel-beck
Copy link
Member

I'm not sure why the copy action is a button (I never use this action, does it copy the whole log or the visible section?)

My guess is because it's a recently added action (#8960) that has been previously implemented like this? Copying seems like the least needed use case, and between view raw, and download raw, even seems redundant. (And it only copies the visible section, via JS.)

@janfaracik
Copy link
Contributor Author

I'm not sure why the copy action is a button (I never use this action, does it copy the whole log or the visible section?)

My guess is because it's a recently added action (#8960) that has been previously implemented like this? Copying seems like the least needed use case, and between view raw, and download raw, even seems redundant. (And it only copies the visible section, via JS.)

Essentially that - I didn't want to undo the existing work, happy to prioritise the order of download/complete log however as I agree.

@janfaracik
Copy link
Contributor Author

Updated it so that there's no longer an overflow menu - all actions are top level now.

image

@yaroslavafenkin yaroslavafenkin added the security-approved @jenkinsci/core-security-review reviewed this PR for security issues label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted security-approved @jenkinsci/core-security-review reviewed this PR for security issues web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
6 participants