Mercurial > gemma
changeset 4491:e3d436052b7c
import: export as CSV
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Fri, 27 Sep 2019 14:09:21 +0200 |
parents | f91e46134cd7 |
children | e289d3f32b75 |
files | client/src/components/importoverview/ImportOverview.vue |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importoverview/ImportOverview.vue Fri Sep 27 12:09:22 2019 +0200 +++ b/client/src/components/importoverview/ImportOverview.vue Fri Sep 27 14:09:21 2019 +0200 @@ -101,6 +101,16 @@ <LogDetail :entry="entry"></LogDetail> </template> </UITableBody> + <a + :class="[ + 'btn btn-xs btn-info d-block mt-2', + { disabled: !imports.length } + ]" + :href="importsCSV" + download="log.txt" + > + <translate class="text-white">Export as CSV</translate> + </a> </div> </div> </template> @@ -174,6 +184,21 @@ countryLabel() { return this.$gettext("Country"); }, + importsCSV() { + if (!this.imports.length) return; + return ( + "data:text/csv;charset=utf-8," + + encodeURIComponent( + this.imports + .map(el => { + return ` ${el.id}, ${el.kind}, ${el.enqueued}, ${el.user}, ${ + el.country + }, ${el.signer}, ${el.state}, ${el.warnings}`; + }) + .join("\n") + ) + ); + }, importReviewLabel() { return this.$gettext("Import review"); },