Add base downloads report page (https://github.com/woocommerce/woocommerce-admin/pull/1106)
This commit is contained in:
parent
e42ad6956b
commit
5924be5fa2
|
@ -4,8 +4,12 @@
|
|||
*/
|
||||
import { __, _x } from '@wordpress/i18n';
|
||||
import { decodeEntities } from '@wordpress/html-entities';
|
||||
import { getRequestByIdString } from '../../../lib/async-requests';
|
||||
import { NAMESPACE } from '../../../store/constants';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { getRequestByIdString } from 'lib/async-requests';
|
||||
import { NAMESPACE } from 'store/constants';
|
||||
|
||||
export const filters = [
|
||||
{
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/** @format */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { __, _x } from '@wordpress/i18n';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { getRequestByIdString } from 'lib/async-requests';
|
||||
import { NAMESPACE } from 'store/constants';
|
||||
|
||||
export const filters = [
|
||||
{
|
||||
label: __( 'Show', 'wc-admin' ),
|
||||
staticParams: [],
|
||||
param: 'filter',
|
||||
showFilters: () => true,
|
||||
filters: [
|
||||
{ label: __( 'All Downloads', 'wc-admin' ), value: 'all' },
|
||||
{ label: __( 'Advanced Filters', 'wc-admin' ), value: 'advanced' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
/*eslint-disable max-len*/
|
||||
export const advancedFilters = {
|
||||
title: _x(
|
||||
'Downloads Match {{select /}} Filters',
|
||||
'A sentence describing filters for Downloads. See screen shot for context: https://cloudup.com/ccxhyH2mEDg',
|
||||
'wc-admin'
|
||||
),
|
||||
filters: {
|
||||
product: {
|
||||
labels: {
|
||||
add: __( 'Product', 'wc-admin' ),
|
||||
placeholder: __( 'Search', 'wc-admin' ),
|
||||
remove: __( 'Remove product filter', 'wc-admin' ),
|
||||
rule: __( 'Select a product filter match', 'wc-admin' ),
|
||||
/* translators: A sentence describing a Product filter. See screen shot for context: https://cloudup.com/ccxhyH2mEDg */
|
||||
title: __( 'Product {{rule /}} {{filter /}}', 'wc-admin' ),
|
||||
filter: __( 'Select product', 'wc-admin' ),
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
value: 'includes',
|
||||
/* translators: Sentence fragment, logical, "Includes" refers to products including a given product(s). Screenshot for context: https://cloudup.com/ccxhyH2mEDg */
|
||||
label: _x( 'Includes', 'products', 'wc-admin' ),
|
||||
},
|
||||
{
|
||||
value: 'excludes',
|
||||
/* translators: Sentence fragment, logical, "Excludes" refers to products excluding a products(s). Screenshot for context: https://cloudup.com/ccxhyH2mEDg */
|
||||
label: _x( 'Excludes', 'products', 'wc-admin' ),
|
||||
},
|
||||
],
|
||||
input: {
|
||||
component: 'Search',
|
||||
type: 'products',
|
||||
getLabels: getRequestByIdString( NAMESPACE + 'products', product => ( {
|
||||
id: product.id,
|
||||
label: product.name,
|
||||
} ) ),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
/*eslint-enable max-len*/
|
|
@ -0,0 +1,38 @@
|
|||
/** @format */
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { Component, Fragment } from '@wordpress/element';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
/**
|
||||
* WooCommerce dependencies
|
||||
*/
|
||||
import { ReportFilters } from '@woocommerce/components';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { filters, advancedFilters } from './config';
|
||||
|
||||
export default class DownloadsReport extends Component {
|
||||
render() {
|
||||
const { query, path } = this.props;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<ReportFilters
|
||||
query={ query }
|
||||
path={ path }
|
||||
filters={ filters }
|
||||
showDatePicker={ false }
|
||||
advancedFilters={ advancedFilters }
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DownloadsReport.propTypes = {
|
||||
query: PropTypes.object.isRequired,
|
||||
};
|
|
@ -24,6 +24,7 @@ import RevenueReport from './revenue';
|
|||
import CategoriesReport from './categories';
|
||||
import CouponsReport from './coupons';
|
||||
import TaxesReport from './taxes';
|
||||
import DownloadsReport from './downloads';
|
||||
import StockReport from './stock';
|
||||
import CustomersReport from './customers';
|
||||
|
||||
|
@ -61,6 +62,11 @@ const getReports = () => {
|
|||
title: __( 'Taxes', 'wc-admin' ),
|
||||
component: TaxesReport,
|
||||
},
|
||||
{
|
||||
report: 'downloads',
|
||||
title: __( 'Downloads', 'wc-admin' ),
|
||||
component: DownloadsReport,
|
||||
},
|
||||
{
|
||||
report: 'stock',
|
||||
title: __( 'Stock', 'wc-admin' ),
|
||||
|
|
|
@ -133,6 +133,14 @@ function wc_admin_register_pages() {
|
|||
)
|
||||
);
|
||||
|
||||
wc_admin_register_page(
|
||||
array(
|
||||
'title' => __( 'Downloads', 'wc-admin' ),
|
||||
'parent' => '/analytics/revenue',
|
||||
'path' => '/analytics/downloads',
|
||||
)
|
||||
);
|
||||
|
||||
wc_admin_register_page(
|
||||
array(
|
||||
'title' => __( 'Stock', 'wc-admin' ),
|
||||
|
|
Loading…
Reference in New Issue