mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 16:45:10 +08:00
This commit updates the display of totals and table rows for reports in the admin interface. Currently we show abbreviated numbers for totals e.g. 2.1M which is not helpful when you need accurate data. We are also not adding locale-specific number separators so the row numbers are hard to read e.g. 246999 instead of 246,999. This commit fixes both issues to improve the UX of reports without having to export them. **Before (totals)**  **After (totals)**  **Before (rows)**  **After (rows)** 
83 lines
No EOL
2.2 KiB
Handlebars
Vendored
83 lines
No EOL
2.2 KiB
Handlebars
Vendored
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
{{#if this.model.computedLabels}}
|
|
{{#each this.model.computedLabels as |label|}}
|
|
<AdminReportTableHeader
|
|
@showSortingUI={{this.showSortingUI}}
|
|
@currentSortDirection={{this.sortDirection}}
|
|
@currentSortLabel={{this.sortLabel}}
|
|
@label={{label}}
|
|
@sortByLabel={{fn this.sortByLabel label}}
|
|
/>
|
|
{{/each}}
|
|
{{else}}
|
|
{{#each this.model.data as |data|}}
|
|
<th>{{data.x}}</th>
|
|
{{/each}}
|
|
{{/if}}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{#each this.paginatedData as |data|}}
|
|
<AdminReportTableRow
|
|
@data={{data}}
|
|
@labels={{this.model.computedLabels}}
|
|
@options={{this.options}}
|
|
/>
|
|
{{/each}}
|
|
|
|
{{#if this.showTotalForSample}}
|
|
<tr class="total-row">
|
|
<td colspan={{this.totalsForSample.length}}>
|
|
{{i18n "admin.dashboard.reports.totals_for_sample"}}
|
|
</td>
|
|
</tr>
|
|
<tr class="admin-report-table-row">
|
|
{{#each this.totalsForSample as |total|}}
|
|
<td class="admin-report-table-cell {{total.type}} {{total.property}}">
|
|
{{total.formattedValue}}
|
|
</td>
|
|
{{/each}}
|
|
</tr>
|
|
{{/if}}
|
|
|
|
{{#if this.showTotal}}
|
|
<tr class="total-row">
|
|
<td colspan="2">
|
|
{{i18n "admin.dashboard.reports.total"}}
|
|
</td>
|
|
</tr>
|
|
<tr class="admin-report-table-row">
|
|
<td class="admin-report-table-cell date x">—</td>
|
|
<td
|
|
class="admin-report-table-cell number y"
|
|
>{{this.formattedTotal}}</td>
|
|
</tr>
|
|
{{/if}}
|
|
|
|
{{#if this.showAverage}}
|
|
<tr class="total-row">
|
|
<td colspan="2">
|
|
{{i18n "admin.dashboard.reports.average_for_sample"}}
|
|
</td>
|
|
</tr>
|
|
<tr class="admin-report-table-row">
|
|
<td class="admin-report-table-cell date x">—</td>
|
|
<td
|
|
class="admin-report-table-cell number y"
|
|
>{{this.averageForSample}}</td>
|
|
</tr>
|
|
{{/if}}
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="pagination">
|
|
{{#each this.pages as |pageState|}}
|
|
<DButton
|
|
@translatedLabel={{pageState.page}}
|
|
@action={{fn this.changePage pageState.index}}
|
|
class={{pageState.class}}
|
|
/>
|
|
{{/each}}
|
|
</div> |