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.
This commit is contained in:
Armen Zambrano G 2019-04-10 14:23:49 -04:00 коммит произвёл Armen Zambrano G
Родитель 0f5c513170
Коммит 95ff5ad63c
7 изменённых файлов: 1 добавлений и 279 удалений

Просмотреть файл

@ -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 (
<DetailView title={person.cn} onGoBack={onGoBack}>
<BugzillaComponents
title="Components"
bugzillaComponents={components}
/>
</DetailView>
);
}
}
PersonDetails.propTypes = {
person: PropTypes.shape({}).isRequired,
bugzillaComponents: PropTypes.arrayOf(
PropTypes.shape({}),
).isRequired,
onGoBack: PropTypes.func.isRequired,
};
export default PersonDetails;

Просмотреть файл

@ -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,
}) => (
<div className={classes.root}>
<div height="1rem">&nbsp;</div>
@ -33,13 +32,6 @@ const Reportees = ({
.sort(sortByPersonName)
.map(({ cn, mail }) => (
<div key={mail} className={classes.person}>
<DrilldownIcon
name={mail}
onChange={onPersonDetails}
properties={{
ldapEmail: mail,
}}
/>
<span>{`${cn} `}</span>
</div>
))}
@ -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);

Просмотреть файл

@ -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 {
/>
</Suspense>
)}
{personDetails && (
<Suspense fallback={<div>Loading...</div>}>
<PersonDetails
person={personDetails}
bugzillaComponents={Object.values(bugzillaComponents)}
onGoBack={this.handleComponentBackToMenu}
/>
</Suspense>
)}
<Suspense fallback={<div>Loading...</div>}>
<Switch>
{partialOrg && (

Просмотреть файл

@ -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((
<PersonDetails
person={person}
bugzillaComponents={bugzillaComponents}
onGoBack={() => null}
/>
))
.toJSON();
expect(tree).toMatchSnapshot();
});
it('renders the details for a manager', () => {
const person = partialOrg['manager@mozilla.com'];
const tree = renderer
.create((
<PersonDetails
person={person}
bugzillaComponents={bugzillaComponents}
onGoBack={() => null}
/>
))
.toJSON();
expect(tree).toMatchSnapshot();
});

Просмотреть файл

@ -9,7 +9,6 @@ it('renders Someone with no reportees', () => {
<Reportees
ldapEmail="someone@mozilla.com"
partialOrg={partialOrg}
onPersonDetails={() => null}
/>
))
.toJSON();
@ -22,7 +21,6 @@ it('renders Manager who has reportees', () => {
<Reportees
ldapEmail="manager@mozilla.com"
partialOrg={partialOrg}
onPersonDetails={() => null}
/>
))
.toJSON();

Просмотреть файл

@ -1,75 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders the details for a manager 1`] = `
<div
className="DetailView-root-1"
>
<div>
<a
href="/"
onClick={[Function]}
rel="noopener noreferrer"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-3"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M0 0h24v24H0z"
fill="none"
/>
<path
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
/>
</svg>
</a>
</div>
<div>
<h2
className="DetailView-title-2"
>
Manager
</h2>
</div>
</div>
`;
exports[`renders the details for an individual contributor 1`] = `
<div
className="DetailView-root-1"
>
<div>
<a
href="/"
onClick={[Function]}
rel="noopener noreferrer"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-3"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M0 0h24v24H0z"
fill="none"
/>
<path
d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
/>
</svg>
</a>
</div>
<div>
<h2
className="DetailView-title-2"
>
Someone
</h2>
</div>
</div>
`;

Просмотреть файл

@ -12,30 +12,6 @@ exports[`renders Manager who has reportees 1`] = `
<div
className="Reportees-person-4"
>
<div
className="DrilldownIcon-svgWrapper-5"
name="manager@mozilla.com"
onClick={[Function]}
onKeyPress={[Function]}
role="button"
tabIndex="0"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-7 DrilldownIcon-icon-6"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
/>
<path
d="M0 0h24v24H0z"
fill="none"
/>
</svg>
</div>
<span>
Manager
</span>
@ -43,30 +19,6 @@ exports[`renders Manager who has reportees 1`] = `
<div
className="Reportees-person-4"
>
<div
className="DrilldownIcon-svgWrapper-5"
name="someone@mozilla.com"
onClick={[Function]}
onKeyPress={[Function]}
role="button"
tabIndex="0"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-7 DrilldownIcon-icon-6"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
/>
<path
d="M0 0h24v24H0z"
fill="none"
/>
</svg>
</div>
<span>
Someone
</span>
@ -86,30 +38,6 @@ exports[`renders Someone with no reportees 1`] = `
<div
className="Reportees-person-4"
>
<div
className="DrilldownIcon-svgWrapper-5"
name="manager@mozilla.com"
onClick={[Function]}
onKeyPress={[Function]}
role="button"
tabIndex="0"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-7 DrilldownIcon-icon-6"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
/>
<path
d="M0 0h24v24H0z"
fill="none"
/>
</svg>
</div>
<span>
Manager
</span>
@ -117,30 +45,6 @@ exports[`renders Someone with no reportees 1`] = `
<div
className="Reportees-person-4"
>
<div
className="DrilldownIcon-svgWrapper-5"
name="someone@mozilla.com"
onClick={[Function]}
onKeyPress={[Function]}
role="button"
tabIndex="0"
>
<svg
aria-hidden="true"
className="MuiSvgIcon-root-7 DrilldownIcon-icon-6"
focusable="false"
role="presentation"
viewBox="0 0 24 24"
>
<path
d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
/>
<path
d="M0 0h24v24H0z"
fill="none"
/>
</svg>
</div>
<span>
Someone
</span>