forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Vis: Default editor] EUIficate other bucket control (elastic#34945) (e…
…lastic#35781) * EUIficate other_bucket control * Filter invalid string params * Fix functional tests * Fix browser tests
- Loading branch information
Showing
9 changed files
with
201 additions
and
95 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/legacy/ui/public/agg_types/buckets/migrate_include_exclude_format.d.ts
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 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { AggConfig } from 'ui/vis/agg_config'; | ||
|
||
export function isStringType(type: AggConfig): boolean; |
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
46 changes: 46 additions & 0 deletions
46
src/legacy/ui/public/agg_types/controls/missing_bucket.tsx
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 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { AggParamEditorProps } from 'ui/vis/editors/default'; | ||
import { SwitchParamEditor } from './switch'; | ||
import { isStringType } from '../buckets/migrate_include_exclude_format'; | ||
|
||
function MissingBucketParamEditor(props: AggParamEditorProps<boolean>) { | ||
return ( | ||
<SwitchParamEditor | ||
dataTestSubj="missingBucketSwitch" | ||
displayLabel={i18n.translate('common.ui.aggTypes.otherBucket.showMissingValuesLabel', { | ||
defaultMessage: 'Show missing values', | ||
})} | ||
displayToolTip={i18n.translate('common.ui.aggTypes.otherBucket.showMissingValuesTooltip', { | ||
defaultMessage: | ||
'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.', | ||
})} | ||
disabled={!isStringType(props.agg)} | ||
{...props} | ||
/> | ||
); | ||
} | ||
|
||
export { MissingBucketParamEditor }; |
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { AggParamEditorProps } from 'ui/vis/editors/default'; | ||
import { SwitchParamEditor } from './switch'; | ||
|
||
function OtherBucketParamEditor(props: AggParamEditorProps<boolean>) { | ||
return ( | ||
<SwitchParamEditor | ||
dataTestSubj="otherBucketSwitch" | ||
displayLabel={i18n.translate('common.ui.aggTypes.otherBucket.groupValuesLabel', { | ||
defaultMessage: 'Group other values in separate bucket', | ||
})} | ||
displayToolTip={i18n.translate('common.ui.aggTypes.otherBucket.groupValuesTooltip', { | ||
defaultMessage: | ||
'Values not in the top N are grouped in this bucket. ' + | ||
"To include documents with missing values, enable 'Show missing values'.", | ||
})} | ||
{...props} | ||
/> | ||
); | ||
} | ||
|
||
export { OtherBucketParamEditor }; |
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,56 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { EuiSwitch, EuiToolTip, EuiSpacer } from '@elastic/eui'; | ||
import { AggParamEditorProps } from 'ui/vis/editors/default'; | ||
|
||
interface SwitchParamEditorProps extends AggParamEditorProps<boolean> { | ||
dataTestSubj?: string; | ||
displayLabel?: string; | ||
displayToolTip?: string; | ||
disabled?: boolean; | ||
} | ||
|
||
function SwitchParamEditor({ | ||
value, | ||
setValue, | ||
dataTestSubj, | ||
displayToolTip, | ||
displayLabel, | ||
disabled, | ||
}: SwitchParamEditorProps) { | ||
return ( | ||
<div className="visEditorSidebar__aggParamFormRow"> | ||
<EuiToolTip content={displayToolTip} delay="long" position="right"> | ||
<EuiSwitch | ||
label={displayLabel} | ||
checked={value} | ||
disabled={disabled} | ||
data-test-subj={dataTestSubj} | ||
onChange={ev => setValue(ev.target.checked)} | ||
/> | ||
</EuiToolTip> | ||
<EuiSpacer size="s" /> | ||
</div> | ||
); | ||
} | ||
|
||
export { SwitchParamEditor }; |
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