mirror of
https://github.com/r3-team/r3.git
synced 2025-12-30 07:20:47 -06:00
Fix: CSV export fails if it has sub query with filter
This commit is contained in:
@@ -106,7 +106,7 @@ func Handler(w http.ResponseWriter, r *http.Request) {
|
||||
handler.AbortRequest(w, handler.ContextCsvDownload, err, handler.ErrGeneral)
|
||||
return
|
||||
}
|
||||
var columns []types.Column
|
||||
var columns []types.CsvExportColumn
|
||||
if err := json.Unmarshal([]byte(columnsString), &columns); err != nil {
|
||||
handler.AbortRequest(w, handler.ContextCsvDownload, err, handler.ErrGeneral)
|
||||
return
|
||||
|
||||
8
types/types_csv.go
Normal file
8
types/types_csv.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package types
|
||||
|
||||
import "github.com/gofrs/uuid"
|
||||
|
||||
type CsvExportColumn struct {
|
||||
AttributeId uuid.UUID `json:"attributeId"`
|
||||
Captions CaptionMap `json:"captions"`
|
||||
}
|
||||
@@ -142,6 +142,17 @@ export default {
|
||||
clearInterval(this.cacheDenialTimeout);
|
||||
},
|
||||
computed:{
|
||||
columnsCsv:(s) => {
|
||||
let out = [];
|
||||
for(const c of s.columnsSorted) {
|
||||
// only keep relevant data
|
||||
out.push({
|
||||
attributeId:c.attributeId,
|
||||
captions:c.captions
|
||||
});
|
||||
}
|
||||
return out;
|
||||
},
|
||||
columnsSorted:(s) => {
|
||||
let out = [];
|
||||
for(const b of s.columnBatches) {
|
||||
@@ -161,7 +172,7 @@ export default {
|
||||
`timezone=${encodeURIComponent(s.timezone)}`,
|
||||
`ignore_header=${s.hasHeader ? 'false' : 'true'}`,
|
||||
`relation_id=${s.query.relationId}`,
|
||||
`columns=${encodeURIComponent(JSON.stringify(s.columnsSorted))}`,
|
||||
`columns=${encodeURIComponent(JSON.stringify(s.columnsCsv))}`,
|
||||
`joins=${encodeURIComponent(JSON.stringify(s.joins))}`,
|
||||
`expressions=${encodeURIComponent(JSON.stringify(s.expressions))}`,
|
||||
`filters=${encodeURIComponent(JSON.stringify(s.filters))}`,
|
||||
|
||||
Reference in New Issue
Block a user