Skip to content

Commit

Permalink
Added error handling for export row front end and fixed row export ba…
Browse files Browse the repository at this point in the history
…ckend behaviour
  • Loading branch information
deanhannigan committed May 25, 2023
1 parent 504a08f commit f4b5a9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,26 @@
})
download(data, `export.${exportFormat}`)
} else if (filters || sorting) {
const data = await API.exportRows({
tableId: view,
format: exportFormat,
search: {
query: luceneFilter,
sort: sorting?.sortColumn,
sortOrder: sorting?.sortOrder,
paginate: false,
},
})
download(data, `export.${exportFormat}`)
let response
try {
response = await API.exportRows({
tableId: view,
format: exportFormat,
search: {
query: luceneFilter,
sort: sorting?.sortColumn,
sortOrder: sorting?.sortOrder,
paginate: false,
},
})
} catch (e) {
console.error("Failed to export", e)
notifications.error("Export Failed")
}
if (response) {
download(response, `export.${exportFormat}`)
notifications.success("Export Successful")
}
} else {
await exportView()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/api/controllers/row/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export async function exportRows(ctx: UserCtx) {

result = await outputProcessing(table, response)
} else if (query) {
let searchResponse = await exports.search(ctx)
let searchResponse = await search(ctx)
result = searchResponse.rows
}

Expand Down

0 comments on commit f4b5a9d

Please sign in to comment.