mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 12:56:24 -05:00
Forcing downloader selection. Adding link to downloads page near global Download button.
This commit is contained in:
parent
f9dd056cc9
commit
2314c3462f
2 changed files with 8 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ import React from "react";
|
|||
import {Button, Dropdown, Form, Header, Segment, TextArea} from "semantic-ui-react";
|
||||
import {getDownloaders, postDownload} from "../api";
|
||||
import {WROLModeMessage} from "./Common";
|
||||
import {Link} from "react-router-dom";
|
||||
|
||||
const validUrl = /^(http|https):\/\/[^ "]+$/;
|
||||
|
||||
|
|
@ -64,7 +65,7 @@ class Downloader extends React.Component {
|
|||
|
||||
render() {
|
||||
let textareaPlaceholder = 'Enter one URL per line';
|
||||
let disabled = !this.state.urls || !this.state.valid || this.state.pending;
|
||||
let disabled = !this.state.urls || !this.state.valid || this.state.pending || !this.state.downloader;
|
||||
|
||||
return (
|
||||
<Form onSubmit={this.submitDownload}>
|
||||
|
|
@ -80,15 +81,15 @@ class Downloader extends React.Component {
|
|||
/>
|
||||
</Form.Field>
|
||||
<Form.Field>
|
||||
<Dropdown
|
||||
selection
|
||||
name='downloader'
|
||||
options={this.state.downloaders}
|
||||
placeholder='Automatic'
|
||||
onChange={this.handleInputChange}
|
||||
<Dropdown selection
|
||||
name='downloader'
|
||||
options={this.state.downloaders}
|
||||
placeholder='Select a downloader'
|
||||
onChange={this.handleInputChange}
|
||||
/>
|
||||
</Form.Field>
|
||||
<Button primary style={{marginTop: '1em'}} disabled={disabled}>Download</Button>
|
||||
<Link to={'/admin'}>View Downloads</Link>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ async def delete_download(_: Request, download_id: int):
|
|||
@openapi.description('List all Downloaders that can be specified by the user.')
|
||||
async def get_downloaders(_: Request):
|
||||
downloaders = download_manager.list_downloaders()
|
||||
downloaders.insert(0, dict(name='auto', pretty_name='Automatic'))
|
||||
disabled = download_manager.disabled.is_set()
|
||||
ret = dict(downloaders=downloaders, manager_disabled=disabled)
|
||||
return json_response(ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue