mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
purge kibana of ng-clip and zeroclipboard
This commit is contained in:
parent
442536d034
commit
d75bd51171
10 changed files with 2 additions and 181 deletions
|
@ -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",
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<div class="form-group">
|
||||
<label>
|
||||
Vis State
|
||||
<kbn-clipboard copy="visStateJson"></kbn-clipboard>
|
||||
</label>
|
||||
<pre>{{visStateJson}}</pre>
|
||||
</div>
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
<p>
|
||||
<div class="input-group">
|
||||
<label>
|
||||
Embed this dashboard.
|
||||
<kbn-clipboard copy="opts.shareData().embed"></kbn-clipboard>
|
||||
Embed this dashboard
|
||||
<small>Add to your html source. Note all clients must still be able to access kibana</small>
|
||||
</label>
|
||||
<div class="form-control" disabled>{{opts.shareData().embed}}</div>
|
||||
|
@ -15,7 +14,6 @@
|
|||
<div class="input-group">
|
||||
<label>
|
||||
Share a link
|
||||
<kbn-clipboard copy="opts.shareData().link"></kbn-clipboard>
|
||||
</label>
|
||||
<div class="form-control" disabled>{{opts.shareData().link}}</div>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<div class="form-group">
|
||||
<label>
|
||||
Embed this visualization.
|
||||
<kbn-clipboard copy="conf.shareData().embed"></kbn-clipboard>
|
||||
<small>Add to your html source. Note all clients must still be able to access kibana</small>
|
||||
</label>
|
||||
<div class="form-control" disabled>{{conf.shareData().embed}}</div>
|
||||
|
@ -15,7 +14,6 @@
|
|||
<div class="form-group">
|
||||
<label>
|
||||
Share a link
|
||||
<kbn-clipboard copy="conf.shareData().link"></kbn-clipboard>
|
||||
</label>
|
||||
<div class="form-control" disabled>{{conf.shareData().link}}</div>
|
||||
</div>
|
||||
|
|
|
@ -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('<kbn-clipboard copy="text"></kbn-clipboard>')($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);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
<span>
|
||||
<a
|
||||
ng-if="!disabled"
|
||||
tooltip="{{shownText}}"
|
||||
tooltip-placement="{{tipPlacement}}"
|
||||
tooltip-animation="false"
|
||||
tooltip-popup-delay="0"
|
||||
tooltip-append-to-body="true">
|
||||
<i class="fa" ng-class="icon" clip-copy="copyText"></i>
|
||||
</a>
|
||||
</span>
|
|
@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
|
@ -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'],
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
require('angular');
|
||||
require('zeroclipboard');
|
||||
require('node_modules/ng-clip/src/ngClip');
|
||||
require('ui/modules').get('kibana', ['ngClipboard']);
|
|
@ -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;
|
Loading…
Add table
Add a link
Reference in a new issue