From 85f06af736157f60392c86e750f729640cac1daa Mon Sep 17 00:00:00 2001 From: Richard Dinh Date: Tue, 16 Jun 2020 15:34:31 -0400 Subject: [PATCH] remove issues from snapshots remove more issues --- src/components/Map/MapPanel.jsx | 12 +--- src/components/Trends/LensTabs.jsx | 10 +-- src/components/Trends/TrendsPanel.jsx | 34 ++++------ .../__snapshots__/MapPanel.spec.jsx.snap | 30 --------- .../__snapshots__/ResultsPanel.spec.jsx.snap | 25 -------- .../__snapshots__/TrendsPanel.spec.jsx.snap | 63 ------------------- src/utils/__tests__/chart.spec.jsx | 6 +- src/utils/chart.jsx | 2 +- 8 files changed, 19 insertions(+), 163 deletions(-) diff --git a/src/components/Map/MapPanel.jsx b/src/components/Map/MapPanel.jsx index 374c5c159..718123e1e 100644 --- a/src/components/Map/MapPanel.jsx +++ b/src/components/Map/MapPanel.jsx @@ -48,11 +48,6 @@ export class MapPanel extends React.Component { data={this.props.productData.data} title="Product by highest complaint volume" total={ this.props.total }/> - @@ -71,16 +66,13 @@ const mapStateToProps = state => { const { enablePer1000, - issue: issueFilters, - mapWarningEnabled, - product: productFilters + mapWarningEnabled } = query return { error, isLoading, - issueData: processRows( issueFilters, results.issue, false ), - productData: processRows( productFilters, results.product, false ), + productData: processRows( results.product, false ), showMobileFilters: state.view.width < 750, showWarning: !enablePer1000 && mapWarningEnabled, total: state.aggs.total diff --git a/src/components/Trends/LensTabs.jsx b/src/components/Trends/LensTabs.jsx index 54c92c2c5..7bea93b87 100644 --- a/src/components/Trends/LensTabs.jsx +++ b/src/components/Trends/LensTabs.jsx @@ -6,12 +6,7 @@ import React from 'react' const lensMaps = { Company: { - tab1: { displayName: 'Products', filterName: 'product' }, - tab2: { displayName: 'Issues', filterName: 'issue' } - }, - Issue: { - tab1: { displayName: 'Sub-issues', filterName: 'sub_issue' }, - tab2: { displayName: 'Products', filterName: 'product' } + tab1: { displayName: 'Products', filterName: 'product' } }, Product: { tab1: { displayName: 'Sub-products', filterName: 'sub_product' }, @@ -49,12 +44,13 @@ export class LensTabs extends React.Component { onClick={ () => this._setTab( lensMaps[lens].tab1.filterName ) }> { lensMaps[lens].tab1.displayName } - + { lensMaps[lens].tab2 && + } ) diff --git a/src/components/Trends/TrendsPanel.jsx b/src/components/Trends/TrendsPanel.jsx index 57cba9b13..04214b412 100644 --- a/src/components/Trends/TrendsPanel.jsx +++ b/src/components/Trends/TrendsPanel.jsx @@ -26,7 +26,7 @@ import { showCompanyOverLay } from '../../utils/trends' import StackedAreaChart from '../Charts/StackedAreaChart' const intervals = [ 'Day', 'Week', 'Month', 'Quarter', 'Year' ] -const lenses = [ 'Overview', 'Company', 'Product', 'Issue' ] +const lenses = [ 'Overview', 'Company', 'Product' ] const subLensMap = { sub_product: 'Sub-products', sub_issue: 'Sub-issues', @@ -56,20 +56,12 @@ export class TrendsPanel extends React.Component { _phaseMap() { if ( this.props.overview ) { - return [ - , - - ] + return } if ( this.props.focus ) { @@ -164,8 +156,6 @@ const mapStateToProps = state => { const { company: companyFilters, dateInterval, - issue: issueFilters, - product: productFilters, lens, subLens } = query @@ -175,19 +165,17 @@ const mapStateToProps = state => { } = trends const lensKey = lens.toLowerCase() - const dataLensFilters = query[lensKey] const focusKey = subLens.replace( '_', '-' ) return { chartType, - companyData: processRows( companyFilters, results.company, false ), + companyData: processRows( results.company, false ), companyOverlay: showCompanyOverLay( lens, companyFilters, isLoading ), dateInterval, focus, - focusData: processRows( issueFilters, results[focusKey], colorMap ), + focusData: processRows( results[focusKey], colorMap ), isLoading, - issueData: processRows( issueFilters, results.issue, false ), - productData: processRows( productFilters, results.product, false ), - dataLensData: processRows( dataLensFilters, results[lensKey], colorMap ), + productData: processRows( results.product, false ), + dataLensData: processRows( results[lensKey], colorMap ), lens, overview: lens === 'Overview', showMobileFilters: state.view.width < 750, diff --git a/src/components/__tests__/__snapshots__/MapPanel.spec.jsx.snap b/src/components/__tests__/__snapshots__/MapPanel.spec.jsx.snap index 845d2f21a..1257a5405 100644 --- a/src/components/__tests__/__snapshots__/MapPanel.spec.jsx.snap +++ b/src/components/__tests__/__snapshots__/MapPanel.spec.jsx.snap @@ -179,16 +179,6 @@ exports[`component:MapPanel renders Print without crashing 1`] = ` id="row-chart-product" /> -
-

- Issue by highest complaint volume -

-
-
`; @@ -408,16 +398,6 @@ exports[`component:MapPanel renders warning without crashing 1`] = ` id="row-chart-product" />
-
-

- Issue by highest complaint volume -

-
-
`; @@ -600,15 +580,5 @@ exports[`component:MapPanel renders without crashing 1`] = ` id="row-chart-product" />
-
-

- Issue by highest complaint volume -

-
-
`; diff --git a/src/components/__tests__/__snapshots__/ResultsPanel.spec.jsx.snap b/src/components/__tests__/__snapshots__/ResultsPanel.spec.jsx.snap index 831854c34..f3b3aad28 100644 --- a/src/components/__tests__/__snapshots__/ResultsPanel.spec.jsx.snap +++ b/src/components/__tests__/__snapshots__/ResultsPanel.spec.jsx.snap @@ -695,16 +695,6 @@ exports[`component:Results renders Map print mode without crashing 1`] = ` id="row-chart-product" />
-
-

- Issue by highest complaint volume -

-
-
-
-

- Issue by highest complaint volume -

-
-
`; @@ -1480,11 +1460,6 @@ exports[`component:Results renders trends panel without crashing 1`] = ` > Product - Product - Product - Product - Products -
Product - Product -
-
-

- Issue by highest complaint volume -

-
-
`; @@ -1864,11 +1823,6 @@ exports[`component:TrendsPanel Snapshots renders mobile filters without crashing > Product - Products -
Product - Products -
{ it( 'handles empty rows / bad data', () => { - const filters = [] - const res = sut.processRows( filters, false, false ) + const res = sut.processRows( false, false ) expect( res ).toEqual( { colorScheme: [], data: [] @@ -181,14 +180,13 @@ describe( 'processRows', () => { } ) it( 'returns only visible rows', () => { - const filters = [] const rows = [ { name: 'abc', visible: true, value: 123 }, { name: 'def', visible: true, value: 123 }, { name: 'Complaint', visible: true, value: 123 }, { name: 'Compla', parent: 'Complaint', visible: false, value: 123 }, { name: 'de11f', parent: 'def', visible: false, value: 123 } ] - const res = sut.processRows( filters, rows, false ) + const res = sut.processRows( rows, false ) expect( res ).toEqual( { colorScheme: [ '#20aa3f', '#20aa3f', '#20aa3f' ], data: [ diff --git a/src/utils/chart.jsx b/src/utils/chart.jsx index cb6921b7c..b17dc5068 100644 --- a/src/utils/chart.jsx +++ b/src/utils/chart.jsx @@ -116,7 +116,7 @@ export const getColorScheme = ( rowNames, colorMap ) => return '#20aa3f' } ) -export const processRows = ( filters, rows, colorMap ) => { +export const processRows = ( rows, colorMap ) => { let data = rows ? rows : [] data = data.filter( o => o.visible ) const colorScheme = getColorScheme( data, colorMap )