WIP: Implement frontend

This commit is contained in:
Simon Grimme
2022-07-21 00:29:00 +02:00
parent 6b89690180
commit cc1e02a1ca
109 changed files with 22662 additions and 670 deletions
@@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { DialogService } from './dialog.service';
describe('DialogService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: DialogService = TestBed.get(DialogService);
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,27 @@
import {Injectable} from '@angular/core';
import {MatDialog, MatDialogConfig} from '@angular/material/dialog';
import {ErrorDialogComponent} from '../components/error-dialog/error-dialog.component';
@Injectable({
providedIn: 'root'
})
export class DialogService {
constructor(private dialog: MatDialog) {
}
public showErrorDialog(message: string): void {
const dialogConfig = new MatDialogConfig();
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
dialogConfig.closeOnNavigation = true;
dialogConfig.data = {
message
};
this.dialog.open(ErrorDialogComponent, dialogConfig);
}
}
@@ -0,0 +1,24 @@
import {Injectable} from '@angular/core';
import {GamesApi} from "../api/GamesApi";
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {DetectedGameDto} from "../models/dtos/DetectedGameDto";
@Injectable({
providedIn: 'root'
})
export class GamesService implements GamesApi {
private readonly apiPath = '/games';
constructor(private http: HttpClient) {
}
getAllGames(): Observable<DetectedGameDto[]> {
return this.http.get<DetectedGameDto[]>(this.apiPath);
}
getAllGameMappings(): Observable<Map<string, string>> {
return this.http.get<Map<string, string>>(`${this.apiPath}/game-mappings`);
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { GamesService } from './games.service';
describe('GameserverApiService', () => {
let service: GamesService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(GamesService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});