Added missing files

This commit is contained in:
grimsi
2022-07-25 21:26:32 +02:00
parent aa72161990
commit 7ba2eb2aea
10 changed files with 291 additions and 0 deletions
@@ -0,0 +1,15 @@
<h3 mat-dialog-title>Map game to IGDB slug</h3>
<mat-dialog-content>
<form fxLayout="column" fxLayoutAlign="space-evenly stretch">
<p>Path: {{path}}</p>
<mat-form-field>
<input matInput type="text" placeholder="IGDB Slug" [formControl]="newSlugInput" [value]="currentSlug"/>
</mat-form-field>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-raised-button mat-dialog-close color="accent">Cancel</button>
<button mat-raised-button (click)="submit()">OK</button>
</mat-dialog-actions>
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MapGameDialogComponent } from './map-game-dialog.component';
describe('MapGameDialogComponent', () => {
let component: MapGameDialogComponent;
let fixture: ComponentFixture<MapGameDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ MapGameDialogComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(MapGameDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,37 @@
import {Component, Inject, OnInit} from '@angular/core';
import {FormBuilder, FormControl} from "@angular/forms";
import {LibraryManagementService} from "../../services/library-management.service";
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
import {PathToSlugDto} from "../../models/dtos/PathToSlugDto";
@Component({
selector: 'app-map-game-dialog',
templateUrl: './map-game-dialog.component.html',
styleUrls: ['./map-game-dialog.component.scss']
})
export class MapGameDialogComponent implements OnInit {
path: string;
currentSlug?: string;
newSlugInput: FormControl;
constructor(private fb: FormBuilder,
private libraryManagementService: LibraryManagementService,
public dialogRef: MatDialogRef<MapGameDialogComponent>,
@Inject(MAT_DIALOG_DATA) data: any) {
this.path = data.path;
this.currentSlug = data.slug;
this.newSlugInput = new FormControl(this.currentSlug);
}
ngOnInit() {
}
close() {
this.dialogRef.close();
}
submit(): void {
this.libraryManagementService.mapGame(new PathToSlugDto(this.newSlugInput.value, this.path)).subscribe(() => this.close())
}
}