# HG changeset patch # User Fadi Abbud # Date 1569592192 -7200 # Node ID b4880e7d408206226c106dd6a28e1ca7f7469d9a # Parent e289d3f32b75e941bb322f27fb28bbce08176786 client: ImportOverview: change place of save button diff -r e289d3f32b75 -r b4880e7d4082 client/src/components/importoverview/ImportOverview.vue --- a/client/src/components/importoverview/ImportOverview.vue Fri Sep 27 14:20:42 2019 +0200 +++ b/client/src/components/importoverview/ImportOverview.vue Fri Sep 27 15:49:52 2019 +0200 @@ -4,7 +4,10 @@ icon="clipboard-check" :title="importReviewLabel" :closeCallback="$parent.close" - :actions="[{ callback: loadUpdatedLogs, icon: 'sync' }]" + :actions="[ + { callback: saveImportsView, icon: 'download' }, + { callback: loadUpdatedLogs, icon: 'sync' } + ]" />
@@ -101,16 +104,6 @@ - - Export as CSV -
@@ -184,21 +177,6 @@ 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"); }, @@ -252,6 +230,26 @@ } }, methods: { + saveImportsView() { + let element = document.createElement("a"); + element.setAttribute("download", "log.txt"); + element.setAttribute("href", this.csvLink()); + element.click(); + }, + csvLink() { + 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") + ) + ); + }, showSingleRessource(id) { id = id * 1; this.loadDetails(id)