From 95ff5ad63c555067bfe9a24c078136f7fa30074b Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <> Date: Wed, 10 Apr 2019 14:23:49 -0400 Subject: [PATCH] Remove detailed view for a person since it was blank and we won't support it We're going to show the details of all reportees on the main view rather than drilling down. --- src/components/PersonDetails/index.jsx | 40 -------- src/components/Reportees/index.jsx | 11 +-- src/views/Main/index.jsx | 23 ----- test/components/PersonDetails.test.jsx | 33 ------- test/components/Reportees.test.jsx | 2 - .../__snapshots__/PersonDetails.test.jsx.snap | 75 --------------- .../__snapshots__/Reportees.test.jsx.snap | 96 ------------------- 7 files changed, 1 insertion(+), 279 deletions(-) delete mode 100644 src/components/PersonDetails/index.jsx delete mode 100644 test/components/PersonDetails.test.jsx delete mode 100644 test/components/__snapshots__/PersonDetails.test.jsx.snap diff --git a/src/components/PersonDetails/index.jsx b/src/components/PersonDetails/index.jsx deleted file mode 100644 index 7380f8a..0000000 --- a/src/components/PersonDetails/index.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import DetailView from '../DetailView'; -import BugzillaComponents from '../BugzillaComponents'; - -class PersonDetails extends React.Component { - render() { - const { person, bugzillaComponents, onGoBack } = this.props; - - // Filter out components not associated to this person - const components = bugzillaComponents - .reduce((result, bzComponent) => { - const { bugzillaEmail } = bzComponent; - if (bugzillaEmail === person.bugzillaEmail) { - // eslint-disable-next-line no-param-reassign - result.push(bzComponent); - } - return result; - }, []); - - return ( - - - - ); - } -} - -PersonDetails.propTypes = { - person: PropTypes.shape({}).isRequired, - bugzillaComponents: PropTypes.arrayOf( - PropTypes.shape({}), - ).isRequired, - onGoBack: PropTypes.func.isRequired, -}; - -export default PersonDetails; diff --git a/src/components/Reportees/index.jsx b/src/components/Reportees/index.jsx index b640b4a..cd6930c 100644 --- a/src/components/Reportees/index.jsx +++ b/src/components/Reportees/index.jsx @@ -1,7 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { withStyles } from '@material-ui/core/styles'; -import DrilldownIcon from '../DrilldownIcon'; const styles = ({ root: { @@ -24,7 +23,7 @@ const styles = ({ const sortByPersonName = (a, b) => a.cn.localeCompare(b.cn); const Reportees = ({ - classes, ldapEmail, partialOrg, onPersonDetails, + classes, ldapEmail, partialOrg, }) => (
 
@@ -33,13 +32,6 @@ const Reportees = ({ .sort(sortByPersonName) .map(({ cn, mail }) => (
- {`${cn} `}
))} @@ -50,7 +42,6 @@ Reportees.propTypes = { classes: PropTypes.shape({}).isRequired, ldapEmail: PropTypes.string.isRequired, partialOrg: PropTypes.shape({}).isRequired, - onPersonDetails: PropTypes.func.isRequired, }; export default withStyles(styles)(Reportees); diff --git a/src/views/Main/index.jsx b/src/views/Main/index.jsx index 159dcfd..f9268e3 100644 --- a/src/views/Main/index.jsx +++ b/src/views/Main/index.jsx @@ -12,7 +12,6 @@ import { TEAMS_CONFIG, BZ_QUERIES } from '../../config'; const BugzillaComponents = React.lazy(() => import('../../components/BugzillaComponents')); const BugzillaComponentDetails = React.lazy(() => import('../../components/BugzillaComponentDetails')); -const PersonDetails = React.lazy(() => import('../../components/PersonDetails')); const Reportees = React.lazy(() => import('../../components/Reportees')); const Teams = React.lazy(() => import('../Teams')); @@ -23,7 +22,6 @@ const DEFAULT_STATE = { teamComponents: {}, selectedTabIndex: 0, componentDetails: undefined, - personDetails: undefined, }; const PATHNAME_TO_TAB_INDEX = { @@ -49,7 +47,6 @@ class MainContainer extends Component { // This guarantees that we load the right tab based on the URL's pathname this.state.selectedTabIndex = PATHNAME_TO_TAB_INDEX[location.pathname] || 0; this.handleShowComponentDetails = this.handleShowComponentDetails.bind(this); - this.handleShowPersonDetails = this.handleShowPersonDetails.bind(this); this.handleComponentBackToMenu = this.handleComponentBackToMenu.bind(this); } @@ -88,7 +85,6 @@ class MainContainer extends Component { handleNavigateAndClear = (_, selectedTabIndex) => { this.setState({ componentDetails: undefined, - personDetails: undefined, selectedTabIndex, }); }; @@ -197,19 +193,10 @@ class MainContainer extends Component { } } - handleShowPersonDetails(event, properties) { - event.preventDefault(); - const { partialOrg } = this.state; - this.setState({ - personDetails: partialOrg[properties.ldapEmail], - }); - } - handleComponentBackToMenu(event) { event.preventDefault(); this.setState({ componentDetails: undefined, - personDetails: undefined, }); } @@ -217,7 +204,6 @@ class MainContainer extends Component { const { doneLoading, componentDetails, - personDetails, bugzillaComponents, ldapEmail, partialOrg, @@ -244,15 +230,6 @@ class MainContainer extends Component { /> )} - {personDetails && ( - Loading...
}> - - - )} Loading...}> {partialOrg && ( diff --git a/test/components/PersonDetails.test.jsx b/test/components/PersonDetails.test.jsx deleted file mode 100644 index 029a080..0000000 --- a/test/components/PersonDetails.test.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import PersonDetails from '../../src/components/PersonDetails'; -import partialOrg from '../mocks/partialOrg'; -import bugzillaComponents from '../mocks/bugzillaComponents'; - -it('renders the details for an individual contributor', () => { - const person = partialOrg['someone@mozilla.com']; - const tree = renderer - .create(( - null} - /> - )) - .toJSON(); - expect(tree).toMatchSnapshot(); -}); - -it('renders the details for a manager', () => { - const person = partialOrg['manager@mozilla.com']; - const tree = renderer - .create(( - null} - /> - )) - .toJSON(); - expect(tree).toMatchSnapshot(); -}); diff --git a/test/components/Reportees.test.jsx b/test/components/Reportees.test.jsx index c909d44..d5922ec 100644 --- a/test/components/Reportees.test.jsx +++ b/test/components/Reportees.test.jsx @@ -9,7 +9,6 @@ it('renders Someone with no reportees', () => { null} /> )) .toJSON(); @@ -22,7 +21,6 @@ it('renders Manager who has reportees', () => { null} /> )) .toJSON(); diff --git a/test/components/__snapshots__/PersonDetails.test.jsx.snap b/test/components/__snapshots__/PersonDetails.test.jsx.snap deleted file mode 100644 index 28f6e4b..0000000 --- a/test/components/__snapshots__/PersonDetails.test.jsx.snap +++ /dev/null @@ -1,75 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`renders the details for a manager 1`] = ` -
- -
-

- Manager -

-
-
-`; - -exports[`renders the details for an individual contributor 1`] = ` -
- -
-

- Someone -

-
-
-`; diff --git a/test/components/__snapshots__/Reportees.test.jsx.snap b/test/components/__snapshots__/Reportees.test.jsx.snap index 2072d6f..3d335cb 100644 --- a/test/components/__snapshots__/Reportees.test.jsx.snap +++ b/test/components/__snapshots__/Reportees.test.jsx.snap @@ -12,30 +12,6 @@ exports[`renders Manager who has reportees 1`] = `
-
- -
Manager @@ -43,30 +19,6 @@ exports[`renders Manager who has reportees 1`] = `
-
- -
Someone @@ -86,30 +38,6 @@ exports[`renders Someone with no reportees 1`] = `
-
- -
Manager @@ -117,30 +45,6 @@ exports[`renders Someone with no reportees 1`] = `
-
- -
Someone