Skip to content

Commit

Permalink
remove other bucket UI from significant terms (elastic#17810) (elasti…
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed May 4, 2018
1 parent 29dd460 commit 3e31069
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 100 deletions.
66 changes: 34 additions & 32 deletions src/ui/public/agg_types/buckets/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Schemas } from '../../vis/editors/default/schemas';
import { AggTypesBucketsCreateFilterTermsProvider } from './create_filter/terms';
import orderAggTemplate from '../controls/order_agg.html';
import orderAndSizeTemplate from '../controls/order_and_size.html';
import otherBucketTemplate from 'ui/agg_types/controls/other_bucket.html';
import { RouteBasedNotifierProvider } from '../../route_based_notifier';
import { OtherBucketHelperProvider } from './_terms_other_bucket_helper';

Expand Down Expand Up @@ -77,37 +78,6 @@ export function AggTypesBucketsTermsProvider(Private) {
name: 'field',
filterFieldTypes: ['number', 'boolean', 'date', 'ip', 'string']
},
{
name: 'otherBucket',
default: false,
write: _.noop
}, {
name: 'otherBucketLabel',
default: 'Other',
write: _.noop
}, {
name: 'missingBucket',
default: false,
write: _.noop
}, {
name: 'missingBucketLabel',
default: 'Missing',
write: _.noop
},
{
name: 'exclude',
type: 'string',
advanced: true,
disabled: isNotType('string'),
...migrateIncludeExcludeFormat
},
{
name: 'include',
type: 'string',
advanced: true,
disabled: isNotType('string'),
...migrateIncludeExcludeFormat
},
{
name: 'size',
default: 5
Expand Down Expand Up @@ -245,7 +215,39 @@ export function AggTypesBucketsTermsProvider(Private) {
{
name: 'orderBy',
write: _.noop // prevent default write, it's handled by orderAgg
}
},
{
name: 'otherBucket',
default: false,
editor: otherBucketTemplate,
write: _.noop
}, {
name: 'otherBucketLabel',
default: 'Other',
write: _.noop
}, {
name: 'missingBucket',
default: false,
write: _.noop
}, {
name: 'missingBucketLabel',
default: 'Missing',
write: _.noop
},
{
name: 'exclude',
type: 'string',
advanced: true,
disabled: isNotType('string'),
...migrateIncludeExcludeFormat
},
{
name: 'include',
type: 'string',
advanced: true,
disabled: isNotType('string'),
...migrateIncludeExcludeFormat
},
]
});
}
65 changes: 1 addition & 64 deletions src/ui/public/agg_types/controls/order_and_size.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,5 @@
>
</div>
</div>
<div class="vis-editor-agg-form-row">
<div class="form-group">
<label>
<input
type="checkbox"
class="kuiCheckBox"
name="showOther"
ng-model="agg.params.otherBucket"
>
Group other values in separate bucket
<icon-tip
position="'right'"
content="'Values not in the top N are grouped in this bucket. To include documents with missing values, enable \'Show missing values\'.'"
></icon-tip>
</label>
</div>
</div>
<div class="vis-editor-agg-form-row" ng-if="agg.params.otherBucket">
<div class="form-group">
<label>
Label for other bucket
</label>
<div>
<input
type="text"
ng-model="agg.params.otherBucketLabel"
class="form-control kuiSideBarInput"
>
</div>
</div>
</div>
<div class="vis-editor-agg-form-row">
<div class="form-group">
<label>
<input
type="checkbox"
class="kuiCheckBox"
name="showMissing"
ng-model="agg.params.missingBucket"
ng-disabled="agg.params.field.type !== 'string'"
>
Show missing values
<icon-tip
position="'right'"
content="'Only works for fields of type \'string\'. When enabled, include documents with missing values in the search. If this bucket is in the top N, it appears in the chart. If not in the top N, and you enable \'Group other values in separate bucket\', Elasticsearch adds the missing values to the \'other\' bucket.'"
></icon-tip>
</label>
</div>
</div>
<div class="vis-editor-agg-form-row" ng-show="agg.params.missingBucket">
<div class="form-group">
<label>
Label for missing values
</label>
<div>
<input
type="text"
ng-model="agg.params.missingBucketLabel"
class="form-control kuiSideBarInput"
ng-disabled="agg.params.field.type !== 'string'"
>
</div>
</div>
</div>

</div>
66 changes: 66 additions & 0 deletions src/ui/public/agg_types/controls/other_bucket.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<div>
<div class="vis-editor-agg-form-row">
<div class="form-group">
<label>
<input
type="checkbox"
class="kuiCheckBox"
name="showOther"
ng-model="agg.params.otherBucket"
>
Group other values in separate bucket
<icon-tip
position="'right'"
content="'Values not in the top N are grouped in this bucket. To include documents with missing values, enable \'Show missing values\'.'"
></icon-tip>
</label>
</div>
</div>
<div class="vis-editor-agg-form-row" ng-if="agg.params.otherBucket">
<div class="form-group">
<label>
Label for other bucket
</label>
<div>
<input
type="text"
ng-model="agg.params.otherBucketLabel"
class="form-control kuiSideBarInput"
>
</div>
</div>
</div>
<div class="vis-editor-agg-form-row">
<div class="form-group">
<label>
<input
type="checkbox"
class="kuiCheckBox"
name="showMissing"
ng-model="agg.params.missingBucket"
ng-disabled="agg.params.field.type !== 'string'"
>
Show missing values
<icon-tip
position="'right'"
content="'Only works for fields of type \'string\'. When enabled, include documents with missing values in the search. If this bucket is in the top N, it appears in the chart. If not in the top N, and you enable \'Group other values in separate bucket\', Elasticsearch adds the missing values to the \'other\' bucket.'"
></icon-tip>
</label>
</div>
</div>
<div class="vis-editor-agg-form-row" ng-show="agg.params.missingBucket">
<div class="form-group">
<label>
Label for missing values
</label>
<div>
<input
type="text"
ng-model="agg.params.missingBucketLabel"
class="form-control kuiSideBarInput"
ng-disabled="agg.params.field.type !== 'string'"
>
</div>
</div>
</div>
</div>
8 changes: 4 additions & 4 deletions src/ui/public/agg_types/param_types/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import { createLegacyClass } from '../../utils/legacy_class';

const notifier = new Notifier();

createLegacyClass(FieldParamType).inherits(BaseParamType);
function FieldParamType(config) {

export function FieldParamType(config) {
FieldParamType.Super.call(this, config);
}

createLegacyClass(FieldParamType).inherits(BaseParamType);

FieldParamType.prototype.editor = editorHtml;
FieldParamType.prototype.scriptable = true;
FieldParamType.prototype.filterFieldTypes = '*';
Expand Down Expand Up @@ -111,5 +113,3 @@ FieldParamType.prototype.write = function (aggConfig, output) {
output.params.field = field.name;
}
};

export { FieldParamType };

0 comments on commit 3e31069

Please sign in to comment.