Bug 1154556 - [RFE][UX] provide 'copy to clipboard' infrastructure
Summary: [RFE][UX] provide 'copy to clipboard' infrastructure
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Frontend.WebAdmin
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Sharon Gratch
QA Contact: Pavel Novotny
URL:
Whiteboard:
Depends On: 1520965
Blocks: 1147688 1194749
TreeView+ depends on / blocked
 
Reported: 2014-10-20 07:31 UTC by Yaniv Bronhaim
Modified: 2020-06-26 16:16 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-02-18 13:31:03 UTC
oVirt Team: UX
Embargoed:
rule-engine: planning_ack?
rule-engine: devel_ack?
lsvaty: testing_ack+


Attachments (Terms of Use)
context copy (27.77 KB, image/png)
2015-04-12 15:32 UTC, Greg Sheremeta
no flags Details
google docs custom context 1 (31.61 KB, image/png)
2015-04-12 15:32 UTC, Greg Sheremeta
no flags Details
google docs custom context 2 (26.07 KB, image/png)
2015-04-12 15:33 UTC, Greg Sheremeta
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1194749 0 unspecified CLOSED [RFE] add "copy to clipboard" option to right-click menu in grids 2021-02-22 00:41:40 UTC
oVirt gerrit 95172 0 'None' ABANDONED added copy button to event log, and actual copy to clipboard method 2020-06-26 16:14:13 UTC

Internal Links: 1194749

Description Yaniv Bronhaim 2014-10-20 07:31:18 UTC
Due to the request in Bug 1147688 we require new GWT infrastructure for 'copy to clipboard' button (such as [1]) near the use of "SSH Public Key" on Add New Host form.

[1] http://davidwalsh.name/demo/zero-clipboard.php

Comment 1 Tal Nisan 2014-10-21 10:55:46 UTC
I suggest using https://github.com/mojombo/clippy, this is what Gerrit uses also, note that browsers given the sandbox will not give you access to the system clipboard, all addons that allow copy to clipboard are using flash (if available)

Comment 4 Greg Sheremeta 2015-04-07 17:04:07 UTC
It's very easy to add, especially if it's on one form.

http://zeroclipboard.org/#demo is the right solution -- Flash is required to reliably access the clipboard. This is what GitHub uses. (Clippy that Tal linked to hasn't been maintained since 2009.)

There are HTML5 api's for clipboard access, but I don't think anyone implements them (yet).

Flash doesn't have to be "required" -- only needed if you want to use the copy button :) Chrome comes with "Flash" bundled now, so only an issue for other browsers.

