mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-19 21:46:43 -04:00
Move unknown series queue items to filter instead of option
This commit is contained in:
@@ -12,7 +12,6 @@ export type HistoryOptions = PageableOptions;
|
|||||||
const { useOptions, useOption, setOptions, setOption, setSort } =
|
const { useOptions, useOption, setOptions, setOption, setSort } =
|
||||||
createOptionsStore<HistoryOptions>('history_options', () => {
|
createOptionsStore<HistoryOptions>('history_options', () => {
|
||||||
return {
|
return {
|
||||||
includeUnknownSeriesItems: true,
|
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
selectedFilterKey: 'all',
|
selectedFilterKey: 'all',
|
||||||
sortKey: 'time',
|
sortKey: 'time',
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import {
|
|||||||
} from 'Utilities/pagePopulator';
|
} from 'Utilities/pagePopulator';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
import QueueFilterModal from './QueueFilterModal';
|
import QueueFilterModal from './QueueFilterModal';
|
||||||
import QueueOptions from './QueueOptions';
|
|
||||||
import {
|
import {
|
||||||
setQueueOption,
|
setQueueOption,
|
||||||
setQueueOptions,
|
setQueueOptions,
|
||||||
@@ -252,7 +251,6 @@ function QueueContent() {
|
|||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
sortKey={sortKey}
|
sortKey={sortKey}
|
||||||
sortDirection={sortDirection}
|
sortDirection={sortDirection}
|
||||||
optionsComponent={QueueOptions}
|
|
||||||
onTableOptionChange={handleTableOptionChange}
|
onTableOptionChange={handleTableOptionChange}
|
||||||
onSelectAllChange={handleSelectAllChange}
|
onSelectAllChange={handleSelectAllChange}
|
||||||
onSortPress={handleSortPress}
|
onSortPress={handleSortPress}
|
||||||
@@ -330,7 +328,6 @@ function QueueContent() {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
maxPageSize={200}
|
maxPageSize={200}
|
||||||
optionsComponent={QueueOptions}
|
|
||||||
onTableOptionChange={handleTableOptionChange}
|
onTableOptionChange={handleTableOptionChange}
|
||||||
>
|
>
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
import React, { useCallback } from 'react';
|
|
||||||
import FormGroup from 'Components/Form/FormGroup';
|
|
||||||
import FormInputGroup from 'Components/Form/FormInputGroup';
|
|
||||||
import FormLabel from 'Components/Form/FormLabel';
|
|
||||||
import { OptionChanged } from 'Helpers/Hooks/useOptionsStore';
|
|
||||||
import { inputTypes } from 'Helpers/Props';
|
|
||||||
import translate from 'Utilities/String/translate';
|
|
||||||
import {
|
|
||||||
QueueOptions as QueueOptionsType,
|
|
||||||
setQueueOption,
|
|
||||||
useQueueOption,
|
|
||||||
} from './queueOptionsStore';
|
|
||||||
import useQueue from './useQueue';
|
|
||||||
|
|
||||||
function QueueOptions() {
|
|
||||||
const includeUnknownSeriesItems = useQueueOption('includeUnknownSeriesItems');
|
|
||||||
const { goToPage } = useQueue();
|
|
||||||
|
|
||||||
const handleOptionChange = useCallback(
|
|
||||||
({ name, value }: OptionChanged<QueueOptionsType>) => {
|
|
||||||
setQueueOption(name, value);
|
|
||||||
|
|
||||||
if (name === 'includeUnknownSeriesItems') {
|
|
||||||
goToPage(1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[goToPage]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FormGroup>
|
|
||||||
<FormLabel>{translate('ShowUnknownSeriesItems')}</FormLabel>
|
|
||||||
|
|
||||||
<FormInputGroup
|
|
||||||
type={inputTypes.CHECK}
|
|
||||||
name="includeUnknownSeriesItems"
|
|
||||||
value={includeUnknownSeriesItems}
|
|
||||||
helpText={translate('ShowUnknownSeriesItemsHelpText')}
|
|
||||||
// @ts-expect-error - The typing for inputs needs more work
|
|
||||||
onChange={handleOptionChange}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default QueueOptions;
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import useApiQuery from 'Helpers/Hooks/useApiQuery';
|
import useApiQuery from 'Helpers/Hooks/useApiQuery';
|
||||||
import { useQueueOption } from '../queueOptionsStore';
|
|
||||||
|
|
||||||
export interface QueueStatus {
|
export interface QueueStatus {
|
||||||
totalCount: number;
|
totalCount: number;
|
||||||
@@ -12,13 +11,8 @@ export interface QueueStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function useQueueStatus() {
|
export default function useQueueStatus() {
|
||||||
const includeUnknownSeriesItems = useQueueOption('includeUnknownSeriesItems');
|
|
||||||
|
|
||||||
const { data } = useApiQuery<QueueStatus>({
|
const { data } = useApiQuery<QueueStatus>({
|
||||||
path: '/queue/status',
|
path: '/queue/status',
|
||||||
queryParams: {
|
|
||||||
includeUnknownSeriesItems,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -29,26 +23,11 @@ export default function useQueueStatus() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { errors, warnings, unknownErrors, unknownWarnings, totalCount } = data;
|
||||||
errors,
|
|
||||||
warnings,
|
|
||||||
unknownErrors,
|
|
||||||
unknownWarnings,
|
|
||||||
count,
|
|
||||||
totalCount,
|
|
||||||
} = data;
|
|
||||||
|
|
||||||
if (includeUnknownSeriesItems) {
|
|
||||||
return {
|
|
||||||
count: totalCount,
|
|
||||||
errors: errors || unknownErrors,
|
|
||||||
warnings: warnings || unknownWarnings,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
count,
|
count: totalCount,
|
||||||
errors,
|
errors: errors || unknownErrors,
|
||||||
warnings,
|
warnings: warnings || unknownWarnings,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,14 +13,12 @@ interface QueueRemovalOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface QueueOptions extends PageableOptions {
|
export interface QueueOptions extends PageableOptions {
|
||||||
includeUnknownSeriesItems: boolean;
|
|
||||||
removalOptions: QueueRemovalOptions;
|
removalOptions: QueueRemovalOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { useOptions, useOption, setOptions, setOption, setSort } =
|
const { useOptions, useOption, setOptions, setOption, setSort } =
|
||||||
createOptionsStore<QueueOptions>('queue_options', () => {
|
createOptionsStore<QueueOptions>('queue_options', () => {
|
||||||
return {
|
return {
|
||||||
includeUnknownSeriesItems: true,
|
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
selectedFilterKey: 'all',
|
selectedFilterKey: 'all',
|
||||||
sortKey: 'time',
|
sortKey: 'time',
|
||||||
|
|||||||
@@ -22,6 +22,17 @@ export const FILTERS: Filter[] = [
|
|||||||
label: () => translate('All'),
|
label: () => translate('All'),
|
||||||
filters: [],
|
filters: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: 'excludeUnknownSeriesItems',
|
||||||
|
label: () => translate('ExcludeUnknownSeriesItems'),
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
key: 'includeUnknownSeriesItems',
|
||||||
|
value: [false],
|
||||||
|
type: 'equal',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const FILTER_BUILDER: FilterBuilderProp<Queue>[] = [
|
export const FILTER_BUILDER: FilterBuilderProp<Queue>[] = [
|
||||||
@@ -55,17 +66,18 @@ export const FILTER_BUILDER: FilterBuilderProp<Queue>[] = [
|
|||||||
type: 'equal',
|
type: 'equal',
|
||||||
valueType: filterBuilderValueTypes.QUEUE_STATUS,
|
valueType: filterBuilderValueTypes.QUEUE_STATUS,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'includeUnknownSeriesItems',
|
||||||
|
label: () => translate('UnknownSeriesItems'),
|
||||||
|
type: 'equal',
|
||||||
|
valueType: filterBuilderValueTypes.BOOL,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const useQueue = () => {
|
const useQueue = () => {
|
||||||
const { page, goToPage } = usePage('queue');
|
const { page, goToPage } = usePage('queue');
|
||||||
const {
|
const { pageSize, selectedFilterKey, sortKey, sortDirection } =
|
||||||
includeUnknownSeriesItems,
|
useQueueOptions();
|
||||||
pageSize,
|
|
||||||
selectedFilterKey,
|
|
||||||
sortKey,
|
|
||||||
sortDirection,
|
|
||||||
} = useQueueOptions();
|
|
||||||
const customFilters = useCustomFiltersList('queue');
|
const customFilters = useCustomFiltersList('queue');
|
||||||
|
|
||||||
const filters = useMemo(() => {
|
const filters = useMemo(() => {
|
||||||
@@ -77,9 +89,6 @@ const useQueue = () => {
|
|||||||
page,
|
page,
|
||||||
pageSize,
|
pageSize,
|
||||||
filters,
|
filters,
|
||||||
queryParams: {
|
|
||||||
includeUnknownSeriesItems,
|
|
||||||
},
|
|
||||||
sortKey,
|
sortKey,
|
||||||
sortDirection,
|
sortDirection,
|
||||||
queryOptions: {
|
queryOptions: {
|
||||||
|
|||||||
@@ -697,6 +697,7 @@
|
|||||||
"ExcludedTags": "Excluded Tags",
|
"ExcludedTags": "Excluded Tags",
|
||||||
"ExcludedReleaseProfile": "Excluded Release Profile",
|
"ExcludedReleaseProfile": "Excluded Release Profile",
|
||||||
"ExcludedReleaseProfiles": "Excluded Release Profiles",
|
"ExcludedReleaseProfiles": "Excluded Release Profiles",
|
||||||
|
"ExcludeUnknownSeriesItems": "Exclude Unknown Series Items",
|
||||||
"Existing": "Existing",
|
"Existing": "Existing",
|
||||||
"ExistingSeries": "Existing Series",
|
"ExistingSeries": "Existing Series",
|
||||||
"ExistingTag": "Existing tag",
|
"ExistingTag": "Existing tag",
|
||||||
@@ -1985,8 +1986,6 @@
|
|||||||
"ShowTags": "Show Tags",
|
"ShowTags": "Show Tags",
|
||||||
"ShowTagsHelpText": "Show tags under poster",
|
"ShowTagsHelpText": "Show tags under poster",
|
||||||
"ShowTitle": "Show Title",
|
"ShowTitle": "Show Title",
|
||||||
"ShowUnknownSeriesItems": "Show Unknown Series Items",
|
|
||||||
"ShowUnknownSeriesItemsHelpText": "Show items without a series in the queue, this could include removed series, movies or anything else in {appName}'s category",
|
|
||||||
"ShownClickToHide": "Shown, click to hide",
|
"ShownClickToHide": "Shown, click to hide",
|
||||||
"Shutdown": "Shutdown",
|
"Shutdown": "Shutdown",
|
||||||
"SingleEpisode": "Single Episode",
|
"SingleEpisode": "Single Episode",
|
||||||
@@ -2132,6 +2131,7 @@
|
|||||||
"Unknown": "Unknown",
|
"Unknown": "Unknown",
|
||||||
"UnknownDownloadState": "Unknown download state: {state}",
|
"UnknownDownloadState": "Unknown download state: {state}",
|
||||||
"UnknownEventTooltip": "Unknown event",
|
"UnknownEventTooltip": "Unknown event",
|
||||||
|
"UnknownSeriesItems": "Unknown Series Items",
|
||||||
"Unlimited": "Unlimited",
|
"Unlimited": "Unlimited",
|
||||||
"UnmappedFilesOnly": "Unmapped Files Only",
|
"UnmappedFilesOnly": "Unmapped Files Only",
|
||||||
"UnmappedFolders": "Unmapped Folders",
|
"UnmappedFolders": "Unmapped Folders",
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Sonarr.Api.V5.Queue
|
|||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownSeriesItems = false, [FromQuery] int[]? seriesIds = null, DownloadProtocol? protocol = null, [FromQuery] int[]? languages = null, [FromQuery] int[]? quality = null, [FromQuery] QueueStatus[]? status = null, [FromQuery] QueueSubresource[]? includeSubresources = null)
|
public PagingResource<QueueResource> GetQueue([FromQuery] PagingRequestResource paging, bool includeUnknownSeriesItems = true, [FromQuery] int[]? seriesIds = null, DownloadProtocol? protocol = null, [FromQuery] int[]? languages = null, [FromQuery] int[]? quality = null, [FromQuery] QueueStatus[]? status = null, [FromQuery] QueueSubresource[]? includeSubresources = null)
|
||||||
{
|
{
|
||||||
var pagingResource = new PagingResource<QueueResource>(paging);
|
var pagingResource = new PagingResource<QueueResource>(paging);
|
||||||
var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(
|
var pagingSpec = pagingResource.MapToPagingSpec<QueueResource, NzbDrone.Core.Queue.Queue>(
|
||||||
|
|||||||
Reference in New Issue
Block a user