From 2cce4e90c5c00de3437256d90843f90c69624714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Wed, 24 Oct 2018 16:25:53 +0200 Subject: [PATCH] Use downloadable prop in Products report table (https://github.com/woocommerce/woocommerce-admin/pull/668) --- .../client/analytics/report/products/table.js | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugins/woocommerce-admin/client/analytics/report/products/table.js b/plugins/woocommerce-admin/client/analytics/report/products/table.js index 5309a165096..299cb706415 100644 --- a/plugins/woocommerce-admin/client/analytics/report/products/table.js +++ b/plugins/woocommerce-admin/client/analytics/report/products/table.js @@ -10,23 +10,11 @@ import { map, orderBy } from 'lodash'; * Internal dependencies */ import { Card, Link, TableCard, TablePlaceholder } from '@woocommerce/components'; -import { downloadCSVFile, generateCSVDataFromTable, generateCSVFileName } from 'lib/csv'; import { formatCurrency, getCurrencyFormatDecimal } from 'lib/currency'; import { onQueryChange } from 'lib/nav-utils'; import ReportError from 'analytics/components/report-error'; export default class ProductsReportTable extends Component { - onDownload( headers, rows, query ) { - // @TODO The current implementation only downloads the contents displayed in the table. - // Another solution is required when the data set is larger (see #311). - return () => { - downloadCSVFile( - generateCSVFileName( 'products', query ), - generateCSVDataFromTable( headers, rows ) - ); - }; - } - getHeadersContent() { return [ { @@ -167,7 +155,7 @@ export default class ProductsReportTable extends Component { } renderTable( tableQuery ) { - const { products, query, totalRows } = this.props; + const { products, totalRows } = this.props; const rowsPerPage = parseInt( tableQuery.per_page ) || 25; const orderedProducts = orderBy( products, tableQuery.orderby, tableQuery.order ); @@ -189,10 +177,10 @@ export default class ProductsReportTable extends Component { labels={ labels } ids={ orderedProducts.map( p => p.product_id ) } compareBy={ 'product' } - onClickDownload={ this.onDownload( headers, rows, query ) } onQueryChange={ onQueryChange } query={ tableQuery } summary={ null } // @TODO + downloadable /> ); }