-
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 pull request #1660 from w33ble/exclude-terms
Include and Exclude params on terms agg
- Loading branch information
Showing
25 changed files
with
436 additions
and
35 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
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
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 |
---|---|---|
|
@@ -161,6 +161,16 @@ | |
} | ||
} | ||
} | ||
|
||
.regex .flags { | ||
.docs { | ||
text-align: right; | ||
} | ||
|
||
a { | ||
color: @link-color; | ||
} | ||
} | ||
} | ||
|
||
&-form-row { | ||
|
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,8 @@ | ||
<div class="advanced-toggle"> | ||
<div ng-show="!advancedToggled"> | ||
<a ng-click="advancedToggled = !advancedToggled">Advanced Parameters</a> | ||
</div> | ||
<div ng-show="advancedToggled"> | ||
<a ng-click="advancedToggled = !advancedToggled">Hide Advanced</a> | ||
</div> | ||
</div> |
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
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
22 changes: 22 additions & 0 deletions
22
src/kibana/components/agg_types/controls/regular_expression.html
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,22 @@ | ||
<div class="form-group regex"> | ||
<label>{{ aggParam.name | label }}</label> | ||
<input | ||
type="text" | ||
class="form-control" | ||
ng-model="params[aggParam.name].pattern" | ||
> | ||
<div class="flags"> | ||
<div class="docs"> | ||
<small><a href="http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#field_detail" | ||
target="_blank">Regex Flags</a></small> | ||
</div> | ||
<select | ||
multiple | ||
chosen | ||
width="'100%'" | ||
data-placeholder="Flags" | ||
ng-model="params[aggParam.name].flags" | ||
ng-options="label for label in aggParam.flags"> | ||
</select> | ||
</div> | ||
</div> |
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
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,62 @@ | ||
define(function (require) { | ||
return function RegexAggParamFactory(Private) { | ||
var _ = require('lodash'); | ||
|
||
var BaseAggParam = Private(require('components/agg_types/param_types/base')); | ||
var editorHtml = require('text!components/agg_types/controls/regular_expression.html'); | ||
|
||
_(RegexAggParam).inherits(BaseAggParam); | ||
function RegexAggParam(config) { | ||
// Java RegExp flags | ||
var flags = [ | ||
'CANON_EQ', | ||
'CASE_INSENSITIVE', | ||
'COMMENTS', | ||
'DOTALL', | ||
'LITERAL', | ||
'MULTILINE', | ||
'UNICODE_CASE', | ||
'UNICODE_CHARACTER_CLASS', | ||
'UNIX_LINES' | ||
]; | ||
|
||
_.defaults(config, { pattern: '', flags: flags }); | ||
RegexAggParam.Super.call(this, config); | ||
} | ||
|
||
RegexAggParam.prototype.editor = editorHtml; | ||
|
||
/** | ||
* Write the aggregation parameter. | ||
* | ||
* @param {AggConfig} aggConfig - the entire configuration for this agg | ||
* @param {object} output - the result of calling write on all of the aggregations | ||
* parameters. | ||
* @param {object} output.params - the final object that will be included as the params | ||
* for the agg | ||
* @return {undefined} | ||
*/ | ||
RegexAggParam.prototype.write = function (aggConfig, output) { | ||
var param = aggConfig.params[this.name]; | ||
|
||
// clear aggParam if pattern is not set | ||
if (!param || !param.pattern || !param.pattern.length) { | ||
delete output.params[this.name]; | ||
return; | ||
} | ||
|
||
var obj = { | ||
pattern: param.pattern | ||
}; | ||
|
||
// include any selected flags | ||
if (_.isArray(param.flags) && param.flags.length) { | ||
obj.flags = param.flags.join('|'); | ||
} | ||
|
||
output.params[this.name] = obj; | ||
}; | ||
|
||
return RegexAggParam; | ||
}; | ||
}); |
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,16 @@ | ||
define(function (require) { | ||
require('modules') | ||
.get('kibana') | ||
.filter('label', function () { | ||
return function (str) { | ||
var words = str.split(' '); | ||
return words.map(capFirst).join(' '); | ||
}; | ||
}); | ||
|
||
function capFirst(str) { | ||
var i = str[0]; | ||
var r = new RegExp(i, 'i'); | ||
return str.replace(r, i.toUpperCase()); | ||
} | ||
}); |
Oops, something went wrong.