Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release update #522

Merged
merged 34 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
53326b9
implemented frontend for contacts page
rgao Mar 29, 2020
d877c6a
fixed linting errors for contacts page
rgao Mar 30, 2020
aa4735b
fixed background image, added button disable/validaton functionality,…
rgao Mar 31, 2020
e5f1337
fixed linting errors
rgao Mar 31, 2020
c928810
Merge branch 'dev' into dev
rgao Mar 31, 2020
00f407d
redux integration for contacts
rgao Apr 5, 2020
bf52dfb
added upstream files
rgao Apr 5, 2020
254e91d
updated request body to be sent in desired format
rgao Apr 5, 2020
7fab6d2
fixed some errors with redux
rgao Apr 8, 2020
7b6bd75
added merged files
rgao Apr 8, 2020
0c5a168
fixed linting errors
rgao Apr 8, 2020
b242939
fixed all linting and updated button
rgao Apr 8, 2020
a911157
added github sha as environment variable in backend docker container
jmensch1 Apr 8, 2020
86e360f
Merge pull request #518 from hackforla/BACK-GithubShaInDocker
sellnat77 Apr 8, 2020
aee9972
Merge branch 'dev' into dev
sellnat77 Apr 8, 2020
05cae9b
Updated styles for contact components.
adamkendis Apr 9, 2020
921af44
Updated Contact page-related reducers.
adamkendis Apr 9, 2020
d721274
Updated feedback-related saga.
adamkendis Apr 9, 2020
6700676
Fixed feedbackService error handling.
adamkendis Apr 9, 2020
fe40199
Updated ContactForm. Success, error display. Email validation.
adamkendis Apr 9, 2020
7d307fb
comparison set colors tied to set number instead of district type
jmensch1 Apr 9, 2020
be0280d
Merge pull request #519 from hackforla/FRONT-ComparisonColors
adamkendis Apr 9, 2020
33f7b96
Merge branch 'dev' into dev
adamkendis Apr 9, 2020
bdf20de
Merge pull request #477 from rgao/dev
adamkendis Apr 9, 2020
0a1a4ac
Reverted react-leaflet-markercluster dependency to @next version
adamkendis Apr 9, 2020
b7efe14
Added Set 1/2 label to comparison District Selector
adamkendis Apr 9, 2020
dfec139
Merge pull request #520 from adamkendis/FRONT-markerclusterVersion
jmensch1 Apr 9, 2020
f831ccd
Added heatmap gradient legend to pinmap
adamkendis Apr 10, 2020
f99e43e
Added tabbable prop to Checkbox component
adamkendis Apr 10, 2020
33fcc54
Removed checkbox from DropdownItem per UI team
adamkendis Apr 10, 2020
0380051
Added hover color to dropdown items.
adamkendis Apr 10, 2020
2b0e72c
Updated districtSelector stylesheet.
adamkendis Apr 10, 2020
83a7200
Removed unused Checkbox import in DropdownItem
adamkendis Apr 10, 2020
f4771e9
Merge pull request #521 from adamkendis/503-FRONT-mapColorLegends
brodly Apr 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Publish_Backend_Package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: |
heroku config:set -a hackforla-311 PROJECT_URL=${{ secrets.PROJECT_URL }} GITHUB_TOKEN=${{ secrets.GH_ISSUES_TOKEN }} TOKEN=${{ secrets.SOCRATA_TOKEN }}
heroku config:set -a hackforla-311 PROJECT_URL=${{ secrets.PROJECT_URL }} GITHUB_TOKEN=${{ secrets.GH_ISSUES_TOKEN }} TOKEN=${{ secrets.SOCRATA_TOKEN }} GITHUB_SHA=${{ github.sha }}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/preset-env": "^7.8.4",
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.8.3",
"babel-eslint": "^10.0.3",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"css-loader": "^3.5.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^6.7.2",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^1.7.0",
Expand Down
18 changes: 9 additions & 9 deletions server/src/services/feedbackService.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ async def create_issue(self,
response = await session.post(self.issues_url,
data=payload,
headers=headers)
response.raise_for_status()
response_content = loads(response.content)
issue_id = response_content['id']
response.raise_for_status()
return issue_id
except requests.exceptions.HTTPError as errh:
return "An Http Error occurred:" + repr(errh)
return errh
except requests.exceptions.ConnectionError as errc:
return "An Error Connecting to the API occurred:" + repr(errc)
return errc
except requests.exceptions.Timeout as errt:
return "A Timeout Error occurred:" + repr(errt)
return errt
except requests.exceptions.RequestException as err:
return "An Unknown Error occurred" + repr(err)
return err

async def add_issue_to_project(self, issue_id, content_type='Issue'):
"""
Expand Down Expand Up @@ -83,10 +83,10 @@ async def add_issue_to_project(self, issue_id, content_type='Issue'):
response.raise_for_status()
return response.status_code
except requests.exceptions.HTTPError as errh:
return "An Http Error occurred:" + repr(errh)
return errh
except requests.exceptions.ConnectionError as errc:
return "An Error Connecting to the API occurred:" + repr(errc)
return errc
except requests.exceptions.Timeout as errt:
return "A Timeout Error occurred:" + repr(errt)
return errt
except requests.exceptions.RequestException as err:
return "An Unknown Error occurred" + repr(err)
return err
Binary file added src/assets/contact_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 22 additions & 18 deletions src/components/Comparison/FrequencyComparison.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import React from 'react';
import PropTypes from 'proptypes';
import { connect } from 'react-redux';
import moment from 'moment';
import { DISTRICT_TYPES } from '@components/common/CONSTANTS';
import { DISTRICT_TYPES, COMPARISON_SETS } from '@components/common/CONSTANTS';
import Chart from '@components/Chart';
import ChartExportSelect from '@components/export/ChartExportSelect';

const FrequencyComparison = ({
bins,
set1,
set2,
sets,
}) => {
/* /// DATA /// */

const getDataSet = set => {
const { district, counts } = set;
const getDataSet = setId => {
const { district, counts } = sets[setId];

const totals = Array.from({ length: bins.length - 1 }).map((_, idx) => (
Object.keys(counts).reduce((acc, name) => (
acc + counts[name][idx]
), 0)
));

const color = DISTRICT_TYPES.find(t => t.id === district)?.color;
const label = DISTRICT_TYPES.find(t => t.id === district)?.name;
const { color, name: setName } = COMPARISON_SETS[setId];
const label = DISTRICT_TYPES.find(t => t.id === district)?.name
.replace(' District', ` (${setName})`);

return {
data: totals,
Expand All @@ -38,8 +38,8 @@ const FrequencyComparison = ({
const chartData = {
labels: bins.slice(0, -1).map(bin => moment(bin).format('MMM D')),
datasets: [
getDataSet(set1),
getDataSet(set2),
getDataSet('set1'),
getDataSet('set2'),
],
};

Expand Down Expand Up @@ -108,20 +108,24 @@ const FrequencyComparison = ({

const mapStateToProps = state => ({
bins: state.comparisonData.frequency.bins,
set1: state.comparisonData.frequency.set1,
set2: state.comparisonData.frequency.set2,
sets: {
set1: state.comparisonData.frequency.set1,
set2: state.comparisonData.frequency.set2,
},
});

export default connect(mapStateToProps)(FrequencyComparison);

FrequencyComparison.propTypes = {
bins: PropTypes.arrayOf(PropTypes.string).isRequired,
set1: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}).isRequired,
}).isRequired,
set2: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}).isRequired,
sets: PropTypes.shape({
set1: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}),
}),
set2: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}),
}),
}).isRequired,
};
24 changes: 10 additions & 14 deletions src/components/Comparison/TimeToCloseComparison.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,33 @@ import React from 'react';
import PropTypes from 'proptypes';
import { connect } from 'react-redux';
import Chart, { ChartTooltip as Tooltip } from '@components/Chart';
import { DISTRICT_TYPES, COUNCILS } from '@components/common/CONSTANTS';
import { COUNCILS, COMPARISON_SETS } from '@components/common/CONSTANTS';
import ChartExportSelect from '@components/export/ChartExportSelect';

const TimeToCloseComparison = ({
timeToClose: { set1, set2 },
timeToClose,
}) => {
/* /// DATA /// */

const boxColors = {
nc: DISTRICT_TYPES.find(t => t.id === 'nc')?.color,
cc: DISTRICT_TYPES.find(t => t.id === 'cc')?.color,
};

const boxLabels = {
nc: id => COUNCILS.find(c => parseInt(id, 10) === c.id).name,
cc: name => `District ${name}`,
};

const getBoxes = ({ district, data }) => (
Object.keys(data)
const getBoxes = setId => {
const { district, data } = timeToClose[setId];
return Object.keys(data)
.filter(name => data[name].count !== 0)
.map(name => ({
label: boxLabels[district](name),
color: boxColors[district],
color: COMPARISON_SETS[setId].color,
stats: { ...data[name], outliers: [] },
}))
);
}));
};

const boxes = [
...getBoxes(set1),
...getBoxes(set2),
...getBoxes('set1'),
...getBoxes('set2'),
];

const chartData = {
Expand Down
40 changes: 22 additions & 18 deletions src/components/Comparison/TotalRequestsComparison.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import React from 'react';
import PropTypes from 'proptypes';
import { connect } from 'react-redux';
import moment from 'moment';
import { DISTRICT_TYPES } from '@components/common/CONSTANTS';
import { DISTRICT_TYPES, COMPARISON_SETS } from '@components/common/CONSTANTS';
import Chart from '@components/Chart';
import ChartExportSelect from '@components/export/ChartExportSelect';

const TotalRequestsComparison = ({
bins,
set1,
set2,
sets,
}) => {
/* /// DATA /// */

const getDataSet = set => {
const { district, counts } = set;
const getDataSet = setId => {
const { district, counts } = sets[setId];

const totals = Array.from({ length: bins.length - 1 }).map((_, idx) => (
Object.keys(counts).reduce((acc, name) => (
acc + counts[name][idx]
), 0)
));

const color = DISTRICT_TYPES.find(t => t.id === district)?.color;
const label = DISTRICT_TYPES.find(t => t.id === district)?.name;
const { color, name: setName } = COMPARISON_SETS[setId];
const label = DISTRICT_TYPES.find(t => t.id === district)?.name
.replace(' District', ` (${setName})`);

return {
data: totals,
Expand All @@ -38,8 +38,8 @@ const TotalRequestsComparison = ({
const chartData = {
labels: bins.slice(0, -1).map(bin => moment(bin).format('MMM D')),
datasets: [
getDataSet(set1),
getDataSet(set2),
getDataSet('set1'),
getDataSet('set2'),
],
};

Expand Down Expand Up @@ -108,20 +108,24 @@ const TotalRequestsComparison = ({

const mapStateToProps = state => ({
bins: state.comparisonData.frequency.bins,
set1: state.comparisonData.frequency.set1,
set2: state.comparisonData.frequency.set2,
sets: {
set1: state.comparisonData.frequency.set1,
set2: state.comparisonData.frequency.set2,
},
});

export default connect(mapStateToProps)(TotalRequestsComparison);

TotalRequestsComparison.propTypes = {
bins: PropTypes.arrayOf(PropTypes.string).isRequired,
set1: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}).isRequired,
}).isRequired,
set2: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}).isRequired,
sets: PropTypes.shape({
set1: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}),
}),
set2: PropTypes.shape({
district: PropTypes.string,
counts: PropTypes.shape({}),
}),
}).isRequired,
};
11 changes: 11 additions & 0 deletions src/components/PinMap/PinMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,17 @@ class PinMap extends Component {
if (link) link.click();
}}
/>
<div className="heatmap-legend-wrapper has-text-centered">
Concentration of Reports (Heatmap)
<div id="heatmap-gradient-legend" className="level">
<span className="level-left">
Low
</span>
<span className="level-right">
High
</span>
</div>
</div>
</>
);
}
Expand Down
39 changes: 24 additions & 15 deletions src/components/chartExtras/ComparisonCriteria.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import PropTypes from 'proptypes';
import { connect } from 'react-redux';
import { DISTRICT_TYPES, REQUEST_TYPES } from '@components/common/CONSTANTS';
import { DISTRICT_TYPES, REQUEST_TYPES, COMPARISON_SETS } from '@components/common/CONSTANTS';
import CollapsibleList from '@components/common/CollapsibleList';

const ComparisonCriteria = ({
startDate,
endDate,
set1,
set2,
sets,
requestTypes,
}) => {
// DATES //
Expand All @@ -17,7 +16,9 @@ const ComparisonCriteria = ({
: 'No date range selected.';

// DISTRICTS //
const districtSelection = set => {
const districtSelection = setId => {
const set = sets[setId];

if (!set.district) {
return (
<>
Expand All @@ -30,10 +31,14 @@ const ComparisonCriteria = ({
}

const { name } = DISTRICT_TYPES.find(t => set.district === t.id);
const { name: setName } = COMPARISON_SETS[setId];
return (
<>
<span className="criteria-type">
{ name }
&nbsp;(
{ setName }
)
</span>
<CollapsibleList
items={set.list}
Expand Down Expand Up @@ -78,8 +83,8 @@ const ComparisonCriteria = ({
Date Range
</span>
{ dateText }
{ districtSelection(set1) }
{ districtSelection(set2) }
{ districtSelection('set1') }
{ districtSelection('set2') }
<span className="criteria-type">
Request Type Selection
</span>
Expand All @@ -92,8 +97,10 @@ const ComparisonCriteria = ({
const mapStateToProps = state => ({
startDate: state.comparisonFilters.startDate,
endDate: state.comparisonFilters.endDate,
set1: state.comparisonFilters.comparison.set1,
set2: state.comparisonFilters.comparison.set2,
sets: {
set1: state.comparisonFilters.comparison.set1,
set2: state.comparisonFilters.comparison.set2,
},
requestTypes: state.comparisonFilters.requestTypes,
});

Expand All @@ -102,13 +109,15 @@ export default connect(mapStateToProps)(ComparisonCriteria);
ComparisonCriteria.propTypes = {
startDate: PropTypes.string,
endDate: PropTypes.string,
set1: PropTypes.shape({
district: PropTypes.string,
list: PropTypes.arrayOf(PropTypes.string),
}).isRequired,
set2: PropTypes.shape({
district: PropTypes.string,
list: PropTypes.arrayOf(PropTypes.string),
sets: PropTypes.shape({
set1: PropTypes.shape({
district: PropTypes.string,
list: PropTypes.array,
}),
set2: PropTypes.shape({
district: PropTypes.string,
list: PropTypes.array,
}),
}).isRequired,
requestTypes: PropTypes.shape({}).isRequired,
};
Expand Down
Loading