Skip to content

Commit

Permalink
fixed bug button double click
Browse files Browse the repository at this point in the history
  • Loading branch information
MuSuAL committed Jun 1, 2021
2 parents 562a193 + 475362d commit 0fa2588
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 165 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2

- name: Use Cache
uses: actions/cache@v2
with: # caches all npm packages. Updates when frontend/package-lock.json changes
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: sets up npm / node.js
uses: actions/setup-node@v2
with:
Expand All @@ -20,7 +30,7 @@ jobs:

- name: Install packages
working-directory: ./frontend
run: npm install # TODO cache them
run: npm install

- name: Build the FrontEnd
working-directory: ./frontend
Expand Down
93 changes: 0 additions & 93 deletions api.yaml

This file was deleted.

13 changes: 8 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ services:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_NAME}
volumes:
- postgres-data
- postgres-data:/var/lib/postgresql/data
expose:
- 5432

backend:
container_name: "amos-linter-java-server"
image: "amoslinter/server:${ENVIRONMENT}"
# build: "./server"
environment:
- spring.datasource.platform=postgres
- spring.datasource.url=jdbc:postgresql://database:5432/${DB_NAME}
Expand All @@ -33,10 +34,12 @@ services:
nginx:
container_name: "amos-linter-nginx"
image: "amoslinter/frontend:${ENVIRONMENT}"
volumes: # more like: load configurations
- ./nginx.conf:/etc/nginx/conf.d/default.conf
# environment: FIXME
# - port=${PORT}
# build: "./frontend"
volumes: # more like: load nginx configuration
- ./nginx.conf:/etc/nginx/templates/default.conf.template
environment:
- PORT=${PORT}
- HOST=${HOST}
depends_on:
- backend
ports: # only connection to outside world
Expand Down
4 changes: 0 additions & 4 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# TODO make this an multistage build.
# Step 1: ng build basically
# Step 2: nginx

FROM nginx:stable

COPY ./dist/frontend/ /usr/share/nginx/html/
6 changes: 3 additions & 3 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Flag `--prod` setzen für production build.

