summaryrefslogtreecommitdiffhomepage
path: root/frontend/src/Series
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/src/Series')
-rw-r--r--frontend/src/Series/Episodes/index.tsx11
-rw-r--r--frontend/src/Series/Episodes/table.tsx20
2 files changed, 20 insertions, 11 deletions
diff --git a/frontend/src/Series/Episodes/index.tsx b/frontend/src/Series/Episodes/index.tsx
index f279a35c2..825d5e47a 100644
--- a/frontend/src/Series/Episodes/index.tsx
+++ b/frontend/src/Series/Episodes/index.tsx
@@ -67,7 +67,9 @@ const SeriesEpisodesView: FunctionComponent<Props> = (props) => {
const profile = useProfileBy(series.content?.profileId);
- const hasTask = useIsAnyTaskRunningWithId(id);
+ const hasTask = useIsAnyTaskRunningWithId(
+ episodes.content.map((v) => v.sonarrEpisodeId)
+ );
if (isNaN(id) || !valid) {
return <Redirect to={RouterEmptyPath}></Redirect>;
@@ -150,7 +152,12 @@ const SeriesEpisodesView: FunctionComponent<Props> = (props) => {
<ItemOverview item={serie} details={details}></ItemOverview>
</Row>
<Row>
- <Table serie={series} episodes={episodes} profile={profile}></Table>
+ <Table
+ serie={series}
+ episodes={episodes}
+ profile={profile}
+ disabled={hasTask}
+ ></Table>
</Row>
<ItemEditorModal
modalKey="edit"
diff --git a/frontend/src/Series/Episodes/table.tsx b/frontend/src/Series/Episodes/table.tsx
index 987cab835..ad6b5376e 100644
--- a/frontend/src/Series/Episodes/table.tsx
+++ b/frontend/src/Series/Episodes/table.tsx
@@ -9,7 +9,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React, { FunctionComponent, useCallback, useMemo } from "react";
import { Badge, ButtonGroup } from "react-bootstrap";
import { Column, TableUpdater } from "react-table";
-import { useIsAnyTaskRunningWithId } from "../../@modules/task/hooks";
import { useProfileItemsToLanguages } from "../../@redux/hooks";
import { useShowOnlyDesired } from "../../@redux/hooks/site";
import { ProvidersApi } from "../../apis";
@@ -29,6 +28,7 @@ import { SubtitleAction } from "./components";
interface Props {
serie: Async.Item<Item.Series>;
episodes: Async.Base<Item.Episode[]>;
+ disabled?: boolean;
profile?: Language.Profile;
}
@@ -48,17 +48,18 @@ const download = (item: any, result: SearchResultType) => {
);
};
-const Table: FunctionComponent<Props> = ({ serie, episodes, profile }) => {
+const Table: FunctionComponent<Props> = ({
+ serie,
+ episodes,
+ profile,
+ disabled,
+}) => {
const showModal = useShowModal();
const onlyDesired = useShowOnlyDesired();
const profileItems = useProfileItemsToLanguages(profile);
- const hasTask = useIsAnyTaskRunningWithId(
- serie.content?.sonarrSeriesId ?? -1
- );
-
const columns: Column<Item.Episode>[] = useMemo<Column<Item.Episode>[]>(
() => [
{
@@ -152,20 +153,21 @@ const Table: FunctionComponent<Props> = ({ serie, episodes, profile }) => {
<ButtonGroup>
<ActionButton
icon={faUser}
- disabled={serie.content?.profileId === null || hasTask}
+ disabled={serie.content?.profileId === null || disabled}
onClick={() => {
externalUpdate && externalUpdate(row, "manual-search");
}}
></ActionButton>
<ActionButton
icon={faHistory}
+ disabled={disabled}
onClick={() => {
externalUpdate && externalUpdate(row, "history");
}}
></ActionButton>
<ActionButton
icon={faBriefcase}
- disabled={hasTask}
+ disabled={disabled}
onClick={() => {
externalUpdate && externalUpdate(row, "tools");
}}
@@ -175,7 +177,7 @@ const Table: FunctionComponent<Props> = ({ serie, episodes, profile }) => {
},
},
],
- [onlyDesired, profileItems, serie, hasTask]
+ [onlyDesired, profileItems, serie, disabled]
);
const updateRow = useCallback<TableUpdater<Item.Episode>>(