From 96ac7040b622406898e0c72ef8f4fbcad3f19731 Mon Sep 17 00:00:00 2001 From: yashgupta-hyland Date: Thu, 28 Nov 2024 23:20:18 +0530 Subject: [PATCH 1/3] WEBUI-1590:Allow option to configure integer display formatting --- elements/nuxeo-results/nuxeo-results.js | 16 +++++++++++++--- .../resources/OSGI-INF/web-ui-properties.xml | 3 +++ 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..b0a67da7f3 100644 --- a/elements/nuxeo-results/nuxeo-results.js +++ b/elements/nuxeo-results/nuxeo-results.js @@ -455,9 +455,19 @@ 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..12b13d3ffb 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 @@ -56,5 +56,8 @@ ${org.nuxeo.web.ui.trustedDomains:=} + + ${org.nuxeo.web.ui.numberFormatting.enabled:=} + \ No newline at end of file From 1e1ffa6963b9213efded2ea4a9208dfd47d525fb Mon Sep 17 00:00:00 2001 From: yashgupta-hyland Date: Tue, 3 Dec 2024 15:28:32 +0530 Subject: [PATCH 2/3] WEBUI-1590:Allow option to configure integer display formatting --- elements/nuxeo-results/nuxeo-results.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/elements/nuxeo-results/nuxeo-results.js b/elements/nuxeo-results/nuxeo-results.js index b0a67da7f3..ab2cfc8311 100644 --- a/elements/nuxeo-results/nuxeo-results.js +++ b/elements/nuxeo-results/nuxeo-results.js @@ -457,9 +457,7 @@ Polymer({ _computeCountLabel() { // 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 + (Nuxeo && Nuxeo.UI && Nuxeo.UI.config && Nuxeo.UI.config.numberFormattingEnabled) || false; if (this.resultsCount < 0) { return this.i18n('results.heading.count.unknown'); } From c7ea9cd1da2113561658075c610b8aa184ff4faf Mon Sep 17 00:00:00 2001 From: yashgupta-hyland Date: Tue, 3 Dec 2024 15:47:19 +0530 Subject: [PATCH 3/3] WEBUI-1590:Allow option to configure integer display formatting --- .../addon/src/main/resources/OSGI-INF/web-ui-properties.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 12b13d3ffb..58685a15c0 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 @@ -56,7 +56,7 @@ ${org.nuxeo.web.ui.trustedDomains:=} - + ${org.nuxeo.web.ui.numberFormatting.enabled:=}