Skip to content

Commit

Permalink
Format numbers in TOC pop-up and add layer menu to locale (elastic#10…
Browse files Browse the repository at this point in the history
…5165) (elastic#105445)

* Format numbers in TOC pop-up and add layer menu to locale

* Review feedback + format a couple other counts

* Update jest test
  • Loading branch information
Aaron Caldwell committed Jul 13, 2021
1 parent be341d1 commit 1bf1e2e
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions docs/maps/vector-layer.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ The index must contain at least one field mapped as {ref}/geo-point.html[geo_poi
Results are limited to the `index.max_result_window` index setting, which defaults to 10000.
Select the appropriate *Scaling* option for your use case.
+
* *Limit results to 10000.* The layer displays features from the first `index.max_result_window` documents.
* *Limit results to 10,000* The layer displays features from the first `index.max_result_window` documents.
Results exceeding `index.max_result_window` are not displayed.

* *Show clusters when results exceed 10000.* When results exceed `index.max_result_window`, the layer uses {ref}/search-aggregations-bucket-geotilegrid-aggregation.html[GeoTile grid aggregation] to group your documents into clusters and displays metrics for each cluster. When results are less then `index.max_result_window`, the layer displays features from individual documents.
* *Show clusters when results exceed 10,000* When results exceed `index.max_result_window`, the layer uses {ref}/search-aggregations-bucket-geotilegrid-aggregation.html[GeoTile grid aggregation] to group your documents into clusters and displays metrics for each cluster. When results are less then `index.max_result_window`, the layer displays features from individual documents.

* *Use vector tiles.* Vector tiles partition your map into 6 to 8 tiles.
Each tile request is limited to the `index.max_result_window` index setting.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class ClientFileCreateSourceEditor extends Component<RenderWizardArgument
? i18n.translate('xpack.maps.fileUpload.trimmedResultsMsg', {
defaultMessage: `Results limited to {numFeatures} features, {previewCoverage}% of file.`,
values: {
numFeatures: geojsonFile.features.length,
numFeatures: geojsonFile.features.length.toLocaleString(),
previewCoverage,
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ export class TiledVectorLayer extends VectorLayer {
? i18n.translate('xpack.maps.tiles.resultsTrimmedMsg', {
defaultMessage: `Results limited to {count} documents.`,
values: {
count: totalFeaturesCount,
count: totalFeaturesCount.toLocaleString(),
},
})
: i18n.translate('xpack.maps.tiles.resultsCompleteMsg', {
defaultMessage: `Found {count} documents.`,
values: {
count: totalFeaturesCount,
count: totalFeaturesCount.toLocaleString(),
},
}),
areResultsTrimmed: isIncomplete,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('getSourceTooltipContent', () => {
sourceDataRequest
);
expect(areResultsTrimmed).toBe(true);
expect(tooltipContent).toBe('Results limited to first 1000 tracks of ~5000.');
expect(tooltipContent).toBe('Results limited to first 1,000 tracks of ~5,000.');
});

it('Should show results trimmed icon and message when tracks are trimmed', () => {
Expand Down Expand Up @@ -90,7 +90,7 @@ describe('getSourceTooltipContent', () => {
);
expect(areResultsTrimmed).toBe(true);
expect(tooltipContent).toBe(
'Results limited to first 1000 tracks of ~5000. 10 of 1000 tracks are incomplete.'
'Results limited to first 1,000 tracks of ~5,000. 10 of 1,000 tracks are incomplete.'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,21 @@ export class ESGeoLineSource extends AbstractESAggSource {
? i18n.translate('xpack.maps.esGeoLine.areEntitiesTrimmedMsg', {
defaultMessage: `Results limited to first {entityCount} tracks of ~{totalEntities}.`,
values: {
entityCount: meta.entityCount,
totalEntities: meta.totalEntities,
entityCount: meta.entityCount.toLocaleString(),
totalEntities: meta.totalEntities.toLocaleString(),
},
})
: i18n.translate('xpack.maps.esGeoLine.tracksCountMsg', {
defaultMessage: `Found {entityCount} tracks.`,
values: { entityCount: meta.entityCount },
values: { entityCount: meta.entityCount.toLocaleString() },
});
const tracksTrimmedMsg =
meta.numTrimmedTracks > 0
? i18n.translate('xpack.maps.esGeoLine.tracksTrimmedMsg', {
defaultMessage: `{numTrimmedTracks} of {entityCount} tracks are incomplete.`,
values: {
entityCount: meta.entityCount,
numTrimmedTracks: meta.numTrimmedTracks,
entityCount: meta.entityCount.toLocaleString(),
numTrimmedTracks: meta.numTrimmedTracks.toLocaleString(),
},
})
: undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,17 +620,17 @@ export class ESSearchSource extends AbstractESSource implements ITiledSingleLaye
? i18n.translate('xpack.maps.esSearch.topHitsResultsTrimmedMsg', {
defaultMessage: `Results limited to first {entityCount} entities of ~{totalEntities}.`,
values: {
entityCount: meta.entityCount,
totalEntities: meta.totalEntities,
entityCount: meta.entityCount?.toLocaleString(),
totalEntities: meta.totalEntities?.toLocaleString(),
},
})
: i18n.translate('xpack.maps.esSearch.topHitsEntitiesCountMsg', {
defaultMessage: `Found {entityCount} entities.`,
values: { entityCount: meta.entityCount },
values: { entityCount: meta.entityCount?.toLocaleString() },
});
const docsPerEntityMsg = i18n.translate('xpack.maps.esSearch.topHitsSizeMsg', {
defaultMessage: `Showing top {topHitsSize} documents per entity.`,
values: { topHitsSize: this._descriptor.topHitsSize },
values: { topHitsSize: this._descriptor.topHitsSize?.toLocaleString() },
});

return {
Expand All @@ -645,7 +645,7 @@ export class ESSearchSource extends AbstractESSource implements ITiledSingleLaye
return {
tooltipContent: i18n.translate('xpack.maps.esSearch.resultsTrimmedMsg', {
defaultMessage: `Results limited to first {count} documents.`,
values: { count: meta.resultsCount },
values: { count: meta.resultsCount?.toLocaleString() },
}),
areResultsTrimmed: true,
};
Expand All @@ -654,7 +654,7 @@ export class ESSearchSource extends AbstractESSource implements ITiledSingleLaye
return {
tooltipContent: i18n.translate('xpack.maps.esSearch.featureCountMsg', {
defaultMessage: `Found {count} documents.`,
values: { count: meta.resultsCount },
values: { count: meta.resultsCount?.toLocaleString() },
}),
areResultsTrimmed: false,
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ interface Props {
}

interface State {
maxResultWindow: number;
maxResultWindow: string;
}

export class ScalingForm extends Component<Props, State> {
state = {
maxResultWindow: DEFAULT_MAX_RESULT_WINDOW,
maxResultWindow: DEFAULT_MAX_RESULT_WINDOW.toLocaleString(),
};
_isMounted = false;

Expand All @@ -61,7 +61,7 @@ export class ScalingForm extends Component<Props, State> {
const indexPattern = await getIndexPatternService().get(this.props.indexPatternId);
const { maxResultWindow } = await loadIndexSettings(indexPattern!.title);
if (this._isMounted) {
this.setState({ maxResultWindow });
this.setState({ maxResultWindow: maxResultWindow.toLocaleString() });
}
} catch (err) {
return;
Expand Down Expand Up @@ -90,7 +90,7 @@ export class ScalingForm extends Component<Props, State> {
<EuiRadio
id={SCALING_TYPES.CLUSTERS}
label={i18n.translate('xpack.maps.source.esSearch.clusterScalingLabel', {
defaultMessage: 'Show clusters when results exceed {maxResultWindow}.',
defaultMessage: 'Show clusters when results exceed {maxResultWindow}',
values: { maxResultWindow: this.state.maxResultWindow },
})}
checked={this.props.scalingType === SCALING_TYPES.CLUSTERS}
Expand Down Expand Up @@ -170,7 +170,7 @@ export class ScalingForm extends Component<Props, State> {
<EuiRadio
id={SCALING_TYPES.LIMIT}
label={i18n.translate('xpack.maps.source.esSearch.limitScalingLabel', {
defaultMessage: 'Limit results to {maxResultWindow}.',
defaultMessage: 'Limit results to {maxResultWindow}',
values: { maxResultWindow: this.state.maxResultWindow },
})}
checked={this.props.scalingType === SCALING_TYPES.LIMIT}
Expand Down

0 comments on commit 1bf1e2e

Please sign in to comment.