mirror of
https://github.com/Sonarr/Sonarr
synced 2025-01-03 05:35:29 +00:00
Sort quality profiles by name in custom filters
This commit is contained in:
parent
84338f4c50
commit
dc7a16a03a
3 changed files with 32 additions and 30 deletions
|
@ -12,7 +12,7 @@ import IndexerFilterBuilderRowValueConnector from './IndexerFilterBuilderRowValu
|
||||||
import LanguageFilterBuilderRowValue from './LanguageFilterBuilderRowValue';
|
import LanguageFilterBuilderRowValue from './LanguageFilterBuilderRowValue';
|
||||||
import ProtocolFilterBuilderRowValue from './ProtocolFilterBuilderRowValue';
|
import ProtocolFilterBuilderRowValue from './ProtocolFilterBuilderRowValue';
|
||||||
import QualityFilterBuilderRowValueConnector from './QualityFilterBuilderRowValueConnector';
|
import QualityFilterBuilderRowValueConnector from './QualityFilterBuilderRowValueConnector';
|
||||||
import QualityProfileFilterBuilderRowValueConnector from './QualityProfileFilterBuilderRowValueConnector';
|
import QualityProfileFilterBuilderRowValue from './QualityProfileFilterBuilderRowValue';
|
||||||
import SeasonsMonitoredStatusFilterBuilderRowValue from './SeasonsMonitoredStatusFilterBuilderRowValue';
|
import SeasonsMonitoredStatusFilterBuilderRowValue from './SeasonsMonitoredStatusFilterBuilderRowValue';
|
||||||
import SeriesFilterBuilderRowValue from './SeriesFilterBuilderRowValue';
|
import SeriesFilterBuilderRowValue from './SeriesFilterBuilderRowValue';
|
||||||
import SeriesStatusFilterBuilderRowValue from './SeriesStatusFilterBuilderRowValue';
|
import SeriesStatusFilterBuilderRowValue from './SeriesStatusFilterBuilderRowValue';
|
||||||
|
@ -78,7 +78,7 @@ function getRowValueConnector(selectedFilterBuilderProp) {
|
||||||
return QualityFilterBuilderRowValueConnector;
|
return QualityFilterBuilderRowValueConnector;
|
||||||
|
|
||||||
case filterBuilderValueTypes.QUALITY_PROFILE:
|
case filterBuilderValueTypes.QUALITY_PROFILE:
|
||||||
return QualityProfileFilterBuilderRowValueConnector;
|
return QualityProfileFilterBuilderRowValue;
|
||||||
|
|
||||||
case filterBuilderValueTypes.SEASONS_MONITORED_STATUS:
|
case filterBuilderValueTypes.SEASONS_MONITORED_STATUS:
|
||||||
return SeasonsMonitoredStatusFilterBuilderRowValue;
|
return SeasonsMonitoredStatusFilterBuilderRowValue;
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
import AppState from 'App/State/AppState';
|
||||||
|
import FilterBuilderRowValueProps from 'Components/Filter/Builder/FilterBuilderRowValueProps';
|
||||||
|
import sortByProp from 'Utilities/Array/sortByProp';
|
||||||
|
import FilterBuilderRowValue from './FilterBuilderRowValue';
|
||||||
|
|
||||||
|
function createQualityProfilesSelector() {
|
||||||
|
return createSelector(
|
||||||
|
(state: AppState) => state.settings.qualityProfiles.items,
|
||||||
|
(qualityProfiles) => {
|
||||||
|
return qualityProfiles;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function QualityProfileFilterBuilderRowValue(
|
||||||
|
props: FilterBuilderRowValueProps
|
||||||
|
) {
|
||||||
|
const qualityProfiles = useSelector(createQualityProfilesSelector());
|
||||||
|
|
||||||
|
const tagList = qualityProfiles
|
||||||
|
.map(({ id, name }) => ({ id, name }))
|
||||||
|
.sort(sortByProp('name'));
|
||||||
|
|
||||||
|
return <FilterBuilderRowValue {...props} tagList={tagList} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QualityProfileFilterBuilderRowValue;
|
|
@ -1,28 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createSelector } from 'reselect';
|
|
||||||
import FilterBuilderRowValue from './FilterBuilderRowValue';
|
|
||||||
|
|
||||||
function createMapStateToProps() {
|
|
||||||
return createSelector(
|
|
||||||
(state) => state.settings.qualityProfiles,
|
|
||||||
(qualityProfiles) => {
|
|
||||||
const tagList = qualityProfiles.items.map((qualityProfile) => {
|
|
||||||
const {
|
|
||||||
id,
|
|
||||||
name
|
|
||||||
} = qualityProfile;
|
|
||||||
|
|
||||||
return {
|
|
||||||
id,
|
|
||||||
name
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
tagList
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default connect(createMapStateToProps)(FilterBuilderRowValue);
|
|
Loading…
Reference in a new issue