website init
This commit is contained in:
17
WEB/src/app/components/song/song.component.html
Normal file
17
WEB/src/app/components/song/song.component.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<div mat-card-avatar>
|
||||
<button mat-icon-button [routerLink]="['/songs']" >
|
||||
<fa-icon [icon]="faArrow"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
<mat-card-title>{{ song.Name }}</mat-card-title>
|
||||
<mat-card-subtitle>{{ song.Key }} - {{ song.Velocity }}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<p>{{ song.Text }}</p>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-button (click)="onClickDownload()">Herunterladen</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
14
WEB/src/app/components/song/song.component.less
Normal file
14
WEB/src/app/components/song/song.component.less
Normal file
@@ -0,0 +1,14 @@
|
||||
.mat-card {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.mat-card-title {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
.mat-card-content {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
25
WEB/src/app/components/song/song.component.spec.ts
Normal file
25
WEB/src/app/components/song/song.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SongComponent } from './song.component';
|
||||
|
||||
describe('SongComponent', () => {
|
||||
let component: SongComponent;
|
||||
let fixture: ComponentFixture<SongComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SongComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SongComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
32
WEB/src/app/components/song/song.component.ts
Normal file
32
WEB/src/app/components/song/song.component.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { DownloadService } from './../../data/download.service';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { SongDetailModel } from 'src/app/models/song-list-detail.model';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { faLongArrowAltLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
@Component({
|
||||
selector: 'app-song',
|
||||
templateUrl: './song.component.html',
|
||||
styleUrls: ['./song.component.less']
|
||||
})
|
||||
export class SongComponent implements OnInit {
|
||||
public song: SongDetailModel;
|
||||
public faArrow = faLongArrowAltLeft;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private downloadService: DownloadService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { song: SongDetailModel }) => {
|
||||
this.song = data.song;
|
||||
});
|
||||
}
|
||||
|
||||
public onClickDownload(): void {
|
||||
const id = this.song.Id;
|
||||
const withKey = this.song.HasKeyFile;
|
||||
this.downloadService.get(id, withKey);
|
||||
}
|
||||
}
|
||||
1
WEB/src/app/components/songs/songs.component.html
Normal file
1
WEB/src/app/components/songs/songs.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<app-table [songs]="songs"></app-table>
|
||||
0
WEB/src/app/components/songs/songs.component.less
Normal file
0
WEB/src/app/components/songs/songs.component.less
Normal file
25
WEB/src/app/components/songs/songs.component.spec.ts
Normal file
25
WEB/src/app/components/songs/songs.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SongsComponent } from './songs.component';
|
||||
|
||||
describe('SongsComponent', () => {
|
||||
let component: SongsComponent;
|
||||
let fixture: ComponentFixture<SongsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SongsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SongsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
22
WEB/src/app/components/songs/songs.component.ts
Normal file
22
WEB/src/app/components/songs/songs.component.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SongListModel } from 'src/app/models/song-list.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-songs',
|
||||
templateUrl: './songs.component.html',
|
||||
styleUrls: ['./songs.component.less']
|
||||
})
|
||||
export class SongsComponent implements OnInit {
|
||||
public songs: SongListModel;
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { songs: SongListModel }) => {
|
||||
this.songs = data.songs;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
31
WEB/src/app/components/songs/table/table.component.html
Normal file
31
WEB/src/app/components/songs/table/table.component.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<table *ngIf="songs.SongList" mat-table [dataSource]="songs.SongList" class="mat-elevation-z8">
|
||||
|
||||
<ng-container matColumnDef="Id">
|
||||
<th mat-header-cell *matHeaderCellDef>#</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Id}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Name">
|
||||
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Name}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Key">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Key}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Type">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Type}}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Velocity">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Velocity}}</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="columns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: columns;" [routerLink]="['/songs', row.Id]" routerLinkActive="router-link-active" ></tr>
|
||||
|
||||
</table>
|
||||
4
WEB/src/app/components/songs/table/table.component.less
Normal file
4
WEB/src/app/components/songs/table/table.component.less
Normal file
@@ -0,0 +1,4 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
25
WEB/src/app/components/songs/table/table.component.spec.ts
Normal file
25
WEB/src/app/components/songs/table/table.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TableComponent } from './table.component';
|
||||
|
||||
describe('TableComponent', () => {
|
||||
let component: TableComponent;
|
||||
let fixture: ComponentFixture<TableComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TableComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TableComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
26
WEB/src/app/components/songs/table/table.component.ts
Normal file
26
WEB/src/app/components/songs/table/table.component.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { SongListModel } from 'src/app/models/song-list.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-table',
|
||||
templateUrl: './table.component.html',
|
||||
styleUrls: ['./table.component.less']
|
||||
})
|
||||
export class TableComponent implements OnInit {
|
||||
@Input() public songs: SongListModel;
|
||||
public columns = [
|
||||
'Id',
|
||||
'Name',
|
||||
'Key',
|
||||
'Type',
|
||||
'Velocity',
|
||||
];
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.songs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user