Skip to content

Commit

Permalink
Merge pull request #447 from MetaPhase-Consulting/dev
Browse files Browse the repository at this point in the history
dev -> staging
  • Loading branch information
rtirserio committed Sep 26, 2019
2 parents 75b2504 + e8c2cbc commit 96d0946
Show file tree
Hide file tree
Showing 56 changed files with 1,685 additions and 468 deletions.
3 changes: 2 additions & 1 deletion public/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"static_content": true,
"notifications": true,
"complete_bidding": true,
"data_sync_admin": true
"data_sync_admin": true,
"available_positions": false
}
}
3 changes: 2 additions & 1 deletion public/config/config_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"static_content": true,
"notifications": true,
"complete_bidding": true,
"data_sync_admin": true
"data_sync_admin": true,
"available_positions": false
}
}
2 changes: 2 additions & 0 deletions src/Components/AdministratorPage/AdministratorPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Route, Switch } from 'react-router-dom';
import { EMPTY_FUNCTION } from '../../Constants/PropTypes';
import Dashboard from './Dashboard';
import Logs from './Logs';
import Stats from './Stats';

const AdministratorPage = (props) => {
const {
Expand Down Expand Up @@ -52,6 +53,7 @@ const AdministratorPage = (props) => {
<Switch>
<Route path="/profile/administrator/dashboard" render={() => <Dashboard {...dashboardProps} />} />
<Route path="/profile/administrator/logs" render={() => <Logs {...logsProps} />} />
<Route path="/profile/administrator/stats" render={() => <Stats />} />
</Switch>
</div>
);
Expand Down
93 changes: 93 additions & 0 deletions src/Components/AdministratorPage/Stats/Stats.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import numeral from 'numeral';
import ProfileSectionTitle from '../../ProfileSectionTitle';
import Spinner from '../../Spinner';
import { EMPTY_FUNCTION } from '../../../Constants/PropTypes';
import { getLoginStats } from '../../../actions/stats';
import BidStatCard from '../../BidStatistics/BidStatCard';

export const formatNum = n => numeral(n).format('0,0');

class Stats extends Component {
constructor(props) {
super(props);
this.state = {
selected: '',
};
}

componentWillMount() {
const { getStats } = this.props;
getStats();
}

render() {
const {
stats,
statsIsLoading,
statsHasErrored,
} = this.props;

const statsSuccess = !statsIsLoading && !statsHasErrored;

return (
<div
className={`usa-grid-full profile-content-inner-container administrator-page
${(statsIsLoading) ? 'results-loading' : ''}`}
>
{
statsIsLoading && !statsHasErrored &&
<Spinner type="homepage-position-results" size="big" />
}
<div className="usa-grid-full">
<ProfileSectionTitle title="Login Statistics" icon="sitemap" />
</div>
{
statsSuccess &&
<div className="usa-grid-full bid-stat-card-list">
<div className="usa-grid-full">
<h3>Total Logins</h3>
{stats.filter(f => f.type === 'total').map(m => (
<BidStatCard title={m.title} number={formatNum(m.count)} />
))}
</div>
<div className="usa-grid-full">
<h3>Unique Logins</h3>
{stats.filter(f => f.type === 'unique').map(m => (
<BidStatCard title={m.title} number={formatNum(m.count)} />
))}
</div>
</div>
}
</div>
);
}
}

Stats.propTypes = {
stats: PropTypes.shape({}),
statsIsLoading: PropTypes.bool,
statsHasErrored: PropTypes.bool,
getStats: PropTypes.func,
};

Stats.defaultProps = {
stats: [],
statsIsLoading: false,
statsHasErrored: false,
getStats: EMPTY_FUNCTION,
};

const mapStateToProps = state => ({
stats: state.stats,
statsIsLoading: state.statsIsLoading,
statsHasErrored: state.statsHasErrored,
});

export const mapDispatchToProps = dispatch => ({
getStats: (options = {}) => dispatch(getLoginStats({ options })),
});

export default connect(mapStateToProps, mapDispatchToProps)(Stats);
1 change: 1 addition & 0 deletions src/Components/AdministratorPage/Stats/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Stats';
2 changes: 1 addition & 1 deletion src/Components/CompareList/CompareList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class CompareList extends Component {
{
compareArray.map(c => (
<td key={shortId.generate()}>
{propOrDefault(c.position, 'current_assignment.estimated_end_date') ? formatDate(c.position.current_assignment.estimated_end_date) : NO_DATE }
{propOrDefault(c, 'ted') ? formatDate(c.ted) : NO_DATE }
</td>
))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ exports[`CompareListComponent matches snapshot 1`] = `
None listed
</td>
<td>
03/13/2020
None listed
</td>
<td
className="empty"
Expand Down Expand Up @@ -745,7 +745,7 @@ exports[`CompareListComponent matches snapshot when there is an obc id 1`] = `
None listed
</td>
<td>
03/13/2020
None listed
</td>
<td
className="empty"
Expand Down
11 changes: 6 additions & 5 deletions src/Components/CondensedCardData/CondensedCardData.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React from 'react';
import { get } from 'lodash';
import { POSITION_DETAILS } from '../../Constants/PropTypes';
import { NO_DATE, NO_GRADE, NO_SKILL } from '../../Constants/SystemMessages';
import LanguageList from '../LanguageList';
import CondensedCardDataPoint from './CondensedCardDataPoint';
import { formatDate, propOrDefault } from '../../utilities';

const CondensedCardData = ({ position }) => {
const estimatedEndDate = propOrDefault(position, 'current_assignment.estimated_end_date') ?
formatDate(position.current_assignment.estimated_end_date) : NO_DATE;
const estimatedEndDate = propOrDefault(position, 'ted') ?
formatDate(position.ted) : NO_DATE;
return (
<div className="usa-grid-full condensed-card-data">
<CondensedCardDataPoint
Expand All @@ -17,17 +18,17 @@ const CondensedCardData = ({ position }) => {
/>
<CondensedCardDataPoint
title="Skill"
content={position.skill || NO_SKILL}
content={get(position, 'position.skill', NO_SKILL)}
hasFixedTitleWidth
/>
<CondensedCardDataPoint
title="Grade"
content={position.grade || NO_GRADE}
content={get(position, 'position.grade', NO_GRADE)}
hasFixedTitleWidth
/>
<CondensedCardDataPoint
title="Language"
content={<LanguageList languages={position.languages} propToUse="representation" />}
content={<LanguageList languages={get(position, 'position.languages')} propToUse="representation" />}
hasFixedTitleWidth
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ exports[`CondensedCardDataComponent matches snapshot 1`] = `
title="TED"
/>
<CondensedCardDataPoint
content="None listed"
content="OFFICE MANAGEMENT (9017)"
hasFixedTitleWidth={true}
title="Skill"
/>
<CondensedCardDataPoint
content="None listed"
content="06"
hasFixedTitleWidth={true}
title="Grade"
/>
Expand All @@ -42,12 +42,12 @@ exports[`CondensedCardDataComponent matches snapshot with an empty estimated end
title="TED"
/>
<CondensedCardDataPoint
content="None listed"
content="OFFICE MANAGEMENT (9017)"
hasFixedTitleWidth={true}
title="Skill"
/>
<CondensedCardDataPoint
content="None listed"
content="06"
hasFixedTitleWidth={true}
title="Grade"
/>
Expand All @@ -74,12 +74,12 @@ exports[`CondensedCardDataComponent matches snapshot with an empty skill 1`] = `
title="TED"
/>
<CondensedCardDataPoint
content="None listed"
content="OFFICE MANAGEMENT (9017)"
hasFixedTitleWidth={true}
title="Skill"
/>
<CondensedCardDataPoint
content="None listed"
content="06"
hasFixedTitleWidth={true}
title="Grade"
/>
Expand Down
9 changes: 7 additions & 2 deletions src/Components/PositionDetails/PositionDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class PositionDetails extends Component {
highlightPosition,
onHighlight,
userProfileIsLoading,
isProjectedVacancy,
} = this.props;

const isReady = details.id && userProfile.id && !isLoading && !hasErrored;
Expand All @@ -76,20 +77,22 @@ class PositionDetails extends Component {
editWebsiteContent={editWebsiteContent}
resetDescriptionEditMessages={resetDescriptionEditMessages}
userProfile={userProfile}
isProjectedVacancy={isProjectedVacancy}
/>
<PositionDetailsItem
details={position}
details={details}
editDescriptionContent={this.editDescriptionContent}
editPocContent={editPocContent}
editWebsiteContent={editWebsiteContent}
resetDescriptionEditMessages={resetDescriptionEditMessages}
userProfile={userProfile}
highlightPosition={highlightPosition}
onHighlight={onHighlight}
isProjectedVacancy={isProjectedVacancy}
/>
<hr />
<Row className="position-details-description-container padded-main-content" fluid>
<PositionSimilarPositions id={details.id} />
{ !isProjectedVacancy && <PositionSimilarPositions id={details.id} /> }
</Row>
</div>}
{isLoading$ && <Spinner type="position-details" size="big" />}
Expand Down Expand Up @@ -118,6 +121,7 @@ PositionDetails.propTypes = {
editWebsiteContent: PropTypes.func.isRequired,
highlightPosition: HIGHLIGHT_POSITION,
onHighlight: PropTypes.func.isRequired,
isProjectedVacancy: PropTypes.bool,
};

PositionDetails.defaultProps = {
Expand All @@ -131,6 +135,7 @@ PositionDetails.defaultProps = {
descriptionEditSuccess: false,
highlightPosition: DEFAULT_HIGHLIGHT_POSITION,
onHighlight: EMPTY_FUNCTION,
isProjectedVacancy: false,
};

export default PositionDetails;
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PositionDetailsContact extends Component {

const isAllowedToEdit = !!(propOrDefault(details, 'description.is_editable_by_user'));

const formattedDate = formatDate(details.update_date);
const formattedDate = formatDate(details.description.date_updated);

const OBCUrl = propOrDefault(details, 'post.post_overview_url');

Expand Down Expand Up @@ -120,7 +120,7 @@ class PositionDetailsContact extends Component {
</div>
</div>
<div className={`contact-container ${!OBCUrl ? 'no-button' : ''}`}>
<strong>Updated</strong>: {formattedDate}
<strong>Capsule Last Updated</strong>: {formattedDate}
</div>
<div className="offset-bid-button-container">
<div className="offset-bid-button-container-button">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ exports[`PositionDetailsContact matches snapshot 1`] = `
className="contact-container no-button"
>
<strong>
Updated
Capsule Last Updated
</strong>
:
06/08/2017
</div>
<div
className="offset-bid-button-container"
Expand Down
Loading

0 comments on commit 96d0946

Please sign in to comment.