Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle booleans in filter editor #13406

Merged
merged 2 commits into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ui/public/directives/focus_on.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ module.directive('focusOn', ($timeout) => ({
restrict: 'A',
link: function (scope, elem, attrs) {
scope.$on(attrs.focusOn, () => {
$timeout(() => elem.find('input').addBack('input').focus());
$timeout(() => {
return elem.find('input,select')
.addBack('input,select')
.focus();
});
});
}
}));
2 changes: 2 additions & 0 deletions src/ui/public/filter_editor/lib/filter_operators.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export const FILTER_OPERATORS = [
name: 'is one of',
type: 'phrases',
negate: false,
fieldTypes: ['string', 'number', 'date', 'ip', 'geo_point', 'geo_shape']
},
{
name: 'is not one of',
type: 'phrases',
negate: true,
fieldTypes: ['string', 'number', 'date', 'ip', 'geo_point', 'geo_shape']
},
{
name: 'is between',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@
ng-model="value"
ng-change="onChange({ value: value })"
/>
<div ng-switch-when="boolean">
<select
class="kuiSelect"
ng-model="value"
ng-options="option for option in boolOptions"
ng-change="onChange({ value: value })"
ng-init="setDefaultBool()"
></select>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ module.directive('filterParamsInputType', function () {
placeholder: '@',
value: '=',
onChange: '&'
},
link: function (scope) {
scope.boolOptions = [true, false];
scope.setDefaultBool = () => {
if (scope.value == null) {
scope.value = scope.boolOptions[0];
scope.onChange({
value: scope.value
});
}
};
}
};
});