list songs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<mat-card>
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<mat-card-header>
|
||||
<div mat-card-avatar>
|
||||
<button mat-icon-button [routerLink]="['/songs']" >
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.mat-card {
|
||||
width: 500px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.mat-card-title {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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';
|
||||
import { Song } from 'src/app/models/song.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-song',
|
||||
@@ -10,7 +10,7 @@ import { faLongArrowAltLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
styleUrls: ['./song.component.less']
|
||||
})
|
||||
export class SongComponent implements OnInit {
|
||||
public song: SongDetailModel;
|
||||
public song: Song;
|
||||
public faArrow = faLongArrowAltLeft;
|
||||
|
||||
constructor(
|
||||
@@ -19,14 +19,13 @@ export class SongComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { song: SongDetailModel }) => {
|
||||
this.route.data.subscribe((data: { song: Song }) => {
|
||||
this.song = data.song;
|
||||
});
|
||||
}
|
||||
|
||||
public onClickDownload(): void {
|
||||
const id = this.song.Id;
|
||||
const withKey = this.song.HasKeyFile;
|
||||
this.downloadService.get(id, withKey);
|
||||
const id = this.song.ID;
|
||||
this.downloadService.get(id, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Song } from './../../models/song.model';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SongListModel } from 'src/app/models/song-list.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-songs',
|
||||
@@ -8,12 +8,12 @@ import { SongListModel } from 'src/app/models/song-list.model';
|
||||
styleUrls: ['./songs.component.less']
|
||||
})
|
||||
export class SongsComponent implements OnInit {
|
||||
public songs: SongListModel;
|
||||
public songs: Song[];
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { songs: SongListModel }) => {
|
||||
this.route.data.subscribe((data: { songs: Song[] }) => {
|
||||
this.songs = data.songs;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,31 +1,43 @@
|
||||
<table *ngIf="songs.SongList" mat-table [dataSource]="songs.SongList" class="mat-elevation-z8">
|
||||
<div class="page-container mat-elevation-z8">
|
||||
<div class="table-container">
|
||||
<table
|
||||
*ngIf="songs"
|
||||
mat-table
|
||||
[dataSource]="songs"
|
||||
class="mat-elevation-z8"
|
||||
>
|
||||
<ng-container matColumnDef="Number">
|
||||
<th mat-header-cell *matHeaderCellDef>#</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.Number }}</td>
|
||||
</ng-container>
|
||||
|
||||
<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="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="Key">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{element.Key}}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="SongType">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.SongType }}</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="Tempo">
|
||||
<th mat-header-cell *matHeaderCellDef></th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.Tempo }}</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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
table {
|
||||
width: 100%;
|
||||
border-radius: 8px;
|
||||
|
||||
}
|
||||
.page-container {
|
||||
height: 400px;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.table-container {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { SongListModel } from 'src/app/models/song-list.model';
|
||||
import { Song } from 'src/app/models/song.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-table',
|
||||
@@ -7,13 +7,13 @@ import { SongListModel } from 'src/app/models/song-list.model';
|
||||
styleUrls: ['./table.component.less']
|
||||
})
|
||||
export class TableComponent implements OnInit {
|
||||
@Input() public songs: SongListModel;
|
||||
@Input() public songs: Song[];
|
||||
public columns = [
|
||||
'Id',
|
||||
'Number',
|
||||
'Name',
|
||||
'Key',
|
||||
'Type',
|
||||
'Velocity',
|
||||
'SongType',
|
||||
'Tempo',
|
||||
];
|
||||
|
||||
constructor() { }
|
||||
|
||||
Reference in New Issue
Block a user