Skip to content

Commit

Permalink
Merge branch 'main' into feat/add_dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
sylviamclaughlin authored Sep 18, 2023
2 parents 6c5094e + 17faf4f commit 0abc9fb
Show file tree
Hide file tree
Showing 11 changed files with 250 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
log_analytics_workspace_key: ${{ secrets.LOG_ANALYTICS_WORKSPACE_KEY }}

- name: Docker generate SBOM
uses: cds-snc/security-tools/.github/actions/generate-sbom@cfec0943e40dbb78cee115bbbe89dc17f07b7a0f # v2.1.3
uses: cds-snc/security-tools/.github/actions/generate-sbom@eecd7a02a0294b379411c126b61e5c29e253676a # v2.1.4
with:
docker_image: "${{ env.REGISTRY }}/sre-bot:latest"
dockerfile_path: "./Dockerfile"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker_vulnerability_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: aws-actions/amazon-ecr-login@2fc7aceee09e9e4a7105c0d060c656fad0b4f63d # v1.7.0

- name: Docker vulnerability scan
uses: cds-snc/security-tools/.github/actions/docker-scan@cfec0943e40dbb78cee115bbbe89dc17f07b7a0f # v2.1.3
uses: cds-snc/security-tools/.github/actions/docker-scan@eecd7a02a0294b379411c126b61e5c29e253676a # v2.1.4
with:
docker_image: "${{ env.REGISTRY }}/sre-bot:latest"
dockerfile_path: "Dockerfile"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@b2dd2d646c3592c87c4080778d90e24b42eae566
uses: ossf/scorecard-action@2dee8c185ea0de807198c818714b6f3436856709
with:
results_file: ossf-results.json
results_format: json
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11.5-slim
FROM python:3.11.5-slim@sha256:9bd704d713fde6cebdd54779c121da9c3ddd28808797e4f93d58af0050e8ba70

RUN apt-get update \
&& apt-get install -y wget \
Expand Down
9 changes: 5 additions & 4 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
arrow==1.2.3
Authlib==1.2.1
Jinja2==3.1.2
awscli==1.29.40
awscli==1.29.44
aws-sns-message-validator==0.0.5
boto3==1.28.40
boto3==1.28.44
fastapi==0.103.1
geoip2==4.7.0
google-api-python-client==2.97.0
google-api-python-client==2.98.0
google-auth-httplib2==0.1.0
google-auth-oauthlib==0.8.0
httpx==0.25.0
itsdangerous==2.1.2
Jinja2==3.1.2
PyYaml==5.3.1 # need to pin down the PyYaml version since the newest version is currently broken - https://github.com/yaml/pyyaml/issues/724
PyYAML!=6.0.0,!=5.4.0,!=5.4.1
python-dotenv==0.21.1
python-i18n==0.3.9
requests==2.31.0
Expand Down
3 changes: 1 addition & 2 deletions app/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
black==22.12.0
coverage==6.5.0
flake8==6.1.0
httpx==0.24.1
pytest==7.4.1
pytest==7.4.2
pytest-asyncio==0.21.1
pytest-env==0.8.2
4 changes: 0 additions & 4 deletions app/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ async def user(request: Request):
return JSONResponse({"error": "Not logged in"})


@handler.route("/webhooks")
async def get_webhooks(request: Request):
pass


@handler.get("/geolocate/{ip}")
def geolocate(ip):
Expand Down
338 changes: 190 additions & 148 deletions frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ function App() {
}


export default App;
export default App;
47 changes: 47 additions & 0 deletions frontend/src/pages/HomePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React, {useEffect, useState} from 'react';

export default function HomePage() {

const [userData, setUserData] = useState(null);

useEffect(() => {
// Make a GET request to the "/user" endpoint
fetch('/user')
.then(response => {
// Check if the response status code is OK (200)
if (!response.ok) {
throw new Error('Network response was not ok');
}
// Parse the JSON response
return response.json();
})
.then(data => {
// Handle the JSON data from the response
setUserData(data);
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
}, []);
const googleLogout = () => {
var logout_url= "/logout"
window.location.href = logout_url
}

return (
<div>
{userData ? (
<div>
<h1 className="text-5xl font-bold">Welcome {userData.name}!</h1>
<br></br>
<p>This is the SRE Bot frontend dashboard. To log out, press the logout button.</p>
<br></br>
<button onClick={googleLogout} className="btn btn-xs sm:btn-sm md:btn-md lg:btn-lg border-zinc-950">Logout from Google</button>
</div>
) : (
<p>Error: Not logged in</p>
)}
</div>

);
}
4 changes: 2 additions & 2 deletions frontend/src/pages/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function LoginPage() {
return (
<div className="hero min-h-screen bg-base-200">

<div className="hero-content flex-col lg:flex-row">
<div className="hero-content flex-col lg:flex-row">

<img src = {sre_bot_logo} alt="sre_bot"></img>
<div>
Expand All @@ -31,5 +31,5 @@ export default function LoginPage() {
</div>
</div>
</div>
);
);
}

0 comments on commit 0abc9fb

Please sign in to comment.