Comment 6 Einav Cohen 2015-04-07 18:53:07 UTC
(In reply to Greg Sheremeta from comment #4)
> ...
> There are HTML5 api's for clipboard access, but I don't think anyone
> implements them (yet).

according to [1], it seems that Firefox fully supports this, IE too (using a non-standard method of interacting with the clipboard though [2]) and Chrome too, except the ClipboardEvent constructor (which I don't think that we need; to my understanding, in order to implement e.g. a 'copy' button, we need the clipboard methods, not clipboard events; please correct me if I am wrong). 

assuming we don't want to use flash for clipboard implementation, and based on the above: do you guys think that we can implement this by utilizing the HTML5 clipboard api after all?

[1] http://caniuse.com/#feat=clipboard

[2] https://msdn.microsoft.com/en-us/library/ie/ms535220(v=vs.85).aspx

Comment 7 Greg Sheremeta 2015-04-09 00:30:45 UTC
I researched this quite a bit.

> according to [1], it seems that Firefox fully supports this, IE too (using a non-standard method of interacting with the clipboard though [2]) and Chrome too

The spec is at [2].

In [2], the only method given for accessing the clipboard is document.execCommand('copy') and document.execCommand('paste').

I've tried to get these to work in Chrome 41 and Firefox 36, but no luck. Google results suggest that this will only work in Chrome in a Chrome extension. So I believe [1] is wrong. Since I cannot get it to work, and since it's experimental and not documented at all, I don't think it's viable.

Google Docs automatically copies share URLs to the clipboard for me in Chrome. I debugged that, and turns out that is implemented via a Chrome extension for Google Docs. It doesn't auto copy in Firefox.

I think we're stuck using Flash if we want to do this. I'm not against using Flash -- either requiring it or suggesting it. It's had 99% market penetration since at least 2011. The only concern I have regarding security is that Adobe stopped developing Flash for Linux years ago. So everyone using Firefox on Linux has a really old Flash installed (although, Adobe supplies critical security fixes for it, but that won't last forever). All versions of Chrome come with the latest Flash bundled, even on Linux, so this is only an issue with Firefox on Linux. (On Fedora 20, my Chrome 41 has Flash 16, and my Firefox 36 has 11.2.)

There is an alternative open source Flash player for Firefox called Shumway. [3] We could probably get ZeroClipboard working with that. I tried it on Firefox 36, and ZeroClipboard doesn't work with it out of the box -- but I think we could get it working. A downside of using it is that it's marked as experimental.

[1] http://caniuse.com/#feat=clipboard
[2] http://www.w3.org/TR/clipboard-apis
[3] http://mozilla.github.io/shumway/

Comment 8 Einav Cohen 2015-04-09 11:35:29 UTC
Thank you for the detailed information, Greg - very educational, and much appreciated. 

@Yaniv, it looks like we have a real issue introducing a clipboard-copy functionality, at least for Firefox on Linux, without using something experimental that doesn't necessarily work (HTML5, Shumway), or using something very old that we cannot necessarily reliably count on for the long term (Flash). 

Based on the information here, my recommendation is to not implement a 'copy' capability in the GUI; instead - it seems like we should rely on "Ctrl+C" and/or native browser context menu, where possible/needed. 

If you agree - this BZ should be closed. 
Otherwise - please let us know your thoughts on a recommended approach for implementation. 

Thanks.

Comment 9 Yaniv Lavi 2015-04-12 14:47:16 UTC
(In reply to Einav Cohen from comment #8)
> Thank you for the detailed information, Greg - very educational, and much
> appreciated. 
> 
> @Yaniv, it looks like we have a real issue introducing a clipboard-copy
> functionality, at least for Firefox on Linux, without using something
> experimental that doesn't necessarily work (HTML5, Shumway), or using
> something very old that we cannot necessarily reliably count on for the long
> term (Flash). 
> 
> Based on the information here, my recommendation is to not implement a
> 'copy' capability in the GUI; instead - it seems like we should rely on
> "Ctrl+C" and/or native browser context menu, where possible/needed. 
> 
> If you agree - this BZ should be closed. 
> Otherwise - please let us know your thoughts on a recommended approach for
> implementation. 
> 
> Thanks.

Can we expose the browser 'copy'\'paste' command in our right click menus?
Because to my understanding our right click menus currently do not show this option.

Comment 10 Greg Sheremeta 2015-04-12 15:32:07 UTC
Created attachment 1013666 [details]
context copy

Comment 11 Greg Sheremeta 2015-04-12 15:32:43 UTC
Created attachment 1013667 [details]
google docs custom context 1

Comment 12 Greg Sheremeta 2015-04-12 15:33:01 UTC
Created attachment 1013668 [details]
google docs custom context 2

Comment 13 Greg Sheremeta 2015-04-12 15:34:23 UTC
> Can we expose the browser 'copy'\'paste' command in our right click menus?

Where we don't have a custom context menu, 'copy' is already there. See attached screenshot named 'context copy'.

Where we've implemented a custom context menu, yes, but only if you want to do one of the (poor) options in comment 7. Einav recommends *not* to in comment 8.

Note that Google Docs offers the options in its custom context menu, but then tells you to manually hit Ctrl-C and Ctrl-V when you click them. (Screenshots attached, 'google docs custom context 1' and 'google docs custom context 2')

Comment 14 Einav Cohen 2015-04-13 23:10:40 UTC
Thanks, Greg - you're absolutely correct. 

One additional note: see bug 1194749, comment #2, in which I mention that UXD/PatternFly is going towards not using custom context menus (like the ones that we have now), which should allow us to utilize the browser context menu more easily throughout the GUI, once we will adopt PatternFly more comprehensively.

Comment 15 Yaniv Lavi 2015-04-14 07:47:03 UTC
(In reply to Einav Cohen from comment #14)
> Thanks, Greg - you're absolutely correct. 
> 
> One additional note: see bug 1194749, comment #2, in which I mention that
> UXD/PatternFly is going towards not using custom context menus (like the
> ones that we have now), which should allow us to utilize the browser context
> menu more easily throughout the GUI, once we will adopt PatternFly more
> comprehensively.

So in 4.0 we will not have custom menus and therefore have the native broswer copy\paste?

Comment 16 Einav Cohen 2015-04-14 11:35:29 UTC
once the grids in the GUI will adopt PatternFly, we expect to lose our custom context menus, therefore have the native browser context menu (that should contain copy/paste) instead, yes. 
[we will try to do it for 4.0, may end up being in 4.x - not sure]

Comment 17 Greg Sheremeta 2017-11-30 22:07:27 UTC
(In reply to Einav Cohen from comment #16)
> once the grids in the GUI will adopt PatternFly, we expect to lose our
> custom context menus, therefore have the native browser context menu (that
> should contain copy/paste) instead, yes. 
> [we will try to do it for 4.0, may end up being in 4.x - not sure]

The context menus live on, but browsers now support copy/paste.
https://clipboardjs.com/
This should not be too difficult.

Comment 18 Sandro Bonazzola 2019-01-28 09:40:54 UTC
This bug has not been marked as blocker for oVirt 4.3.0.
Since we are releasing it tomorrow, January 29th, this bug has been re-targeted to 4.3.1.

Comment 20 Michal Skrivanek 2020-02-18 13:31:03 UTC
after pf3 conversion things are easy to copy, not needed anymore


Note You need to log in before you can comment on or make changes to this bug.