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"; 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 = ""; this.queryError = "";
if (offset == 0) { if (offset == 0) {
this.data = []; this.data = [];
@ -41,7 +41,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
return; return;
this.loadingData = "loading"; this.loadingData = "loading";
await http await http
.post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, { .post(`/admin/querybuilder/query?` + (noLimit ? `noLimit=true` : `offset=${offset}&count=${count}`), {
query: queryToSend, query: queryToSend,
}) })
.then((result) => { .then((result) => {
@ -66,7 +66,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
this.loadingData = "fetched"; this.loadingData = "fetched";
}, },
async exportData() { async exportData() {
await this.sendQuery(0, this.totalLength); await this.sendQuery(0, 0, undefined, true);
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(";"))