mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-19 21:46:43 -04:00
Fix episode status on wanted
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import QueueDetailsProvider from 'Activity/Queue/Details/QueueDetailsProvider';
|
||||
import { SelectProvider, useSelect } from 'App/Select/SelectContext';
|
||||
import AppState, { Filter } from 'App/State/AppState';
|
||||
import * as commandNames from 'Commands/commandNames';
|
||||
@@ -22,6 +23,7 @@ import Episode from 'Episode/Episode';
|
||||
import useCurrentPage from 'Helpers/Hooks/useCurrentPage';
|
||||
import { align, icons, kinds } from 'Helpers/Props';
|
||||
import { executeCommand } from 'Store/Actions/commandActions';
|
||||
import { fetchEpisodeFiles } from 'Store/Actions/episodeFileActions';
|
||||
import {
|
||||
batchToggleCutoffUnmetEpisodes,
|
||||
clearCutoffUnmet,
|
||||
@@ -35,6 +37,7 @@ import createCommandExecutingSelector from 'Store/Selectors/createCommandExecuti
|
||||
import { CheckInputChanged } from 'typings/inputs';
|
||||
import { TableOptionsChangePayload } from 'typings/Table';
|
||||
import getFilterValue from 'Utilities/Filter/getFilterValue';
|
||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||
import {
|
||||
registerPagePopulator,
|
||||
unregisterPagePopulator,
|
||||
@@ -108,6 +111,14 @@ function CutoffUnmetContent() {
|
||||
const isSearchingForEpisodes =
|
||||
isSearchingForAllEpisodes || isSearchingForSelectedEpisodes;
|
||||
|
||||
const episodeIds = useMemo(() => {
|
||||
return selectUniqueIds<Episode, number>(items, 'id');
|
||||
}, [items]);
|
||||
|
||||
const episodeFileIds = useMemo(() => {
|
||||
return selectUniqueIds<Episode, number>(items, 'episodeFileId');
|
||||
}, [items]);
|
||||
|
||||
const handleSelectAllChange = useCallback(
|
||||
({ value }: CheckInputChanged) => {
|
||||
if (value) {
|
||||
@@ -214,13 +225,22 @@ function CutoffUnmetContent() {
|
||||
};
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
if (episodeFileIds.length) {
|
||||
dispatch(fetchEpisodeFiles({ episodeFileIds }));
|
||||
}
|
||||
}, [episodeFileIds, dispatch]);
|
||||
|
||||
return (
|
||||
<QueueDetailsProvider episodeIds={episodeIds}>
|
||||
<PageContent title={translate('CutoffUnmet')}>
|
||||
<PageToolbar>
|
||||
<PageToolbarSection>
|
||||
<PageToolbarButton
|
||||
label={
|
||||
anySelected ? translate('SearchSelected') : translate('SearchAll')
|
||||
anySelected
|
||||
? translate('SearchSelected')
|
||||
: translate('SearchAll')
|
||||
}
|
||||
iconName={icons.SEARCH}
|
||||
isDisabled={isSearchingForEpisodes}
|
||||
@@ -271,7 +291,9 @@ function CutoffUnmetContent() {
|
||||
{isFetching && !isPopulated ? <LoadingIndicator /> : null}
|
||||
|
||||
{!isFetching && error ? (
|
||||
<Alert kind={kinds.DANGER}>{translate('CutoffUnmetLoadError')}</Alert>
|
||||
<Alert kind={kinds.DANGER}>
|
||||
{translate('CutoffUnmetLoadError')}
|
||||
</Alert>
|
||||
) : null}
|
||||
|
||||
{isPopulated && !error && !items.length ? (
|
||||
@@ -295,7 +317,11 @@ function CutoffUnmetContent() {
|
||||
<TableBody>
|
||||
{items.map((item) => {
|
||||
return (
|
||||
<CutoffUnmetRow key={item.id} columns={columns} {...item} />
|
||||
<CutoffUnmetRow
|
||||
key={item.id}
|
||||
columns={columns}
|
||||
{...item}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</TableBody>
|
||||
@@ -336,6 +362,7 @@ function CutoffUnmetContent() {
|
||||
) : null}
|
||||
</PageContentBody>
|
||||
</PageContent>
|
||||
</QueueDetailsProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import QueueDetailsProvider from 'Activity/Queue/Details/QueueDetailsProvider';
|
||||
import { SelectProvider, useSelect } from 'App/Select/SelectContext';
|
||||
import AppState, { Filter } from 'App/State/AppState';
|
||||
import * as commandNames from 'Commands/commandNames';
|
||||
@@ -36,6 +37,7 @@ import createCommandExecutingSelector from 'Store/Selectors/createCommandExecuti
|
||||
import { CheckInputChanged } from 'typings/inputs';
|
||||
import { TableOptionsChangePayload } from 'typings/Table';
|
||||
import getFilterValue from 'Utilities/Filter/getFilterValue';
|
||||
import selectUniqueIds from 'Utilities/Object/selectUniqueIds';
|
||||
import {
|
||||
registerPagePopulator,
|
||||
unregisterPagePopulator,
|
||||
@@ -112,6 +114,10 @@ function MissingContent() {
|
||||
const isSearchingForEpisodes =
|
||||
isSearchingForAllEpisodes || isSearchingForSelectedEpisodes;
|
||||
|
||||
const episodeIds = useMemo(() => {
|
||||
return selectUniqueIds<Episode, number>(items, 'id');
|
||||
}, [items]);
|
||||
|
||||
const handleSelectAllChange = useCallback(
|
||||
({ value }: CheckInputChanged) => {
|
||||
if (value) {
|
||||
@@ -227,12 +233,15 @@ function MissingContent() {
|
||||
}, [dispatch]);
|
||||
|
||||
return (
|
||||
<QueueDetailsProvider episodeIds={episodeIds}>
|
||||
<PageContent title={translate('Missing')}>
|
||||
<PageToolbar>
|
||||
<PageToolbarSection>
|
||||
<PageToolbarButton
|
||||
label={
|
||||
anySelected ? translate('SearchSelected') : translate('SearchAll')
|
||||
anySelected
|
||||
? translate('SearchSelected')
|
||||
: translate('SearchAll')
|
||||
}
|
||||
iconName={icons.SEARCH}
|
||||
isDisabled={isSearchingForEpisodes}
|
||||
@@ -340,9 +349,12 @@ function MissingContent() {
|
||||
message={
|
||||
<div>
|
||||
<div>
|
||||
{translate('SearchForAllMissingEpisodesConfirmationCount', {
|
||||
{translate(
|
||||
'SearchForAllMissingEpisodesConfirmationCount',
|
||||
{
|
||||
totalRecords,
|
||||
})}
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
<div>{translate('MassSearchCancelWarning')}</div>
|
||||
</div>
|
||||
@@ -360,6 +372,7 @@ function MissingContent() {
|
||||
onModalClose={handleInteractiveImportModalClose}
|
||||
/>
|
||||
</PageContent>
|
||||
</QueueDetailsProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user