(front) Albums: link to artist/albums + Play count

Improve ngIf part
Use a script in ELS query to sort on avg play count
This commit is contained in:
2021-01-19 18:46:51 +01:00
parent 57e1c18a7f
commit fb620f582f
2 changed files with 29 additions and 7 deletions

View File

@@ -9,22 +9,31 @@
<th>Track Count</th>
<th>Artist/Album Artist</th>
<th>Avg Bit Rate (min)</th>
<th>Play Count</th>
<th>Rating</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let album of albums">
<td>
{{album.Album}}
<a [routerLink]="['/album', album.Album]">{{album.Album}}</a>&nbsp;
<span class="glyphicon glyphicon-remove-circle" style="cursor:pointer" (click)="exlude('Album', album)"></span>
</td>
<td>{{album['Track Count']}}</td>
<td>
{{album['Album Artist'] ? album['Album Artist'] : album.Artist}}
<span *ngIf="album['Album Artist']; else removeArtistButton"
class="glyphicon glyphicon-remove-circle" style="cursor:pointer" (click)="exlude('Album Artist', album)"></span>
<ng-template #removeArtistButton>
<span class="glyphicon glyphicon-remove-circle" style="cursor:pointer" (click)="exlude('Artist', album)"></span>
<!-- {{album['Album Artist'] ? album['Album Artist'] : album.Artist}} -->
<span *ngIf="album['Album Artist']; else artistSection">
<a [routerLink]="['/artist', album['Album Artist']]">{{album['Album Artist']}}</a>&nbsp;
<span class="glyphicon glyphicon-ban-circle" style="cursor:pointer" (click)="exlude('Album Artist', album)"></span>
</span>
<ng-template #artistSection>
<span>
<a [routerLink]="['/artist', album.Artist[0]]">{{album.Artist}}</a>&nbsp;
<span class="glyphicon glyphicon-ban-circle" style="cursor:pointer" (click)="exlude('Artist', album)"></span>
</span>
</ng-template>
</td>
@@ -33,6 +42,10 @@
<span *ngIf="album['Avg Bit Rate'] != album['Min Bit Rate']">({{album['Min Bit Rate']}})</span>
</td>
<td>
{{album['Play Count']}} ({{album['Play Count']/album['Track Count'] | number:'1.0-0'}}/songs)
</td>
<td class="star" [title]="(album['Album Rating Computed']?'Computed Rating: ':'Rating: ') + album['Album Rating']">
<span *ngFor="let item of numberToArray(album['Album Rating'], 20)">
<span class="glyphicon" [ngClass]="album['Album Rating Computed']?'glyphicon-star-empty':'glyphicon-star'"></span>

View File

@@ -14,7 +14,16 @@ export class ElsAlbumService extends ElsService {
'Avg Bit Rate': {
'order': 'asc'
}
} ],
}, {
'_script' : {
'type' : 'number',
'script' : {
'lang': 'painless',
'source': 'doc[\'Play Count\'].value / doc[\'Track Count\'].value'
},
'order' : 'desc'
}
} ],
'size': ElsService.DEFAULT_SIZE
}