Enhance copy-to-clipboard, for logviewer/raw log urls on current job

VERIFIED FIXED

Status

Tree Management
Treeherder
P4
enhancement
VERIFIED FIXED
3 years ago
3 years ago

People

(Reporter: jfrench, Assigned: jfrench)

Tracking

Details

(URL)

Attachments

(2 attachments)

(Assignee)

Description

3 years ago
Based on convo with Ryan yesterday, one repeated sheriff task is to provide a failed job log url to repo owners in various channels. His workflow to get that link, is to use the RMB-context menu on the job navbar log icon. The content of that context menu and its 'Copy link location' entry in it varies depending on whether the icon requested by/for sheriffs is font-awesome, or svg/img.

After spending more time thinking about the user problem, I think sheriffs shouldn't need to navigate into that RMB-context menu at all for this task.

Instead I pose when a job is selected, we provide a shortcut which copies the relevant link to the user's copy buffer. It seems we could do this given we:

o know there is always just one job selected
o have the link fragments
o already construct the full path for a manual click
o already know if the log is unavailable (and could issue a warning)

Proposed workflow:

o user clicks on a job
o user issues a shortcut (eg. ctrl+[something..])
o the logviewer link is copied to their buffer
o [optional] - 1sec css pulse of the icon to confirm the copy happened
o user pastes it in channel

I pose the same be done for the raw log.
(Assignee)

Comment 1

3 years ago
Well, it was a noble idea, but after digging around, the only browser that offers easy access to the clipboard is IE. And there is no proper, safe, cross-browser support for unidirectional or bidirectional clipboard modification, since browsers are inherently sandboxed and the system clipboard is restricted.

It seems to me the best approach to solve the user-problem will be for folks to solicit the font-awesome people for an equivalent 'log' icon in fa, which matches the one requested/approved by the team last month.

Marking this bug won't fix for now, on that basis.

If anyone knows any differently wrt. system clipboard access, feel free to chime in.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
So, the logviewer link can be scraped together from the properties present on the job-btn element (the value of the data-jmkey property plus the current repo name is sufficient). A Firefox or Chrome extension could easily add a "copy logviewer link to context menu" item only on the job-btn elements and then hook into browser features to scrape together and add the link to the clipboard when clicked.

Getting the raw log link is harder (though middle-clicking the job-btn element opens up the raw log in a new tab, unsure where that gets handled). Could enough details be added to the job-btn element's properties so an addon could scrape together the raw log link for that job?
Flags: needinfo?(tojonmz)
(Assignee)

Comment 3

3 years ago
Not sure but I imagine you could inject whatever content to the job element you wished, assuming it didn't negatively impact load performance of the result sets.

The problem in meeting the goal of the bug, lies in being able to meet the spec'd workflow - creating a keyboard shortcut which modifies the user's system clipboard. As far as I can tell, it is prohibited in any browser other than IE.

Ryan indicated in channel he can live with the nuisance of a different location of the 'Copy link' log menu (the inspiration for this bug) for now until his muscle memory adjusted.

It was just my hope with this bug enhancement we could make a true leap in UX with a shortcut, rather than requiring more mouse interaction.

nb. I had spent a few hours investigating several extensions, ZeroClipboard, ng-clip, and in addition to requiring flash and being questionable, none appeared to allow a shortcut implementation for the security reasons described.

It also explains why I use IE as little as possible :)

Comment 4

3 years ago
See bug 1030710 for prior discussion about clipboard and flash etc.

