diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html index 19dc96c04..6a352c940 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html @@ -102,7 +102,7 @@
- +
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.html index 86143b4c5..1d5d5bec7 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.html @@ -12,11 +12,11 @@
-
+
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.ts index 4ecfb77ac..7e1dab431 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/panels/artist-release-panel/artist-release-panel.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, ViewEncapsulation, OnInit } from "@angular/core"; +import { Component, Input, ViewEncapsulation, OnInit, OnChanges, SimpleChanges } from "@angular/core"; import { IReleaseGroups } from "../../../../../interfaces/IMusicSearchResultV2"; import { SearchV2Service } from "../../../../../services/searchV2.service"; import { ActivatedRoute } from "@angular/router"; @@ -9,19 +9,16 @@ import { ActivatedRoute } from "@angular/router"; selector: "artist-release-panel", encapsulation: ViewEncapsulation.None }) -export class ArtistReleasePanel implements OnInit { - +export class ArtistReleasePanel implements OnChanges { @Input() public releases: IReleaseGroups[]; public albums: IReleaseGroups[]; - constructor(private searchService: SearchV2Service, private route: ActivatedRoute) { - route.params.subscribe(() => { - // This is due to when we change the music Id, NgOnInit is not called again - // Since the component has not been destroyed (We are not navigating away) - // so we need to subscribe to custom changes so we can do the data manulipulation below - this.loadAlbums(); - }); + constructor(private searchService: SearchV2Service) { + } + + ngOnChanges(changes: SimpleChanges): void { + this.loadAlbums(); } public ngOnInit() { @@ -29,10 +26,19 @@ export class ArtistReleasePanel implements OnInit { } private loadAlbums(): void { - this.albums = this.releases.filter(x => x.type === "Album"); + if (this.releases) { + this.albums = this.releases.filter(x => x.type === "Album"); + this.albums = this.albums.sort((a: IReleaseGroups, b: IReleaseGroups) => { + return this.getTime(new Date(b.releaseDate)) - this.getTime(new Date(a.releaseDate)); + }); + + this.albums.forEach(a => { + this.searchService.getReleaseGroupArt(a.id).subscribe(x => a.image = x.image); + }); + } + } - this.albums.forEach(a => { - this.searchService.getReleaseGroupArt(a.id).subscribe(x => a.image = x.image); - }); + private getTime(date?: Date) { + return date != null ? date.getTime() : 0; } } diff --git a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html index 0806fdcc8..314b19146 100644 --- a/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html +++ b/src/Ombi/ClientApp/src/app/settings/jobs/jobs.component.html @@ -8,7 +8,7 @@
Changes to any of the below requires you to restart Ombi. - You can generate valid CRON Expressions here: http://www.cronmaker.com/ + You can generate valid CRON Expressions here: https://www.cronmaker.com/