diff options
Diffstat (limited to 'frontend/src/Wanted/generic')
-rw-r--r-- | frontend/src/Wanted/generic/index.tsx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/frontend/src/Wanted/generic/index.tsx b/frontend/src/Wanted/generic/index.tsx index f8a4fda36..f25b346ee 100644 --- a/frontend/src/Wanted/generic/index.tsx +++ b/frontend/src/Wanted/generic/index.tsx @@ -4,6 +4,9 @@ import React from "react"; import { Container, Row } from "react-bootstrap"; import { Helmet } from "react-helmet"; import { Column } from "react-table"; +import { dispatchTask } from "../../@modules/task"; +import { useIsGroupTaskRunning } from "../../@modules/task/hooks"; +import { createTask } from "../../@modules/task/utilites"; import { AsyncPageTable, ContentHeader } from "../../components"; interface Props<T extends Wanted.Base> { @@ -14,6 +17,8 @@ interface Props<T extends Wanted.Base> { searchAll: () => Promise<void>; } +const TaskGroupName = "Searching wanted subtitles..."; + function GenericWantedView<T extends Wanted.Base>({ type, columns, @@ -25,19 +30,24 @@ function GenericWantedView<T extends Wanted.Base>({ const dataCount = Object.keys(state.content.entities).length; + const hasTask = useIsGroupTaskRunning(TaskGroupName); + return ( <Container fluid> <Helmet> <title>Wanted {typeName} - Bazarr</title> </Helmet> <ContentHeader> - <ContentHeader.AsyncButton - disabled={dataCount === 0} - promise={searchAll} + <ContentHeader.Button + disabled={dataCount === 0 || hasTask} + onClick={() => { + const task = createTask(type, undefined, searchAll); + dispatchTask(TaskGroupName, [task], "Searching..."); + }} icon={faSearch} > Search All - </ContentHeader.AsyncButton> + </ContentHeader.Button> </ContentHeader> <Row> <AsyncPageTable |