mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Done #627
This commit is contained in:
parent
7fc26df599
commit
ea52fa3dc3
24 changed files with 419 additions and 32 deletions
|
@ -8,7 +8,7 @@
|
|||
return s;
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
|
@ -93,6 +93,19 @@ function createBaseUrl(base, url) {
|
|||
return url;
|
||||
}
|
||||
|
||||
|
||||
function createBaseUrl(url) {
|
||||
var base = $('#baseUrl').text();
|
||||
if (base) {
|
||||
if (url.charAt(0) === "/") {
|
||||
url = "/" + base + url;
|
||||
} else {
|
||||
url = "/" + base + "/" + url;
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
var noResultsHtml = "<div class='no-search-results'>" +
|
||||
"<i class='fa fa-film no-search-results-icon'></i><div class='no-search-results-text'>Sorry, we didn't find any results!</div></div>";
|
||||
var noResultsMusic = "<div class='no-search-results'>" +
|
||||
|
|
150
Ombi.UI/Modules/Admin/ScheduledJobsRunnerModule.cs
Normal file
150
Ombi.UI/Modules/Admin/ScheduledJobsRunnerModule.cs
Normal file
|
@ -0,0 +1,150 @@
|
|||
#region Copyright
|
||||
// /************************************************************************
|
||||
// Copyright (c) 2016 Jamie Rees
|
||||
// File: AboutModule.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 System.Threading.Tasks;
|
||||
using Nancy;
|
||||
using Ombi.Core;
|
||||
using Ombi.Core.SettingModels;
|
||||
using Ombi.Helpers.Permissions;
|
||||
using Ombi.Services.Interfaces;
|
||||
using Ombi.Services.Jobs;
|
||||
using Ombi.UI.Models;
|
||||
using ISecurityExtensions = Ombi.Core.ISecurityExtensions;
|
||||
|
||||
namespace Ombi.UI.Modules.Admin
|
||||
{
|
||||
public class ScheduledJobsRunnerModule : BaseModule
|
||||
{
|
||||
public ScheduledJobsRunnerModule(ISettingsService<PlexRequestSettings> settingsService,
|
||||
ISecurityExtensions security, IPlexContentCacher contentCacher, ISonarrCacher sonarrCacher, IWatcherCacher watcherCacher,
|
||||
IRadarrCacher radarrCacher, ICouchPotatoCacher cpCacher, IStoreBackup store, ISickRageCacher srCacher, IAvailabilityChecker plexChceker,
|
||||
IStoreCleanup cleanup, IUserRequestLimitResetter requestLimit, IPlexEpisodeCacher episodeCacher, IRecentlyAdded recentlyAdded,
|
||||
IFaultQueueHandler faultQueueHandler, IPlexUserChecker plexUserChecker) : base("admin", settingsService, security)
|
||||
{
|
||||
Before += (ctx) => Security.AdminLoginRedirect(Permissions.Administrator, ctx);
|
||||
|
||||
PlexContentCacher = contentCacher;
|
||||
SonarrCacher = sonarrCacher;
|
||||
RadarrCacher = radarrCacher;
|
||||
WatcherCacher = watcherCacher;
|
||||
CpCacher = cpCacher;
|
||||
StoreBackup = store;
|
||||
SrCacher = srCacher;
|
||||
AvailabilityChecker = plexChceker;
|
||||
StoreCleanup = cleanup;
|
||||
RequestLimit = requestLimit;
|
||||
EpisodeCacher = episodeCacher;
|
||||
RecentlyAdded = recentlyAdded;
|
||||
FaultQueueHandler = faultQueueHandler;
|
||||
PlexUserChecker = plexUserChecker;
|
||||
|
||||
Post["/schedulerun", true] = async (x, ct) => await ScheduleRun((string)Request.Form.key);
|
||||
}
|
||||
|
||||
private IPlexContentCacher PlexContentCacher { get; }
|
||||
private IRadarrCacher RadarrCacher { get; }
|
||||
private ISonarrCacher SonarrCacher { get; }
|
||||
private IWatcherCacher WatcherCacher { get; }
|
||||
private ICouchPotatoCacher CpCacher { get; }
|
||||
private IStoreBackup StoreBackup { get; }
|
||||
private ISickRageCacher SrCacher { get; }
|
||||
private IAvailabilityChecker AvailabilityChecker { get; }
|
||||
private IStoreCleanup StoreCleanup { get; }
|
||||
private IUserRequestLimitResetter RequestLimit { get; }
|
||||
private IPlexEpisodeCacher EpisodeCacher { get; }
|
||||
private IRecentlyAdded RecentlyAdded { get; }
|
||||
private IFaultQueueHandler FaultQueueHandler { get; }
|
||||
private IPlexUserChecker PlexUserChecker { get; }
|
||||
|
||||
|
||||
private async Task<Response> ScheduleRun(string key)
|
||||
{
|
||||
if (key.Equals(JobNames.PlexCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
PlexContentCacher.CacheContent();
|
||||
}
|
||||
|
||||
if (key.Equals(JobNames.WatcherCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
WatcherCacher.Queued();
|
||||
}
|
||||
|
||||
if (key.Equals(JobNames.SonarrCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
SonarrCacher.Queued();
|
||||
}
|
||||
if (key.Equals(JobNames.RadarrCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
RadarrCacher.Queued();
|
||||
}
|
||||
if (key.Equals(JobNames.CpCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
CpCacher.Queued();
|
||||
}
|
||||
if (key.Equals(JobNames.StoreBackup, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
StoreBackup.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.SrCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
SrCacher.Queued();
|
||||
}
|
||||
if (key.Equals(JobNames.PlexChecker, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
AvailabilityChecker.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.StoreCleanup, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
StoreCleanup.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.RequestLimitReset, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
RequestLimit.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.EpisodeCacher, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
EpisodeCacher.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.RecentlyAddedEmail, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
RecentlyAdded.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.FaultQueueHandler, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
FaultQueueHandler.Start();
|
||||
}
|
||||
if (key.Equals(JobNames.PlexUserChecker, StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
RequestLimit.Start();
|
||||
}
|
||||
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,6 +52,12 @@ namespace Ombi.UI.NinjectModules
|
|||
Bind<IPlexContentCacher>().To<PlexContentCacher>();
|
||||
Bind<IJobFactory>().To<CustomJobFactory>();
|
||||
Bind<IMovieSender>().To<MovieSender>();
|
||||
Bind<IStoreBackup>().To<StoreBackup>();
|
||||
Bind<IStoreCleanup>().To<StoreCleanup>();
|
||||
Bind<IUserRequestLimitResetter>().To<UserRequestLimitResetter>();
|
||||
Bind<IPlexEpisodeCacher>().To<PlexEpisodeCacher>();
|
||||
Bind<IFaultQueueHandler>().To<FaultQueueHandler>();
|
||||
Bind<IPlexUserChecker>().To<PlexUserChecker>();
|
||||
|
||||
Bind<IAnalytics>().To<Analytics>();
|
||||
Bind<ISchedulerFactory>().To<StdSchedulerFactory>();
|
||||
|
|
|
@ -258,6 +258,7 @@
|
|||
<Compile Include="Models\UI\Dropdown.cs" />
|
||||
<Compile Include="Models\UserManagement\DeleteUserViewModel.cs" />
|
||||
<Compile Include="Models\UserManagement\UserUpdateViewModel.cs" />
|
||||
<Compile Include="Modules\Admin\ScheduledJobsRunnerModule.cs" />
|
||||
<Compile Include="Modules\Admin\AboutModule.cs" />
|
||||
<Compile Include="Modules\Admin\CustomizationModule.cs" />
|
||||
<Compile Include="Modules\Admin\IntegrationModule.cs" />
|
||||
|
|
|
@ -3,22 +3,32 @@
|
|||
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
|
||||
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Job Name</td>
|
||||
<td>Last Run</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in Model.JobRecorder)
|
||||
{
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
@record.Key
|
||||
</td>
|
||||
<td>
|
||||
@record.Value.ToString("R")
|
||||
</td>
|
||||
<td class="refresh" id="@record.Key"><i class="fa fa-refresh"></i></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4"><strong>Job Name</strong>
|
||||
</div>
|
||||
<div class="col-md-6 col-md-push-3"><strong>Last Run</strong>
|
||||
</div>
|
||||
</div>
|
||||
<hr style="margin-top: 4px; margin-bottom: 4px"/>
|
||||
@foreach (var record in Model.JobRecorder)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-md-4">@record.Key</div>
|
||||
<div class="col-md-5 col-md-push-3 date">@record.Value.ToString("R")</div>
|
||||
</div>
|
||||
<hr style="margin-top: 4px; margin-bottom: 4px"/>
|
||||
}
|
||||
<br/>
|
||||
<br/>
|
||||
<form class="form-horizontal" method="POST" id="mainForm">
|
||||
|
@ -122,6 +132,34 @@
|
|||
$obj.text(newDate);
|
||||
});
|
||||
|
||||
|
||||
$('.refresh').click(function(e) {
|
||||
var id = e.currentTarget.id;
|
||||
|
||||
var ev = $(e.currentTarget.children[0]);
|
||||
ev.addClass("fa-spin");
|
||||
|
||||
var url = createBaseUrl("/admin/schedulerun");
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {key:id},
|
||||
url: url,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response.result === true) {
|
||||
generateNotify("Success!", "success");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#save')
|
||||
.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
@Html.Partial("Shared/Partial/_Sidebar")
|
||||
<div class="col-sm-8 col-sm-push-1">
|
||||
<fieldset>
|
||||
<legend>Release Fault Queue</legend>
|
||||
<legend>Request Fault Queue</legend>
|
||||
|
||||
<table class="table table-striped table-hover table-responsive table-condensed">
|
||||
<thead>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue