-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into embedded-vis
Conflicts: src/kibana/plugins/visualize/editor/editor.html
- Loading branch information
Showing
49 changed files
with
1,040 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
define(function (require) { | ||
require('components/highlight/highlight_tags'); | ||
|
||
var _ = require('lodash'); | ||
var angular = require('angular'); | ||
var module = require('modules').get('kibana'); | ||
|
||
module.filter('highlight', function (highlightTags) { | ||
return function (formatted, highlight) { | ||
if (typeof formatted === 'object') formatted = angular.toJson(formatted); | ||
|
||
formatted = _.escape(formatted); | ||
|
||
_.each(highlight, function (section) { | ||
section = _.escape(section); | ||
|
||
// Strip out the highlight tags to compare against the formatted string | ||
var untagged = section | ||
.split(highlightTags.pre).join('') | ||
.split(highlightTags.post).join(''); | ||
|
||
// Replace all highlight tags with proper html tags | ||
var tagged = section | ||
.split(highlightTags.pre).join('<mark>') | ||
.split(highlightTags.post).join('</mark>'); | ||
|
||
// Replace all instances of the untagged string with the properly tagged string | ||
formatted = formatted.split(untagged).join(tagged); | ||
}); | ||
|
||
return formatted; | ||
}; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
define(function (require) { | ||
var module = require('modules').get('kibana'); | ||
|
||
// By default, ElasticSearch surrounds matched values in <em></em>. This is not ideal because it is possible that | ||
// the value could contain <em></em> in the value. We define these custom tags that we would never expect to see | ||
// inside a field value. | ||
module.constant('highlightTags', { | ||
pre: '@kibana-highlighted-field@', | ||
post: '@/kibana-highlighted-field@' | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
define(function (require) { | ||
return function MapFieldFn(Private, config) { | ||
var _ = require('lodash'); | ||
var castMappingType = Private(require('components/index_patterns/_cast_mapping_type')); | ||
|
||
/** | ||
* Accepts a field object and its name, and tries to give it a mapping | ||
* @param {Object} field - the field mapping returned by elasticsearch | ||
* @param {String} type - name of the field | ||
* @return {Object} - the resulting field after overrides and tweaking | ||
*/ | ||
return function mapField(field, name) { | ||
var keys = Object.keys(field.mapping); | ||
if (keys.length === 0 || (name[0] === '_') && !_.contains(config.get('metaFields'), name)) return; | ||
|
||
var mapping = _.cloneDeep(field.mapping[keys.shift()]); | ||
mapping.type = castMappingType(mapping.type); | ||
|
||
// Override the mapping, even if elasticsearch says otherwise | ||
var mappingOverrides = { | ||
_id: { | ||
indexed: true | ||
}, | ||
_timestamp: { | ||
indexed: true, | ||
type: 'date' | ||
} | ||
}; | ||
|
||
if (!mapping.index || mapping.index === 'no') { | ||
// elasticsearch responds with false sometimes and 'no' others | ||
mapping.indexed = false; | ||
} else { | ||
mapping.indexed = true; | ||
} | ||
|
||
mapping.analyzed = mapping.index === 'analyzed' ? true : false; | ||
|
||
if (mappingOverrides[name]) { | ||
_.merge(mapping, mappingOverrides[name]); | ||
} | ||
|
||
return mapping; | ||
}; | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
define(function (require) { | ||
var _ = require('lodash'); | ||
|
||
require('modules').get('kibana') | ||
.run(function ($rootScope) { | ||
|
||
/** | ||
* Helper that registers an event listener, and removes that listener when | ||
* the $scope is destroyed. | ||
* | ||
* @param {EventEmitter} emitter - the event emitter to listen to | ||
* @param {string} eventName - the event name | ||
* @param {Function} handler - the event handler | ||
* @return {undefined} | ||
*/ | ||
$rootScope.constructor.prototype.$listen = function (emitter, eventName, handler) { | ||
emitter.on(eventName, handler); | ||
this.$on('$destroy', function () { | ||
emitter.off(eventName, handler); | ||
}); | ||
}; | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.truncate-by-height { | ||
max-height: <%= truncateMaxHeight %>; | ||
} | ||
.truncate-by-height::before { | ||
top: <%= truncateGradientTop %>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
define(function (require) { | ||
var _ = require('lodash'); | ||
var $ = require('jquery'); | ||
var $style = $('<style>').appendTo('head').attr('id', 'style-compile'); | ||
|
||
require('modules') | ||
.get('kibana') | ||
.run(function ($rootScope, $compile, config) { | ||
var truncateGradientHeight = 15; | ||
var template = _.template(require('text!components/style_compile/style_compile.css.tmpl')); | ||
var locals = {}; | ||
|
||
$rootScope.$on('$destroy', function () { | ||
$style.remove(); | ||
}); | ||
|
||
// watch the value of the truncate:maxHeight config param | ||
$rootScope.$watch(function () { | ||
return config.get('truncate:maxHeight'); | ||
}, function (maxHeight) { | ||
if (maxHeight > 0) { | ||
locals.truncateMaxHeight = maxHeight + 'px !important'; | ||
locals.truncateGradientTop = maxHeight - truncateGradientHeight + 'px'; | ||
} else { | ||
locals.truncateMaxHeight = 'none'; | ||
locals.truncateGradientTop = '-' + truncateGradientHeight + 'px'; | ||
} | ||
|
||
$style.html(template(locals)); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
define(function (require) { | ||
var html = require('text!components/tooltip/tooltip.html'); | ||
|
||
require('modules').get('kibana') | ||
.config(function ($tooltipProvider) { | ||
$tooltipProvider.options({ | ||
placement: 'bottom', | ||
animation: true, | ||
popupDelay: 150, | ||
appendToBody: false | ||
}); | ||
}) | ||
.directive('kbnTooltip', function () { | ||
return { | ||
restrict: 'E', | ||
template: html, | ||
transclude: true, | ||
replace: true, | ||
scope: true, | ||
link: function ($scope, $el, attr) { | ||
$scope.text = attr.text; | ||
$scope.placement = attr.placement || 'top'; | ||
$scope.delay = attr.delay || 400; | ||
$scope.appendToBody = attr.appendToBody || 0; | ||
} | ||
}; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.