mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (Tags) Show applications in tag details
This commit is contained in:
@@ -17,6 +17,7 @@ function TagDetailsModalContent(props) {
|
|||||||
indexers,
|
indexers,
|
||||||
notifications,
|
notifications,
|
||||||
indexerProxies,
|
indexerProxies,
|
||||||
|
applications,
|
||||||
onModalClose,
|
onModalClose,
|
||||||
onDeleteTagPress
|
onDeleteTagPress
|
||||||
} = props;
|
} = props;
|
||||||
@@ -79,6 +80,21 @@ function TagDetailsModalContent(props) {
|
|||||||
}
|
}
|
||||||
</FieldSet>
|
</FieldSet>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!!applications.length &&
|
||||||
|
<FieldSet legend={translate('Applications')}>
|
||||||
|
{
|
||||||
|
applications.map((item) => {
|
||||||
|
return (
|
||||||
|
<div key={item.id}>
|
||||||
|
{item.name}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</FieldSet>
|
||||||
|
}
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
@@ -110,6 +126,7 @@ TagDetailsModalContent.propTypes = {
|
|||||||
indexers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
indexers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
notifications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
notifications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
indexerProxies: PropTypes.arrayOf(PropTypes.object).isRequired,
|
indexerProxies: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
|
applications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired,
|
onModalClose: PropTypes.func.isRequired,
|
||||||
onDeleteTagPress: PropTypes.func.isRequired
|
onDeleteTagPress: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
@@ -18,16 +18,24 @@ function createMatchingIndexersSelector() {
|
|||||||
|
|
||||||
function createMatchingIndexerProxiesSelector() {
|
function createMatchingIndexerProxiesSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state, { notificationIds }) => notificationIds,
|
(state, { indexerProxyIds }) => indexerProxyIds,
|
||||||
(state) => state.settings.notifications.items,
|
(state) => state.settings.indexerProxies.items,
|
||||||
findMatchingItems
|
findMatchingItems
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMatchingNotificationsSelector() {
|
function createMatchingNotificationsSelector() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state, { indexerProxyIds }) => indexerProxyIds,
|
(state, { notificationIds }) => notificationIds,
|
||||||
(state) => state.settings.indexerProxies.items,
|
(state) => state.settings.notifications.items,
|
||||||
|
findMatchingItems
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createMatchingApplicationsSelector() {
|
||||||
|
return createSelector(
|
||||||
|
(state, { applicationIds }) => applicationIds,
|
||||||
|
(state) => state.settings.applications.items,
|
||||||
findMatchingItems
|
findMatchingItems
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -37,11 +45,13 @@ function createMapStateToProps() {
|
|||||||
createMatchingIndexersSelector(),
|
createMatchingIndexersSelector(),
|
||||||
createMatchingIndexerProxiesSelector(),
|
createMatchingIndexerProxiesSelector(),
|
||||||
createMatchingNotificationsSelector(),
|
createMatchingNotificationsSelector(),
|
||||||
(indexers, indexerProxies, notifications) => {
|
createMatchingApplicationsSelector(),
|
||||||
|
(indexers, indexerProxies, notifications, applications) => {
|
||||||
return {
|
return {
|
||||||
indexers,
|
indexers,
|
||||||
indexerProxies,
|
indexerProxies,
|
||||||
notifications
|
notifications,
|
||||||
|
applications
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@@ -55,7 +55,8 @@ class Tag extends Component {
|
|||||||
label,
|
label,
|
||||||
notificationIds,
|
notificationIds,
|
||||||
indexerIds,
|
indexerIds,
|
||||||
indexerProxyIds
|
indexerProxyIds,
|
||||||
|
applicationIds
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -66,7 +67,8 @@ class Tag extends Component {
|
|||||||
const isTagUsed = !!(
|
const isTagUsed = !!(
|
||||||
indexerIds.length ||
|
indexerIds.length ||
|
||||||
notificationIds.length ||
|
notificationIds.length ||
|
||||||
indexerProxyIds.length
|
indexerProxyIds.length ||
|
||||||
|
applicationIds.length
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -102,6 +104,13 @@ class Tag extends Component {
|
|||||||
{indexerProxyIds.length} {indexerProxyIds.length > 1 ? translate('IndexerProxies') : translate('IndexerProxy')}
|
{indexerProxyIds.length} {indexerProxyIds.length > 1 ? translate('IndexerProxies') : translate('IndexerProxy')}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
!!applicationIds.length &&
|
||||||
|
<div>
|
||||||
|
{applicationIds.length} {applicationIds.length > 1 ? translate('Applications') : translate('Application')}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +127,7 @@ class Tag extends Component {
|
|||||||
indexerIds={indexerIds}
|
indexerIds={indexerIds}
|
||||||
notificationIds={notificationIds}
|
notificationIds={notificationIds}
|
||||||
indexerProxyIds={indexerProxyIds}
|
indexerProxyIds={indexerProxyIds}
|
||||||
|
applicationIds={applicationIds}
|
||||||
isOpen={isDetailsModalOpen}
|
isOpen={isDetailsModalOpen}
|
||||||
onModalClose={this.onDetailsModalClose}
|
onModalClose={this.onDetailsModalClose}
|
||||||
onDeleteTagPress={this.onDeleteTagPress}
|
onDeleteTagPress={this.onDeleteTagPress}
|
||||||
@@ -143,13 +153,15 @@ Tag.propTypes = {
|
|||||||
notificationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
notificationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
indexerIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
indexerIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
indexerProxyIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
indexerProxyIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
|
applicationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
onConfirmDeleteTag: PropTypes.func.isRequired
|
onConfirmDeleteTag: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
Tag.defaultProps = {
|
Tag.defaultProps = {
|
||||||
indexerIds: [],
|
indexerIds: [],
|
||||||
notificationIds: [],
|
notificationIds: [],
|
||||||
indexerProxyIds: []
|
indexerProxyIds: [],
|
||||||
|
applicationIds: []
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Tag;
|
export default Tag;
|
||||||
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
import { fetchIndexerProxies, fetchNotifications } from 'Store/Actions/settingsActions';
|
import { fetchApplications, fetchIndexerProxies, fetchNotifications } from 'Store/Actions/settingsActions';
|
||||||
import { fetchTagDetails } from 'Store/Actions/tagActions';
|
import { fetchTagDetails } from 'Store/Actions/tagActions';
|
||||||
import Tags from './Tags';
|
import Tags from './Tags';
|
||||||
|
|
||||||
@@ -27,7 +27,8 @@ function createMapStateToProps() {
|
|||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
dispatchFetchTagDetails: fetchTagDetails,
|
dispatchFetchTagDetails: fetchTagDetails,
|
||||||
dispatchFetchNotifications: fetchNotifications,
|
dispatchFetchNotifications: fetchNotifications,
|
||||||
dispatchFetchIndexerProxies: fetchIndexerProxies
|
dispatchFetchIndexerProxies: fetchIndexerProxies,
|
||||||
|
dispatchFetchApplications: fetchApplications
|
||||||
};
|
};
|
||||||
|
|
||||||
class MetadatasConnector extends Component {
|
class MetadatasConnector extends Component {
|
||||||
@@ -39,12 +40,14 @@ class MetadatasConnector extends Component {
|
|||||||
const {
|
const {
|
||||||
dispatchFetchTagDetails,
|
dispatchFetchTagDetails,
|
||||||
dispatchFetchNotifications,
|
dispatchFetchNotifications,
|
||||||
dispatchFetchIndexerProxies
|
dispatchFetchIndexerProxies,
|
||||||
|
dispatchFetchApplications
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
dispatchFetchTagDetails();
|
dispatchFetchTagDetails();
|
||||||
dispatchFetchNotifications();
|
dispatchFetchNotifications();
|
||||||
dispatchFetchIndexerProxies();
|
dispatchFetchIndexerProxies();
|
||||||
|
dispatchFetchApplications();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -62,7 +65,8 @@ class MetadatasConnector extends Component {
|
|||||||
MetadatasConnector.propTypes = {
|
MetadatasConnector.propTypes = {
|
||||||
dispatchFetchTagDetails: PropTypes.func.isRequired,
|
dispatchFetchTagDetails: PropTypes.func.isRequired,
|
||||||
dispatchFetchNotifications: PropTypes.func.isRequired,
|
dispatchFetchNotifications: PropTypes.func.isRequired,
|
||||||
dispatchFetchIndexerProxies: PropTypes.func.isRequired
|
dispatchFetchIndexerProxies: PropTypes.func.isRequired,
|
||||||
|
dispatchFetchApplications: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(MetadatasConnector);
|
export default connect(createMapStateToProps, mapDispatchToProps)(MetadatasConnector);
|
||||||
|
@@ -10,13 +10,8 @@ namespace NzbDrone.Core.Tags
|
|||||||
public List<int> NotificationIds { get; set; }
|
public List<int> NotificationIds { get; set; }
|
||||||
public List<int> IndexerIds { get; set; }
|
public List<int> IndexerIds { get; set; }
|
||||||
public List<int> IndexerProxyIds { get; set; }
|
public List<int> IndexerProxyIds { get; set; }
|
||||||
|
public List<int> ApplicationIds { get; set; }
|
||||||
|
|
||||||
public bool InUse
|
public bool InUse => NotificationIds.Any() || IndexerIds.Any() || IndexerProxyIds.Any() || ApplicationIds.Any();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return NotificationIds.Any() || IndexerIds.Any() || IndexerProxyIds.Any();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Applications;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.IndexerProxies;
|
using NzbDrone.Core.IndexerProxies;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
@@ -28,18 +29,21 @@ namespace NzbDrone.Core.Tags
|
|||||||
private readonly INotificationFactory _notificationFactory;
|
private readonly INotificationFactory _notificationFactory;
|
||||||
private readonly IIndexerFactory _indexerFactory;
|
private readonly IIndexerFactory _indexerFactory;
|
||||||
private readonly IIndexerProxyFactory _indexerProxyFactory;
|
private readonly IIndexerProxyFactory _indexerProxyFactory;
|
||||||
|
private readonly IApplicationFactory _applicationFactory;
|
||||||
|
|
||||||
public TagService(ITagRepository repo,
|
public TagService(ITagRepository repo,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
INotificationFactory notificationFactory,
|
INotificationFactory notificationFactory,
|
||||||
IIndexerFactory indexerFactory,
|
IIndexerFactory indexerFactory,
|
||||||
IIndexerProxyFactory indexerProxyFactory)
|
IIndexerProxyFactory indexerProxyFactory,
|
||||||
|
IApplicationFactory applicationFactory)
|
||||||
{
|
{
|
||||||
_repo = repo;
|
_repo = repo;
|
||||||
_eventAggregator = eventAggregator;
|
_eventAggregator = eventAggregator;
|
||||||
_notificationFactory = notificationFactory;
|
_notificationFactory = notificationFactory;
|
||||||
_indexerFactory = indexerFactory;
|
_indexerFactory = indexerFactory;
|
||||||
_indexerProxyFactory = indexerProxyFactory;
|
_indexerProxyFactory = indexerProxyFactory;
|
||||||
|
_applicationFactory = applicationFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tag GetTag(int tagId)
|
public Tag GetTag(int tagId)
|
||||||
@@ -70,6 +74,7 @@ namespace NzbDrone.Core.Tags
|
|||||||
var notifications = _notificationFactory.AllForTag(tagId);
|
var notifications = _notificationFactory.AllForTag(tagId);
|
||||||
var indexers = _indexerFactory.AllForTag(tagId);
|
var indexers = _indexerFactory.AllForTag(tagId);
|
||||||
var indexerProxies = _indexerProxyFactory.AllForTag(tagId);
|
var indexerProxies = _indexerProxyFactory.AllForTag(tagId);
|
||||||
|
var applications = _applicationFactory.AllForTag(tagId);
|
||||||
|
|
||||||
return new TagDetails
|
return new TagDetails
|
||||||
{
|
{
|
||||||
@@ -77,7 +82,8 @@ namespace NzbDrone.Core.Tags
|
|||||||
Label = tag.Label,
|
Label = tag.Label,
|
||||||
NotificationIds = notifications.Select(c => c.Id).ToList(),
|
NotificationIds = notifications.Select(c => c.Id).ToList(),
|
||||||
IndexerIds = indexers.Select(c => c.Id).ToList(),
|
IndexerIds = indexers.Select(c => c.Id).ToList(),
|
||||||
IndexerProxyIds = indexerProxies.Select(c => c.Id).ToList()
|
IndexerProxyIds = indexerProxies.Select(c => c.Id).ToList(),
|
||||||
|
ApplicationIds = applications.Select(c => c.Id).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +93,7 @@ namespace NzbDrone.Core.Tags
|
|||||||
var notifications = _notificationFactory.All();
|
var notifications = _notificationFactory.All();
|
||||||
var indexers = _indexerFactory.All();
|
var indexers = _indexerFactory.All();
|
||||||
var indexerProxies = _indexerProxyFactory.All();
|
var indexerProxies = _indexerProxyFactory.All();
|
||||||
|
var applications = _applicationFactory.All();
|
||||||
|
|
||||||
var details = new List<TagDetails>();
|
var details = new List<TagDetails>();
|
||||||
|
|
||||||
@@ -98,7 +105,8 @@ namespace NzbDrone.Core.Tags
|
|||||||
Label = tag.Label,
|
Label = tag.Label,
|
||||||
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
NotificationIds = notifications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
IndexerIds = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
IndexerIds = indexers.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
IndexerProxyIds = indexerProxies.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
|
IndexerProxyIds = indexerProxies.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList(),
|
||||||
|
ApplicationIds = applications.Where(c => c.Tags.Contains(tag.Id)).Select(c => c.Id).ToList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@ namespace Prowlarr.Api.V1.Tags
|
|||||||
public List<int> NotificationIds { get; set; }
|
public List<int> NotificationIds { get; set; }
|
||||||
public List<int> IndexerIds { get; set; }
|
public List<int> IndexerIds { get; set; }
|
||||||
public List<int> IndexerProxyIds { get; set; }
|
public List<int> IndexerProxyIds { get; set; }
|
||||||
|
public List<int> ApplicationIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TagDetailsResourceMapper
|
public static class TagDetailsResourceMapper
|
||||||
@@ -28,7 +29,8 @@ namespace Prowlarr.Api.V1.Tags
|
|||||||
Label = model.Label,
|
Label = model.Label,
|
||||||
NotificationIds = model.NotificationIds,
|
NotificationIds = model.NotificationIds,
|
||||||
IndexerIds = model.IndexerIds,
|
IndexerIds = model.IndexerIds,
|
||||||
IndexerProxyIds = model.IndexerProxyIds
|
IndexerProxyIds = model.IndexerProxyIds,
|
||||||
|
ApplicationIds = model.ApplicationIds
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user