This commit is contained in:
Albert Juhé Lluveras 2018-12-15 00:56:52 +01:00 committed by Timmy Crawford
parent 88b81beac0
commit f9533afdda
4 changed files with 11 additions and 11 deletions

View File

@ -74,7 +74,7 @@ class ReportTable extends Component {
const isRequesting = tableData.isRequesting || primaryData.isRequesting; const isRequesting = tableData.isRequesting || primaryData.isRequesting;
const orderedItems = orderBy( items.data, query.orderby, query.order ); const orderedItems = orderBy( items.data, query.orderby, query.order );
const totals = get( primaryData, [ 'data', 'totals' ], null ); const totals = get( primaryData, [ 'data', 'totals' ], null );
const totalCount = items.totalCount || 0; const totalResults = items.totalResults || 0;
const { headers, ids, rows, summary } = applyFilters( TABLE_FILTER, { const { headers, ids, rows, summary } = applyFilters( TABLE_FILTER, {
endpoint: endpoint, endpoint: endpoint,
headers: getHeadersContent(), headers: getHeadersContent(),
@ -82,7 +82,7 @@ class ReportTable extends Component {
ids: itemIdField ? orderedItems.map( item => item[ itemIdField ] ) : null, ids: itemIdField ? orderedItems.map( item => item[ itemIdField ] ) : null,
rows: getRowsContent( orderedItems ), rows: getRowsContent( orderedItems ),
totals: totals, totals: totals,
summary: getSummary ? getSummary( totals, totalCount ) : null, summary: getSummary ? getSummary( totals, totalResults ) : null,
} ); } );
// Hide any headers based on user prefs, if loaded. // Hide any headers based on user prefs, if loaded.
@ -99,7 +99,7 @@ class ReportTable extends Component {
rows={ rows } rows={ rows }
rowsPerPage={ parseInt( query.per_page ) } rowsPerPage={ parseInt( query.per_page ) }
summary={ summary } summary={ summary }
totalRows={ totalCount } totalRows={ totalResults }
{ ...tableProps } { ...tableProps }
/> />
); );

View File

@ -98,15 +98,15 @@ export default class CategoriesReportTable extends Component {
} ); } );
} }
getSummary( totals, totalCount ) { getSummary( totals, totalResults ) {
if ( ! totals ) { if ( ! totals ) {
return []; return [];
} }
return [ return [
{ {
label: _n( 'category', 'categories', totalCount, 'wc-admin' ), label: _n( 'category', 'categories', totalResults, 'wc-admin' ),
value: numberFormat( totalCount ), value: numberFormat( totalResults ),
}, },
{ {
label: _n( 'item sold', 'items sold', totals.items_sold, 'wc-admin' ), label: _n( 'item sold', 'items sold', totals.items_sold, 'wc-admin' ),

View File

@ -285,7 +285,7 @@ export default compose(
tableData: { tableData: {
items: { items: {
data: formatTableOrders( orders ), data: formatTableOrders( orders ),
totalCount: ordersTotalCount, totalResults: ordersTotalCount,
}, },
isError, isError,
isRequesting, isRequesting,

View File

@ -162,15 +162,15 @@ class RevenueReportTable extends Component {
} ); } );
} }
getSummary( totals, totalCount ) { getSummary( totals, totalResults ) {
if ( ! totals ) { if ( ! totals ) {
return []; return [];
} }
return [ return [
{ {
label: _n( 'day', 'days', totalCount, 'wc-admin' ), label: _n( 'day', 'days', totalResults, 'wc-admin' ),
value: numberFormat( totalCount ), value: numberFormat( totalResults ),
}, },
{ {
label: _n( 'order', 'orders', totals.orders_count, 'wc-admin' ), label: _n( 'order', 'orders', totals.orders_count, 'wc-admin' ),
@ -245,7 +245,7 @@ export default compose(
tableData: { tableData: {
items: { items: {
data: get( revenueData, [ 'data', 'intervals' ] ), data: get( revenueData, [ 'data', 'intervals' ] ),
totalCount: get( revenueData, [ 'totalResults' ] ), totalResults: get( revenueData, [ 'totalResults' ] ),
}, },
isError, isError,
isRequesting, isRequesting,