fix: download all query rows before csv export
This commit is contained in:
parent
88ec075d20
commit
e38f3cbd37
1 changed files with 4 additions and 3 deletions
|
@ -30,7 +30,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
|||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) {
|
||||
async sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) {
|
||||
this.queryError = "";
|
||||
if (offset == 0) {
|
||||
this.data = [];
|
||||
|
@ -40,7 +40,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
|||
if (queryToSend == undefined || queryToSend == "" || (typeof queryToSend != "string" && queryToSend.table == ""))
|
||||
return;
|
||||
this.loadingData = "loading";
|
||||
http
|
||||
await http
|
||||
.post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, {
|
||||
query: queryToSend,
|
||||
})
|
||||
|
@ -65,7 +65,8 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
|||
this.queryError = "";
|
||||
this.loadingData = "fetched";
|
||||
},
|
||||
exportData() {
|
||||
async exportData() {
|
||||
await this.sendQuery(0, this.totalLength);
|
||||
if (this.data.length == 0) return;
|
||||
const csvString = [Object.keys(this.data[0]), ...this.data.map((d) => Object.values(d))]
|
||||
.map((e) => e.join(";"))
|
||||
|
|
Loading…
Add table
Reference in a new issue