change: query builder fetch all on download

This commit is contained in:
Julian Krauser 2025-02-16 13:32:20 +01:00
parent 4b8d25435b
commit 4821be0c8c

View file

@ -30,7 +30,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
this.loading = "failed";
});
},
async sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) {
async sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string, noLimit: boolean = false) {
this.queryError = "";
if (offset == 0) {
this.data = [];
@ -41,7 +41,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
return;
this.loadingData = "loading";
await http
.post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, {
.post(`/admin/querybuilder/query?` + (noLimit ? `noLimit=true` : `offset=${offset}&count=${count}`), {
query: queryToSend,
})
.then((result) => {
@ -66,7 +66,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
this.loadingData = "fetched";
},
async exportData() {
await this.sendQuery(0, this.totalLength);
await this.sendQuery(0, 0, undefined, true);
if (this.data.length == 0) return;
const csvString = [Object.keys(this.data[0]), ...this.data.map((d) => Object.values(d))]
.map((e) => e.join(";"))