Skip to content

Commit

Permalink
WEBUI-1590::Allow option to configure integer display formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yashgupta-hyland committed Nov 29, 2024
1 parent 52ee5e8 commit 1cb2c7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 13 additions & 3 deletions elements/nuxeo-results/nuxeo-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,8 @@
<!-- allowed url to redirect -->
<property name="org.nuxeo.web.ui.trustedDomains">${org.nuxeo.web.ui.trustedDomains:=}</property>

<!-- Search reasult numberFormatting -->
<property name="org.nuxeo.web.ui.numberFormatting.enabled">${org.nuxeo.web.ui.numberFormatting.enabled:=}</property>

</extension>
</component>

0 comments on commit 1cb2c7f

Please sign in to comment.