summaryrefslogtreecommitdiffhomepage
path: root/frontend/src/System/Tasks/index.tsx
blob: 4211e0991b9f6e7f8e6dccd19e26cdad5b16fc12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { faSync } from "@fortawesome/free-solid-svg-icons";
import React, { FunctionComponent } from "react";
import { Container, Row } from "react-bootstrap";
import { Helmet } from "react-helmet";
import { systemMarkTasksDirty } from "../../@redux/actions";
import { useSystemTasks } from "../../@redux/hooks";
import { useReduxAction } from "../../@redux/hooks/base";
import { AsyncOverlay, ContentHeader } from "../../components";
import Table from "./table";

interface Props {}

const SystemTasksView: FunctionComponent<Props> = () => {
  const tasks = useSystemTasks();
  const update = useReduxAction(systemMarkTasksDirty);

  return (
    <AsyncOverlay ctx={tasks}>
      {({ content, state }) => (
        <Container fluid>
          <Helmet>
            <title>Tasks - Bazarr (System)</title>
          </Helmet>
          <ContentHeader>
            <ContentHeader.Button
              updating={state === "loading"}
              icon={faSync}
              onClick={update}
            >
              Refresh
            </ContentHeader.Button>
          </ContentHeader>
          <Row>
            <Table tasks={content ?? []}></Table>
          </Row>
        </Container>
      )}
    </AsyncOverlay>
  );
};

export default SystemTasksView;