Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
71bb729
Migrate number-list
maryia-lapata Apr 8, 2019
54d548b
Merge branch 'master' into number-list
maryia-lapata Apr 9, 2019
a219144
Add types
maryia-lapata Apr 9, 2019
b69cf21
Refactoring
maryia-lapata Apr 9, 2019
2d4391e
Merge branch 'master' into number-list
maryia-lapata Apr 10, 2019
18c72d4
Add number row
maryia-lapata Apr 10, 2019
ab21bbf
Add and remove items
maryia-lapata Apr 10, 2019
9256a73
Merge branch 'master' into number-list
maryia-lapata Apr 11, 2019
332ed80
Add onChange
maryia-lapata Apr 11, 2019
8faa7c1
Add validate function
maryia-lapata Apr 11, 2019
84181ab
Merge branch 'master' into number-list
maryia-lapata Apr 25, 2019
fa1c107
Apply validation
maryia-lapata Apr 26, 2019
900ac6f
Merge branch 'master' into number-list
maryia-lapata Apr 29, 2019
337774b
Merge branch 'master' into number-list
maryia-lapata Apr 29, 2019
686ca5f
Fix merge conflict
maryia-lapata Apr 29, 2019
80c5270
Merge branch 'master' into number-list
maryia-lapata Apr 30, 2019
214fa02
Merge branch 'master' into number-list
maryia-lapata May 13, 2019
2721147
Apply order validation
maryia-lapata May 13, 2019
aa556ad
Fix ts
maryia-lapata May 14, 2019
72e99de
Refactoring
maryia-lapata May 14, 2019
040912c
EUIficate percentiles control
maryia-lapata May 14, 2019
2849664
Merge branch 'master' into number-list
maryia-lapata May 15, 2019
cbdfcdc
Remove unused translations
maryia-lapata May 15, 2019
6b5b93d
Move helper functions to a separate file
maryia-lapata May 16, 2019
1880b72
Merge branch 'master' into number-list
maryia-lapata May 20, 2019
d113d7d
Merge branch 'master' into number-list
maryia-lapata May 21, 2019
85cbd6a
Fix code review comments
maryia-lapata May 21, 2019
f6689ef
Make add button 'xs' size
maryia-lapata May 21, 2019
1787357
Remove extra space
maryia-lapata May 21, 2019
f2e19c2
Fix validation
maryia-lapata May 21, 2019
55514c1
Merge branch 'master' into number-list
maryia-lapata May 24, 2019
b05694f
Merge branch 'master' into number-list
maryia-lapata May 27, 2019
026ebbe
Remove unused translations
maryia-lapata May 27, 2019
b0b66bf
Merge branch 'master' into number-list
maryia-lapata May 29, 2019
4455d04
Merge branch 'master' into number-list
maryia-lapata May 29, 2019
79908c4
Merge branch 'master' into number-list
maryia-lapata May 29, 2019
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
169 changes: 0 additions & 169 deletions src/legacy/ui/public/agg_types/__tests__/controls/number_list.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/legacy/ui/public/agg_types/controls/percentile_ranks.html

This file was deleted.

70 changes: 70 additions & 0 deletions src/legacy/ui/public/agg_types/controls/percentile_ranks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* 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, { useState } from 'react';

import { EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParamEditorProps } from '../../vis/editors/default';
import { NumberList } from '../number_list';

function PercentileRanksEditor({
agg,
showValidation,
value,
setTouched,
setValidity,
setValue,
}: AggParamEditorProps<Array<number | undefined>>) {
const label = i18n.translate('common.ui.aggTypes.percentileRanks.valuesLabel', {
defaultMessage: 'Values',
});
const [isValid, setIsValid] = useState(true);

const setModelValidy = (isListValid: boolean) => {
setIsValid(isListValid);
setValidity(isListValid);
};

return (
<EuiFormRow
label={label}
labelType="legend"
fullWidth={true}
id={`visEditorPercentileRanksLabel${agg.id}`}
isInvalid={showValidation ? !isValid : false}
className="visEditorSidebar__aggParamFormRow"
>
<NumberList
labelledbyId={`visEditorPercentileRanksLabel${agg.id}-legend`}
numberArray={value}
range="[-Infinity,Infinity]"
unitName={i18n.translate('common.ui.aggTypes.percentileRanks.valueUnitNameText', {
defaultMessage: 'value',
})}
showValidation={showValidation}
onChange={setValue}
setTouched={setTouched}
setValidity={setModelValidy}
/>
</EuiFormRow>
);
}

export { PercentileRanksEditor };
15 changes: 0 additions & 15 deletions src/legacy/ui/public/agg_types/controls/percentiles.html

This file was deleted.

71 changes: 71 additions & 0 deletions src/legacy/ui/public/agg_types/controls/percentiles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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, { useState } from 'react';

import { EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AggParamEditorProps } from '../../vis/editors/default';
import { NumberList } from '../number_list';

function PercentilesEditor({
agg,
showValidation,
value,
setTouched,
setValidity,
setValue,
}: AggParamEditorProps<Array<number | undefined>>) {
const label = i18n.translate('common.ui.aggTypes.percentiles.percentsLabel', {
defaultMessage: 'Percents',
});
const [isValid, setIsValid] = useState(true);

const setModelValidy = (isListValid: boolean) => {
setIsValid(isListValid);
setValidity(isListValid);
};

return (
<EuiFormRow
label={label}
labelType="legend"
fullWidth={true}
id={`visEditorPercentileLabel${agg.id}`}
isInvalid={showValidation ? !isValid : false}
className="visEditorSidebar__aggParamFormRow"
>
<NumberList
labelledbyId={`visEditorPercentileLabel${agg.id}-legend`}
numberArray={value}
range="[0,100]"
validateAscendingOrder={false}
unitName={i18n.translate('common.ui.aggTypes.percentileRanks.percentUnitNameText', {
defaultMessage: 'percent',
})}
showValidation={showValidation}
onChange={setValue}
setTouched={setTouched}
setValidity={setModelValidy}
/>
</EuiFormRow>
);
}

export { PercentilesEditor };
5 changes: 2 additions & 3 deletions src/legacy/ui/public/agg_types/metrics/percentile_ranks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* under the License.
*/

import valuesEditor from '../controls/percentile_ranks.html';
import '../number_list';
import { PercentileRanksEditor } from '../controls/percentile_ranks';
import { MetricAggType } from './metric_agg_type';
import { getResponseAggConfigClass } from './get_response_agg_config_class';
import { fieldFormats } from '../../registry/field_formats';
Expand Down Expand Up @@ -60,7 +59,7 @@ export const percentileRanksMetricAgg = new MetricAggType({
},
{
name: 'values',
editor: valuesEditor,
editorComponent: PercentileRanksEditor,
default: []
},
{
Expand Down
5 changes: 2 additions & 3 deletions src/legacy/ui/public/agg_types/metrics/percentiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/

import { ordinalSuffix } from '../../utils/ordinal_suffix';
import percentsEditor from '../controls/percentiles.html';
import '../number_list';
import { PercentilesEditor } from '../controls/percentiles';
import { MetricAggType } from './metric_agg_type';
import { getResponseAggConfigClass } from './get_response_agg_config_class';
import { getPercentileValue } from './percentiles_get_value';
Expand Down Expand Up @@ -54,7 +53,7 @@ export const percentilesMetricAgg = new MetricAggType({
},
{
name: 'percents',
editor: percentsEditor,
editorComponent: PercentilesEditor,
default: [1, 5, 25, 50, 75, 95, 99]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/

import './number_list';
export { NumberList } from './number_list';
Loading