From 067c9beba84bfc41188ac610aa7ff953359d35a0 Mon Sep 17 00:00:00 2001 From: yashgupta-hyland Date: Thu, 28 Nov 2024 23:06:56 +0530 Subject: [PATCH] WEBUI-1590: Allow option to configure integer display formatting --- elements/nuxeo-results/nuxeo-results.js | 17 ++++++++++++++--- .../resources/OSGI-INF/web-ui-properties.xml | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/elements/nuxeo-results/nuxeo-results.js b/elements/nuxeo-results/nuxeo-results.js index d9c3ea6036..0462f2ceff 100644 --- a/elements/nuxeo-results/nuxeo-results.js +++ b/elements/nuxeo-results/nuxeo-results.js @@ -455,9 +455,20 @@ Polymer({ }, _computeCountLabel() { - return this.resultsCount < 0 - ? this.i18n('results.heading.count.unknown') - : this.i18n('results.heading.count', this.resultsCount); + // Fetch the property value from web-ui-properties.xml + const isNumberFormattingEnabled = + Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.numberFormattingEnabled !== undefined + ? Nuxeo.UI.config.numberFormattingEnabled + : false; // Default to false if the property is not set + if (this.resultsCount < 0) { + return this.i18n('results.heading.count.unknown'); + } + if (isNumberFormattingEnabled) { + const formattedCount = new Intl.NumberFormat().format(this.resultsCount); + return this.i18n('results.heading.count', formattedCount); + } + return this.i18n('results.heading.count', this.resultsCount); + }, _sortOptions() { diff --git a/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml b/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml index 792dc7fc3f..28bed8f6ba 100644 --- a/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml +++ b/plugin/web-ui/addon/src/main/resources/OSGI-INF/web-ui-properties.xml @@ -55,6 +55,8 @@ ${org.nuxeo.pagination.nuxeoSelectOptions.maxAllowedItems:=1000} ${org.nuxeo.web.ui.trustedDomains:=} + + ${org.nuxeo.web.ui.numberFormatting.enabled:=} \ No newline at end of file