diff --git a/app/src/components/admin/Downloads.js b/app/src/components/admin/Downloads.js index 5f237459..84f04002 100644 --- a/app/src/components/admin/Downloads.js +++ b/app/src/components/admin/Downloads.js @@ -1,4 +1,4 @@ -import React, {useContext} from "react"; +import React from "react"; import {clearCompletedDownloads, clearFailedDownloads, deleteDownload, killDownload, postDownload} from "../../api"; import {Link} from "react-router-dom"; import { @@ -22,7 +22,6 @@ import { TableRow } from "semantic-ui-react"; import {Button, Header, Placeholder, Segment, Table} from "../Theme"; -import {ThemeContext} from "../../contexts/contexts"; import {useDownloads} from "../../hooks/customHooks"; import _ from "lodash"; @@ -310,76 +309,73 @@ class StoppableRow extends React.Component { } } +export function OnceDownloadsTable({downloads, fetchDownloads}) { + if (downloads && _.isEmpty(downloads)) { + return No downloads are scheduled.; + } else if (downloads) { + return <> + + + + + + URL + Completed At + Control + + + + {downloads.map(i => )} + +
+ ; + } else { + return + + + ; + } +} + +export function RecurringDownloadsTable({downloads, fetchDownloads}) { + if (downloads && _.isEmpty(downloads)) { + return No downloads are scheduled.; + } else if (downloads) { + return + + + URL + Download Frequency + Completed At + Next + Control + + + + {downloads.map(i => )} + +
; + } else { + return + + + ; + } +} + export function Downloads() { useTitle('Downloads'); const {onceDownloads, recurringDownloads, fetchDownloads} = useDownloads(); - const tablePlaceholder = - - - ; - - const stoppableHeader = ( - - - URL - Completed At - Control - - - ); - - const nonStoppableHeader = ( - - - URL - Download Frequency - Completed At - Next - Control - - - ); - - let onceTable = tablePlaceholder; - if (onceDownloads && _.isEmpty(onceDownloads)) { - onceTable = No downloads are scheduled. - } else if (onceDownloads) { - onceTable = ( - <> - - - - {stoppableHeader} - - {onceDownloads.map((i) => - - )} - -
- ); - } - - let recurringTable = tablePlaceholder; - if (recurringDownloads && _.isEmpty(recurringDownloads)) { - recurringTable = No recurring downloads are scheduled. - } else if (recurringDownloads) { - recurringTable = - {nonStoppableHeader} - - {recurringDownloads.map((i) => )} - -
; - } - return <> +
Downloads
- {onceTable} +
Recurring Downloads
- {recurringTable} + }