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,
|
||||
notifications,
|
||||
indexerProxies,
|
||||
applications,
|
||||
onModalClose,
|
||||
onDeleteTagPress
|
||||
} = props;
|
||||
@@ -79,6 +80,21 @@ function TagDetailsModalContent(props) {
|
||||
}
|
||||
</FieldSet>
|
||||
}
|
||||
|
||||
{
|
||||
!!applications.length &&
|
||||
<FieldSet legend={translate('Applications')}>
|
||||
{
|
||||
applications.map((item) => {
|
||||
return (
|
||||
<div key={item.id}>
|
||||
{item.name}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
</FieldSet>
|
||||
}
|
||||
</ModalBody>
|
||||
|
||||
<ModalFooter>
|
||||
@@ -110,6 +126,7 @@ TagDetailsModalContent.propTypes = {
|
||||
indexers: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
notifications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
indexerProxies: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
applications: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
onModalClose: PropTypes.func.isRequired,
|
||||
onDeleteTagPress: PropTypes.func.isRequired
|
||||
};
|
||||
|
@@ -18,16 +18,24 @@ function createMatchingIndexersSelector() {
|
||||
|
||||
function createMatchingIndexerProxiesSelector() {
|
||||
return createSelector(
|
||||
(state, { notificationIds }) => notificationIds,
|
||||
(state) => state.settings.notifications.items,
|
||||
(state, { indexerProxyIds }) => indexerProxyIds,
|
||||
(state) => state.settings.indexerProxies.items,
|
||||
findMatchingItems
|
||||
);
|
||||
}
|
||||
|
||||
function createMatchingNotificationsSelector() {
|
||||
return createSelector(
|
||||
(state, { indexerProxyIds }) => indexerProxyIds,
|
||||
(state) => state.settings.indexerProxies.items,
|
||||
(state, { notificationIds }) => notificationIds,
|
||||
(state) => state.settings.notifications.items,
|
||||
findMatchingItems
|
||||
);
|
||||
}
|
||||
|
||||
function createMatchingApplicationsSelector() {
|
||||
return createSelector(
|
||||
(state, { applicationIds }) => applicationIds,
|
||||
(state) => state.settings.applications.items,
|
||||
findMatchingItems
|
||||
);
|
||||
}
|
||||
@@ -37,11 +45,13 @@ function createMapStateToProps() {
|
||||
createMatchingIndexersSelector(),
|
||||
createMatchingIndexerProxiesSelector(),
|
||||
createMatchingNotificationsSelector(),
|
||||
(indexers, indexerProxies, notifications) => {
|
||||
createMatchingApplicationsSelector(),
|
||||
(indexers, indexerProxies, notifications, applications) => {
|
||||
return {
|
||||
indexers,
|
||||
indexerProxies,
|
||||
notifications
|
||||
notifications,
|
||||
applications
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@@ -55,7 +55,8 @@ class Tag extends Component {
|
||||
label,
|
||||
notificationIds,
|
||||
indexerIds,
|
||||
indexerProxyIds
|
||||
indexerProxyIds,
|
||||
applicationIds
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
@@ -66,7 +67,8 @@ class Tag extends Component {
|
||||
const isTagUsed = !!(
|
||||
indexerIds.length ||
|
||||
notificationIds.length ||
|
||||
indexerProxyIds.length
|
||||
indexerProxyIds.length ||
|
||||
applicationIds.length
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -102,6 +104,13 @@ class Tag extends Component {
|
||||
{indexerProxyIds.length} {indexerProxyIds.length > 1 ? translate('IndexerProxies') : translate('IndexerProxy')}
|
||||
</div>
|
||||
}
|
||||
|
||||
{
|
||||
!!applicationIds.length &&
|
||||
<div>
|
||||
{applicationIds.length} {applicationIds.length > 1 ? translate('Applications') : translate('Application')}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -118,6 +127,7 @@ class Tag extends Component {
|
||||
indexerIds={indexerIds}
|
||||
notificationIds={notificationIds}
|
||||
indexerProxyIds={indexerProxyIds}
|
||||
applicationIds={applicationIds}
|
||||
isOpen={isDetailsModalOpen}
|
||||
onModalClose={this.onDetailsModalClose}
|
||||
onDeleteTagPress={this.onDeleteTagPress}
|
||||
@@ -143,13 +153,15 @@ Tag.propTypes = {
|
||||
notificationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
indexerIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
indexerProxyIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
applicationIds: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||
onConfirmDeleteTag: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
Tag.defaultProps = {
|
||||
indexerIds: [],
|
||||
notificationIds: [],
|
||||
indexerProxyIds: []
|
||||
indexerProxyIds: [],
|
||||
applicationIds: []
|
||||
};
|
||||
|
||||
export default Tag;
|
||||
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
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 Tags from './Tags';
|
||||
|
||||
@@ -27,7 +27,8 @@ function createMapStateToProps() {
|
||||
const mapDispatchToProps = {
|
||||
dispatchFetchTagDetails: fetchTagDetails,
|
||||
dispatchFetchNotifications: fetchNotifications,
|
||||
dispatchFetchIndexerProxies: fetchIndexerProxies
|
||||
dispatchFetchIndexerProxies: fetchIndexerProxies,
|
||||
dispatchFetchApplications: fetchApplications
|
||||
};
|
||||
|
||||
class MetadatasConnector extends Component {
|
||||
@@ -39,12 +40,14 @@ class MetadatasConnector extends Component {
|
||||
const {
|
||||
dispatchFetchTagDetails,
|
||||
dispatchFetchNotifications,
|
||||
dispatchFetchIndexerProxies
|
||||
dispatchFetchIndexerProxies,
|
||||
dispatchFetchApplications
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchTagDetails();
|
||||
dispatchFetchNotifications();
|
||||
dispatchFetchIndexerProxies();
|
||||
dispatchFetchApplications();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -62,7 +65,8 @@ class MetadatasConnector extends Component {
|
||||
MetadatasConnector.propTypes = {
|
||||
dispatchFetchTagDetails: 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);
|
||||
|
Reference in New Issue
Block a user