mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 04:46:18 -05:00
Creating ClearCompleteDownloads button.
This commit is contained in:
parent
5178f72b66
commit
c4f511e469
6 changed files with 99 additions and 9 deletions
|
|
@ -11,7 +11,7 @@ import {
|
|||
Placeholder,
|
||||
Table
|
||||
} from "semantic-ui-react";
|
||||
import {getDownloads, getSettings, killDownload, postDownload, saveSettings} from "../api";
|
||||
import {clearDownloads, getDownloads, getSettings, killDownload, postDownload, saveSettings} from "../api";
|
||||
import TimezoneSelect from 'react-timezone-select';
|
||||
import {
|
||||
DisableDownloadsToggle,
|
||||
|
|
@ -198,6 +198,24 @@ class WROLMode extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
function ClearCompleteDownloads() {
|
||||
const [disabled, setDisabled] = React.useState(false);
|
||||
|
||||
async function localClearDownloads() {
|
||||
setDisabled(true);
|
||||
await clearDownloads();
|
||||
setDisabled(false);
|
||||
}
|
||||
|
||||
return <>
|
||||
<Button
|
||||
onClick={localClearDownloads}
|
||||
disabled={disabled}
|
||||
color='yellow'
|
||||
>Clear Completed</Button>
|
||||
</>
|
||||
}
|
||||
|
||||
class DownloadRow extends React.Component {
|
||||
|
||||
render() {
|
||||
|
|
@ -387,14 +405,18 @@ class Downloads extends React.Component {
|
|||
if (this.state.once_downloads !== null && this.state.once_downloads.length === 0) {
|
||||
onceTable = <p>No downloads are scheduled to be downloaded.</p>
|
||||
} else if (this.state.once_downloads !== null) {
|
||||
onceTable = (<Table>
|
||||
{stoppableHeader}
|
||||
<Table.Body>
|
||||
{this.state.once_downloads.map((i) =>
|
||||
<StoppableRow {...i} fetchDownloads={this.fetchDownloads} key={i.id}/>
|
||||
)}
|
||||
</Table.Body>
|
||||
</Table>);
|
||||
onceTable = (
|
||||
<>
|
||||
<ClearCompleteDownloads/>
|
||||
<Table>
|
||||
{stoppableHeader}
|
||||
<Table.Body>
|
||||
{this.state.once_downloads.map((i) =>
|
||||
<StoppableRow {...i} fetchDownloads={this.fetchDownloads} key={i.id}/>
|
||||
)}
|
||||
</Table.Body>
|
||||
</Table>
|
||||
</>);
|
||||
}
|
||||
|
||||
let recurringTable = tablePlaceholder;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue