Fixing issue #2193, also fixing the name of the file on export, as well as fixing an issue with the exporters not handling relationships.
This commit is contained in:
parent
3f99d7427e
commit
217e5a02bf
|
@ -18,10 +18,12 @@
|
||||||
let exportFormat = FORMATS[0].key
|
let exportFormat = FORMATS[0].key
|
||||||
|
|
||||||
async function exportView() {
|
async function exportView() {
|
||||||
|
const filename = `export.${exportFormat}`
|
||||||
download(
|
download(
|
||||||
`/api/views/export?view=${encodeURIComponent(
|
`/api/views/export?view=${encodeURIComponent(
|
||||||
view
|
view
|
||||||
)}&format=${exportFormat}`
|
)}&format=${exportFormat}`,
|
||||||
|
filename
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,11 @@ exports.csv = function (headers, rows) {
|
||||||
|
|
||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
csv = `${csv}\n${headers
|
csv = `${csv}\n${headers
|
||||||
.map(header => `"${row[header]}"`.trim())
|
.map(header => {
|
||||||
|
let val = row[header]
|
||||||
|
val = typeof val === "object" ? JSON.stringify(val) : val
|
||||||
|
return `"${val}"`.trim()
|
||||||
|
})
|
||||||
.join(",")}`
|
.join(",")}`
|
||||||
}
|
}
|
||||||
return csv
|
return csv
|
||||||
|
|
|
@ -10,7 +10,7 @@ const CouchDB = require("../db")
|
||||||
|
|
||||||
module.exports = async (ctx, next) => {
|
module.exports = async (ctx, next) => {
|
||||||
// try to get the appID from the request
|
// try to get the appID from the request
|
||||||
const requestAppId = getAppId(ctx)
|
let requestAppId = getAppId(ctx)
|
||||||
// get app cookie if it exists
|
// get app cookie if it exists
|
||||||
let appCookie = null
|
let appCookie = null
|
||||||
try {
|
try {
|
||||||
|
@ -29,6 +29,8 @@ module.exports = async (ctx, next) => {
|
||||||
clearCookie(ctx, Cookies.CurrentApp)
|
clearCookie(ctx, Cookies.CurrentApp)
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
// if the request app ID wasn't set, update it with the cookie
|
||||||
|
requestAppId = requestAppId || appId
|
||||||
}
|
}
|
||||||
|
|
||||||
let appId,
|
let appId,
|
||||||
|
|
Loading…
Reference in New Issue