Erst bauen (siehe oben) dann folgendes Ausführen: `docker build -t amoslinter/frontend:<TAG> .` (tag z.B staging oder release)

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Local Dev-Server
`ng serve` für einen Lokalen Server zum Testen.
Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
54 changes: 29 additions & 25 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ export class AppComponent implements OnInit {
chipsControl = new FormControl('');
chipsValue$ = this.chipsControl.valueChanges;
//SearchBarValue = '';
kategorie = new FormControl("");
kategorie = new FormControl('');
all_projects: Project[];
options: FormGroup;
forwardLinkWorked = true;
errorMsgForwardLink = '';
hideRequiredControl = new FormControl(false);
floatLabelControl = new FormControl('auto');

chipOptions: string[];

gridInfo: GridInfo[] = new Array<GridInfo>();

dataArray: GridInfo[] = new Array<GridInfo>();
displayColumns: string[] =
['project',
'testsPassed',
'testsPassedPerActivChip',
'newTestsPassedSinceLastMonth'];
displayColumns: string[] = [
'project',
'testsPassed',
'testsPassedPerActivChip',
'newTestsPassedSinceLastMonth',
];

columnsToDisplay: string[] = this.displayColumns.slice();
data = new MatTableDataSource<GridInfo>(this.dataArray);
Expand Down Expand Up @@ -169,13 +170,15 @@ export class AppComponent implements OnInit {
//für jedes projekt
for (var i = 0; i < this.all_projects.length; i++) {
//lade ergebnisse der checks aus dem backend

await this.http
.get(`${environment.baseURL}/project/${this.all_projects[i].id}/lastMonth`).toPromise()
.then((val: any) => {

var checkResults: CheckResults[] =
val.lintingResults[val.lintingResults.length - 1].checkResults;
var checkResultsLastMonth : CheckResults[] =
val.lintingResults[0].checkResults;
var checkResultsLastMonth: CheckResults[] =
val.lintingResults[0].checkResults;
//Zähler für erfolgreiche Checks
var checksPassed = 0;
//Zähler für erfolgreiche Checks pro Tag
Expand All @@ -187,15 +190,18 @@ export class AppComponent implements OnInit {

if (checkResults[j].result) {
checksPassed = checksPassed + 1;
for(var k = 0; k < this.chipsControl.value.length ; k++){
for (var k = 0; k < this.chipsControl.value.length; k++) {
//console.log('chipControl', this.chipsControl.value[k]);
//console.log('tag in backend', checkResults[j].tag);
if(this.chipsControl.value[k].toLowerCase().trim() == checkResults[j].tag.toLowerCase().trim()){
if (
this.chipsControl.value[k].toLowerCase().trim() ==
checkResults[j].tag.toLowerCase().trim()
) {
checksPassedPerActivChip = checksPassedPerActivChip + 1;
}
}
}
if(checkResultsLastMonth[j].result){
if (checkResultsLastMonth[j].result) {
checksPassedLastMonth = checksPassedLastMonth + 1;
}
}
Expand All @@ -205,7 +211,7 @@ export class AppComponent implements OnInit {
project: val.name,
testsPassed: checksPassed,
testsPassedPerActivChip: checksPassedPerActivChip,
newTestsPassedSinceLastMonth: checksPassed - checksPassedLastMonth
newTestsPassedSinceLastMonth: checksPassed - checksPassedLastMonth,
};


Expand All @@ -214,18 +220,18 @@ export class AppComponent implements OnInit {
}

//wähle die sortier funktion nach eingabe
switch(this.kategorie.value){
case "bestandene_tests" : {
switch (this.kategorie.value) {
case 'bestandene_tests': {
//this.gridInfo = this.bubbleSort(this.gridInfo, this.compareTestsPassed);
this.gridInfo.sort(this.compareTestsPassed);
break;
}
case "bestandene_tests_letzter_monat": {
case 'bestandene_tests_letzter_monat': {
//this.gridInfo = this.bubbleSort(this.gridInfo, this.compareNewTestsPassedSinceLastMonth);
this.gridInfo.sort(this.compareNewTestsPassedSinceLastMonth);
break;
}
case "bestandene_tests_pro_kategorie" : {
case 'bestandene_tests_pro_kategorie': {
//this.gridInfo = this.bubbleSort(this.gridInfo, this.compareTestsPassedPerTag);
this.gridInfo.sort(this.compareTestsPassedPerActivChip);
break;
Expand Down Expand Up @@ -267,37 +273,35 @@ export class AppComponent implements OnInit {
*/

compareTestsPassed(a, b) {
if(a.testsPassed < b.testsPassed){
if (a.testsPassed < b.testsPassed) {
return 1;
}
if(a.testsPassed > b.testsPassed){
if (a.testsPassed > b.testsPassed) {
return -1;
}
return 0;
}

compareNewTestsPassedSinceLastMonth(a, b) {
if(a.newTestsPassedSinceLastMonth < b.newTestsPassedSinceLastMonth){
if (a.newTestsPassedSinceLastMonth < b.newTestsPassedSinceLastMonth) {
return 1;
}
if(a.newTestsPassedSinceLastMonth > b.newTestsPassedSinceLastMonth){
if (a.newTestsPassedSinceLastMonth > b.newTestsPassedSinceLastMonth) {
return -1;
}
return 0;
}

compareTestsPassedPerActivChip(a, b) {
if(a.testsPassedPerActivChip < b.testsPassedPerActivChip){
if (a.testsPassedPerActivChip < b.testsPassedPerActivChip) {
return 1;
}
if(a.testsPassedPerActivChip > b.testsPassedPerActivChip){
if (a.testsPassedPerActivChip > b.testsPassedPerActivChip) {
return -1;
}
return 0;
}



/*
compareTestsPassedPerTag(a, b, setTags) {
var result;
Expand Down
Binary file added frontend/src/app/favicon.ico
Binary file not shown.
Loading

0 comments on commit 0fa2588

Please sign in to comment.