From d75bd5117119c247aa7a444505566dd9268bad6d Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 23 Sep 2015 13:24:26 -0700 Subject: [PATCH 1/3] purge kibana of ng-clip and zeroclipboard --- package.json | 4 +- .../devMode/public/visDebugSpyPanel.html | 1 - .../public/dashboard/partials/share.html | 4 +- .../public/visualize/editor/panels/share.html | 2 - .../public/clipboard/__tests__/clipboard.js | 100 ------------------ src/ui/public/clipboard/clipboard.html | 11 -- src/ui/public/clipboard/clipboard.js | 47 -------- tasks/config/licenses.js | 1 - webpackShims/ng-clip.js | 4 - webpackShims/zeroclipboard.js | 9 -- 10 files changed, 2 insertions(+), 181 deletions(-) delete mode 100644 src/ui/public/clipboard/__tests__/clipboard.js delete mode 100644 src/ui/public/clipboard/clipboard.html delete mode 100644 src/ui/public/clipboard/clipboard.js delete mode 100644 webpackShims/ng-clip.js delete mode 100644 webpackShims/zeroclipboard.js diff --git a/package.json b/package.json index 354c78b7d204d5..8a6aadea2d7870 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,6 @@ "minimatch": "2.0.10", "mkdirp": "0.5.1", "moment": "2.10.6", - "ng-clip": "0.2.6", "raw-loader": "0.5.1", "request": "2.61.0", "requirefrom": "0.2.0", @@ -118,8 +117,7 @@ "url-loader": "0.5.6", "webpack": "1.12.1", "webpack-directory-name-as-main": "1.0.0", - "whatwg-fetch": "0.9.0", - "zeroclipboard": "2.2.0" + "whatwg-fetch": "0.9.0" }, "devDependencies": { "angular-mocks": "1.2.28", diff --git a/src/plugins/devMode/public/visDebugSpyPanel.html b/src/plugins/devMode/public/visDebugSpyPanel.html index f53eda75a3a563..0eee9db727bea4 100644 --- a/src/plugins/devMode/public/visDebugSpyPanel.html +++ b/src/plugins/devMode/public/visDebugSpyPanel.html @@ -4,7 +4,6 @@
{{visStateJson}}
diff --git a/src/plugins/kibana/public/dashboard/partials/share.html b/src/plugins/kibana/public/dashboard/partials/share.html index f3982b68fd08de..bf34366604db1d 100644 --- a/src/plugins/kibana/public/dashboard/partials/share.html +++ b/src/plugins/kibana/public/dashboard/partials/share.html @@ -3,8 +3,7 @@

{{opts.shareData().embed}}
@@ -15,7 +14,6 @@
{{opts.shareData().link}}
diff --git a/src/plugins/kibana/public/visualize/editor/panels/share.html b/src/plugins/kibana/public/visualize/editor/panels/share.html index 3e6c37881a748b..a356060024e006 100644 --- a/src/plugins/kibana/public/visualize/editor/panels/share.html +++ b/src/plugins/kibana/public/visualize/editor/panels/share.html @@ -4,7 +4,6 @@
{{conf.shareData().embed}}
@@ -15,7 +14,6 @@
{{conf.shareData().link}}
diff --git a/src/ui/public/clipboard/__tests__/clipboard.js b/src/ui/public/clipboard/__tests__/clipboard.js deleted file mode 100644 index 57e30bf680932d..00000000000000 --- a/src/ui/public/clipboard/__tests__/clipboard.js +++ /dev/null @@ -1,100 +0,0 @@ - -var angular = require('angular'); -var _ = require('lodash'); -var sinon = require('auto-release-sinon'); -var expect = require('expect.js'); -var $ = require('jquery'); -var ngMock = require('ngMock'); - -require('ui/clipboard'); - -describe('Clipboard directive', function () { - var $scope; - var $rootScope; - var $compile; - var $interpolate; - var el; - var tips; - - function init() { - // load the application - ngMock.module('kibana'); - - ngMock.inject(function (_$rootScope_, _$compile_, _$interpolate_) { - $rootScope = _$rootScope_; - $compile = _$compile_; - $interpolate = _$interpolate_; - $rootScope.text = 'foo'; - - el = $compile('')($rootScope); - - $scope = el.scope(); - $scope.$digest(); - }); - } - - describe.skip('With flash disabled', function () { - beforeEach(function () { - sinon.stub(window.ZeroClipboard, 'isFlashUnusable', _.constant(true)); - init(); - }); - - it('should be an empty element', function () { - expect(el.children()).to.have.length(0); - }); - - it('should not show the tooltip', function () { - var clip = el.find('[tooltip]'); - expect(clip).to.have.length(0); - }); - - it('should not show the clipboard button', function () { - var clip = el.find('[clip-copy]'); - expect(clip).to.have.length(0); - }); - }); - - describe.skip('With flash enabled', function () { - beforeEach(function () { - sinon.stub(window.ZeroClipboard, 'isFlashUnusable', _.constant(false)); - init(); - }); - - it('should contain an element with clip-copy', function () { - var clip = el.find('[clip-copy]'); - expect(clip).to.have.length(1); - }); - - it('should have a tooltip', function () { - var clip = el.find('[tooltip]'); - expect(clip).to.have.length(1); - - var clipText = $interpolate($(clip).attr('tooltip'))(); - expect(clipText).to.be('Copy to clipboard'); - - }); - - it('should change the tooltip text when clicked, back when mouse leaves', function () { - el.mouseenter(); - el.click(); - $scope.$digest(); - - var clipText = $interpolate($('[tooltip]', el).attr('tooltip'))(); - expect(clipText).to.be('Copied!'); - - el.mouseleave(); - $scope.$digest(); - - clipText = $interpolate($('[tooltip]', el).attr('tooltip'))(); - expect(clipText).to.be('Copy to clipboard'); - }); - - it('should unbind all handlers on destroy', function () { - var handlers = $._data(el.get(0), 'events'); - expect(Object.keys(handlers)).to.have.length(2); - - $scope.$destroy(); - expect(Object.keys(handlers)).to.have.length(0); - }); - }); -}); diff --git a/src/ui/public/clipboard/clipboard.html b/src/ui/public/clipboard/clipboard.html deleted file mode 100644 index 7753c64e3a2f6c..00000000000000 --- a/src/ui/public/clipboard/clipboard.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/ui/public/clipboard/clipboard.js b/src/ui/public/clipboard/clipboard.js deleted file mode 100644 index da21491eb395f6..00000000000000 --- a/src/ui/public/clipboard/clipboard.js +++ /dev/null @@ -1,47 +0,0 @@ -define(function (require) { - var ZeroClipboard = require('ng-clip'); - var $ = require('jquery'); - var html = require('ui/clipboard/clipboard.html'); - - require('ui/modules') - .get('kibana') - .directive('kbnClipboard', function ($compile, $timeout) { - return { - restrict: 'E', - template: html, - replace: true, - scope: { - copyText: '=copy' - }, - transclude: true, - link: function ($scope, $el, attr) { - if (ZeroClipboard.isFlashUnusable()) { - $scope.disabled = true; - return; - } - - $scope.tipPlacement = attr.tipPlacement || 'top'; - $scope.tipText = attr.tipText || 'Copy to clipboard'; - $scope.tipConfirm = attr.tipConfirm = 'Copied!'; - $scope.icon = attr.icon || 'fa-clipboard'; - - $scope.shownText = $scope.tipText; - - $el.on('click', function () { - $scope.shownText = $scope.tipConfirm; - // Reposition tooltip to account for text length change - $('a', $el).mouseenter(); - }); - - $el.on('mouseleave', function () { - $scope.shownText = $scope.tipText; - }); - - $scope.$on('$destroy', function () { - $el.off('click'); - $el.off('mouseleave'); - }); - } - }; - }); -}); diff --git a/tasks/config/licenses.js b/tasks/config/licenses.js index c7000bf3306f3d..f7800c7f2e55e8 100644 --- a/tasks/config/licenses.js +++ b/tasks/config/licenses.js @@ -48,7 +48,6 @@ module.exports = function (grunt) { 'Nonsense@0.1.2': ['Public-Domain'], 'pkginfo@0.2.3': ['MIT'], 'uglify-js@2.2.5': ['BSD'], - 'zeroclipboard@2.2.0': ['MIT'], } } }; diff --git a/webpackShims/ng-clip.js b/webpackShims/ng-clip.js deleted file mode 100644 index decc9d76076096..00000000000000 --- a/webpackShims/ng-clip.js +++ /dev/null @@ -1,4 +0,0 @@ -require('angular'); -require('zeroclipboard'); -require('node_modules/ng-clip/src/ngClip'); -require('ui/modules').get('kibana', ['ngClipboard']); diff --git a/webpackShims/zeroclipboard.js b/webpackShims/zeroclipboard.js deleted file mode 100644 index 7a70edebc87f48..00000000000000 --- a/webpackShims/zeroclipboard.js +++ /dev/null @@ -1,9 +0,0 @@ -// ng-clip expects ZeroClipboard to be global, but it's UMD, so it never is -window.ZeroClipboard = require('node_modules/zeroclipboard/dist/ZeroClipboard.js'); -window.ZeroClipboard.SWF_URL = require('file!node_modules/zeroclipboard/dist/ZeroClipboard.swf'); - -window.ZeroClipboard.config({ - swfPath: window.ZeroClipboard.SWF_URL, -}); - -module.exports = window.ZeroClipboard; From 06aca423b88fba8233a2aefd49589d43fc5dc0ac Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 23 Sep 2015 13:37:38 -0700 Subject: [PATCH 2/3] but, like, for real this time --- src/plugins/devMode/public/visDebugSpyPanel.js | 2 -- src/plugins/kibana/public/dashboard/index.js | 1 - src/plugins/kibana/public/visualize/editor/editor.js | 1 - 3 files changed, 4 deletions(-) diff --git a/src/plugins/devMode/public/visDebugSpyPanel.js b/src/plugins/devMode/public/visDebugSpyPanel.js index 294e897adda830..5c3336f2b0891d 100644 --- a/src/plugins/devMode/public/visDebugSpyPanel.js +++ b/src/plugins/devMode/public/visDebugSpyPanel.js @@ -3,8 +3,6 @@ define(function (require) { require('ui/registry/spy_modes').register(VisDetailsSpyProvider); function VisDetailsSpyProvider(Notifier, $filter, $rootScope, config) { - require('ui/clipboard'); - return { name: 'debug', display: 'Debug', diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index 0921c640f1abe8..4c47233bca1f72 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -10,7 +10,6 @@ define(function (require) { require('ui/config'); require('ui/notify'); require('ui/typeahead'); - require('ui/clipboard'); require('plugins/kibana/dashboard/directives/grid'); require('plugins/kibana/dashboard/components/panel/panel'); diff --git a/src/plugins/kibana/public/visualize/editor/editor.js b/src/plugins/kibana/public/visualize/editor/editor.js index b48616998cc495..38d0c42da79319 100644 --- a/src/plugins/kibana/public/visualize/editor/editor.js +++ b/src/plugins/kibana/public/visualize/editor/editor.js @@ -5,7 +5,6 @@ define(function (require) { require('plugins/kibana/visualize/editor/agg_filter'); require('ui/visualize'); - require('ui/clipboard'); require('ui/collapsible_sidebar'); require('ui/routes') From a22719db60c55f84a102aa071c16a71b41717092 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 23 Sep 2015 13:40:26 -0700 Subject: [PATCH 3/3] update docs --- docs/dashboard.asciidoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/dashboard.asciidoc b/docs/dashboard.asciidoc index be22e1a626f5db..8fb9525d31830c 100644 --- a/docs/dashboard.asciidoc +++ b/docs/dashboard.asciidoc @@ -72,8 +72,7 @@ in your Web page. NOTE: A user must have Kibana access in order to view embedded dashboards. Click the *Share* button to display HTML code to embed the dashboard in another Web page, along with a direct link to -the dashboard. Click the copy button image:images/Clipboard.png[Copy to Clipboard button] next to either option to copy -the code or the link to your clipboard. +the dashboard. You can select the text in either option to copy the code or the link to your clipboard. [float] [[embedding-dashboards]]