Add never list. song + fix color red panel
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
}
|
||||
|
||||
.panel-red {
|
||||
background-color: #9b59b6;
|
||||
background-color: #d9534f;
|
||||
color:white;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<br />
|
||||
<div class="row cardAdmin">
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-yellow">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
@@ -59,6 +59,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-red">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-stop stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!neverListenSong"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="neverListenSong">{{neverListenSong}}</h3>
|
||||
</div>
|
||||
<div><br>Never list. songs</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Top Played Songs</h3>
|
||||
|
||||
@@ -19,6 +19,7 @@ export class DashboardComponent implements OnInit {
|
||||
trackCountSong: number = 0;
|
||||
trackCountArtist: number = 0;
|
||||
trackCountAlbum: number = 0;
|
||||
neverListenSong: number = 0;
|
||||
|
||||
mostPlayedSongs: Song[] = [];
|
||||
|
||||
@@ -35,13 +36,16 @@ export class DashboardComponent implements OnInit {
|
||||
this.totalSizeSt = this.convertSizeToString(result);
|
||||
});
|
||||
|
||||
this.elsService.getCount("song")
|
||||
this.elsService.getCountSong("song")
|
||||
.then(result => this.trackCountSong = result);
|
||||
this.elsService.getCount("artist")
|
||||
this.elsService.getCountSong("artist")
|
||||
.then(result => this.trackCountArtist = result);
|
||||
this.elsService.getCount("album")
|
||||
this.elsService.getCountSong("album")
|
||||
.then(result => this.trackCountAlbum = result);
|
||||
|
||||
this.elsService.getCountNeverListenSong()
|
||||
.then(result => this.neverListenSong = result);
|
||||
|
||||
this.elsService.getMostPlayedTrack().subscribe(
|
||||
data => this.mostPlayedSongs = data
|
||||
);
|
||||
@@ -63,7 +67,7 @@ export class DashboardComponent implements OnInit {
|
||||
x /= 24
|
||||
let days = Math.round(x);
|
||||
|
||||
return days + "d, " + hours + ":" + minutes + "." + seconds;
|
||||
return days + "d" + hours + ":" + minutes + "." + seconds;
|
||||
// return days + " days, " + hours + " hours, " + minutes + " minutes and " + seconds + " seconds";
|
||||
}
|
||||
|
||||
|
||||
@@ -43,16 +43,26 @@ export class ElsService {
|
||||
});
|
||||
}
|
||||
|
||||
getCount(type: string): Promise<number> {
|
||||
getCountSong(type: string): Promise<number> {
|
||||
return this.http.get(this.elsUrl + type + "/_count")
|
||||
.toPromise()
|
||||
.then(res => res.json().count as number)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCountNeverListenSong(): Promise<number> {
|
||||
return this.http
|
||||
.post(this.elsUrl + "song/_count",
|
||||
JSON.stringify({"query":{"bool":{"must_not": {"exists": {"field": "Play Count"}}}}}),
|
||||
{headers: this.headers})
|
||||
.toPromise()
|
||||
.then(res => res.json().count as number)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getTrackCountSlowly(type: string): Promise<number> {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => resolve(this.getCount(type)), 2000);
|
||||
setTimeout(() => resolve(this.getCountSong(type)), 2000);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,10 +96,10 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getAlbumSongs(albumName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug("Album name: " + albumName + " - from: " + from);
|
||||
console.debug("getAlbumSongs- Album name: " + albumName + " - from: " + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + "song/_search",
|
||||
JSON.stringify({"query":{"match_phrase":{"Album":albumName}},"size": ElsService.DEFAULT_SIZE, "from": from}), // TODO Dynamic size
|
||||
JSON.stringify({"query":{"match_phrase":{"Album":albumName}},"size": ElsService.DEFAULT_SIZE, "from": from}),
|
||||
{headers: this.headers})
|
||||
.map(res => {
|
||||
return res.json().hits.hits;
|
||||
@@ -104,10 +114,21 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getArtistSongs(artistName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug("Artist name: " + artistName + " - from: " + from);
|
||||
console.debug("getArtistSongs- Artist name: " + artistName + " - from: " + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + "song/_search",
|
||||
JSON.stringify({"query":{"match_phrase":{"Artist":artistName}},"size": ElsService.DEFAULT_SIZE, "from": from}), // TODO Dynamic size
|
||||
JSON.stringify({
|
||||
"query": {
|
||||
"bool": {
|
||||
"should": [
|
||||
{"match_phrase" : { "Album Artist" : artistName }},
|
||||
{"match_phrase" : { "Artist" : artistName }}
|
||||
]
|
||||
}
|
||||
},
|
||||
"size": ElsService.DEFAULT_SIZE,
|
||||
"from": from
|
||||
}),
|
||||
{headers: this.headers})
|
||||
.map(res => {
|
||||
return res.json().hits.hits;
|
||||
@@ -124,7 +145,7 @@ export class ElsService {
|
||||
getAlbum(albumName: string): Observable<Album> {
|
||||
return this.http
|
||||
.post(this.elsUrl + "album/_search",
|
||||
JSON.stringify({"query":{"match_phrase":{"Album":albumName}},"size": ElsService.DEFAULT_SIZE}), // TODO Dynamic size
|
||||
JSON.stringify({"query":{"match_phrase":{"Album":albumName}},"size": ElsService.DEFAULT_SIZE}),
|
||||
{headers: this.headers})
|
||||
.map(res => {
|
||||
return res.json().hits.hits;
|
||||
|
||||
Reference in New Issue
Block a user