Commit 3e81ad68 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

dynamically build name based on filters

parent f9aca3b8
Pipeline #32807 passed with stages
in 3 minutes and 36 seconds
...@@ -142,6 +142,26 @@ export default { ...@@ -142,6 +142,26 @@ export default {
return 'right'; return 'right';
} }
return 'left'; return 'left';
},
fileName() {
if (this.searchGeneName) {
return this.searchGeneName;
}
var basename = "metagenedb";
if (this.geneSource && this.geneSource != 'all') {
basename = `${basename}_${this.geneSource}`;
}
if (this.filterGeneLength) {
basename = `${basename}_${this.geneLengthFilterRange[0]}bp-${this.geneLengthFilterRange[1]}bp`;
}
if (this.functionID){
basename = `${basename}_function-${this.functionID}`;
}
if (this.taxChoice) {
var taxName = this.taxChoice.replace(/ /g,"_");
basename = `${basename}_${this.taxLevel}-${taxName}`;
}
return basename;
} }
}, },
mounted() { mounted() {
...@@ -226,7 +246,7 @@ export default { ...@@ -226,7 +246,7 @@ export default {
}) })
.then((response) => { .then((response) => {
this.downloadFastaReady = true; this.downloadFastaReady = true;
this.forceFileDownload(response, 'metagenedb_sequences.fasta'); this.forceFileDownload(response, `${this.fileName}.fasta`);
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
...@@ -248,7 +268,7 @@ export default { ...@@ -248,7 +268,7 @@ export default {
}) })
.then((response) => { .then((response) => {
this.downloadCSVReady = true; this.downloadCSVReady = true;
this.forceFileDownload(response, 'metagenedb_metadata.csv'); this.forceFileDownload(response, `${this.fileName}.csv`);
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment