mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Adding gte and lt symbols in range filter fileds and popup (#46697)
This commit is contained in:
parent
905d021c5a
commit
b4887d8586
8 changed files with 34 additions and 16 deletions
|
@ -62,9 +62,9 @@ describe('Range Agg', function () {
|
|||
const format = function (val) {
|
||||
return agg.fieldFormatter()(agg.getKey(val));
|
||||
};
|
||||
expect(format(buckets[0])).to.be('-∞ to 1 KB');
|
||||
expect(format(buckets[1])).to.be('1 KB to 2.5 KB');
|
||||
expect(format(buckets[2])).to.be('2.5 KB to +∞');
|
||||
expect(format(buckets[0])).to.be('≥ -∞ and < 1 KB');
|
||||
expect(format(buckets[1])).to.be('≥ 1 KB and < 2.5 KB');
|
||||
expect(format(buckets[2])).to.be('≥ 2.5 KB and < +∞');
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('AggConfig Filters', function () {
|
|||
expect(filter.range).to.have.property('bytes');
|
||||
expect(filter.range.bytes).to.have.property('gte', 1024.0);
|
||||
expect(filter.range.bytes).to.have.property('lt', 2048.0);
|
||||
expect(filter.meta).to.have.property('formattedValue', '1,024 to 2,048');
|
||||
expect(filter.meta).to.have.property('formattedValue', '≥ 1,024 and < 2,048');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -66,12 +66,16 @@ export const rangeBucketAgg = new BucketAggType({
|
|||
|
||||
const RangeFormat = FieldFormat.from(function (range) {
|
||||
const format = agg.fieldOwnFormatter();
|
||||
const gte = '\u2265';
|
||||
const lt = '\u003c';
|
||||
return i18n.translate('common.ui.aggTypes.buckets.ranges.rangesFormatMessage', {
|
||||
defaultMessage: '{from} to {to}',
|
||||
defaultMessage: '{gte} {from} and {lt} {to}',
|
||||
values: {
|
||||
gte,
|
||||
from: format(range.gte),
|
||||
to: format(range.lt)
|
||||
}
|
||||
lt,
|
||||
to: format(range.lt),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -153,6 +153,16 @@ function RangesParamEditor({
|
|||
[isFromValid, isToValid] = validateRange({ from, to }, index);
|
||||
}
|
||||
|
||||
const fromPrepend = i18n.translate(
|
||||
'common.ui.aggTypes.ranges.greaterThanOrEqualPrepend',
|
||||
{
|
||||
defaultMessage: '\u2265',
|
||||
}
|
||||
);
|
||||
const toPrepend = i18n.translate('common.ui.aggTypes.ranges.lessThanPrepend', {
|
||||
defaultMessage: '\u003c',
|
||||
});
|
||||
|
||||
return (
|
||||
<Fragment key={id}>
|
||||
<EuiFlexGroup gutterSize="s" alignItems="center" responsive={false}>
|
||||
|
@ -168,6 +178,7 @@ function RangesParamEditor({
|
|||
fullWidth={true}
|
||||
compressed={true}
|
||||
isInvalid={!isFromValid}
|
||||
prepend={fromPrepend}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
|
@ -185,6 +196,7 @@ function RangesParamEditor({
|
|||
fullWidth={true}
|
||||
compressed={true}
|
||||
isInvalid={!isToValid}
|
||||
prepend={toPrepend}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
|
|
|
@ -99,10 +99,14 @@ export const getFormat: FormatFactory = (mapping = {}) => {
|
|||
if (id === 'range') {
|
||||
const RangeFormat = FieldFormat.from((range: any) => {
|
||||
const format = getFieldFormat(id, mapping.params);
|
||||
const gte = '\u2265';
|
||||
const lt = '\u003c';
|
||||
return i18n.translate('common.ui.aggTypes.buckets.ranges.rangesFormatMessage', {
|
||||
defaultMessage: '{from} to {to}',
|
||||
defaultMessage: '{gte} {from} and {lt} {to}',
|
||||
values: {
|
||||
gte,
|
||||
from: format.convert(range.gte),
|
||||
lt,
|
||||
to: format.convert(range.lt),
|
||||
},
|
||||
});
|
||||
|
|
|
@ -101,9 +101,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
async function expectValidTableData() {
|
||||
const data = await PageObjects.visualize.getTableVisData();
|
||||
expect(data.trim().split('\n')).to.be.eql([
|
||||
'0 to 1000',
|
||||
'≥ 0 and < 1000',
|
||||
'1,351 64.7%',
|
||||
'1000 to 2000',
|
||||
'≥ 1000 and < 2000',
|
||||
'737 35.3%',
|
||||
]);
|
||||
}
|
||||
|
@ -146,9 +146,9 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
const data = await PageObjects.visualize.getTableVisData();
|
||||
expect(data.trim().split('\n')).to.be.eql([
|
||||
'0 to 1000',
|
||||
'≥ 0 and < 1000',
|
||||
'344.094B',
|
||||
'1000 to 2000',
|
||||
'≥ 1000 and < 2000',
|
||||
'1.697KB',
|
||||
]);
|
||||
});
|
||||
|
@ -248,8 +248,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.visualize.clickGo();
|
||||
const data = await PageObjects.visualize.getTableVisData();
|
||||
expect(data.trim().split('\n')).to.be.eql([
|
||||
'0 to 1000', '1,351',
|
||||
'1000 to 2000', '737',
|
||||
'≥ 0 and < 1000', '1,351',
|
||||
'≥ 1000 and < 2000', '737',
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@
|
|||
"common.ui.aggTypes.buckets.intervalOptions.yearlyDisplayName": "1 年ごと",
|
||||
"common.ui.aggTypes.buckets.ipRangeLabel": "{fieldName} IP 範囲",
|
||||
"common.ui.aggTypes.buckets.ipRangeTitle": "IPv4 範囲",
|
||||
"common.ui.aggTypes.buckets.ranges.rangesFormatMessage": "{from} ~ {to}",
|
||||
"common.ui.aggTypes.buckets.rangesLabel": "{fieldName} の範囲",
|
||||
"common.ui.aggTypes.buckets.rangeTitle": "範囲",
|
||||
"common.ui.aggTypes.buckets.significantTerms.excludeLabel": "除外",
|
||||
|
|
|
@ -102,7 +102,6 @@
|
|||
"common.ui.aggTypes.buckets.intervalOptions.yearlyDisplayName": "每年",
|
||||
"common.ui.aggTypes.buckets.ipRangeLabel": "{fieldName} IP 范围",
|
||||
"common.ui.aggTypes.buckets.ipRangeTitle": "IPv4 范围",
|
||||
"common.ui.aggTypes.buckets.ranges.rangesFormatMessage": "{from} 至 {to}",
|
||||
"common.ui.aggTypes.buckets.rangesLabel": "{fieldName} 范围",
|
||||
"common.ui.aggTypes.buckets.rangeTitle": "范围",
|
||||
"common.ui.aggTypes.buckets.significantTerms.excludeLabel": "排除",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue