Merge branch 'develop' into milestone/ff-admin-unit
This commit is contained in:
commit
4ebacc5f52
107 changed files with 4980 additions and 1739 deletions
|
@ -87,6 +87,9 @@ export const useMemberStore = defineStore("member", {
|
|||
})
|
||||
.catch((err) => {});
|
||||
},
|
||||
fetchLastInternalId() {
|
||||
return http.get(`/admin/member/last/internalId`);
|
||||
},
|
||||
async printMemberByActiveId() {
|
||||
return http.get(`/admin/member/${this.activeMember}/print`, {
|
||||
responseType: "blob",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http, newEventSource, streamingFetch } from "@/serverCom";
|
||||
import { http, streamingFetch } from "@/serverCom";
|
||||
import { useNewsletterStore } from "./newsletter";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { EventSourcePolyfill } from "event-source-polyfill";
|
||||
import { useNotificationStore, type NotificationType } from "../../../notification";
|
||||
import { useNotificationStore, type NotificationType } from "@/stores/notification";
|
||||
|
||||
export const useNewsletterPrintoutStore = defineStore("newsletterPrintout", {
|
||||
state: () => {
|
||||
|
|
|
@ -2,6 +2,7 @@ import { defineStore } from "pinia";
|
|||
import { http } from "@/serverCom";
|
||||
import type { TableMeta } from "@/viewmodels/admin/configuration/query.models";
|
||||
import type { DynamicQueryStructure, FieldType } from "@/types/dynamicQueries";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const useQueryBuilderStore = defineStore("queryBuilder", {
|
||||
state: () => {
|
||||
|
@ -58,6 +59,16 @@ export const useQueryBuilderStore = defineStore("queryBuilder", {
|
|||
this.loadingData = "failed";
|
||||
});
|
||||
},
|
||||
async sendQueryByStoreId(
|
||||
id: string,
|
||||
offset = 0,
|
||||
count = 25,
|
||||
noLimit: boolean = false
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
return await http.post(
|
||||
`/admin/querybuilder/query/${id}?` + (noLimit ? `noLimit=true` : `offset=${offset}&count=${count}`)
|
||||
);
|
||||
},
|
||||
clearResults() {
|
||||
this.data = [];
|
||||
this.totalLength = 0;
|
||||
|
|
|
@ -6,7 +6,7 @@ import type {
|
|||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const useNewsletterConfigStore = defineStore("newsletterConfi", {
|
||||
export const useNewsletterConfigStore = defineStore("newsletterConfig", {
|
||||
state: () => {
|
||||
return {
|
||||
config: [] as Array<NewsletterConfigViewModel>,
|
||||
|
|
|
@ -6,10 +6,10 @@ import type {
|
|||
} from "@/viewmodels/admin/configuration/query.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { useQueryBuilderStore } from "../club/queryBuilder";
|
||||
import { useModalStore } from "../../modal";
|
||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import { defineAsyncComponent, markRaw } from "vue";
|
||||
import { useAbilityStore } from "../../ability";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
|
||||
export const useQueryStoreStore = defineStore("queryStore", {
|
||||
state: () => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse, AxiosProgressEvent } from "axios";
|
||||
import type { BackupRestoreViewModel } from "../../../viewmodels/admin/management/backup.models";
|
||||
import type { BackupRestoreViewModel } from "@/viewmodels/admin/management/backup.models";
|
||||
|
||||
export const useBackupStore = defineStore("backup", {
|
||||
state: () => {
|
||||
|
|
103
src/stores/admin/management/setting.ts
Normal file
103
src/stores/admin/management/setting.ts
Normal file
|
@ -0,0 +1,103 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { SettingString, SettingTopic, SettingValueMapping } from "@/types/settingTypes";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const useSettingStore = defineStore("setting", {
|
||||
state: () => {
|
||||
return {
|
||||
settings: {} as { [key in SettingString]: SettingValueMapping[key] },
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
getters: {
|
||||
readSetting:
|
||||
(state) =>
|
||||
<K extends SettingString>(key: K): SettingValueMapping[K] => {
|
||||
return state.settings[key];
|
||||
},
|
||||
readByTopic:
|
||||
(state) =>
|
||||
<T extends SettingTopic>(
|
||||
topic: T
|
||||
): { [K in SettingString as K extends `${T}.${string}` ? K : never]: SettingValueMapping[K] } => {
|
||||
return Object.entries(state.settings).reduce((acc, [key, value]) => {
|
||||
const typedKey = key as SettingString;
|
||||
if (key.startsWith(topic)) {
|
||||
acc[typedKey] = value;
|
||||
}
|
||||
return acc;
|
||||
}, {} as any);
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
fetchSettings() {
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get("/admin/setting")
|
||||
.then((result) => {
|
||||
this.settings = result.data;
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
async getSetting(key: SettingString): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/setting/${key}`).then((res) => {
|
||||
//@ts-expect-error
|
||||
this.settings[key] = res.data;
|
||||
return res;
|
||||
});
|
||||
},
|
||||
async updateSetting<K extends SettingString>(
|
||||
key: K,
|
||||
value: SettingValueMapping[K]
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.put("/admin/setting", {
|
||||
setting: key,
|
||||
value: value,
|
||||
})
|
||||
.then((res) => {
|
||||
this.settings[key] = value;
|
||||
return res;
|
||||
});
|
||||
},
|
||||
async updateSettings<K extends SettingString>(
|
||||
data: { key: K; value: SettingValueMapping[K] }[]
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
return await http.put("/admin/setting/multi", data).then((res) => {
|
||||
for (const element of data) {
|
||||
this.settings[element.key] = element.value;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
},
|
||||
async uploadImage(
|
||||
data: { key: "club.logo" | "club.icon"; value?: File | "keep" }[]
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const formData = new FormData();
|
||||
for (let entry of data) {
|
||||
if (entry.value) {
|
||||
formData.append(typeof entry.value == "string" ? entry.key : entry.key.split(".")[1], entry.value);
|
||||
}
|
||||
}
|
||||
return await http
|
||||
.put("/admin/setting/images", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
for (const element of data) {
|
||||
this.settings[element.key] = element.value ? "configured" : "";
|
||||
}
|
||||
return res;
|
||||
});
|
||||
},
|
||||
async resetSetting(key: SettingString): Promise<AxiosResponse<any, any>> {
|
||||
return await http.delete(`/admin/setting/${key}`);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import router from "@/router";
|
||||
import type { PermissionSection } from "../../types/permissionTypes";
|
||||
import type { PermissionSection } from "@/types/permissionTypes";
|
||||
|
||||
export type navigationModel = {
|
||||
[key in topLevelNavigationType]: navigationSplitModel;
|
||||
|
@ -146,6 +146,7 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
...(abilityStore.can("read", "management", "user") ? [{ key: "user", title: "Benutzer" }] : []),
|
||||
...(abilityStore.can("read", "management", "role") ? [{ key: "role", title: "Rollen" }] : []),
|
||||
...(abilityStore.can("read", "management", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []),
|
||||
...(abilityStore.can("read", "management", "setting") ? [{ key: "setting", title: "Einstellungen" }] : []),
|
||||
...(abilityStore.can("read", "management", "backup") ? [{ key: "backup", title: "Backups" }] : []),
|
||||
...(abilityStore.isAdmin() ? [{ key: "version", title: "Version" }] : []),
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue