Forcing downloader selection. Adding link to downloads page near global Download button.

This commit is contained in:
Roland 2022-05-10 22:53:33 -06:00
parent f9dd056cc9
commit 2314c3462f
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 8 additions and 8 deletions

View file

@ -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>
)
}

View file

@ -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)