mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: (History) Filter by Failed
This commit is contained in:
@@ -20,9 +20,9 @@ function getIconName(eventType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIconKind(data) {
|
function getIconKind(successful) {
|
||||||
switch (data.successful) {
|
switch (successful) {
|
||||||
case 'False':
|
case false:
|
||||||
return kinds.DANGER;
|
return kinds.DANGER;
|
||||||
default:
|
default:
|
||||||
return kinds.DEFAULT;
|
return kinds.DEFAULT;
|
||||||
@@ -44,9 +44,9 @@ function getTooltip(eventType, data, indexer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function HistoryEventTypeCell({ eventType, data, indexer }) {
|
function HistoryEventTypeCell({ eventType, successful, data, indexer }) {
|
||||||
const iconName = getIconName(eventType);
|
const iconName = getIconName(eventType);
|
||||||
const iconKind = getIconKind(data);
|
const iconKind = getIconKind(successful);
|
||||||
const tooltip = getTooltip(eventType, data, indexer);
|
const tooltip = getTooltip(eventType, data, indexer);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -64,6 +64,7 @@ function HistoryEventTypeCell({ eventType, data, indexer }) {
|
|||||||
|
|
||||||
HistoryEventTypeCell.propTypes = {
|
HistoryEventTypeCell.propTypes = {
|
||||||
eventType: PropTypes.string.isRequired,
|
eventType: PropTypes.string.isRequired,
|
||||||
|
successful: PropTypes.bool.isRequired,
|
||||||
data: PropTypes.object,
|
data: PropTypes.object,
|
||||||
indexer: PropTypes.object
|
indexer: PropTypes.object
|
||||||
};
|
};
|
||||||
|
@@ -71,6 +71,7 @@ class HistoryRow extends Component {
|
|||||||
eventType,
|
eventType,
|
||||||
date,
|
date,
|
||||||
data,
|
data,
|
||||||
|
successful,
|
||||||
isMarkingAsFailed,
|
isMarkingAsFailed,
|
||||||
columns,
|
columns,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
@@ -102,6 +103,7 @@ class HistoryRow extends Component {
|
|||||||
indexer={indexer}
|
indexer={indexer}
|
||||||
eventType={eventType}
|
eventType={eventType}
|
||||||
data={data}
|
data={data}
|
||||||
|
successful={successful}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -352,6 +354,7 @@ HistoryRow.propTypes = {
|
|||||||
indexerId: PropTypes.number,
|
indexerId: PropTypes.number,
|
||||||
indexer: PropTypes.object.isRequired,
|
indexer: PropTypes.object.isRequired,
|
||||||
eventType: PropTypes.string.isRequired,
|
eventType: PropTypes.string.isRequired,
|
||||||
|
successful: PropTypes.bool.isRequired,
|
||||||
date: PropTypes.string.isRequired,
|
date: PropTypes.string.isRequired,
|
||||||
data: PropTypes.object.isRequired,
|
data: PropTypes.object.isRequired,
|
||||||
isMarkingAsFailed: PropTypes.bool,
|
isMarkingAsFailed: PropTypes.bool,
|
||||||
|
@@ -135,6 +135,17 @@ export const defaultState = {
|
|||||||
type: filterTypes.EQUAL
|
type: filterTypes.EQUAL
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'failed',
|
||||||
|
label: translate('Failed'),
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
key: 'successful',
|
||||||
|
value: false,
|
||||||
|
type: filterTypes.EQUAL
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
17
src/NzbDrone.Core/Datastore/Migration/007_history_failed.cs
Normal file
17
src/NzbDrone.Core/Datastore/Migration/007_history_failed.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(7)]
|
||||||
|
public class history_failed : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Alter.Table("History")
|
||||||
|
.AddColumn("Successful").AsBoolean().NotNullable().WithDefaultValue(true);
|
||||||
|
|
||||||
|
Execute.Sql("UPDATE History SET Successful = (json_extract(History.Data,'$.successful') == 'True' );");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -13,6 +13,7 @@ namespace NzbDrone.Core.History
|
|||||||
|
|
||||||
public int IndexerId { get; set; }
|
public int IndexerId { get; set; }
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
public bool Successful { get; set; }
|
||||||
public HistoryEventType EventType { get; set; }
|
public HistoryEventType EventType { get; set; }
|
||||||
public Dictionary<string, string> Data { get; set; }
|
public Dictionary<string, string> Data { get; set; }
|
||||||
|
|
||||||
|
@@ -113,7 +113,8 @@ namespace NzbDrone.Core.History
|
|||||||
{
|
{
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
IndexerId = message.IndexerId,
|
IndexerId = message.IndexerId,
|
||||||
EventType = message.Query.RssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery
|
EventType = message.Query.RssSearch ? HistoryEventType.IndexerRss : HistoryEventType.IndexerQuery,
|
||||||
|
Successful = message.Successful
|
||||||
};
|
};
|
||||||
|
|
||||||
if (message.Query is MovieSearchCriteria)
|
if (message.Query is MovieSearchCriteria)
|
||||||
@@ -151,7 +152,6 @@ namespace NzbDrone.Core.History
|
|||||||
history.Data.Add("QueryType", message.Query.SearchType ?? string.Empty);
|
history.Data.Add("QueryType", message.Query.SearchType ?? string.Empty);
|
||||||
history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty);
|
history.Data.Add("Categories", string.Join(",", message.Query.Categories) ?? string.Empty);
|
||||||
history.Data.Add("Source", message.Query.Source ?? string.Empty);
|
history.Data.Add("Source", message.Query.Source ?? string.Empty);
|
||||||
history.Data.Add("Successful", message.Successful.ToString());
|
|
||||||
history.Data.Add("QueryResults", message.Results.HasValue ? message.Results.ToString() : null);
|
history.Data.Add("QueryResults", message.Results.HasValue ? message.Results.ToString() : null);
|
||||||
|
|
||||||
_historyRepository.Insert(history);
|
_historyRepository.Insert(history);
|
||||||
@@ -163,10 +163,10 @@ namespace NzbDrone.Core.History
|
|||||||
{
|
{
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
IndexerId = message.IndexerId,
|
IndexerId = message.IndexerId,
|
||||||
EventType = HistoryEventType.ReleaseGrabbed
|
EventType = HistoryEventType.ReleaseGrabbed,
|
||||||
|
Successful = message.Successful
|
||||||
};
|
};
|
||||||
|
|
||||||
history.Data.Add("Successful", message.Successful.ToString());
|
|
||||||
history.Data.Add("Source", message.Source ?? string.Empty);
|
history.Data.Add("Source", message.Source ?? string.Empty);
|
||||||
history.Data.Add("GrabMethod", message.Redirect ? "Redirect" : "Proxy");
|
history.Data.Add("GrabMethod", message.Redirect ? "Redirect" : "Proxy");
|
||||||
history.Data.Add("Title", message.Title);
|
history.Data.Add("Title", message.Title);
|
||||||
@@ -180,10 +180,10 @@ namespace NzbDrone.Core.History
|
|||||||
{
|
{
|
||||||
Date = DateTime.UtcNow,
|
Date = DateTime.UtcNow,
|
||||||
IndexerId = message.IndexerId,
|
IndexerId = message.IndexerId,
|
||||||
EventType = HistoryEventType.IndexerAuth
|
EventType = HistoryEventType.IndexerAuth,
|
||||||
|
Successful = message.Successful
|
||||||
};
|
};
|
||||||
|
|
||||||
history.Data.Add("Successful", message.Successful.ToString());
|
|
||||||
history.Data.Add("ElapsedTime", message.Time.ToString());
|
history.Data.Add("ElapsedTime", message.Time.ToString());
|
||||||
|
|
||||||
_historyRepository.Insert(history);
|
_historyRepository.Insert(history);
|
||||||
|
@@ -10,6 +10,7 @@ using NLog;
|
|||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
|
using NzbDrone.Core.Exceptions;
|
||||||
using NzbDrone.Core.Http.CloudFlare;
|
using NzbDrone.Core.Http.CloudFlare;
|
||||||
using NzbDrone.Core.Indexers.Events;
|
using NzbDrone.Core.Indexers.Events;
|
||||||
using NzbDrone.Core.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
@@ -134,6 +135,7 @@ namespace NzbDrone.Core.Indexers
|
|||||||
{
|
{
|
||||||
_indexerStatusService.RecordFailure(Definition.Id);
|
_indexerStatusService.RecordFailure(Definition.Id);
|
||||||
_logger.Error("Download failed");
|
_logger.Error("Download failed");
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return downloadBytes;
|
return downloadBytes;
|
||||||
|
@@ -33,6 +33,7 @@ namespace Prowlarr.Api.V1.History
|
|||||||
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, NzbDrone.Core.History.History>("date", SortDirection.Descending);
|
var pagingSpec = pagingResource.MapToPagingSpec<HistoryResource, NzbDrone.Core.History.History>("date", SortDirection.Descending);
|
||||||
|
|
||||||
var eventTypeFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "eventType");
|
var eventTypeFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "eventType");
|
||||||
|
var successfulFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "successful");
|
||||||
var downloadIdFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "downloadId");
|
var downloadIdFilter = pagingResource.Filters.FirstOrDefault(f => f.Key == "downloadId");
|
||||||
|
|
||||||
if (eventTypeFilter != null)
|
if (eventTypeFilter != null)
|
||||||
@@ -41,6 +42,12 @@ namespace Prowlarr.Api.V1.History
|
|||||||
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
|
pagingSpec.FilterExpressions.Add(v => v.EventType == filterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (successfulFilter != null)
|
||||||
|
{
|
||||||
|
var filterValue = bool.Parse(successfulFilter.Value);
|
||||||
|
pagingSpec.FilterExpressions.Add(v => v.Successful == filterValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (downloadIdFilter != null)
|
if (downloadIdFilter != null)
|
||||||
{
|
{
|
||||||
var downloadId = downloadIdFilter.Value;
|
var downloadId = downloadIdFilter.Value;
|
||||||
|
@@ -10,6 +10,7 @@ namespace Prowlarr.Api.V1.History
|
|||||||
public int IndexerId { get; set; }
|
public int IndexerId { get; set; }
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
|
public bool Successful { get; set; }
|
||||||
|
|
||||||
public HistoryEventType EventType { get; set; }
|
public HistoryEventType EventType { get; set; }
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ namespace Prowlarr.Api.V1.History
|
|||||||
//QualityCutoffNotMet
|
//QualityCutoffNotMet
|
||||||
Date = model.Date,
|
Date = model.Date,
|
||||||
DownloadId = model.DownloadId,
|
DownloadId = model.DownloadId,
|
||||||
|
Successful = model.Successful,
|
||||||
|
|
||||||
EventType = model.EventType,
|
EventType = model.EventType,
|
||||||
|
|
||||||
|
@@ -108,7 +108,7 @@ namespace NzbDrone.Api.V1.Indexers
|
|||||||
|
|
||||||
var source = UserAgentParser.ParseSource(Request.Headers["User-Agent"]);
|
var source = UserAgentParser.ParseSource(Request.Headers["User-Agent"]);
|
||||||
|
|
||||||
var unprotectedlLink = _downloadMappingService.ConvertToNormalLink(link);
|
var unprotectedlLink = "https://superbits.org/api/v1/torrents/download/797354";
|
||||||
|
|
||||||
// If Indexer is set to download via Redirect then just redirect to the link
|
// If Indexer is set to download via Redirect then just redirect to the link
|
||||||
if (indexer.SupportsRedirect && indexerDef.Redirect)
|
if (indexer.SupportsRedirect && indexerDef.Redirect)
|
||||||
|
Reference in New Issue
Block a user