Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
40 changes: 40 additions & 0 deletions .github/workflows/featureRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Latest Release

on:
push:
branches:
- 'feature/**'
paths:
- 'webapp_frontend/**'
- 'webapp_provider/**'

jobs:
Build_Docker_Image_on_Push:
runs-on: ubuntu-latest
steps:
-
name: Set up Project
uses: actions/checkout@v2
-
name: Set up Node.js environment
uses: actions/setup-node@v2.1.2
with:
node-version: 12
-
name: Build frontend
run: |
cd webapp_frontend
npm i
npm run-script build
cp -r build ../webapp_provider/public
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PW }}
-
name: Build and push
run: |
docker build -t filefighter/frontend:feature webapp_provider/
docker push filefighter/frontend:feature
8 changes: 7 additions & 1 deletion .github/workflows/latestRelease.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Latest Release

on: push
on:
push:
branches:
- 'master'
paths:
- 'webapp_frontend/**'
- 'webapp_provider/**'

jobs:
Build_Docker_Image_on_Push:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/stableRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@ name: Stable Release

on:
push:
branches:
- 'master'
tags:
- 'v*.*.*'
paths:
- 'webapp_frontend/**'
- 'webapp_provider/**'

jobs:
Build_Docker_Image_on_new_Tag:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions webapp_frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions webapp_frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"@types/node": "^12.12.64",
"@types/react": "^16.9.51",
"@types/react-dom": "^16.9.8",
"axios": "^0.20.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3",
Expand Down
29 changes: 0 additions & 29 deletions webapp_frontend/src/App.tsx

This file was deleted.

21 changes: 21 additions & 0 deletions webapp_frontend/src/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Axios from "axios";

const uri = "http://localhost:8080";

interface BackendHealthData {
uptimeInSeconds: number
}

function callBackendHealth():Promise<BackendHealthData>{
return new Promise((resolve, reject) => {
Axios.get(`${uri}/health`)
.then((data) => {
resolve(data.data);
})
.catch(((error) => {
reject(error);
}));
});
}

export {callBackendHealth}
45 changes: 45 additions & 0 deletions webapp_frontend/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, {ReactElement, useEffect, useState} from 'react';
import logo from '../logo.svg';
import './App.css';
import {callBackendHealth} from "../api";

function App():ReactElement {
const [backendLiveTime, setBackendLiveTime] = useState<number | string>("Init");

useEffect(() => {
updateVariables()
});

function updateVariables(): void {
Promise.all([callBackendHealth()])
.then(([backendHealthData]) => {
setBackendLiveTime(backendHealthData.uptimeInSeconds)
})
}

return (
<div className="App">
<header className="App-header">
<p>
Hello World
</p>
<img src={logo} className="App-logo" alt="logo"/>
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<button style={{marginTop: "20px"}} onClick={() => updateVariables()}>Test</button>
<p>{backendLiveTime}</p>
</header>
</div>
);
}

export default App;
2 changes: 1 addition & 1 deletion webapp_frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import App from './components/App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(
Expand Down