From b1e6fd313ba51646d31c53fb3bbf39af17105007 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 14 Nov 2018 20:06:50 +0000 Subject: [PATCH 01/20] !wip started on the request queue --- .../Jobs/Ombi/ResendFailedRequests.cs | 19 +++++++++++++++++++ src/Ombi.Store/Entities/RequestQueue.cs | 14 ++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs create mode 100644 src/Ombi.Store/Entities/RequestQueue.cs diff --git a/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs new file mode 100644 index 000000000..1e7b8d760 --- /dev/null +++ b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Ombi.Store.Entities; +using Ombi.Store.Repository; + +namespace Ombi.Schedule.Jobs.Ombi +{ + public class ResendFailedRequests + { + public ResendFailedRequests(IRepository queue, IMovieSender movieSender) + { + + } + + public async Task Start() + { + + } + } +} \ No newline at end of file diff --git a/src/Ombi.Store/Entities/RequestQueue.cs b/src/Ombi.Store/Entities/RequestQueue.cs new file mode 100644 index 000000000..980bfca31 --- /dev/null +++ b/src/Ombi.Store/Entities/RequestQueue.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Ombi.Store.Entities +{ + [Table("RequestQueue")] + public class RequestQueue : Entity + { + public int RequestId { get; set; } + public RequestType Type { get; set; } + public DateTime Dts { get; set; } + public DateTime Completed { get; set; } + } +} \ No newline at end of file From 185c47b0ee56310bbc386e9fc936a72c8650b47c Mon Sep 17 00:00:00 2001 From: Victor Usoltsev Date: Wed, 28 Nov 2018 10:02:54 +1300 Subject: [PATCH 02/20] Maps alias email variable for welcome emails. --- src/Ombi/Controllers/IdentityController.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Ombi/Controllers/IdentityController.cs b/src/Ombi/Controllers/IdentityController.cs index 61b3f06d8..f963db0b8 100644 --- a/src/Ombi/Controllers/IdentityController.cs +++ b/src/Ombi/Controllers/IdentityController.cs @@ -863,6 +863,7 @@ namespace Ombi.Controllers { var ombiUser = new OmbiUser { + Alias = user.Alias, Email = user.EmailAddress, UserName = user.UserName }; From 6c1057ad70d05ba5ed1f923085a6ae88abfc1cf2 Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 28 Nov 2018 21:19:35 +0000 Subject: [PATCH 03/20] Increased the logo size on the landing page to match the container below it --- src/Ombi/ClientApp/app/landingpage/landingpage.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Ombi/ClientApp/app/landingpage/landingpage.component.html b/src/Ombi/ClientApp/app/landingpage/landingpage.component.html index 27545b64b..03878033f 100644 --- a/src/Ombi/ClientApp/app/landingpage/landingpage.component.html +++ b/src/Ombi/ClientApp/app/landingpage/landingpage.component.html @@ -3,7 +3,7 @@
-
+
From 91fdfa74c19ba876fc0af98ecf5ba5bfeea901dd Mon Sep 17 00:00:00 2001 From: TidusJar Date: Mon, 3 Dec 2018 20:34:21 +0000 Subject: [PATCH 04/20] #2669 Fixed missing translations --- src/Ombi/ClientApp/app/search/moviesearch.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.html b/src/Ombi/ClientApp/app/search/moviesearch.component.html index 05dbf15ad..b51dec5a6 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.html @@ -92,12 +92,12 @@
+ +
+ + + The Retry Requests is required + +
diff --git a/src/Ombi/Controllers/SettingsController.cs b/src/Ombi/Controllers/SettingsController.cs index b523250a6..338b55f21 100644 --- a/src/Ombi/Controllers/SettingsController.cs +++ b/src/Ombi/Controllers/SettingsController.cs @@ -520,6 +520,7 @@ namespace Ombi.Controllers j.Newsletter = j.Newsletter.HasValue() ? j.Newsletter : JobSettingsHelper.Newsletter(j); j.LidarrArtistSync = j.LidarrArtistSync.HasValue() ? j.LidarrArtistSync : JobSettingsHelper.LidarrArtistSync(j); j.IssuesPurge = j.IssuesPurge.HasValue() ? j.IssuesPurge : JobSettingsHelper.IssuePurge(j); + j.RetryRequests = j.RetryRequests.HasValue() ? j.RetryRequests : JobSettingsHelper.ResendFailedRequests(j); return j; } From 75f43260c0aff88d0a6bf7602e4af6dd3f4c0127 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Mon, 3 Dec 2018 21:36:46 +0000 Subject: [PATCH 07/20] !wip added the api --- .../Rule/Search/CouchPotatoCacheRuleTests.cs | 4 +- .../Rule/Search/RadarrCacheRuleTests.cs | 4 +- src/Ombi.Core/Ombi.Core.csproj | 1 + src/Ombi.Core/Senders/MusicSender.cs | 2 - src/Ombi.Schedule.Tests/NewsletterTests.cs | 6 +- .../20181203213532_RequestQueue.Designer.cs | 1182 +++++++++++++++++ .../Migrations/20181203213532_RequestQueue.cs | 17 + .../Migrations/OmbiContextModelSnapshot.cs | 2 +- src/Ombi/Controllers/RequestRetyController.cs | 44 + 9 files changed, 1253 insertions(+), 9 deletions(-) create mode 100644 src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs create mode 100644 src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs create mode 100644 src/Ombi/Controllers/RequestRetyController.cs diff --git a/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs index 56524522b..2a8f7a520 100644 --- a/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs @@ -18,13 +18,13 @@ namespace Ombi.Core.Tests.Rule.Search [SetUp] public void Setup() { - ContextMock = new Mock>(); + ContextMock = new Mock>(); Rule = new CouchPotatoCacheRule(ContextMock.Object); } private CouchPotatoCacheRule Rule { get; set; } - private Mock> ContextMock { get; set; } + private Mock> ContextMock { get; set; } [Test] public async Task Should_ReturnApproved_WhenMovieIsInCouchPotato() diff --git a/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs index 914112d5b..94efe89a2 100644 --- a/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs @@ -15,13 +15,13 @@ namespace Ombi.Core.Tests.Rule.Search [SetUp] public void Setup() { - ContextMock = new Mock>(); + ContextMock = new Mock>(); Rule = new RadarrCacheRule(ContextMock.Object); } private RadarrCacheRule Rule { get; set; } - private Mock> ContextMock { get; set; } + private Mock> ContextMock { get; set; } [Test] public async Task Should_ReturnApproved_WhenMovieIsInRadarr() diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj index 644c02515..fb1024b93 100644 --- a/src/Ombi.Core/Ombi.Core.csproj +++ b/src/Ombi.Core/Ombi.Core.csproj @@ -22,6 +22,7 @@ + diff --git a/src/Ombi.Core/Senders/MusicSender.cs b/src/Ombi.Core/Senders/MusicSender.cs index b016e76b5..76a9fc14c 100644 --- a/src/Ombi.Core/Senders/MusicSender.cs +++ b/src/Ombi.Core/Senders/MusicSender.cs @@ -4,14 +4,12 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Ombi.Api.Lidarr; using Ombi.Api.Lidarr.Models; -using Ombi.Api.Radarr; using Ombi.Core.Settings; using Ombi.Helpers; using Ombi.Settings.Settings.Models.External; using Ombi.Store.Entities; using Ombi.Store.Entities.Requests; using Ombi.Store.Repository; -using Serilog; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Ombi.Core.Senders diff --git a/src/Ombi.Schedule.Tests/NewsletterTests.cs b/src/Ombi.Schedule.Tests/NewsletterTests.cs index 146cd97cf..f729e8899 100644 --- a/src/Ombi.Schedule.Tests/NewsletterTests.cs +++ b/src/Ombi.Schedule.Tests/NewsletterTests.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using NUnit.Framework; +using Ombi.Helpers; using static Ombi.Schedule.Jobs.Ombi.NewsletterJob; namespace Ombi.Schedule.Tests @@ -15,7 +17,7 @@ namespace Ombi.Schedule.Tests { ep.Add(i); } - var result = BuildEpisodeList(ep); + var result = StringHelper.BuildEpisodeList(ep); return result; } diff --git a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs b/src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs new file mode 100644 index 000000000..5de4398af --- /dev/null +++ b/src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs @@ -0,0 +1,1182 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context; + +namespace Ombi.Store.Migrations +{ + [DbContext(typeof(OmbiContext))] + [Migration("20181203213532_RequestQueue")] + partial class RequestQueue + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.4-rtm-31024"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Name") + .HasMaxLength(256); + + b.Property("NormalizedName") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("RoleId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClaimType"); + + b.Property("ClaimValue"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider"); + + b.Property("ProviderKey"); + + b.Property("ProviderDisplayName"); + + b.Property("UserId") + .IsRequired(); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId"); + + b.Property("RoleId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId"); + + b.Property("LoginProvider"); + + b.Property("Name"); + + b.Property("Value"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.ApplicationConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Type"); + + b.Property("Value"); + + b.HasKey("Id"); + + b.ToTable("ApplicationConfiguration"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AuditArea"); + + b.Property("AuditType"); + + b.Property("DateTime"); + + b.Property("Description"); + + b.Property("User"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.CouchPotatoCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("TheMovieDbId"); + + b.HasKey("Id"); + + b.ToTable("CouchPotatoCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.EmbyContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("EmbyId") + .IsRequired(); + + b.Property("ImdbId"); + + b.Property("ProviderId"); + + b.Property("TheMovieDbId"); + + b.Property("Title"); + + b.Property("TvDbId"); + + b.Property("Type"); + + b.Property("Url"); + + b.HasKey("Id"); + + b.ToTable("EmbyContent"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("EmbyId"); + + b.Property("EpisodeNumber"); + + b.Property("ImdbId"); + + b.Property("ParentId"); + + b.Property("ProviderId"); + + b.Property("SeasonNumber"); + + b.Property("TheMovieDbId"); + + b.Property("Title"); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("EmbyEpisode"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.GlobalSettings", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Content"); + + b.Property("SettingsName"); + + b.HasKey("Id"); + + b.ToTable("GlobalSettings"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("ArtistId"); + + b.Property("ForeignAlbumId"); + + b.Property("Monitored"); + + b.Property("PercentOfTracks"); + + b.Property("ReleaseDate"); + + b.Property("Title"); + + b.Property("TrackCount"); + + b.HasKey("Id"); + + b.ToTable("LidarrAlbumCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.LidarrArtistCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ArtistId"); + + b.Property("ArtistName"); + + b.Property("ForeignArtistId"); + + b.Property("Monitored"); + + b.HasKey("Id"); + + b.ToTable("LidarrArtistCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Agent"); + + b.Property("Enabled"); + + b.Property("Message"); + + b.Property("NotificationType"); + + b.Property("Subject"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("PlayerId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AccessFailedCount"); + + b.Property("Alias"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken(); + + b.Property("Email") + .HasMaxLength(256); + + b.Property("EmailConfirmed"); + + b.Property("EmbyConnectUserId"); + + b.Property("EpisodeRequestLimit"); + + b.Property("LastLoggedIn"); + + b.Property("LockoutEnabled"); + + b.Property("LockoutEnd"); + + b.Property("MovieRequestLimit"); + + b.Property("MusicRequestLimit"); + + b.Property("NormalizedEmail") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .HasMaxLength(256); + + b.Property("PasswordHash"); + + b.Property("PhoneNumber"); + + b.Property("PhoneNumberConfirmed"); + + b.Property("ProviderUserId"); + + b.Property("SecurityStamp"); + + b.Property("TwoFactorEnabled"); + + b.Property("UserAccessToken"); + + b.Property("UserName") + .HasMaxLength(256); + + b.Property("UserType"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EpisodeNumber"); + + b.Property("GrandparentKey"); + + b.Property("Key"); + + b.Property("ParentKey"); + + b.Property("SeasonNumber"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.HasIndex("GrandparentKey"); + + b.ToTable("PlexEpisode"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ParentKey"); + + b.Property("PlexContentId"); + + b.Property("PlexServerContentId"); + + b.Property("SeasonKey"); + + b.Property("SeasonNumber"); + + b.HasKey("Id"); + + b.HasIndex("PlexServerContentId"); + + b.ToTable("PlexSeasonsContent"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.PlexServerContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("ImdbId"); + + b.Property("Key"); + + b.Property("Quality"); + + b.Property("ReleaseYear"); + + b.Property("TheMovieDbId"); + + b.Property("Title"); + + b.Property("TvDbId"); + + b.Property("Type"); + + b.Property("Url"); + + b.HasKey("Id"); + + b.ToTable("PlexServerContent"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RadarrCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HasFile"); + + b.Property("TheMovieDbId"); + + b.HasKey("Id"); + + b.ToTable("RadarrCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AddedAt"); + + b.Property("AlbumId"); + + b.Property("ContentId"); + + b.Property("ContentType"); + + b.Property("EpisodeNumber"); + + b.Property("SeasonNumber"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Approved"); + + b.Property("ArtistName"); + + b.Property("Available"); + + b.Property("Cover"); + + b.Property("Denied"); + + b.Property("DeniedReason"); + + b.Property("Disk"); + + b.Property("ForeignAlbumId"); + + b.Property("ForeignArtistId"); + + b.Property("MarkedAsApproved"); + + b.Property("MarkedAsAvailable"); + + b.Property("MarkedAsDenied"); + + b.Property("Rating"); + + b.Property("ReleaseDate"); + + b.Property("RequestType"); + + b.Property("RequestedDate"); + + b.Property("RequestedUserId"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("AlbumRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Approved"); + + b.Property("Available"); + + b.Property("Denied"); + + b.Property("DeniedReason"); + + b.Property("IssueId"); + + b.Property("MarkedAsApproved"); + + b.Property("MarkedAsAvailable"); + + b.Property("MarkedAsDenied"); + + b.Property("ParentRequestId"); + + b.Property("RequestType"); + + b.Property("RequestedDate"); + + b.Property("RequestedUserId"); + + b.Property("SeriesType"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Value"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Comment"); + + b.Property("Date"); + + b.Property("IssuesId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.Property("IssueCategoryId"); + + b.Property("IssueId"); + + b.Property("ProviderId"); + + b.Property("RequestId"); + + b.Property("RequestType"); + + b.Property("ResovledDate"); + + b.Property("Status"); + + b.Property("Subject"); + + b.Property("Title"); + + b.Property("UserReportedId"); + + b.HasKey("Id"); + + b.HasIndex("IssueCategoryId"); + + b.HasIndex("IssueId"); + + b.HasIndex("UserReportedId"); + + b.ToTable("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Approved"); + + b.Property("Available"); + + b.Property("Background"); + + b.Property("Denied"); + + b.Property("DeniedReason"); + + b.Property("DigitalReleaseDate"); + + b.Property("ImdbId"); + + b.Property("IssueId"); + + b.Property("MarkedAsApproved"); + + b.Property("MarkedAsAvailable"); + + b.Property("MarkedAsDenied"); + + b.Property("Overview"); + + b.Property("PosterPath"); + + b.Property("QualityOverride"); + + b.Property("ReleaseDate"); + + b.Property("RequestType"); + + b.Property("RequestedDate"); + + b.Property("RequestedUserId"); + + b.Property("RootPathOverride"); + + b.Property("Status"); + + b.Property("TheMovieDbId"); + + b.Property("Title"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EpisodeCount"); + + b.Property("RequestDate"); + + b.Property("RequestId"); + + b.Property("RequestType"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Background"); + + b.Property("ImdbId"); + + b.Property("Overview"); + + b.Property("PosterPath"); + + b.Property("QualityOverride"); + + b.Property("ReleaseDate"); + + b.Property("RootFolder"); + + b.Property("Status"); + + b.Property("Title"); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("RequestId"); + + b.Property("RequestType"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.SickRageCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.ToTable("SickRageCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.SickRageEpisodeCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EpisodeNumber"); + + b.Property("SeasonNumber"); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.ToTable("SickRageEpisodeCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.SonarrCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.ToTable("SonarrCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.SonarrEpisodeCache", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EpisodeNumber"); + + b.Property("HasFile"); + + b.Property("SeasonNumber"); + + b.Property("TvDbId"); + + b.HasKey("Id"); + + b.ToTable("SonarrEpisodeCache"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Token"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Agent"); + + b.Property("Enabled"); + + b.Property("UserId"); + + b.Property("Value"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("RadarrQualityProfile"); + + b.Property("RadarrRootPath"); + + b.Property("SonarrQualityProfile"); + + b.Property("SonarrQualityProfileAnime"); + + b.Property("SonarrRootPath"); + + b.Property("SonarrRootPathAnime"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Date"); + + b.Property("Deleted"); + + b.Property("RequestId"); + + b.Property("RequestType"); + + b.Property("UserId"); + + b.Property("VoteType"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AirDate"); + + b.Property("Approved"); + + b.Property("Available"); + + b.Property("EpisodeNumber"); + + b.Property("Requested"); + + b.Property("SeasonId"); + + b.Property("Title"); + + b.Property("Url"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ChildRequestId"); + + b.Property("SeasonNumber"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Ombi.Store.Entities.OmbiUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Ombi.Store.Entities.EmbyEpisode", b => + { + b.HasOne("Ombi.Store.Entities.EmbyContent", "Series") + .WithMany("Episodes") + .HasForeignKey("ParentId") + .HasPrincipalKey("EmbyId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.PlexEpisode", b => + { + b.HasOne("Ombi.Store.Entities.PlexServerContent", "Series") + .WithMany("Episodes") + .HasForeignKey("GrandparentKey") + .HasPrincipalKey("Key") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Ombi.Store.Entities.PlexSeasonsContent", b => + { + b.HasOne("Ombi.Store.Entities.PlexServerContent") + .WithMany("Seasons") + .HasForeignKey("PlexServerContentId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") + .WithMany("Comments") + .HasForeignKey("IssuesId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") + .WithMany() + .HasForeignKey("IssueCategoryId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests") + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests") + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") + .WithMany() + .HasForeignKey("UserReportedId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") + .WithMany("Episodes") + .HasForeignKey("SeasonId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs b/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs new file mode 100644 index 000000000..cd577cc26 --- /dev/null +++ b/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations +{ + public partial class RequestQueue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs b/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs index 60927b1ed..672525b41 100644 --- a/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace Ombi.Store.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.3-rtm-32065"); + .HasAnnotation("ProductVersion", "2.1.4-rtm-31024"); modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => { diff --git a/src/Ombi/Controllers/RequestRetyController.cs b/src/Ombi/Controllers/RequestRetyController.cs new file mode 100644 index 000000000..34e11eb6d --- /dev/null +++ b/src/Ombi/Controllers/RequestRetyController.cs @@ -0,0 +1,44 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Ombi.Store.Entities.Requests; +using Ombi.Store.Repository; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Ombi.Store.Entities; + +namespace Ombi.Controllers +{ + [ApiV1] + [Authorize] + [Produces("application/json")] + public class RequestRetyController : Controller + { + public RequestRetyController(IRepository requestQueue) + { + _requestQueueRepository = requestQueue; + } + + private readonly IRepository _requestQueueRepository; + + /// + /// Get's all the failed requests that are currently in the queue + /// + /// + [HttpGet] + public async Task> Categories() + { + return await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync(); + } + + [HttpDelete("{queueId:int}")] + public async Task Delete(int queueId) + { + var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId); + await _requestQueueRepository.Delete(queueItem); + return Ok(); + } + + } +} \ No newline at end of file From e8c6b23304e70d41809fcba2eb3391b702b87094 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Mon, 3 Dec 2018 21:44:07 +0000 Subject: [PATCH 08/20] Started on the UI !wip --- src/Ombi.DependencyInjection/IocExtensions.cs | 1 + .../app/services/requestretry.service.ts | 18 +++++++++++++ .../failedrequest.component.html | 3 +++ .../failedrequests.component.ts | 25 +++++++++++++++++++ .../app/settings/jobs/jobs.component.html | 2 +- .../ClientApp/app/settings/settings.module.ts | 3 +++ src/Ombi/Controllers/RequestRetyController.cs | 3 ++- 7 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 src/Ombi/ClientApp/app/services/requestretry.service.ts create mode 100644 src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html create mode 100644 src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index f5184493c..836bc4f5b 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -198,6 +198,7 @@ namespace Ombi.DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } } diff --git a/src/Ombi/ClientApp/app/services/requestretry.service.ts b/src/Ombi/ClientApp/app/services/requestretry.service.ts new file mode 100644 index 000000000..338475609 --- /dev/null +++ b/src/Ombi/ClientApp/app/services/requestretry.service.ts @@ -0,0 +1,18 @@ +import { PlatformLocation } from "@angular/common"; +import { Injectable } from "@angular/core"; + +import { HttpClient } from "@angular/common/http"; +import { Observable } from "rxjs"; + +import { IMobileUsersViewModel } from "../interfaces"; +import { ServiceHelpers } from "./service.helpers"; + +@Injectable() +export class RequestRetryService extends ServiceHelpers { + constructor(http: HttpClient, public platformLocation: PlatformLocation) { + super(http, "/api/v1/requestretry/", platformLocation); + } + public getUserDeviceList(): Observable { + return this.http.get(`${this.url}notification/`, {headers: this.headers}); + } +} diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html new file mode 100644 index 000000000..4689eef46 --- /dev/null +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html @@ -0,0 +1,3 @@ + + + diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts new file mode 100644 index 000000000..af75a8bf1 --- /dev/null +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from "@angular/core"; +import { IAbout } from "../../interfaces/ISettings"; +import { JobService, SettingsService } from "../../services"; + +@Component({ + templateUrl: "./about.component.html", +}) +export class AboutComponent implements OnInit { + + public about: IAbout; + public newUpdate: boolean; + + constructor(private readonly settingsService: SettingsService, + private readonly jobService: JobService) { } + + public ngOnInit() { + this.settingsService.about().subscribe(x => this.about = x); + this.jobService.getCachedUpdate().subscribe(x => { + if (x === true) { + this.newUpdate = true; + } + }); + + } +} diff --git a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.html b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.html index e889c0fca..f8e3bb309 100644 --- a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.html +++ b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.html @@ -51,7 +51,7 @@
- + The Retry Requests is required
diff --git a/src/Ombi/ClientApp/app/settings/settings.module.ts b/src/Ombi/ClientApp/app/settings/settings.module.ts index 060d42b19..e0fd90db9 100644 --- a/src/Ombi/ClientApp/app/settings/settings.module.ts +++ b/src/Ombi/ClientApp/app/settings/settings.module.ts @@ -19,6 +19,7 @@ import { CouchPotatoComponent } from "./couchpotato/couchpotato.component"; import { CustomizationComponent } from "./customization/customization.component"; import { DogNzbComponent } from "./dognzb/dognzb.component"; import { EmbyComponent } from "./emby/emby.component"; +import { FailedRequestsComponent } from "./failedrequests/failedrequests.component"; import { IssuesComponent } from "./issues/issues.component"; import { JobsComponent } from "./jobs/jobs.component"; import { LandingPageComponent } from "./landingpage/landingpage.component"; @@ -77,6 +78,7 @@ const routes: Routes = [ { path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] }, { path: "Lidarr", component: LidarrComponent, canActivate: [AuthGuard] }, { path: "Vote", component: VoteComponent, canActivate: [AuthGuard] }, + { path: "FailedRequests", component: FailedRequestsComponent, canActivate: [AuthGuard] }, ]; @NgModule({ @@ -130,6 +132,7 @@ const routes: Routes = [ NewsletterComponent, LidarrComponent, VoteComponent, + FailedRequestsComponent, ], exports: [ RouterModule, diff --git a/src/Ombi/Controllers/RequestRetyController.cs b/src/Ombi/Controllers/RequestRetyController.cs index 34e11eb6d..69e379838 100644 --- a/src/Ombi/Controllers/RequestRetyController.cs +++ b/src/Ombi/Controllers/RequestRetyController.cs @@ -6,12 +6,13 @@ using Ombi.Store.Repository; using System.Collections.Generic; using System.Linq; using Microsoft.EntityFrameworkCore; +using Ombi.Attributes; using Ombi.Store.Entities; namespace Ombi.Controllers { [ApiV1] - [Authorize] + [Admin] [Produces("application/json")] public class RequestRetyController : Controller { From 806cf7c0ffc73182a8099de40ad84b10825eff53 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Tue, 4 Dec 2018 09:45:22 +0000 Subject: [PATCH 09/20] More on the UI !wip --- src/Ombi.Store/Context/OmbiContext.cs | 1 + .../Migrations/20181203213532_RequestQueue.cs | 17 ---- ...> 20181204084915_RequestQueue.Designer.cs} | 24 ++++- .../Migrations/20181204084915_RequestQueue.cs | 35 +++++++ .../Migrations/OmbiContextModelSnapshot.cs | 22 +++++ .../app/interfaces/IFailedRequests.ts | 11 +++ .../ClientApp/app/interfaces/IRequestModel.ts | 2 +- src/Ombi/ClientApp/app/interfaces/index.ts | 1 + src/Ombi/ClientApp/app/services/index.ts | 1 + .../app/services/requestretry.service.ts | 6 +- .../failedrequest.component.html | 25 +++++ .../failedrequests.component.ts | 23 ++--- .../app/settings/jobs/jobs.component.ts | 1 + .../ClientApp/app/settings/settings.module.ts | 3 +- .../Controllers/RequestRetryController.cs | 92 +++++++++++++++++++ src/Ombi/Controllers/RequestRetyController.cs | 45 --------- src/Ombi/Models/FailedRequestViewModel.cs | 17 ++++ 17 files changed, 243 insertions(+), 83 deletions(-) delete mode 100644 src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs rename src/Ombi.Store/Migrations/{20181203213532_RequestQueue.Designer.cs => 20181204084915_RequestQueue.Designer.cs} (98%) create mode 100644 src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs create mode 100644 src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts create mode 100644 src/Ombi/Controllers/RequestRetryController.cs delete mode 100644 src/Ombi/Controllers/RequestRetyController.cs create mode 100644 src/Ombi/Models/FailedRequestViewModel.cs diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index 16f26c65a..3d8c05daa 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -56,6 +56,7 @@ namespace Ombi.Store.Context public DbSet RequestSubscription { get; set; } public DbSet UserNotificationPreferences { get; set; } public DbSet UserQualityProfileses { get; set; } + public DbSet RequestQueue { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { diff --git a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs b/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs deleted file mode 100644 index cd577cc26..000000000 --- a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Ombi.Store.Migrations -{ - public partial class RequestQueue : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs similarity index 98% rename from src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs rename to src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs index 5de4398af..468abb2c7 100644 --- a/src/Ombi.Store/Migrations/20181203213532_RequestQueue.Designer.cs +++ b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.Designer.cs @@ -9,7 +9,7 @@ using Ombi.Store.Context; namespace Ombi.Store.Migrations { [DbContext(typeof(OmbiContext))] - [Migration("20181203213532_RequestQueue")] + [Migration("20181204084915_RequestQueue")] partial class RequestQueue { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -510,6 +510,28 @@ namespace Ombi.Store.Migrations b.ToTable("RecentlyAddedLog"); }); + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Completed"); + + b.Property("Dts"); + + b.Property("Error"); + + b.Property("RequestId"); + + b.Property("RetryCount"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => { b.Property("Id") diff --git a/src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs new file mode 100644 index 000000000..820ce50af --- /dev/null +++ b/src/Ombi.Store/Migrations/20181204084915_RequestQueue.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations +{ + public partial class RequestQueue : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "RequestQueue", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RequestId = table.Column(nullable: false), + Type = table.Column(nullable: false), + Dts = table.Column(nullable: false), + Error = table.Column(nullable: true), + Completed = table.Column(nullable: true), + RetryCount = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_RequestQueue", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "RequestQueue"); + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs b/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs index 672525b41..5a009d5ef 100644 --- a/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/OmbiContextModelSnapshot.cs @@ -508,6 +508,28 @@ namespace Ombi.Store.Migrations b.ToTable("RecentlyAddedLog"); }); + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Completed"); + + b.Property("Dts"); + + b.Property("Error"); + + b.Property("RequestId"); + + b.Property("RetryCount"); + + b.Property("Type"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => { b.Property("Id") diff --git a/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts b/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts new file mode 100644 index 000000000..002904386 --- /dev/null +++ b/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts @@ -0,0 +1,11 @@ +import { RequestType } from "."; +export interface IFailedRequestsViewModel { + failedId: number; + title: string; + releaseYear: Date; + requestId: number; + requestType: RequestType; + dts: Date; + error: string; + retryCount: number; +} diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts index 310aaa6fd..5a72abf31 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts @@ -3,7 +3,7 @@ export enum RequestType { movie = 1, tvShow = 2, - + album = 3, } // NEW WORLD diff --git a/src/Ombi/ClientApp/app/interfaces/index.ts b/src/Ombi/ClientApp/app/interfaces/index.ts index bfc89edc6..e1cf823e8 100644 --- a/src/Ombi/ClientApp/app/interfaces/index.ts +++ b/src/Ombi/ClientApp/app/interfaces/index.ts @@ -17,3 +17,4 @@ export * from "./IRecentlyAdded"; export * from "./ILidarr"; export * from "./ISearchMusicResult"; export * from "./IVote"; +export * from "./IFailedRequests"; diff --git a/src/Ombi/ClientApp/app/services/index.ts b/src/Ombi/ClientApp/app/services/index.ts index c1ccc2585..edffdd625 100644 --- a/src/Ombi/ClientApp/app/services/index.ts +++ b/src/Ombi/ClientApp/app/services/index.ts @@ -15,3 +15,4 @@ export * from "./mobile.service"; export * from "./notificationMessage.service"; export * from "./recentlyAdded.service"; export * from "./vote.service"; +export * from "./requestretry.service"; diff --git a/src/Ombi/ClientApp/app/services/requestretry.service.ts b/src/Ombi/ClientApp/app/services/requestretry.service.ts index 338475609..09e345566 100644 --- a/src/Ombi/ClientApp/app/services/requestretry.service.ts +++ b/src/Ombi/ClientApp/app/services/requestretry.service.ts @@ -4,7 +4,7 @@ import { Injectable } from "@angular/core"; import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; -import { IMobileUsersViewModel } from "../interfaces"; +import { IFailedRequestsViewModel } from "../interfaces"; import { ServiceHelpers } from "./service.helpers"; @Injectable() @@ -12,7 +12,7 @@ export class RequestRetryService extends ServiceHelpers { constructor(http: HttpClient, public platformLocation: PlatformLocation) { super(http, "/api/v1/requestretry/", platformLocation); } - public getUserDeviceList(): Observable { - return this.http.get(`${this.url}notification/`, {headers: this.headers}); + public getFailedRequests(): Observable { + return this.http.get(this.url, {headers: this.headers}); } } diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html index 4689eef46..d1e5b13ec 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html @@ -1,3 +1,28 @@  + + + + + + + + + + + + + + + + + + + + + + +
TitleTypeRetry CountError DescriptionRetryDelete
+ {{v.title}} + {{RequestType[v.type] | humanize}}{{v.retryCount}}
diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts index af75a8bf1..214729840 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts @@ -1,25 +1,18 @@ import { Component, OnInit } from "@angular/core"; -import { IAbout } from "../../interfaces/ISettings"; -import { JobService, SettingsService } from "../../services"; +import { IFailedRequestsViewModel, RequestType } from "../../interfaces"; +import { RequestRetryService } from "../../services"; @Component({ - templateUrl: "./about.component.html", + templateUrl: "./failedrequest.component.html", }) -export class AboutComponent implements OnInit { +export class FailedRequestsComponent implements OnInit { - public about: IAbout; - public newUpdate: boolean; + public vm: IFailedRequestsViewModel[]; + public RequestType = RequestType; - constructor(private readonly settingsService: SettingsService, - private readonly jobService: JobService) { } + constructor(private retry: RequestRetryService) { } public ngOnInit() { - this.settingsService.about().subscribe(x => this.about = x); - this.jobService.getCachedUpdate().subscribe(x => { - if (x === true) { - this.newUpdate = true; - } - }); - + this.retry.getFailedRequests().subscribe(x => this.vm = x); } } diff --git a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts index d8ce106ae..853005185 100644 --- a/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts +++ b/src/Ombi/ClientApp/app/settings/jobs/jobs.component.ts @@ -36,6 +36,7 @@ export class JobsComponent implements OnInit { plexRecentlyAddedSync: [x.plexRecentlyAddedSync, Validators.required], lidarrArtistSync: [x.lidarrArtistSync, Validators.required], issuesPurge: [x.issuesPurge, Validators.required], + retryRequests: [x.retryRequests, Validators.required], }); }); } diff --git a/src/Ombi/ClientApp/app/settings/settings.module.ts b/src/Ombi/ClientApp/app/settings/settings.module.ts index e0fd90db9..fb1a10abe 100644 --- a/src/Ombi/ClientApp/app/settings/settings.module.ts +++ b/src/Ombi/ClientApp/app/settings/settings.module.ts @@ -9,7 +9,7 @@ import { AuthGuard } from "../auth/auth.guard"; import { AuthService } from "../auth/auth.service"; import { CouchPotatoService, EmbyService, IssuesService, JobService, LidarrService, MobileService, NotificationMessageService, PlexService, RadarrService, - SonarrService, TesterService, ValidationService, + RequestRetryService, SonarrService, TesterService, ValidationService, } from "../services"; import { PipeModule } from "../pipes/pipe.module"; @@ -152,6 +152,7 @@ const routes: Routes = [ MobileService, NotificationMessageService, LidarrService, + RequestRetryService, ], }) diff --git a/src/Ombi/Controllers/RequestRetryController.cs b/src/Ombi/Controllers/RequestRetryController.cs new file mode 100644 index 000000000..6a53f9732 --- /dev/null +++ b/src/Ombi/Controllers/RequestRetryController.cs @@ -0,0 +1,92 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Ombi.Store.Entities.Requests; +using Ombi.Store.Repository; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Ombi.Attributes; +using Ombi.Models; +using Ombi.Store.Entities; +using Ombi.Store.Repository.Requests; + +namespace Ombi.Controllers +{ + [ApiV1] + [Admin] + [Produces("application/json")] + public class RequestRetryController : Controller + { + public RequestRetryController(IRepository requestQueue, IMovieRequestRepository movieRepo, + ITvRequestRepository tvRepo, IMusicRequestRepository musicRepo) + { + _requestQueueRepository = requestQueue; + _movieRequestRepository = movieRepo; + _tvRequestRepository = tvRepo; + _musicRequestRepository = musicRepo; + } + + private readonly IRepository _requestQueueRepository; + private readonly IMovieRequestRepository _movieRequestRepository; + private readonly ITvRequestRepository _tvRequestRepository; + private readonly IMusicRequestRepository _musicRequestRepository; + + /// + /// Get's all the failed requests that are currently in the queue + /// + /// + [HttpGet] + public async Task> GetFailedRequests() + { + var failed = await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync(); + + var vm = new List(); + foreach (var f in failed) + { + var vmModel = new FailedRequestViewModel + { + RequestId = f.RequestId, + RetryCount = f.RetryCount, + Dts = f.Dts, + Error = f.Error, + FailedId = f.Id, + Type = f.Type + }; + + if (f.Type == RequestType.Movie) + { + var request = await _movieRequestRepository.Find(f.RequestId); + vmModel.Title = request.Title; + vmModel.ReleaseYear = request.ReleaseDate; + } + + if (f.Type == RequestType.Album) + { + var request = await _musicRequestRepository.Find(f.RequestId); + vmModel.Title = request.Title; + vmModel.ReleaseYear = request.ReleaseDate; + } + + if (f.Type == RequestType.TvShow) + { + var request = await _tvRequestRepository.GetChild().Include(x => x.ParentRequest).FirstOrDefaultAsync(x => x.Id == f.RequestId); + vmModel.Title = request.Title; + vmModel.ReleaseYear = request.ParentRequest.ReleaseDate; + } + vm.Add(vmModel); + } + + return vm; + } + + [HttpDelete("{queueId:int}")] + public async Task Delete(int queueId) + { + var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId); + await _requestQueueRepository.Delete(queueItem); + return Ok(); + } + + } +} \ No newline at end of file diff --git a/src/Ombi/Controllers/RequestRetyController.cs b/src/Ombi/Controllers/RequestRetyController.cs deleted file mode 100644 index 69e379838..000000000 --- a/src/Ombi/Controllers/RequestRetyController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Ombi.Store.Entities.Requests; -using Ombi.Store.Repository; -using System.Collections.Generic; -using System.Linq; -using Microsoft.EntityFrameworkCore; -using Ombi.Attributes; -using Ombi.Store.Entities; - -namespace Ombi.Controllers -{ - [ApiV1] - [Admin] - [Produces("application/json")] - public class RequestRetyController : Controller - { - public RequestRetyController(IRepository requestQueue) - { - _requestQueueRepository = requestQueue; - } - - private readonly IRepository _requestQueueRepository; - - /// - /// Get's all the failed requests that are currently in the queue - /// - /// - [HttpGet] - public async Task> Categories() - { - return await _requestQueueRepository.GetAll().Where(x => !x.Completed.HasValue).ToListAsync(); - } - - [HttpDelete("{queueId:int}")] - public async Task Delete(int queueId) - { - var queueItem = await _requestQueueRepository.GetAll().FirstOrDefaultAsync(x => x.Id == queueId); - await _requestQueueRepository.Delete(queueItem); - return Ok(); - } - - } -} \ No newline at end of file diff --git a/src/Ombi/Models/FailedRequestViewModel.cs b/src/Ombi/Models/FailedRequestViewModel.cs new file mode 100644 index 000000000..bd3f7a858 --- /dev/null +++ b/src/Ombi/Models/FailedRequestViewModel.cs @@ -0,0 +1,17 @@ +using System; +using Ombi.Store.Entities; + +namespace Ombi.Models +{ + public class FailedRequestViewModel + { + public int FailedId { get; set; } + public string Title { get; set; } + public DateTime ReleaseYear { get; set; } + public int RequestId { get; set; } + public RequestType Type { get; set; } + public DateTime Dts { get; set; } + public string Error { get; set; } + public int RetryCount { get; set; } + } +} \ No newline at end of file From 9d2fc81a0c876042c0d6507927361c18dae661dd Mon Sep 17 00:00:00 2001 From: TidusJar Date: Tue, 4 Dec 2018 14:15:38 +0000 Subject: [PATCH 10/20] !wip --- src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts | 2 +- src/Ombi/ClientApp/app/services/requestretry.service.ts | 3 +++ .../app/settings/failedrequests/failedrequest.component.html | 4 +--- .../app/settings/failedrequests/failedrequests.component.ts | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts b/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts index 002904386..51a924db5 100644 --- a/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts +++ b/src/Ombi/ClientApp/app/interfaces/IFailedRequests.ts @@ -4,7 +4,7 @@ export interface IFailedRequestsViewModel { title: string; releaseYear: Date; requestId: number; - requestType: RequestType; + type: RequestType; dts: Date; error: string; retryCount: number; diff --git a/src/Ombi/ClientApp/app/services/requestretry.service.ts b/src/Ombi/ClientApp/app/services/requestretry.service.ts index 09e345566..9803f73f7 100644 --- a/src/Ombi/ClientApp/app/services/requestretry.service.ts +++ b/src/Ombi/ClientApp/app/services/requestretry.service.ts @@ -15,4 +15,7 @@ export class RequestRetryService extends ServiceHelpers { public getFailedRequests(): Observable { return this.http.get(this.url, {headers: this.headers}); } + public deleteFailedRequest(failedId: number): Observable { + return this.http.delete(`${this.url}/${failedId}`, {headers: this.headers}); + } } diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html index d1e5b13ec..c0cc2ca1e 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html @@ -9,7 +9,6 @@ Type Retry Count Error Description - Retry Delete @@ -21,8 +20,7 @@ {{RequestType[v.type] | humanize}} {{v.retryCount}} - - + diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts index 214729840..65be04a22 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts @@ -15,4 +15,8 @@ export class FailedRequestsComponent implements OnInit { public ngOnInit() { this.retry.getFailedRequests().subscribe(x => this.vm = x); } + + public remove(failedId: number) { + this.retry.deleteFailedRequest(failedId).subscribe(); + } } From b8450a5c497e7abffca84463e7f4d7ffb63b331c Mon Sep 17 00:00:00 2001 From: Jamie Date: Tue, 4 Dec 2018 21:23:30 +0000 Subject: [PATCH 11/20] Started #2359 !wip --- src/Ombi.Api.Sonarr/ISonarrV3Api.cs | 13 ++++++++ .../Models/V3/LanguageProfiles.cs | 30 +++++++++++++++++++ src/Ombi.Api.Sonarr/SonarrApi.cs | 27 +++++++++-------- src/Ombi.Api.Sonarr/SonarrV3Api.cs | 25 ++++++++++++++++ src/Ombi.DependencyInjection/IocExtensions.cs | 1 + .../Models/External/SonarrSettings.cs | 1 + .../app/settings/sonarr/sonarr.component.ts | 1 + 7 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 src/Ombi.Api.Sonarr/ISonarrV3Api.cs create mode 100644 src/Ombi.Api.Sonarr/Models/V3/LanguageProfiles.cs create mode 100644 src/Ombi.Api.Sonarr/SonarrV3Api.cs diff --git a/src/Ombi.Api.Sonarr/ISonarrV3Api.cs b/src/Ombi.Api.Sonarr/ISonarrV3Api.cs new file mode 100644 index 000000000..1d3ea3468 --- /dev/null +++ b/src/Ombi.Api.Sonarr/ISonarrV3Api.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Ombi.Api.Sonarr.Models; +using System.Net.Http; +using Ombi.Api.Sonarr.Models.V3; + +namespace Ombi.Api.Sonarr +{ + public interface ISonarrV3Api : ISonarrApi + { + Task> LanguageProfiles(string apiKey, string baseUrl); + } +} \ No newline at end of file diff --git a/src/Ombi.Api.Sonarr/Models/V3/LanguageProfiles.cs b/src/Ombi.Api.Sonarr/Models/V3/LanguageProfiles.cs new file mode 100644 index 000000000..aa3b199bd --- /dev/null +++ b/src/Ombi.Api.Sonarr/Models/V3/LanguageProfiles.cs @@ -0,0 +1,30 @@ +namespace Ombi.Api.Sonarr.Models.V3 +{ + public class LanguageProfiles + { + public string name { get; set; } + public bool upgradeAllowed { get; set; } + public Cutoff cutoff { get; set; } + public Languages[] languages { get; set; } + public int id { get; set; } + } + + public class Cutoff + { + public int id { get; set; } + public string name { get; set; } + } + + public class Languages + { + public Language languages { get; set; } + public bool allowed { get; set; } + } + + public class Language + { + public int id { get; set; } + public string name { get; set; } + } + +} \ No newline at end of file diff --git a/src/Ombi.Api.Sonarr/SonarrApi.cs b/src/Ombi.Api.Sonarr/SonarrApi.cs index 7fd74d2a3..0b0df4c15 100644 --- a/src/Ombi.Api.Sonarr/SonarrApi.cs +++ b/src/Ombi.Api.Sonarr/SonarrApi.cs @@ -16,18 +16,19 @@ namespace Ombi.Api.Sonarr Api = api; } - private IApi Api { get; } + protected IApi Api { get; } + protected virtual string ApiBaseUrl => "/api/"; public async Task> GetProfiles(string apiKey, string baseUrl) { - var request = new Request("/api/profile", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}profile", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); return await Api.Request>(request); } public async Task> GetRootFolders(string apiKey, string baseUrl) { - var request = new Request("/api/rootfolder", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}rootfolder", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); return await Api.Request>(request); } @@ -40,7 +41,7 @@ namespace Ombi.Api.Sonarr /// public async Task> GetSeries(string apiKey, string baseUrl) { - var request = new Request("/api/series", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}series", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); var results = await Api.Request>(request); @@ -63,7 +64,7 @@ namespace Ombi.Api.Sonarr /// public async Task GetSeriesById(int id, string apiKey, string baseUrl) { - var request = new Request($"/api/series/{id}", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}series/{id}", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); var result = await Api.Request(request); if (result?.seasons?.Length > 0) @@ -82,7 +83,7 @@ namespace Ombi.Api.Sonarr /// public async Task UpdateSeries(SonarrSeries updated, string apiKey, string baseUrl) { - var request = new Request("/api/series/", baseUrl, HttpMethod.Put); + var request = new Request($"{ApiBaseUrl}series/", baseUrl, HttpMethod.Put); request.AddHeader("X-Api-Key", apiKey); request.AddJsonBody(updated); return await Api.Request(request); @@ -94,7 +95,7 @@ namespace Ombi.Api.Sonarr { return new NewSeries { ErrorMessages = new List { seriesToAdd.Validate() } }; } - var request = new Request("/api/series/", baseUrl, HttpMethod.Post); + var request = new Request($"{ApiBaseUrl}series/", baseUrl, HttpMethod.Post); request.AddHeader("X-Api-Key", apiKey); request.AddJsonBody(seriesToAdd); @@ -120,7 +121,7 @@ namespace Ombi.Api.Sonarr /// public async Task> GetEpisodes(int seriesId, string apiKey, string baseUrl) { - var request = new Request($"/api/Episode?seriesId={seriesId}", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}Episode?seriesId={seriesId}", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); return await Api.Request>(request); } @@ -134,14 +135,14 @@ namespace Ombi.Api.Sonarr /// public async Task GetEpisodeById(int episodeId, string apiKey, string baseUrl) { - var request = new Request($"/api/Episode/{episodeId}", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}Episode/{episodeId}", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); return await Api.Request(request); } public async Task UpdateEpisode(Episode episodeToUpdate, string apiKey, string baseUrl) { - var request = new Request($"/api/Episode/", baseUrl, HttpMethod.Put); + var request = new Request($"{ApiBaseUrl}Episode/", baseUrl, HttpMethod.Put); request.AddHeader("X-Api-Key", apiKey); request.AddJsonBody(episodeToUpdate); return await Api.Request(request); @@ -189,7 +190,7 @@ namespace Ombi.Api.Sonarr private async Task Command(string apiKey, string baseUrl, object body) { - var request = new Request($"/api/Command/", baseUrl, HttpMethod.Post); + var request = new Request($"{ApiBaseUrl}Command/", baseUrl, HttpMethod.Post); request.AddHeader("X-Api-Key", apiKey); request.AddJsonBody(body); return await Api.Request(request); @@ -197,7 +198,7 @@ namespace Ombi.Api.Sonarr public async Task SystemStatus(string apiKey, string baseUrl) { - var request = new Request("/api/system/status", baseUrl, HttpMethod.Get); + var request = new Request($"{ApiBaseUrl}system/status", baseUrl, HttpMethod.Get); request.AddHeader("X-Api-Key", apiKey); return await Api.Request(request); @@ -217,7 +218,7 @@ namespace Ombi.Api.Sonarr ignoreEpisodesWithoutFiles = false, } }; - var request = new Request("/api/seasonpass", baseUrl, HttpMethod.Post); + var request = new Request($"{ApiBaseUrl}seasonpass", baseUrl, HttpMethod.Post); request.AddHeader("X-Api-Key", apiKey); request.AddJsonBody(seasonPass); diff --git a/src/Ombi.Api.Sonarr/SonarrV3Api.cs b/src/Ombi.Api.Sonarr/SonarrV3Api.cs new file mode 100644 index 000000000..64377ee4a --- /dev/null +++ b/src/Ombi.Api.Sonarr/SonarrV3Api.cs @@ -0,0 +1,25 @@ +using System.Net.Http; +using System.Collections.Generic; +using System.Threading.Tasks; +using Ombi.Api.Sonarr.Models.V3; + +namespace Ombi.Api.Sonarr +{ + public class SonarrV3Api : SonarrApi, ISonarrV3Api + { + public SonarrV3Api(IApi api) : base(api) + { + + } + + protected override string ApiBaseUrl => "/api/v3/"; + + public async Task> LanguageProfiles(string apiKey, string baseUrl) + { + var request = new Request($"{ApiBaseUrl}languageprofile", baseUrl, HttpMethod.Get); + request.AddHeader("X-Api-Key", apiKey); + + return await Api.Request>(request); + } + } +} diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index f5184493c..c33f31c10 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -107,6 +107,7 @@ namespace Ombi.DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs index 0c7e17900..81df73aad 100644 --- a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs @@ -18,5 +18,6 @@ public string QualityProfileAnime { get; set; } public string RootPathAnime { get; set; } public bool AddOnly { get; set; } + public bool V3 { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index a1c03be58..4af2c490e 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -47,6 +47,7 @@ export class SonarrComponent implements OnInit { port: [x.port, [Validators.required]], addOnly: [x.addOnly], seasonFolders: [x.seasonFolders], + v3: [x.v3], }); if (x.qualityProfile) { From a69637a3fbe255787ca791e7c44df08ed2e6c48d Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 5 Dec 2018 09:25:59 +0000 Subject: [PATCH 12/20] Did the frontend settings for Sonarr to add V3. !wip #2359 --- .../Rule/Search/CouchPotatoCacheRuleTests.cs | 4 +- .../Rule/Search/RadarrCacheRuleTests.cs | 4 +- src/Ombi.Core/Senders/TvSender.cs | 14 +- .../Models/External/SonarrSettings.cs | 1 + .../ClientApp/app/interfaces/ISettings.ts | 2 + src/Ombi/ClientApp/app/interfaces/ISonarr.ts | 5 + .../services/applications/sonarr.service.ts | 6 +- .../app/settings/sonarr/sonarr.component.html | 143 +++++++++++------- .../app/settings/sonarr/sonarr.component.ts | 23 ++- .../Controllers/External/SonarrController.cs | 36 ++++- 10 files changed, 174 insertions(+), 64 deletions(-) diff --git a/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs index 56524522b..2a8f7a520 100644 --- a/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/CouchPotatoCacheRuleTests.cs @@ -18,13 +18,13 @@ namespace Ombi.Core.Tests.Rule.Search [SetUp] public void Setup() { - ContextMock = new Mock>(); + ContextMock = new Mock>(); Rule = new CouchPotatoCacheRule(ContextMock.Object); } private CouchPotatoCacheRule Rule { get; set; } - private Mock> ContextMock { get; set; } + private Mock> ContextMock { get; set; } [Test] public async Task Should_ReturnApproved_WhenMovieIsInCouchPotato() diff --git a/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs b/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs index 914112d5b..94efe89a2 100644 --- a/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs +++ b/src/Ombi.Core.Tests/Rule/Search/RadarrCacheRuleTests.cs @@ -15,13 +15,13 @@ namespace Ombi.Core.Tests.Rule.Search [SetUp] public void Setup() { - ContextMock = new Mock>(); + ContextMock = new Mock>(); Rule = new RadarrCacheRule(ContextMock.Object); } private RadarrCacheRule Rule { get; set; } - private Mock> ContextMock { get; set; } + private Mock> ContextMock { get; set; } [Test] public async Task Should_ReturnApproved_WhenMovieIsInRadarr() diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index 1b3ed9461..b6c2aa8af 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -21,11 +21,12 @@ namespace Ombi.Core.Senders { public class TvSender : ITvSender { - public TvSender(ISonarrApi sonarrApi, ILogger log, ISettingsService sonarrSettings, + public TvSender(ISonarrApi sonarrApi, ISonarrV3Api sonarrV3Api, ILogger log, ISettingsService sonarrSettings, ISettingsService dog, IDogNzbApi dogApi, ISettingsService srSettings, ISickRageApi srApi, IRepository userProfiles) { SonarrApi = sonarrApi; + SonarrV3Api = sonarrV3Api; Logger = log; SonarrSettings = sonarrSettings; DogNzbSettings = dog; @@ -36,6 +37,7 @@ namespace Ombi.Core.Senders } private ISonarrApi SonarrApi { get; } + private ISonarrV3Api SonarrV3Api { get; } private IDogNzbApi DogNzbApi { get; } private ISickRageApi SickRageApi { get; } private ILogger Logger { get; } @@ -175,6 +177,16 @@ namespace Ombi.Core.Senders qualityToUse = model.ParentRequest.QualityOverride.Value; } + + // Are we using v3 sonarr? + var sonarrV3 = s.V3; + var languageProfileId = 0; + if (sonarrV3) + { + languageProfileId = s.LanguageProfile; + } + + try { // Does the series actually exist? diff --git a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs index 81df73aad..bbbe58fd3 100644 --- a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs @@ -19,5 +19,6 @@ public string RootPathAnime { get; set; } public bool AddOnly { get; set; } public bool V3 { get; set; } + public int LanguageProfile { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index f1934a994..99662088e 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -72,6 +72,8 @@ export interface ISonarrSettings extends IExternalSettings { rootPathAnime: string; fullRootPath: string; addOnly: boolean; + v3: boolean; + languageProfile: number; } export interface IRadarrSettings extends IExternalSettings { diff --git a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts index 3c71b835c..ffe9e9b6d 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISonarr.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISonarr.ts @@ -7,3 +7,8 @@ export interface ISonarrProfile { name: string; id: number; } + +export interface ILanguageProfiles { + name: string; + id: number; +} diff --git a/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts b/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts index 756c6ea6c..bce47acf9 100644 --- a/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts +++ b/src/Ombi/ClientApp/app/services/applications/sonarr.service.ts @@ -5,7 +5,7 @@ import { HttpClient } from "@angular/common/http"; import { Observable } from "rxjs"; import { ISonarrSettings } from "../../interfaces"; -import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; +import { ILanguageProfiles, ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; import { ServiceHelpers } from "../service.helpers"; @Injectable() @@ -27,4 +27,8 @@ export class SonarrService extends ServiceHelpers { public getQualityProfilesWithoutSettings(): Observable { return this.http.get(`${this.url}/Profiles/`, {headers: this.headers}); } + + public getV3LanguageProfiles(settings: ISonarrSettings): Observable { + return this.http.post(`${this.url}/v3/languageprofiles/`, JSON.stringify(settings), {headers: this.headers}); + } } diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html index 6a419feab..91385c353 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html @@ -1,5 +1,4 @@ - - +
Sonarr Settings @@ -10,33 +9,47 @@
-
-
- - +
+
+
+ + +
+
+
+ +
+
+
+ + +
- - - The IP/Hostname is required + + + The IP/Hostname is required
- - The Port is required + + The Port is required
- - - The API Key is required + + + The API Key is required
@@ -48,63 +61,80 @@
- +
-
-
- + + +
+ +
+ + + A Default Quality + Profile is required +
-
-
- -
- -
- A Default Quality Profile is required - -
-
+ +
- +
-
-
- -
-
-
+
- + + A Default Root Path + is + required
- A Default Root Path is required -
-
+ +
-
- + +
+ +
+ +
+ + + + A Default + Langauage Profile is required +
-
+
@@ -112,26 +142,27 @@
-
+
-
+
+
+ +
+
+ +
- -
-
- - -
-
- +
+
-
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index 4af2c490e..ee2438f1b 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; -import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; +import { ILanguageProfiles, ISonarrProfile, ISonarrRootFolder } from "../../interfaces"; import { ISonarrSettings } from "../../interfaces"; import { SonarrService } from "../../services"; @@ -18,10 +18,13 @@ export class SonarrComponent implements OnInit { public qualitiesAnime: ISonarrProfile[]; public rootFolders: ISonarrRootFolder[]; public rootFoldersAnime: ISonarrRootFolder[]; + public languageProfiles: ILanguageProfiles[]; public selectedRootFolder: ISonarrRootFolder; public selectedQuality: ISonarrProfile; + public selectedLanguageProfiles: ILanguageProfiles; public profilesRunning: boolean; public rootFoldersRunning: boolean; + public langRunning: boolean; public form: FormGroup; public advanced = false; @@ -48,6 +51,7 @@ export class SonarrComponent implements OnInit { addOnly: [x.addOnly], seasonFolders: [x.seasonFolders], v3: [x.v3], + langaugeProfile: [x.languageProfile], }); if (x.qualityProfile) { @@ -56,11 +60,16 @@ export class SonarrComponent implements OnInit { if (x.rootPath) { this.getRootFolders(this.form); } + if(x.languageProfile) { + this.getLanguageProfiles(this.form); + } }); this.rootFolders = []; this.qualities = []; + this.languageProfiles = []; this.rootFolders.push({ path: "Please Select", id: -1 }); this.qualities.push({ name: "Please Select", id: -1 }); + this.languageProfiles.push({ name: "Please Select", id: -1 }); } public getProfiles(form: FormGroup) { @@ -89,6 +98,18 @@ export class SonarrComponent implements OnInit { }); } + public getLanguageProfiles(form: FormGroup) { + this.langRunning = true; + this.sonarrService.getV3LanguageProfiles(form.value) + .subscribe(x => { + this.languageProfiles = x; + this.languageProfiles.unshift({ name: "Please Select", id: -1 }); + + this.langRunning = false; + this.notificationService.success("Successfully retrieved the Languge Profiles"); + }); + } + public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Please check your entered values"); diff --git a/src/Ombi/Controllers/External/SonarrController.cs b/src/Ombi/Controllers/External/SonarrController.cs index c3401736d..bc2534ab8 100644 --- a/src/Ombi/Controllers/External/SonarrController.cs +++ b/src/Ombi/Controllers/External/SonarrController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Ombi.Api.Sonarr; using Ombi.Api.Sonarr.Models; +using Ombi.Api.Sonarr.Models.V3; using Ombi.Attributes; using Ombi.Core.Settings; using Ombi.Core.Settings.Models.External; @@ -16,14 +17,16 @@ namespace Ombi.Controllers.External [Produces("application/json")] public class SonarrController : Controller { - public SonarrController(ISonarrApi sonarr, ISettingsService settings) + public SonarrController(ISonarrApi sonarr, ISonarrV3Api sonarrv3, ISettingsService settings) { SonarrApi = sonarr; + SonarrV3Api = sonarrv3; SonarrSettings = settings; SonarrSettings.ClearCache(); } private ISonarrApi SonarrApi { get; } + private ISonarrV3Api SonarrV3Api { get; } private ISettingsService SonarrSettings { get; } /// @@ -82,5 +85,36 @@ namespace Ombi.Controllers.External return null; } + + /// + /// Gets the Sonarr V3 language profiles + /// + /// + [HttpGet("v3/LanguageProfiles")] + [PowerUser] + public async Task> GetLanguageProfiles() + { + var settings = await SonarrSettings.GetSettingsAsync(); + if (settings.Enabled) + { + return await SonarrV3Api.LanguageProfiles(settings.ApiKey, settings.FullUri); + } + + return null; + } + + + /// + /// Gets the Sonarr V3 language profiles + /// + /// The settings. + /// + [HttpPost("v3/LanguageProfiles")] + [PowerUser] + public async Task> GetLanguageProfiles([FromBody] SonarrSettings settings) + { + return await SonarrV3Api.LanguageProfiles(settings.ApiKey, settings.FullUri); + } + } } \ No newline at end of file From c1e2cad2528ea1643bf07d985a3294f56bda8a08 Mon Sep 17 00:00:00 2001 From: TidusJar Date: Wed, 5 Dec 2018 09:47:06 +0000 Subject: [PATCH 13/20] Added Sonarr v3 #2359 --- src/Ombi.Api.Sonarr/Models/NewSeries.cs | 3 +++ src/Ombi.Core/Senders/TvSender.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Ombi.Api.Sonarr/Models/NewSeries.cs b/src/Ombi.Api.Sonarr/Models/NewSeries.cs index ef18baddb..d6f721b0b 100644 --- a/src/Ombi.Api.Sonarr/Models/NewSeries.cs +++ b/src/Ombi.Api.Sonarr/Models/NewSeries.cs @@ -27,6 +27,9 @@ namespace Ombi.Api.Sonarr.Models public int id { get; set; } public List images { get; set; } + // V3 Property + public int languageProfileId { get; set; } + /// /// This is for us /// diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index b6c2aa8af..aadb893d0 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -180,12 +180,7 @@ namespace Ombi.Core.Senders // Are we using v3 sonarr? var sonarrV3 = s.V3; - var languageProfileId = 0; - if (sonarrV3) - { - languageProfileId = s.LanguageProfile; - } - + var languageProfileId = s.LanguageProfile; try { @@ -216,6 +211,11 @@ namespace Ombi.Core.Senders } }; + if (sonarrV3) + { + newSeries.languageProfileId = languageProfileId; + } + // Montitor the correct seasons, // If we have that season in the model then it's monitored! var seasonsToAdd = GetSeasonsToCreate(model); From d3444059dda456419d5fc7dae32ce807f09aa4af Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 5 Dec 2018 20:48:16 +0000 Subject: [PATCH 14/20] Sorted out the sonarr settings UI !wip --- .../app/settings/sonarr/sonarr.component.html | 50 +++++++++++-------- .../app/settings/sonarr/sonarr.component.ts | 5 +- src/Ombi/ClientApp/styles/Styles.scss | 2 +- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html index 91385c353..f016fd56e 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html @@ -22,34 +22,40 @@
- +
- + - The IP/Hostname is required
- + - The Port is required
- + - The API Key is required
@@ -68,9 +74,10 @@
-
- +
- A Default Quality - Profile is required +
+
+
@@ -94,7 +102,10 @@
- +
- A Default Root Path - is - required
@@ -119,17 +127,17 @@
- +
- + - A Default - Langauage Profile is required
diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index ee2438f1b..11845a06e 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -51,7 +51,7 @@ export class SonarrComponent implements OnInit { addOnly: [x.addOnly], seasonFolders: [x.seasonFolders], v3: [x.v3], - langaugeProfile: [x.languageProfile], + languageProfile: [x.languageProfile], }); if (x.qualityProfile) { @@ -63,6 +63,9 @@ export class SonarrComponent implements OnInit { if(x.languageProfile) { this.getLanguageProfiles(this.form); } + if(x.v3) { + this.form.controls.languageProfile.setValidators([Validators.required]); + } }); this.rootFolders = []; this.qualities = []; diff --git a/src/Ombi/ClientApp/styles/Styles.scss b/src/Ombi/ClientApp/styles/Styles.scss index b41e1c2a7..d98e4cf83 100644 --- a/src/Ombi/ClientApp/styles/Styles.scss +++ b/src/Ombi/ClientApp/styles/Styles.scss @@ -27,4 +27,4 @@ $bg-colour-disabled: #252424; .label { margin: 3px; -} \ No newline at end of file +} From a1c903aa162ed436c33a4290189662eedfe5405f Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 5 Dec 2018 21:06:31 +0000 Subject: [PATCH 15/20] Sorted out some of the settings pages, trying to make it consistent --- .../app/settings/lidarr/lidarr.component.html | 39 +++++--- .../app/settings/radarr/radarr.component.html | 96 +++++++++++-------- .../app/settings/settingsmenu.component.html | 2 +- 3 files changed, 82 insertions(+), 55 deletions(-) diff --git a/src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html b/src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html index 50938412f..5e898e719 100644 --- a/src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html +++ b/src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html @@ -19,25 +19,28 @@
- + - The IP/Hostname is required
- + - The Port is required +
- + - The API Key is required +
@@ -56,19 +59,22 @@
- +
- - A Default Quality Profile is required
- +
@@ -89,12 +97,14 @@
- A Language profile is required
- +
- A Metadata profile is required
diff --git a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html index 909a64226..08a8035c2 100644 --- a/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html +++ b/src/Ombi/ClientApp/app/settings/radarr/radarr.component.html @@ -1,5 +1,4 @@ - - +
Radarr Settings @@ -19,25 +18,34 @@
- + - - The IP/Hostname is required +
- + - - The Port is required +
- - - - The API Key is required + + +
@@ -49,63 +57,73 @@
- +
+
-
- -
-
-
- +
- +
- A Default Quality Profile is required
-
-
- -
- -
- +
- + -
- A Default Root Path is required + + +
+ +
- +
-
- - A Default Minimum Availability is required
- +
+
+
- +
@@ -118,4 +136,4 @@
-
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html index 59ce35c32..f77e77501 100644 --- a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html +++ b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html @@ -54,7 +54,7 @@ Music From 4eeb5d4d355cd89025ba53471e53243ffa1215f1 Mon Sep 17 00:00:00 2001 From: Jamie Date: Wed, 5 Dec 2018 21:24:50 +0000 Subject: [PATCH 16/20] Sorted out the UI !wip --- src/Ombi.Store/Entities/RequestType.cs | 6 +----- src/Ombi/ClientApp/app/interfaces/IRequestModel.ts | 4 ++-- src/Ombi/ClientApp/app/services/requestretry.service.ts | 4 ++-- .../settings/failedrequests/failedrequest.component.html | 2 +- .../settings/failedrequests/failedrequests.component.ts | 9 +++++++-- .../ClientApp/app/settings/settingsmenu.component.html | 1 + src/Ombi/Controllers/RequestRetryController.cs | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Ombi.Store/Entities/RequestType.cs b/src/Ombi.Store/Entities/RequestType.cs index 151453bdd..4d2d20ac4 100644 --- a/src/Ombi.Store/Entities/RequestType.cs +++ b/src/Ombi.Store/Entities/RequestType.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Ombi.Store.Entities +namespace Ombi.Store.Entities { public enum RequestType { diff --git a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts index 5a72abf31..b083ca088 100644 --- a/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/app/interfaces/IRequestModel.ts @@ -1,9 +1,9 @@ import { IUser } from "./IUser"; export enum RequestType { + tvShow = 0, movie = 1, - tvShow = 2, - album = 3, + album = 2, } // NEW WORLD diff --git a/src/Ombi/ClientApp/app/services/requestretry.service.ts b/src/Ombi/ClientApp/app/services/requestretry.service.ts index 9803f73f7..e5c9cabe0 100644 --- a/src/Ombi/ClientApp/app/services/requestretry.service.ts +++ b/src/Ombi/ClientApp/app/services/requestretry.service.ts @@ -15,7 +15,7 @@ export class RequestRetryService extends ServiceHelpers { public getFailedRequests(): Observable { return this.http.get(this.url, {headers: this.headers}); } - public deleteFailedRequest(failedId: number): Observable { - return this.http.delete(`${this.url}/${failedId}`, {headers: this.headers}); + public deleteFailedRequest(failedId: number): Observable { + return this.http.delete(`${this.url}/${failedId}`, {headers: this.headers}); } } diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html index c0cc2ca1e..898710199 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequest.component.html @@ -20,7 +20,7 @@ {{RequestType[v.type] | humanize}} {{v.retryCount}} - + diff --git a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts index 65be04a22..a303ac713 100644 --- a/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts +++ b/src/Ombi/ClientApp/app/settings/failedrequests/failedrequests.component.ts @@ -16,7 +16,12 @@ export class FailedRequestsComponent implements OnInit { this.retry.getFailedRequests().subscribe(x => this.vm = x); } - public remove(failedId: number) { - this.retry.deleteFailedRequest(failedId).subscribe(); + public remove(failed: IFailedRequestsViewModel) { + this.retry.deleteFailedRequest(failed.failedId).subscribe(x => { + if(x) { + const index = this.vm.indexOf(failed); + this.vm.splice(index,1); + } + }); } } diff --git a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html index 59ce35c32..eae56bce2 100644 --- a/src/Ombi/ClientApp/app/settings/settingsmenu.component.html +++ b/src/Ombi/ClientApp/app/settings/settingsmenu.component.html @@ -84,6 +84,7 @@