From: Grégoire Aubert Date: Tue, 28 Nov 2017 07:59:54 +0000 (+0100) Subject: Use correct metric suffix X-Git-Tag: 7.0-RC1~276 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5880d0c5b446408b2bc50bdb587643eeff0ae99c;p=sonarqube.git Use correct metric suffix --- diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts index e0795b485f2..e57d404eeab 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts @@ -34,9 +34,9 @@ beforeEach(() => { 'metric.level.ERROR': 'Error', 'metric.level.WARN': 'Warning', 'metric.level.OK': 'Ok', + 'short_number_suffix.g': 'G', 'short_number_suffix.k': 'k', - 'short_number_suffix.m': 'm', - 'short_number_suffix.b': 'b' + 'short_number_suffix.m': 'M' }); }); @@ -60,7 +60,7 @@ describe('#formatMeasure()', () => { expect(formatMeasure(1529, 'SHORT_INT')).toBe('1.5k'); expect(formatMeasure(10000, 'SHORT_INT')).toBe('10k'); expect(formatMeasure(10678, 'SHORT_INT')).toBe('11k'); - expect(formatMeasure(1234567890, 'SHORT_INT')).toBe('1b'); + expect(formatMeasure(1234567890, 'SHORT_INT')).toBe('1G'); }); it('should format FLOAT', () => { @@ -130,8 +130,8 @@ describe('#formatMeasure()', () => { expect(formatMeasure(-1 * ONE_MINUTE, 'SHORT_WORK_DUR')).toBe('-1min'); expect(formatMeasure(1529 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1.5kd'); - expect(formatMeasure(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1md'); - expect(formatMeasure(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('1md'); + expect(formatMeasure(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('1Md'); + expect(formatMeasure(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('1Md'); }); it('should format RATING', () => { @@ -247,8 +247,8 @@ describe('#formatMeasureVariation()', () => { expect(formatMeasureVariation(-1 * ONE_MINUTE, 'SHORT_WORK_DUR')).toBe('-1min'); expect(formatMeasureVariation(1529 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1.5kd'); - expect(formatMeasureVariation(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1md'); - expect(formatMeasureVariation(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('+1md'); + expect(formatMeasureVariation(1234567 * ONE_DAY, 'SHORT_WORK_DUR')).toBe('+1Md'); + expect(formatMeasureVariation(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR')).toBe('+1Md'); }); it('should not format unknown type', () => { diff --git a/server/sonar-web/src/main/js/helpers/measures.ts b/server/sonar-web/src/main/js/helpers/measures.ts index e1c4c46e58e..6e36fe5289c 100644 --- a/server/sonar-web/src/main/js/helpers/measures.ts +++ b/server/sonar-web/src/main/js/helpers/measures.ts @@ -164,7 +164,7 @@ function intVariationFormatter(value: number): string { function shortIntFormatter(value: number): string { if (value >= 1e9) { - return numberFormatter(value / 1e9) + translate('short_number_suffix.b'); + return numberFormatter(value / 1e9) + translate('short_number_suffix.g'); } else if (value >= 1e6) { return numberFormatter(value / 1e6) + translate('short_number_suffix.m'); } else if (value >= 1e4) { diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index cf5916587df..32946f38725 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -218,9 +218,9 @@ no_results_search.favorites.2=Would you like to search among {url} projects? page_extension_failed=Page extension failed. set_as_default=Set as Default unset_as_default=Unset as Default +short_number_suffix.g=G short_number_suffix.k=k -short_number_suffix.m=m -short_number_suffix.b=b +short_number_suffix.m=M show_more=Show More should_be_unique=Should be unique since_x=since {0}