I think a browser extension is overkill for this, we either need bug 1012662 (but don't hold your breath hehe) or else we should use the tricks mentioned in bug 1030710 comment 0 (specifically the one used by Trello).
(Assignee)

Updated

3 years ago
Flags: needinfo?(tojonmz)
(Assignee)

Comment 5

3 years ago
I've got a wip directive working locally for the logviewer and rawlog links using that Trello approach. A few things still to sort out.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
(Assignee)

Updated

3 years ago
Assignee: nobody → tojonmz
Status: REOPENED → ASSIGNED
Summary: Create shortcuts for copy-to-buffer, for logviewer/raw log urls on current job → Enhance copy-to-clipboard, for logviewer/raw log urls on current job
(Assignee)

Comment 6

3 years ago
I think I have everything working as expected now for both icons. Will open a PR shortly.
(Assignee)

Comment 7

3 years ago
Created attachment 8551963 [details] [review]
treeherder-ui-PR#343

Please see above PR for status and review.
Attachment #8551963 - Flags: review?(cdawson)

Comment 8

3 years ago
Commits pushed to master at https://github.com/mozilla/treeherder-ui

https://github.com/mozilla/treeherder-ui/commit/4eb9d0e077b7d5778b07e3211c9befc1f033cf49
Bug 1120133 - Enhance copy of logviewer/raw log icon links

https://github.com/mozilla/treeherder-ui/commit/0c4952fa8bd2b6580511bd75664e41ed645fcef0
Merge pull request #343 from tojonmz/hover-copy-directive

Bug 1120133 - Enhance copy of logviewer/raw log icon links

Updated

3 years ago
Attachment #8551963 - Flags: review?(cdawson) → review+
(Assignee)

Comment 9

3 years ago
Marking fixed per above merge. Will verify on push to stage/prod.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago3 years ago
Resolution: --- → FIXED
In production :-)
(Assignee)

Comment 11

3 years ago
Cool, thanks Ed! Verified fixed in production.
Status: RESOLVED → VERIFIED
It's pretty slick! CCing sheriffs so they know it exists :-)
(Assignee)

Comment 13

3 years ago
Thanks! It is indeed groovy. Testing it locally I never tired of the magic :)

For discovery I added it to the Help. We decided against bloating the tooltip with the same info, since it is a power user thing, and because we've exposed it in Help.
FYI, this sticks /ui in the URL, which I understand we're not supposed to use anymore.
(Assignee)

Comment 15

3 years ago
Sure, np I will pull that out with a supplemental PR.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
(Assignee)

Comment 16

3 years ago
Created attachment 8554204 [details] [review]
treeherder-PR-#348-supplemental

Please see above supplemental PR for status and review.
Attachment #8554204 - Flags: review?(cdawson)
Comment on attachment 8554204 [details] [review]
treeherder-PR-#348-supplemental

Thank you :-)
Attachment #8554204 - Flags: review?(cdawson) → review+

Comment 18

3 years ago
Commits pushed to master at https://github.com/mozilla/treeherder-ui

https://github.com/mozilla/treeherder-ui/commit/fb3c4253068b5ca991feaf16870e1ad98424a86b
Bug 1120133 - Remove ui fragment from logviewer hover link

https://github.com/mozilla/treeherder-ui/commit/1b5a2e7f0ac9f17ad2cb12955a520cea089d4ad2
Merge pull request #348 from tojonmz/tweak-log-hover

Bug 1120133 - Remove ui fragment from logviewer hover link
(Assignee)

Comment 19

3 years ago
Thanks Ed! Marking fixed per above merge. I will re-verify on the next push to prod.
Status: REOPENED → RESOLVED
Last Resolved: 3 years ago3 years ago
Resolution: --- → FIXED
(Assignee)

Comment 20

3 years ago
Verified fixed on production.
Status: RESOLVED → VERIFIED

Comment 21

3 years ago
Commits pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/485e6838572082bd5fcf67a7b7db0e2b081774d3
Bug 1120133 - Enhance copy of logviewer/raw log icon links

https://github.com/mozilla/treeherder/commit/2949e5fdf9506e23f14b2e4d88925cbb07ab74bd
Merge pull request #343 from tojonmz/hover-copy-directive

Bug 1120133 - Enhance copy of logviewer/raw log icon links

https://github.com/mozilla/treeherder/commit/86ef28e1d70f6d91581485ff155bff580efb686e
Bug 1120133 - Remove ui fragment from logviewer hover link

https://github.com/mozilla/treeherder/commit/889c94e50994438e95490cc774f41731d370fb4d
Merge pull request #348 from tojonmz/tweak-log-hover

Bug 1120133 - Remove ui fragment from logviewer hover link
You need to log in before you can comment on or make changes to this bug.