mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Displaying downloads link when user submits download.
This commit is contained in:
parent
46cf28dee8
commit
0689c03866
2 changed files with 47 additions and 17 deletions
|
|
@ -180,9 +180,18 @@ class StoppableRow extends React.Component {
|
|||
stopOpen: false,
|
||||
startOpen: false,
|
||||
errorModalOpen: false,
|
||||
deleteOpen: false,
|
||||
};
|
||||
}
|
||||
|
||||
openDelete = () => {
|
||||
this.setState({deleteOpen: true});
|
||||
}
|
||||
|
||||
closeDelete = () => {
|
||||
this.setState({deleteOpen: false});
|
||||
}
|
||||
|
||||
openStop = () => {
|
||||
this.setState({stopOpen: true});
|
||||
}
|
||||
|
|
@ -199,6 +208,13 @@ class StoppableRow extends React.Component {
|
|||
this.setState({startOpen: false});
|
||||
}
|
||||
|
||||
handleDelete = async (e) => {
|
||||
e.preventDefault();
|
||||
await deleteDownload(this.props.id);
|
||||
this.closeDelete();
|
||||
await this.props.fetchDownloads();
|
||||
};
|
||||
|
||||
handleStop = async (e) => {
|
||||
e.preventDefault();
|
||||
await killDownload(this.props.id);
|
||||
|
|
@ -216,7 +232,7 @@ class StoppableRow extends React.Component {
|
|||
|
||||
render() {
|
||||
let {url, last_successful_download, status, location, error} = this.props;
|
||||
let {stopOpen, startOpen, errorModalOpen} = this.state;
|
||||
let {stopOpen, startOpen, errorModalOpen, deleteOpen} = this.state;
|
||||
|
||||
const link = location ?
|
||||
(text) => <Link to={location}>{text}</Link> :
|
||||
|
|
@ -243,21 +259,15 @@ class StoppableRow extends React.Component {
|
|||
} else if (status === 'failed' || status === 'deferred') {
|
||||
buttonCell = (
|
||||
<TableCell>
|
||||
<Button
|
||||
onClick={this.openStop}
|
||||
color='red'
|
||||
>Stop</Button>
|
||||
<Button icon='trash' onClick={this.openDelete} color='red'/>
|
||||
<Confirm
|
||||
open={stopOpen}
|
||||
content='Are you sure you want to stop this download? It will not be retried.'
|
||||
confirmButton='Stop'
|
||||
onCancel={this.closeStop}
|
||||
onConfirm={this.handleStop}
|
||||
open={deleteOpen}
|
||||
content='Are you sure you want to delete this download?'
|
||||
confirmButton='Delete'
|
||||
onCancel={this.closeDelete}
|
||||
onConfirm={this.handleDelete}
|
||||
/>
|
||||
<Button
|
||||
onClick={this.openStart}
|
||||
color='green'
|
||||
>Retry</Button>
|
||||
<Button onClick={this.openStart} color='green'>Retry</Button>
|
||||
<Confirm
|
||||
open={startOpen}
|
||||
content='Are you sure you want to restart this download?'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue