(front) Another way to get toSort boolean at Service
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
<h1>{{albumName}}</h1>
|
<h1>{{albumName}}</h1>
|
||||||
|
|
||||||
<div *ngIf="toSort" class="alert alert-danger">
|
<div *ngIf="toSort" class="alert alert-danger">
|
||||||
To sort filter applyed. Songs are filter on location.
|
To sort filter applyed. Songs are filter on location. <br/>
|
||||||
|
Album folder: {{album['Location']}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { map, catchError } from 'rxjs/operators';
|
|||||||
|
|
||||||
import { Album } from './model/album';
|
import { Album } from './model/album';
|
||||||
import { ElsService } from './els.service';
|
import { ElsService } from './els.service';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ElsAlbumService extends ElsService {
|
export class ElsAlbumService extends ElsService {
|
||||||
@@ -36,8 +37,10 @@ export class ElsAlbumService extends ElsService {
|
|||||||
'size': 500
|
'size': 500
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(protected http: HttpClient) {
|
constructor(
|
||||||
super(http);
|
protected http: HttpClient,
|
||||||
|
protected route: ActivatedRoute) {
|
||||||
|
super(http, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAlbums(query: any): Observable<Album[]> {
|
getAlbums(query: any): Observable<Album[]> {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, catchError } from 'rxjs/operators';
|
import { map, catchError } from 'rxjs/operators';
|
||||||
import { ElsService } from './els.service';
|
import { ElsService } from './els.service';
|
||||||
@@ -12,8 +13,10 @@ import { Song } from './model/song';
|
|||||||
})
|
})
|
||||||
export class ElsSortService extends ElsService {
|
export class ElsSortService extends ElsService {
|
||||||
|
|
||||||
constructor(protected http: HttpClient) {
|
constructor(
|
||||||
super(http);
|
protected http: HttpClient,
|
||||||
|
protected route: ActivatedRoute) {
|
||||||
|
super(http, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTime(): Promise<number> {
|
getTime(): Promise<number> {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { Album } from './model/album';
|
|||||||
import { Artist } from './model/artist';
|
import { Artist } from './model/artist';
|
||||||
import { Bucket } from './model/bucket';
|
import { Bucket } from './model/bucket';
|
||||||
import { Suggested } from './model/suggested';
|
import { Suggested } from './model/suggested';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ElsService {
|
export class ElsService {
|
||||||
@@ -25,7 +26,16 @@ export class ElsService {
|
|||||||
protected headers = new HttpHeaders({'Content-Type': 'application/json'});
|
protected headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||||
protected defaultLocation = "/F:/Musique" // TODO Use conf
|
protected defaultLocation = "/F:/Musique" // TODO Use conf
|
||||||
|
|
||||||
constructor(protected http: HttpClient) { }
|
constructor(
|
||||||
|
protected http: HttpClient,
|
||||||
|
protected route: ActivatedRoute) { }
|
||||||
|
|
||||||
|
fetchToSortParam() {
|
||||||
|
const toSort = this.route.snapshot.queryParams['backend'] || 'defaultUrl';
|
||||||
|
console.log('fetchToSortParam return ' + toSort)
|
||||||
|
return toSort;
|
||||||
|
// ? Retrieve to sort on Service or on each component and add a parameter for each methods?
|
||||||
|
}
|
||||||
|
|
||||||
getTime(): Promise<number> {
|
getTime(): Promise<number> {
|
||||||
return this.http
|
return this.http
|
||||||
|
|||||||
Reference in New Issue
Block a user