Skip to content

Commit

Permalink
fix: use the title directly instead of passing complete objects
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian Steffens committed Sep 15, 2023
1 parent d5cfcc4 commit 630a6e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/main/sections/MainWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
emit('tables:column:create')
},
downloadCSV() {
this.downloadCsv(this.rows, this.columns, this.element)
this.downloadCsv(this.rows, this.columns, this.element.title)
},
toggleShare() {
emit('tables:sidebar:sharing', { open: true, tab: 'sharing' })
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/ncTable/NcTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ deselect-all-rows -> unselect all rows, e.g. after deleting selected rows
:view-setting.sync="localViewSetting"
:config="config"
@create-row="$emit('create-row')"
@download-csv="data => downloadCsv(data, parsedColumns, table)"
@download-csv="data => downloadCsv(data, parsedColumns, downloadTitle)"
@set-search-string="str => setSearchString(str)"
@delete-selected-rows="rowIds => $emit('delete-selected-rows', rowIds)" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/ncTable/mixins/exportTableMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {

methods: {

downloadCsv(rows, columns, table) {
downloadCsv(rows, columns, fileName) {
if (!rows || rows.length === 0) {
console.debug('downloadCSV has empty parameter, expected array ob row objects', rows)
}
Expand All @@ -25,7 +25,7 @@ export default {
const csv = this.$papa.unparse(data)

// remove smileys from title
const tableTitle = table.title.replace(/([#0-9]\u20E3)|[\xA9\xAE\u203C\u2047-\u2049\u2122\u2139\u3030\u303D\u3297\u3299][\uFE00-\uFEFF]?|[\u2190-\u21FF][\uFE00-\uFEFF]?|[\u2300-\u23FF][\uFE00-\uFEFF]?|[\u2460-\u24FF][\uFE00-\uFEFF]?|[\u25A0-\u25FF][\uFE00-\uFEFF]?|[\u2600-\u27BF][\uFE00-\uFEFF]?|[\u2900-\u297F][\uFE00-\uFEFF]?|[\u2B00-\u2BF0][\uFE00-\uFEFF]?|(?:\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDEFF])[\uFE00-\uFEFF]?/g, '')
const tableTitle = fileName.replace(/([#0-9]\u20E3)|[\xA9\xAE\u203C\u2047-\u2049\u2122\u2139\u3030\u303D\u3297\u3299][\uFE00-\uFEFF]?|[\u2190-\u21FF][\uFE00-\uFEFF]?|[\u2300-\u23FF][\uFE00-\uFEFF]?|[\u2460-\u24FF][\uFE00-\uFEFF]?|[\u25A0-\u25FF][\uFE00-\uFEFF]?|[\u2600-\u27BF][\uFE00-\uFEFF]?|[\u2900-\u297F][\uFE00-\uFEFF]?|[\u2B00-\u2BF0][\uFE00-\uFEFF]?|(?:\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDEFF])[\uFE00-\uFEFF]?/g, '')
this.$papa.download(csv, moment().format('YY-MM-DD_HH-mm') + '_' + tableTitle)
},
},
Expand Down

0 comments on commit 630a6e3

Please sign in to comment.