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";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) {
|
async sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) {
|
||||||
this.queryError = "";
|
this.queryError = "";
|
||||||
if (offset == 0) {
|
if (offset == 0) {
|
||||||
this.data = [];
|
this.data = [];
|
||||||
|
@ -40,7 +40,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
||||||
if (queryToSend == undefined || queryToSend == "" || (typeof queryToSend != "string" && queryToSend.table == ""))
|
if (queryToSend == undefined || queryToSend == "" || (typeof queryToSend != "string" && queryToSend.table == ""))
|
||||||
return;
|
return;
|
||||||
this.loadingData = "loading";
|
this.loadingData = "loading";
|
||||||
http
|
await http
|
||||||
.post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, {
|
.post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, {
|
||||||
query: queryToSend,
|
query: queryToSend,
|
||||||
})
|
})
|
||||||
|
@ -65,7 +65,8 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
||||||
this.queryError = "";
|
this.queryError = "";
|
||||||
this.loadingData = "fetched";
|
this.loadingData = "fetched";
|
||||||
},
|
},
|
||||||
exportData() {
|
async exportData() {
|
||||||
|
await this.sendQuery(0, this.totalLength);
|
||||||
if (this.data.length == 0) return;
|
if (this.data.length == 0) return;
|
||||||
const csvString = [Object.keys(this.data[0]), ...this.data.map((d) => Object.values(d))]
|
const csvString = [Object.keys(this.data[0]), ...this.data.map((d) => Object.values(d))]
|
||||||
.map((e) => e.join(";"))
|
.map((e) => e.join(";"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue