hawtio / hawtio-ui

Hawtio UI widgets for hawtio 2.x see http://ui.hawt.io/
Apache License 2.0
7 stars 6 forks source link

zero clipboard directive doesn't seem to work #29

Closed gashcrumb closed 7 years ago

gashcrumb commented 8 years ago

Might be worth tracking down a third-party replacement and alias the existing directive name perhaps?

Might also be worth figuring out if it's a packaging/dependency issue when the site is build, as we need to ensure the .swf file is included in any downstream consumer of the widget.

abkieling commented 8 years ago

I'll work on this one. Github has a "Copy to clipboard" button in the clone repo popover. We could check how they implemented it.

gashcrumb commented 8 years ago

Great! I think we're using the github widget actually, I think we just might not be loading the .swf file properly. The other tricky bit is ensuring that the .swf file will get picked up at the right path by downstream components using hawtio-ui. That being said if there's a better approach that doesn't require the flash it might be worth switching to that...

abkieling commented 8 years ago

I did some research and it looks like the way forward is using native browser support via document.execCommand("copy"). It might be simple to implement it ourselves. Alternatively, we could use clipboardjs. Some references: https://hacks.mozilla.org/2015/09/flash-free-clipboard-for-the-web/ https://developers.google.com/web/updates/2015/04/cut-and-copy-commands

gashcrumb commented 8 years ago

Ah, perfect! I'd be fine either way, if we can keep the directive config/usage working the same as the example there then I think we'd be in great shape...

On Mon, Jul 18, 2016 at 8:49 AM, Alexandre Kieling <notifications@github.com

wrote:

I did some research and it looks like the way forward is using native browser support via document.execCommand("copy"). It might be simple to implement it ourselves. Alternatively, we could use clipboardjs https://clipboardjs.com/. Some references: https://hacks.mozilla.org/2015/09/flash-free-clipboard-for-the-web/ https://developers.google.com/web/updates/2015/04/cut-and-copy-commands

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hawtio/hawtio-ui/issues/29#issuecomment-233318929, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVdrFu8l-uQvao_u22hzWONZMC2vn9iks5qW3ZfgaJpZM4JJcEK .

abkieling commented 8 years ago

Just a quick question: hawtio-ui defines the AngularJS dependency as "angular": ">= 1.1.0 <= 1.6.0". Does it mean features not present in version 1.1.0 cannot be used? It would be nice to use Angular's 1.5.x .component() method.

gashcrumb commented 8 years ago

I've kept it fairly wide up to this point just for compatibility reasons but honestly I see no reason not to move to angularjs 1.5 across all hawtio components, can always go through and fix issues as they come up.

On Mon, Jul 18, 2016 at 9:12 AM, Alexandre Kieling <notifications@github.com

wrote:

Just a quick question: hawtio-ui defines the AngularJS dependency as "angular": ">= 1.1.0 <= 1.6.0". Does it mean features not present in version 1.1.0 cannot be used? It would be nice to use Angular's 1.5.x .component() method.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hawtio/hawtio-ui/issues/29#issuecomment-233323932, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVdrPT4NDn96vzcPakm-DrZm4zl0v2Aks5qW3uqgaJpZM4JJcEK .

abkieling commented 8 years ago

I've just tested it and it's working on http://ui.hawt.io I think it's safer to leave this one alone and create a new component without flash. The current one checks for a useCallback attribute and invokes the callback passing a reference to the ZeroClipboard object. I don't want to break code that depends on that.

abkieling commented 8 years ago

We can replace ZeroClipboard if removing the useCallback attribute won't break any code. This callback is leaking the encapsulation.

abkieling commented 8 years ago

I was waiting for some feedback on this one. Is deprecating this widget and building a new one too much trouble? I didn't want to risk breaking something due to the exposed ZeroClipboard instance via callback.

gashcrumb commented 8 years ago

Sorry for the delay! Yeah, I see it's actually working on the site so that's awesome. I think deprecating this widget is the way to go, we can then eventually move code that's currently using it to whatever we decide to use?

Had a grep through most of the repos, the useCallback seems to be only used in hawtio 1.x code, I don't see it getting used in any current 2.x views.

abkieling commented 8 years ago

The project needs a new component that doesn't depend on Flash. https://chrome.googleblog.com/2016/08/flash-and-chrome.html

abkieling commented 7 years ago

So this component works but depends on Flash. Shall we close this issue and deprecate the component? I think there are existing clipboard components we can use.

gashcrumb commented 7 years ago

+1 we should mark it deprecated on the site and suggest an alternative.

On Fri, Jan 20, 2017 at 9:04 AM, Alexandre Kieling <notifications@github.com

wrote:

So this component works but depends on Flash. Shall we close this issue and deprecate the component? I think there are existing clipboard components we can use.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hawtio/hawtio-ui/issues/29#issuecomment-274079188, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVdrK7MlRaRK2wQZ7adSoQEEQoRnUWFks5rUL7egaJpZM4JJcEK .