mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Finished #483
This commit is contained in:
parent
dd92bb179c
commit
8a61371048
10 changed files with 243 additions and 7 deletions
|
@ -80,7 +80,7 @@ namespace PlexRequests.Core.Queue
|
||||||
var existingItem = await RequestQueue.CustomAsync(async connection =>
|
var existingItem = await RequestQueue.CustomAsync(async connection =>
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
var result = await connection.QueryAsync<RequestQueue>("select * from RequestQueue where PrimaryIdentifier = @ProviderId", new { ProviderId = id });
|
var result = await connection.QueryAsync<RequestQueue>("select * from RequestFaultQueue where PrimaryIdentifier = @ProviderId", new { ProviderId = id });
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ using Dapper.Contrib.Extensions;
|
||||||
|
|
||||||
namespace PlexRequests.Store.Models
|
namespace PlexRequests.Store.Models
|
||||||
{
|
{
|
||||||
[Table("RequestQueue")]
|
[Table("RequestFaultQueue")]
|
||||||
public class RequestQueue : Entity
|
public class RequestQueue : Entity
|
||||||
{
|
{
|
||||||
public string PrimaryIdentifier { get; set; }
|
public string PrimaryIdentifier { get; set; }
|
||||||
|
|
|
@ -133,7 +133,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS PlexEpisodes_Id ON PlexEpisodes (Id);
|
||||||
CREATE INDEX IF NOT EXISTS PlexEpisodes_ProviderId ON PlexEpisodes (ProviderId);
|
CREATE INDEX IF NOT EXISTS PlexEpisodes_ProviderId ON PlexEpisodes (ProviderId);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS RequestQueue
|
CREATE TABLE IF NOT EXISTS RequestFaultQueue
|
||||||
(
|
(
|
||||||
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
Id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
PrimaryIdentifier VARCHAR(100) NOT NULL,
|
PrimaryIdentifier VARCHAR(100) NOT NULL,
|
||||||
|
|
56
PlexRequests.UI/Models/FaultedRequestsViewModel.cs
Normal file
56
PlexRequests.UI/Models/FaultedRequestsViewModel.cs
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: FaultedRequestsViewModel.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using PlexRequests.Store;
|
||||||
|
using PlexRequests.Store.Models;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.Models
|
||||||
|
{
|
||||||
|
public class FaultedRequestsViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string PrimaryIdentifier { get; set; }
|
||||||
|
public RequestTypeViewModel Type { get; set; }
|
||||||
|
public string Title { get; set; }
|
||||||
|
public FaultTypeViewModel FaultType { get; set; }
|
||||||
|
public DateTime? LastRetry { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum RequestTypeViewModel
|
||||||
|
{
|
||||||
|
Movie,
|
||||||
|
TvShow,
|
||||||
|
Album
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FaultTypeViewModel
|
||||||
|
{
|
||||||
|
RequestFault,
|
||||||
|
MissingInformation
|
||||||
|
}
|
||||||
|
}
|
74
PlexRequests.UI/Modules/Admin/FaultQueueModule.cs
Normal file
74
PlexRequests.UI/Modules/Admin/FaultQueueModule.cs
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#region Copyright
|
||||||
|
// /************************************************************************
|
||||||
|
// Copyright (c) 2016 Jamie Rees
|
||||||
|
// File: SystemStatusModule.cs
|
||||||
|
// Created By: Jamie Rees
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
// a copy of this software and associated documentation files (the
|
||||||
|
// "Software"), to deal in the Software without restriction, including
|
||||||
|
// without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
// permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
// the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be
|
||||||
|
// included in all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
// ************************************************************************/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Nancy.Responses.Negotiation;
|
||||||
|
using PlexRequests.Core;
|
||||||
|
using PlexRequests.Core.SettingModels;
|
||||||
|
using PlexRequests.Helpers;
|
||||||
|
using PlexRequests.Helpers.Permissions;
|
||||||
|
using PlexRequests.Store;
|
||||||
|
using PlexRequests.Store.Models;
|
||||||
|
using PlexRequests.Store.Repository;
|
||||||
|
using PlexRequests.UI.Models;
|
||||||
|
|
||||||
|
namespace PlexRequests.UI.Modules.Admin
|
||||||
|
{
|
||||||
|
public class FaultQueueModule : BaseModule
|
||||||
|
{
|
||||||
|
public FaultQueueModule(ISettingsService<PlexRequestSettings> settingsService, ICacheProvider cache, IRepository<RequestQueue> requestQueue) : base("admin", settingsService)
|
||||||
|
{
|
||||||
|
Cache = cache;
|
||||||
|
RequestQueue = requestQueue;
|
||||||
|
|
||||||
|
Security.HasPermissionsResponse(Permissions.Administrator);
|
||||||
|
|
||||||
|
Get["Index", "/faultqueue"] = x => Index();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICacheProvider Cache { get; }
|
||||||
|
private IRepository<RequestQueue> RequestQueue { get; }
|
||||||
|
|
||||||
|
private Negotiator Index()
|
||||||
|
{
|
||||||
|
var requests = RequestQueue.GetAll();
|
||||||
|
|
||||||
|
var model = requests.Select(r => new FaultedRequestsViewModel
|
||||||
|
{
|
||||||
|
FaultType = (FaultTypeViewModel)(int)r.FaultType,
|
||||||
|
Type = (RequestTypeViewModel)(int)r.Type,
|
||||||
|
Title = ByteConverterHelper.ReturnObject<RequestedModel>(r.Content).Title,
|
||||||
|
Id = r.Id,
|
||||||
|
PrimaryIdentifier = r.PrimaryIdentifier,
|
||||||
|
LastRetry = r.LastRetry
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
return View["RequestFaultQueue", model];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,14 +2,11 @@
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Nancy;
|
using Nancy;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
using PlexRequests.Core;
|
using PlexRequests.Core;
|
||||||
using PlexRequests.Core.SettingModels;
|
using PlexRequests.Core.SettingModels;
|
||||||
using PlexRequests.Helpers;
|
using PlexRequests.Helpers;
|
||||||
using PlexRequests.UI.Models;
|
|
||||||
|
|
||||||
namespace PlexRequests.UI.Modules
|
namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
|
|
|
@ -616,7 +616,7 @@ namespace PlexRequests.UI.Modules
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<Response> RequestTvShow(int showId, string seasons)
|
private async Task<Response> RequestTvShow(int showId, string seasons)
|
||||||
{
|
{
|
||||||
if (Security.DoesNotHavePermissions(Permissions.ReadOnlyUser, User))
|
if (Security.HasPermissions(User, Permissions.ReadOnlyUser))
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
Response.AsJson(new JsonResponseModel()
|
Response.AsJson(new JsonResponseModel()
|
||||||
|
|
|
@ -229,6 +229,7 @@
|
||||||
<Compile Include="Models\DatatablesModel.cs" />
|
<Compile Include="Models\DatatablesModel.cs" />
|
||||||
<Compile Include="Models\EpisodeListViewModel.cs" />
|
<Compile Include="Models\EpisodeListViewModel.cs" />
|
||||||
<Compile Include="Models\EpisodeRequestModel.cs" />
|
<Compile Include="Models\EpisodeRequestModel.cs" />
|
||||||
|
<Compile Include="Models\FaultedRequestsViewModel.cs" />
|
||||||
<Compile Include="Models\IssuesDetailsViewModel.cs" />
|
<Compile Include="Models\IssuesDetailsViewModel.cs" />
|
||||||
<Compile Include="Models\IssuesViewMOdel.cs" />
|
<Compile Include="Models\IssuesViewMOdel.cs" />
|
||||||
<Compile Include="Models\JsonUpdateAvailableModel.cs" />
|
<Compile Include="Models\JsonUpdateAvailableModel.cs" />
|
||||||
|
@ -241,6 +242,7 @@
|
||||||
<Compile Include="Models\SearchMovieViewModel.cs" />
|
<Compile Include="Models\SearchMovieViewModel.cs" />
|
||||||
<Compile Include="Models\UserManagement\DeleteUserViewModel.cs" />
|
<Compile Include="Models\UserManagement\DeleteUserViewModel.cs" />
|
||||||
<Compile Include="Models\UserManagement\UserUpdateViewModel.cs" />
|
<Compile Include="Models\UserManagement\UserUpdateViewModel.cs" />
|
||||||
|
<Compile Include="Modules\Admin\FaultQueueModule.cs" />
|
||||||
<Compile Include="Modules\Admin\SystemStatusModule.cs" />
|
<Compile Include="Modules\Admin\SystemStatusModule.cs" />
|
||||||
<Compile Include="Modules\ApiDocsModule.cs" />
|
<Compile Include="Modules\ApiDocsModule.cs" />
|
||||||
<Compile Include="Modules\ApiSettingsMetadataModule.cs" />
|
<Compile Include="Modules\ApiSettingsMetadataModule.cs" />
|
||||||
|
@ -724,6 +726,9 @@
|
||||||
<None Include="Views\Admin\NewsletterSettings.cshtml">
|
<None Include="Views\Admin\NewsletterSettings.cshtml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<Content Include="Views\Admin\RequestFaultQueue.cshtml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>web.config</DependentUpon>
|
<DependentUpon>web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
|
|
103
PlexRequests.UI/Views/Admin/RequestFaultQueue.cshtml
Normal file
103
PlexRequests.UI/Views/Admin/RequestFaultQueue.cshtml
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
@using PlexRequests.UI.Helpers
|
||||||
|
@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase<IEnumerable<PlexRequests.UI.Models.FaultedRequestsViewModel>>
|
||||||
|
@Html.Partial("_Sidebar")
|
||||||
|
<div class="col-sm-8 col-sm-push-1">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Release Fault Queue</legend>
|
||||||
|
|
||||||
|
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Request Title
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Type
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Fault Type
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
LastRetry
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
@foreach (var m in Model)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
@m.Title
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@m.Type
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@m.FaultType
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@m.LastRetry
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@*<script>
|
||||||
|
|
||||||
|
var base = '@Html.GetBaseUrl()';
|
||||||
|
$('#autoUpdate')
|
||||||
|
.click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('body').append("<i class=\"fa fa-spinner fa-spin fa-5x fa-fw\" style=\"position: absolute; top: 20%; left: 50%;\"></i>");
|
||||||
|
$('#autoUpdate').prop("disabled", "disabled");
|
||||||
|
document.getElementById("lightbox").style.display = "";
|
||||||
|
var count = 0;
|
||||||
|
setInterval(function () {
|
||||||
|
count++;
|
||||||
|
var dots = new Array(count % 10).join('.');
|
||||||
|
document.getElementById('autoUpdate').innerHTML = "Updating" + dots;
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "Post",
|
||||||
|
url: "autoupdate",
|
||||||
|
data: { url: "@Model.Status.DownloadUri" },
|
||||||
|
dataType: "json",
|
||||||
|
error: function () {
|
||||||
|
setTimeout(
|
||||||
|
function () {
|
||||||
|
location.reload();
|
||||||
|
}, 30000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#saveSettings').click(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var $form = $("#mainForm");
|
||||||
|
|
||||||
|
var branches = $("#branches option:selected").val();
|
||||||
|
|
||||||
|
var data = $form.serialize();
|
||||||
|
data = data + "&branch=" + branches;
|
||||||
|
$.ajax({
|
||||||
|
type: $form.prop("method"),
|
||||||
|
url: $form.prop("action"),
|
||||||
|
data: data,
|
||||||
|
dataType: "json",
|
||||||
|
success: function (response) {
|
||||||
|
if (response.result === true) {
|
||||||
|
generateNotify(response.message, "success");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
generateNotify(response.message, "warning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>*@
|
|
@ -18,5 +18,6 @@
|
||||||
@Html.GetSidebarUrl(Context, "/admin/logs", "Logs")
|
@Html.GetSidebarUrl(Context, "/admin/logs", "Logs")
|
||||||
@Html.GetSidebarUrl(Context, "/admin/status", "Status")
|
@Html.GetSidebarUrl(Context, "/admin/status", "Status")
|
||||||
@Html.GetSidebarUrl(Context, "/admin/scheduledjobs", "Scheduled Jobs")
|
@Html.GetSidebarUrl(Context, "/admin/scheduledjobs", "Scheduled Jobs")
|
||||||
|
@Html.GetSidebarUrl(Context, "/admin/faultqueue", "Request Fault Queue")
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Add table
Add a link
Reference in a new issue