diff --git a/app/src/api.js b/app/src/api.js
index 6b819ebe..7040a635 100644
--- a/app/src/api.js
+++ b/app/src/api.js
@@ -411,7 +411,7 @@ export async function getArchive(archiveId) {
}
}
-export async function postDownload(urls, downloader, frequency, sub_downloader, excludedURLs, destination) {
+export async function postDownload(urls, downloader, frequency, sub_downloader, excludedURLs, destination, tagNames) {
if (!downloader) {
toast({
type: 'error',
@@ -432,6 +432,9 @@ export async function postDownload(urls, downloader, frequency, sub_downloader,
if (sub_downloader) {
body['sub_downloader'] = sub_downloader;
}
+ if (tagNames) {
+ body['tag_names'] = tagNames;
+ }
let response = await apiPost(`${API_URI}/download`, body);
return response;
}
diff --git a/app/src/components/Download.js b/app/src/components/Download.js
index be7cc7ec..e884547f 100644
--- a/app/src/components/Download.js
+++ b/app/src/components/Download.js
@@ -28,11 +28,11 @@ class Downloader extends React.Component {
}
submitDownload = async () => {
- let {urls, downloader, destination} = this.state;
+ let {urls, downloader, destination, tagNames} = this.state;
if (urls) {
this.setState({pending: true, submitted: false});
try {
- let response = await postDownload(urls, downloader, null, null, null, destination);
+ let response = await postDownload(urls, downloader, null, null, null, destination, tagNames);
if (response.status === 204) {
this.setState({urls: '', pending: false, submitted: true});
}
@@ -72,7 +72,6 @@ class Downloader extends React.Component {
}
handleSelectedTags = (tagNames) => {
- console.log(tagNames);
this.setState({tagNames});
}
@@ -87,7 +86,29 @@ class Downloader extends React.Component {
render() {
let disabled = !this.state.urls || !this.state.valid || this.state.pending || !this.state.downloader;
const {advancedOpen, destination, submitted, tagNames} = this.state;
- const {header, withDestination} = this.props;
+ const {header, withDestination, withTags} = this.props;
+
+ let destinationField;
+ if (withDestination) {
+ destinationField =
+
+
+
+
+ ;
+ }
+
+ let tagsSelector;
+ if (withTags) {
+ tagsSelector =
+
+ ;
+ }
const advancedAccordion =
this.setState({advancedOpen: !advancedOpen})}>
@@ -95,21 +116,9 @@ class Downloader extends React.Component {
-
-
-
-
-
-
-
-
-
-
+ {destinationField}
+ {withDestination && withTags &&
}
+ {tagsSelector}
;
@@ -126,7 +135,7 @@ class Downloader extends React.Component {
onChange={this.handleInputChange}
value={this.state.urls}
/>
- {withDestination && advancedAccordion}
+ {(withDestination || withTags) && advancedAccordion}