Skip to content

Commit

Permalink
Merge pull request #1 from hackforla/dev
Browse files Browse the repository at this point in the history
Updating dev to be current with master
  • Loading branch information
ryanmswan authored Nov 27, 2019
2 parents 90b74e4 + 6e025dc commit 87c3dbc
Show file tree
Hide file tree
Showing 28 changed files with 183 additions and 15,523 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/Continuous_Integration_Frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Build project
run: npm run-script build
- name: Run Tests
run: export CI=true && npm run test -- --coverage
run: npm run-script test -- --coverage
env:
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

dist/
# Test results
coverage/

Expand Down Expand Up @@ -30,3 +30,6 @@ package-lock.json
# config
config.js
.env
settings.cfg

__pycache__/
15,183 changes: 0 additions & 15,183 deletions package-lock.json

This file was deleted.

46 changes: 22 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,42 @@
"homepage": "https://hackforla.github.io/311-data",
"dependencies": {
"axios": "^0.19.0",
"babel-jest": "^24.9.0",
"dataframe-js": "^1.4.3",
"dev": "^0.1.3",
"dotenv-webpack": "^1.7.0",
"gh-pages": "^2.1.1",
"ignore-warnings": "^0.2.1",
"jest": "^24.9.0",
"leaflet": "^1.5.1",
"node-sass": "^4.12.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-leaflet": "^2.4.0",
"react-leaflet-choropleth": "^2.0.0",
"react-scripts": "3.0.1",
"react-test-renderer": "^16.12.0",
"react-vis": "^1.11.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start": "npm start",
"dev": "webpack-dev-server",
"build": "webpack",
"test": "jest",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-class-properties": "^7.7.0",
"@babel/preset-env": "^7.7.1",
"@babel/preset-react": "^7.7.0",
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0"
"enzyme-adapter-react-16": "^1.15.1",
"file-loader": "^4.2.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
}
}
29 changes: 2 additions & 27 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,16 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="stylesheet" href="https://unpkg.com/react-vis/dist/style.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>311 Data</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="bundle.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:3.7-alpine

COPY requirements.txt /

RUN pip install -r /requirements.txt

COPY src/ /app

WORKDIR /app

EXPOSE 5000

CMD ["python", "app.py"]
24 changes: 24 additions & 0 deletions server/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
aiofiles==0.4.0
certifi==2019.9.11
chardet==3.0.4
Click==7.0
h11==0.8.1
h2==3.1.1
hpack==3.0.0
httpcore==0.3.0
httptools==0.0.13
hyperframe==5.2.0
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10.3
MarkupSafe==1.1.1
multidict==4.5.2
requests==2.22.0
requests-async==0.5.0
rfc3986==1.3.2
sanic==19.9.0
ujson==1.35
urllib3==1.25.7
uvloop==0.14.0
websockets==8.1
Werkzeug==0.16.0
84 changes: 0 additions & 84 deletions server/server.js

This file was deleted.

Empty file added server/src/__init__.py
Empty file.
36 changes: 36 additions & 0 deletions server/src/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
from sanic import Sanic
from sanic.response import json
from services.time_to_close import time_to_close
from services.frequency import frequency

app = Sanic(__name__)
app.config.from_pyfile(os.path.join(os.getcwd(),'settings.cfg'))

@app.route('/')
async def index(request):
return json('You hit the index')

@app.route('/timetoclose')
async def timetoclose(request):
ttc_worker = time_to_close()
# Insert time to close calculation here
return_data = ttc_worker.hello_world()

return json(return_data)

@app.route('/requestfrequency')
async def requestfrequency(request):
freq_worker = frequency()
# Insert frequency calculation here
return_data = freq_worker.hello_world()

return json(return_data)

@app.route('/sample-data')
async def sample_route(request):
sample_dataset = {'cool_key':['value1', 'value2'], app.config['REDACTED']:app.config['REDACTED']}
return json(sample_dataset)

if __name__ == '__main__':
app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.config['DEBUG'])
Empty file added server/src/services/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions server/src/services/frequency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class frequency(object):
def __init__(self):
pass

def hello_world(self):
return {'response':'hello from frequency service'}
6 changes: 6 additions & 0 deletions server/src/services/time_to_close.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class time_to_close(object):
def __init__(self):
pass

def hello_world(self):
return {'response':'hello from time to close service'}
4 changes: 4 additions & 0 deletions server/src/settings.example.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DEBUG=True
HOST="0.0.0.0"
PORT="5000"
REDACTED = "REDACTED"
33 changes: 0 additions & 33 deletions src/App.css

This file was deleted.

1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import './App.css';
import Header from './containers/Header/Header.jsx'
import MapContainer from './containers/Map/MapContainer.jsx'
import FrequencyContainer from './containers/Graphs/FrequencyContainer.jsx'
Expand Down
5 changes: 0 additions & 5 deletions src/App.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/Frequency/Frequency.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import './Styles/Frequency.scss'
export default ({}) => {
return (
<div className='Frequency'>
<img className='FrequencyImg' src={process.env.PUBLIC_URL + '/frequency.svg'} alt='frequency'/>
<img className='FrequencyImg' src={'./frequency.svg'} alt='frequency'/>
</div>
)
}
2 changes: 1 addition & 1 deletion src/components/LoadingSpinner/LoadingSpinner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './Styles/LoadingSpinner.scss';
// import './Styles/LoadingSpinner.scss';
import React from 'react';

const LoadingSpinner = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/TimeToClose/TimeToClose.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import './Styles/TimeToClose.scss'
export default ({}) => {
return (
<div className='TimeToClose'>
<img className='TimeToCloseImg' src={process.env.PUBLIC_URL + '/timetoclose.svg'} alt="timetoclose"/>
<img className='TimeToCloseImg' src={'./timetoclose.svg'} alt="timetoclose"/>
</div>
)
}
Loading

0 comments on commit 87c3dbc

Please sign in to comment.