Merge pull request 'feature/#31-backup-&-import' (#56) from feature/#31-backup-&-import into develop
Reviewed-on: #56
This commit is contained in:
commit
b436678393
37 changed files with 813 additions and 106 deletions
81
package-lock.json
generated
81
package-lock.json
generated
|
@ -17,7 +17,7 @@
|
||||||
"@headlessui/vue": "^1.7.13",
|
"@headlessui/vue": "^1.7.13",
|
||||||
"@heroicons/vue": "^2.1.5",
|
"@heroicons/vue": "^2.1.5",
|
||||||
"@vueup/vue-quill": "^1.2.0",
|
"@vueup/vue-quill": "^1.2.0",
|
||||||
"axios": "^0.26.1",
|
"axios": "^1.7.9",
|
||||||
"event-source-polyfill": "^1.0.31",
|
"event-source-polyfill": "^1.0.31",
|
||||||
"grapesjs": "^0.22.4",
|
"grapesjs": "^0.22.4",
|
||||||
"grapesjs-preset-newsletter": "^1.0.2",
|
"grapesjs-preset-newsletter": "^1.0.2",
|
||||||
|
@ -3951,6 +3951,12 @@
|
||||||
"integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
|
"integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/asynckit": {
|
||||||
|
"version": "0.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||||
|
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/at-least-node": {
|
"node_modules/at-least-node": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||||
|
@ -4013,11 +4019,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "0.26.1",
|
"version": "1.7.9",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
||||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.14.8"
|
"follow-redirects": "^1.15.6",
|
||||||
|
"form-data": "^4.0.0",
|
||||||
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/b4a": {
|
"node_modules/b4a": {
|
||||||
|
@ -4515,6 +4524,18 @@
|
||||||
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
|
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/combined-stream": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"delayed-stream": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/commander": {
|
"node_modules/commander": {
|
||||||
"version": "2.20.3",
|
"version": "2.20.3",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||||
|
@ -4875,6 +4896,15 @@
|
||||||
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
|
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/delayed-stream": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/detect-libc": {
|
"node_modules/detect-libc": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",
|
||||||
|
@ -5714,6 +5744,20 @@
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/form-data": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"asynckit": "^0.4.0",
|
||||||
|
"combined-stream": "^1.0.8",
|
||||||
|
"mime-types": "^2.1.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fraction.js": {
|
"node_modules/fraction.js": {
|
||||||
"version": "4.3.7",
|
"version": "4.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
||||||
|
@ -7172,6 +7216,27 @@
|
||||||
"node": ">=8.6"
|
"node": ">=8.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/mimic-response": {
|
"node_modules/mimic-response": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||||
|
@ -8115,6 +8180,12 @@
|
||||||
"integrity": "sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==",
|
"integrity": "sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/proxy-from-env": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/pump": {
|
"node_modules/pump": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
"@headlessui/vue": "^1.7.13",
|
"@headlessui/vue": "^1.7.13",
|
||||||
"@heroicons/vue": "^2.1.5",
|
"@heroicons/vue": "^2.1.5",
|
||||||
"@vueup/vue-quill": "^1.2.0",
|
"@vueup/vue-quill": "^1.2.0",
|
||||||
"axios": "^0.26.1",
|
"axios": "^1.7.9",
|
||||||
"event-source-polyfill": "^1.0.31",
|
"event-source-polyfill": "^1.0.31",
|
||||||
"grapesjs": "^0.22.4",
|
"grapesjs": "^0.22.4",
|
||||||
"grapesjs-preset-newsletter": "^1.0.2",
|
"grapesjs-preset-newsletter": "^1.0.2",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="grow flex flex-col gap-2 overflow-hidden">
|
<div class="grow flex flex-col gap-2 overflow-hidden">
|
||||||
<div v-if="useSearch" class="relative self-end flex flex-row items-center gap-2">
|
<div v-if="useSearch" class="relative self-end flex flex-row items-center gap-2">
|
||||||
<Spinner v-if="deferingSearch" />
|
<Spinner v-if="deferingSearch" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="!max-w-64 !w-64 rounded-md shadow-sm relative block px-3 py-2 pr-5 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
|
class="!max-w-64 !w-64 rounded-md shadow-sm relative block px-3 py-2 pr-5 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm"
|
||||||
|
@ -82,27 +82,30 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const slots = defineSlots<{
|
const slots = defineSlots<{
|
||||||
pageRow(props: { row: T }): void;
|
pageRow(props: { row: T; key: number }): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const timer = ref(undefined) as undefined | any;
|
const timer = ref(undefined) as undefined | any;
|
||||||
const currentPage = ref(0);
|
const currentPage = ref(0);
|
||||||
const searchString = ref("");
|
const searchString = ref("");
|
||||||
const deferingSearch = ref(false)
|
const deferingSearch = ref(false);
|
||||||
|
|
||||||
watch(searchString, async () => {
|
watch(searchString, async () => {
|
||||||
deferingSearch.value = true
|
deferingSearch.value = true;
|
||||||
clearTimeout(timer.value);
|
clearTimeout(timer.value);
|
||||||
timer.value = setTimeout(() => {
|
timer.value = setTimeout(() => {
|
||||||
currentPage.value = 0;
|
currentPage.value = 0;
|
||||||
deferingSearch.value = false
|
deferingSearch.value = false;
|
||||||
emit("search", searchString.value);
|
emit("search", searchString.value);
|
||||||
}, 600);
|
}, 600);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => props.totalCount, async () => {
|
watch(
|
||||||
currentPage.value = 0;
|
() => props.totalCount,
|
||||||
});
|
async () => {
|
||||||
|
currentPage.value = 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const emit = defineEmits({
|
const emit = defineEmits({
|
||||||
submit(id: number) {
|
submit(id: number) {
|
||||||
|
@ -159,7 +162,7 @@ const loadPage = (newPage: number | ".") => {
|
||||||
if (pageEnd > entryCount.value) pageEnd = entryCount.value;
|
if (pageEnd > entryCount.value) pageEnd = entryCount.value;
|
||||||
|
|
||||||
let loadedElementCount = filterData(props.items, searchString.value, pageStart, pageEnd).length;
|
let loadedElementCount = filterData(props.items, searchString.value, pageStart, pageEnd).length;
|
||||||
|
|
||||||
if (loadedElementCount < props.maxEntriesPerPage && (pageEnd != props.totalCount || loadedElementCount == 0))
|
if (loadedElementCount < props.maxEntriesPerPage && (pageEnd != props.totalCount || loadedElementCount == 0))
|
||||||
emit("loadData", pageStart, props.maxEntriesPerPage, searchString.value);
|
emit("loadData", pageStart, props.maxEntriesPerPage, searchString.value);
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ import Spinner from "../Spinner.vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array as PropType<Array<number>>,
|
type: Array as PropType<Array<string>>,
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
title: String,
|
title: String,
|
||||||
|
@ -133,7 +133,7 @@ export default defineComponent({
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set(val: Array<number>) {
|
set(val: Array<string>) {
|
||||||
this.$emit("update:model-value", val);
|
this.$emit("update:model-value", val);
|
||||||
if (this.modelValue.length < val.length) {
|
if (this.modelValue.length < val.length) {
|
||||||
let diff = difference(val, this.modelValue);
|
let diff = difference(val, this.modelValue);
|
||||||
|
@ -166,7 +166,7 @@ export default defineComponent({
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getMemberFromSearch(id: number) {
|
getMemberFromSearch(id: string) {
|
||||||
return this.filtered.find((f) => f.id == id);
|
return this.filtered.find((f) => f.id == id);
|
||||||
},
|
},
|
||||||
loadMembersInitial() {
|
loadMembersInitial() {
|
||||||
|
|
|
@ -178,12 +178,12 @@ export default defineComponent({
|
||||||
if (!this.permissionUpdate[section]) {
|
if (!this.permissionUpdate[section]) {
|
||||||
this.permissionUpdate[section] = {};
|
this.permissionUpdate[section] = {};
|
||||||
}
|
}
|
||||||
this.permissionUpdate[section].all = permissions;
|
this.permissionUpdate[section]!.all = permissions;
|
||||||
} else {
|
} else {
|
||||||
if (!this.permissionUpdate[section]) {
|
if (!this.permissionUpdate[section]) {
|
||||||
this.permissionUpdate[section] = {};
|
this.permissionUpdate[section] = {};
|
||||||
}
|
}
|
||||||
this.permissionUpdate[section][modul] = permissions;
|
this.permissionUpdate[section]![modul] = permissions;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
reset() {
|
reset() {
|
||||||
|
|
58
src/components/admin/user/backup/BackupListItem.vue
Normal file
58
src/components/admin/user/backup/BackupListItem.vue
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||||
|
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||||
|
<p>{{ backup }}</p>
|
||||||
|
<div class="flex flex-row">
|
||||||
|
<div @click="downloadBackup">
|
||||||
|
<ArrowDownTrayIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||||
|
</div>
|
||||||
|
<div v-if="can('admin', 'user', 'backup')" @click="openRestoreModal">
|
||||||
|
<BarsArrowUpIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent, defineAsyncComponent, markRaw, type PropType } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { ArchiveBoxArrowDownIcon, ArrowDownTrayIcon, BarsArrowUpIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import { useBackupStore } from "../../../../stores/admin/user/backup";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
props: {
|
||||||
|
backup: { type: String, default: "" },
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useAbilityStore, ["can"]),
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
...mapActions(useBackupStore, ["fetchBackupById"]),
|
||||||
|
openRestoreModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/RestoreBackupModal.vue"))),
|
||||||
|
this.backup
|
||||||
|
);
|
||||||
|
},
|
||||||
|
downloadBackup() {
|
||||||
|
this.fetchBackupById(this.backup)
|
||||||
|
.then((response) => {
|
||||||
|
const fileURL = window.URL.createObjectURL(new Blob([JSON.stringify(response.data, null, 2)]));
|
||||||
|
const fileLink = document.createElement("a");
|
||||||
|
fileLink.href = fileURL;
|
||||||
|
fileLink.setAttribute("download", this.backup);
|
||||||
|
document.body.appendChild(fileLink);
|
||||||
|
fileLink.click();
|
||||||
|
fileLink.remove();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
67
src/components/admin/user/backup/CreateBackupModal.vue
Normal file
67
src/components/admin/user/backup/CreateBackupModal.vue
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<template>
|
||||||
|
<div class="w-full md:max-w-md">
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
<p class="text-xl font-medium">Backup erstellen</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<form class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreateBackup">
|
||||||
|
<div class="flex flex-row gap-2">
|
||||||
|
<button primary type="submit" :disabled="status == 'loading' || status?.status == 'success'">erstellen</button>
|
||||||
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-end">
|
||||||
|
<div class="flex flex-row gap-4 py-2">
|
||||||
|
<button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
|
||||||
|
abbrechen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import Spinner from "@/components/Spinner.vue";
|
||||||
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
|
timeout: undefined as any,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["closeModal"]),
|
||||||
|
...mapActions(useBackupStore, ["triggerBackupCreate"]),
|
||||||
|
triggerCreateBackup(e: any) {
|
||||||
|
this.status = "loading";
|
||||||
|
this.triggerBackupCreate()
|
||||||
|
.then(() => {
|
||||||
|
this.status = { status: "success" };
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.closeModal();
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.status = { status: "failed" };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
107
src/components/admin/user/backup/RestoreBackupModal.vue
Normal file
107
src/components/admin/user/backup/RestoreBackupModal.vue
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
<template>
|
||||||
|
<div class="w-full md:max-w-md">
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
<p class="text-xl font-medium">Backup {{ data }} laden</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<form class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreateBackup">
|
||||||
|
<div class="flex flex-row items-center gap-2">
|
||||||
|
<input type="checkbox" id="partial" v-model="partial" />
|
||||||
|
<label for="partial">Backup vollständig laden</label>
|
||||||
|
</div>
|
||||||
|
<div v-if="!partial">
|
||||||
|
<label for="sections">Module zur Wiederherstellung auswählen:</label>
|
||||||
|
<select id="sections" multiple>
|
||||||
|
<option v-for="section in backupSections" :value="section">{{ section }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div v-if="!partial" class="flex flex-row items-center gap-2">
|
||||||
|
<input type="checkbox" id="overwrite" checked />
|
||||||
|
<label for="overwrite">Daten entfernen und importieren</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<p class="flex">
|
||||||
|
<InformationCircleIcon class="min-h-5 h-5 min-w-5 w-5" />Je nach Auswahl, werden die entsprechenden
|
||||||
|
Bestandsdaten ersetzt. Dadurch können Daten, die seit diesem Backup erstellt wurden, verloren gehen.
|
||||||
|
</p>
|
||||||
|
<p class="flex">Das Laden eines vollständigen Backups wird zur Vermeidung von Inkonsistenzen empfohlen.</p>
|
||||||
|
|
||||||
|
<div class="flex flex-row gap-2">
|
||||||
|
<button primary type="submit" :disabled="status == 'loading' || status?.status == 'success'">
|
||||||
|
Backup laden
|
||||||
|
</button>
|
||||||
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-end">
|
||||||
|
<div class="flex flex-row gap-4 py-2">
|
||||||
|
<button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
|
||||||
|
abbrechen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import Spinner from "@/components/Spinner.vue";
|
||||||
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
import type { BackupRestoreViewModel } from "../../../../viewmodels/admin/user/backup.models";
|
||||||
|
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { backupSections, type BackupSection } from "../../../../types/backupTypes";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
props: {
|
||||||
|
data: { type: String, default: "" },
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
|
timeout: undefined as any,
|
||||||
|
partial: true,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["closeModal"]),
|
||||||
|
...mapActions(useBackupStore, ["restoreBackup"]),
|
||||||
|
triggerCreateBackup(e: any) {
|
||||||
|
let formData = e.target.elements;
|
||||||
|
let restoreBackup: BackupRestoreViewModel = {
|
||||||
|
filename: this.data,
|
||||||
|
partial: !formData.partial.checked,
|
||||||
|
include: Array.from(formData?.sections?.selectedOptions ?? []).map(
|
||||||
|
(t) => (t as HTMLOptionElement).value
|
||||||
|
) as Array<BackupSection>,
|
||||||
|
overwrite: !formData?.overwrite.checked,
|
||||||
|
};
|
||||||
|
this.status = "loading";
|
||||||
|
this.restoreBackup(restoreBackup)
|
||||||
|
.then(() => {
|
||||||
|
this.status = { status: "success" };
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.closeModal();
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.status = { status: "failed" };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
98
src/components/admin/user/backup/UploadBackupModal.vue
Normal file
98
src/components/admin/user/backup/UploadBackupModal.vue
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
<template>
|
||||||
|
<div class="w-full md:max-w-md">
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
<p class="text-xl font-medium">Backup hochladen</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div
|
||||||
|
class="hidden md:flex flex-col gap-2 py-7 bg-gray-200 justify-center items-center w-full grow rounded-lg"
|
||||||
|
@drop.prevent="fileDrop"
|
||||||
|
@dragover.prevent
|
||||||
|
>
|
||||||
|
<p class="text-lg text-dark-gray">Datei hierher ziehen</p>
|
||||||
|
</div>
|
||||||
|
<p class="hidden md:block text-center">oder</p>
|
||||||
|
<div class="flex flex-row gap-2 items-center">
|
||||||
|
<input
|
||||||
|
class="!hidden"
|
||||||
|
type="file"
|
||||||
|
ref="fileSelect"
|
||||||
|
accept="application/JSON"
|
||||||
|
@change="
|
||||||
|
(e) => {
|
||||||
|
uploadFile((e.target as HTMLInputElement)?.files?.[0]);
|
||||||
|
e.target.value = null;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
<button primary @click="openFileSelect">Datei auswählen</button>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row gap-2 pt-4 items-center justify-center">
|
||||||
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-end">
|
||||||
|
<div class="flex flex-row gap-4 py-2">
|
||||||
|
<button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
|
||||||
|
abbrechen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import Spinner from "@/components/Spinner.vue";
|
||||||
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
|
timeout: undefined as any,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["closeModal"]),
|
||||||
|
...mapActions(useBackupStore, ["uploadBackup"]),
|
||||||
|
openFileSelect(event: Event) {
|
||||||
|
(this.$refs.fileSelect as HTMLInputElement).click();
|
||||||
|
},
|
||||||
|
fileDrop(event: DragEvent) {
|
||||||
|
const file = event.dataTransfer?.files[0];
|
||||||
|
console.log("hi", file);
|
||||||
|
if (file?.type.toLocaleLowerCase() != "application/json") return;
|
||||||
|
this.uploadFile(file);
|
||||||
|
},
|
||||||
|
uploadFile(file?: File) {
|
||||||
|
if (!file) return;
|
||||||
|
this.status = "loading";
|
||||||
|
this.uploadBackup(file)
|
||||||
|
.then(() => {
|
||||||
|
this.status = { status: "success" };
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.closeModal();
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.status = { status: "failed" };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -7,7 +7,7 @@
|
||||||
</p>
|
</p>
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
<RouterLink
|
<RouterLink
|
||||||
v-if="can('update', 'user', 'user')"
|
v-if="can('admin', 'user', 'user')"
|
||||||
:to="{ name: 'admin-user-user-roles', params: { id: user.id } }"
|
:to="{ name: 'admin-user-user-roles', params: { id: user.id } }"
|
||||||
>
|
>
|
||||||
<UserGroupIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
<UserGroupIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||||
|
|
19
src/router/backupGuard.ts
Normal file
19
src/router/backupGuard.ts
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import { useBackupStore } from "../stores/admin/user/backup";
|
||||||
|
|
||||||
|
export async function setBackupPage(to: any, from: any, next: any) {
|
||||||
|
const backup = useBackupStore();
|
||||||
|
|
||||||
|
let uploadPage = to.name.includes("uploaded");
|
||||||
|
|
||||||
|
if (uploadPage) {
|
||||||
|
backup.page = "uploaded";
|
||||||
|
backup.backups = [];
|
||||||
|
} else {
|
||||||
|
backup.page = "generated";
|
||||||
|
backup.backups = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
backup.fetchBackups();
|
||||||
|
|
||||||
|
next();
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import { resetMemberStores, setMemberId } from "./memberGuard";
|
||||||
import { resetProtocolStores, setProtocolId } from "./protocolGuard";
|
import { resetProtocolStores, setProtocolId } from "./protocolGuard";
|
||||||
import { resetNewsletterStores, setNewsletterId } from "./newsletterGuard";
|
import { resetNewsletterStores, setNewsletterId } from "./newsletterGuard";
|
||||||
import { config } from "../config";
|
import { config } from "../config";
|
||||||
|
import { setBackupPage } from "./backupGuard";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
@ -634,6 +635,32 @@ const router = createRouter({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "backup",
|
||||||
|
name: "admin-user-backup-route",
|
||||||
|
component: () => import("@/views/admin/user/backup/BackupRouting.vue"),
|
||||||
|
meta: { type: "read", section: "user", module: "backup" },
|
||||||
|
beforeEnter: [abilityAndNavUpdate],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: "",
|
||||||
|
name: "admin-user-backup",
|
||||||
|
redirect: { name: "admin-user-backup-generated" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "generated",
|
||||||
|
name: "admin-user-backup-generated",
|
||||||
|
component: () => import("@/views/admin/user/backup/GeneratedBackup.vue"),
|
||||||
|
beforeEnter: [setBackupPage],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "uploads",
|
||||||
|
name: "admin-user-backup-uploaded",
|
||||||
|
component: () => import("@/views/admin/user/backup/UploadedBackup.vue"),
|
||||||
|
beforeEnter: [setBackupPage],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
members: [] as Array<MemberViewModel & { tab_pos: number }>,
|
members: [] as Array<MemberViewModel & { tab_pos: number }>,
|
||||||
totalCount: 0 as number,
|
totalCount: 0 as number,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
activeMember: null as number | null,
|
activeMember: null as string | null,
|
||||||
activeMemberObj: null as MemberViewModel | null,
|
activeMemberObj: null as MemberViewModel | null,
|
||||||
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
||||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -50,7 +50,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
return { ...res, data: res.data.members };
|
return { ...res, data: res.data.members };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> {
|
async getMembersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
|
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
|
||||||
return { ...res, data: res.data.members };
|
return { ...res, data: res.data.members };
|
||||||
});
|
});
|
||||||
|
@ -72,7 +72,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
this.loadingActive = "failed";
|
this.loadingActive = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchMemberById(id: number) {
|
fetchMemberById(id: string) {
|
||||||
return http.get(`/admin/member/${id}`);
|
return http.get(`/admin/member/${id}`);
|
||||||
},
|
},
|
||||||
fetchMemberStatisticsByActiveId() {
|
fetchMemberStatisticsByActiveId() {
|
||||||
|
@ -83,7 +83,7 @@ export const useMemberStore = defineStore("member", {
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
fetchMemberStatisticsById(id: number) {
|
fetchMemberStatisticsById(id: string) {
|
||||||
return http.get(`/admin/member/${id}/statistics`);
|
return http.get(`/admin/member/${id}/statistics`);
|
||||||
},
|
},
|
||||||
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
|
|
|
@ -12,8 +12,8 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
initialized: false as boolean,
|
initialized: false as boolean,
|
||||||
recipients: [] as Array<number>,
|
recipients: [] as Array<string>,
|
||||||
origin: [] as Array<number>,
|
origin: [] as Array<string>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,8 +22,8 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
getters: {
|
getters: {
|
||||||
detectedChangeProtocolPresence: (state) =>
|
detectedChangeProtocolPresence: (state) =>
|
||||||
!isEqual(
|
!isEqual(
|
||||||
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
state.origin, //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
||||||
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
state.presence //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
||||||
) && state.syncingProtocolPresence != "syncing",
|
) && state.syncingProtocolPresence != "syncing",
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -133,6 +133,7 @@ export const useNavigationStore = defineStore("navigation", {
|
||||||
...(abilityStore.can("read", "user", "user") ? [{ key: "user", title: "Benutzer" }] : []),
|
...(abilityStore.can("read", "user", "user") ? [{ key: "user", title: "Benutzer" }] : []),
|
||||||
...(abilityStore.can("read", "user", "role") ? [{ key: "role", title: "Rollen" }] : []),
|
...(abilityStore.can("read", "user", "role") ? [{ key: "role", title: "Rollen" }] : []),
|
||||||
...(abilityStore.can("read", "user", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []),
|
...(abilityStore.can("read", "user", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []),
|
||||||
|
...(abilityStore.can("read", "user", "backup") ? [{ key: "backup", title: "Backups" }] : []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
} as navigationModel;
|
} as navigationModel;
|
||||||
|
|
57
src/stores/admin/user/backup.ts
Normal file
57
src/stores/admin/user/backup.ts
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
import { http } from "@/serverCom";
|
||||||
|
import type { AxiosResponse, AxiosProgressEvent } from "axios";
|
||||||
|
import type { BackupRestoreViewModel } from "../../../viewmodels/admin/user/backup.models";
|
||||||
|
|
||||||
|
export const useBackupStore = defineStore("backup", {
|
||||||
|
state: () => {
|
||||||
|
return {
|
||||||
|
backups: [] as Array<string>,
|
||||||
|
loading: null as null | "loading" | "success" | "failed",
|
||||||
|
page: "generated" as "generated" | "uploaded",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
fetchBackups() {
|
||||||
|
this.loading = "loading";
|
||||||
|
http
|
||||||
|
.get(`/admin/backup/${this.page}`)
|
||||||
|
.then((result) => {
|
||||||
|
this.backups = result.data;
|
||||||
|
this.loading = "success";
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.loading = "failed";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fetchBackupById(filename: string): Promise<AxiosResponse<any, any>> {
|
||||||
|
return http.get(`/admin/backup/${this.page}/${filename}`);
|
||||||
|
},
|
||||||
|
async restoreBackup(backup: BackupRestoreViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
|
return await http.post(`/admin/backup/${this.page}/restore`, backup);
|
||||||
|
},
|
||||||
|
async triggerBackupCreate(): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.post("/admin/backup");
|
||||||
|
this.fetchBackups();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async uploadBackup(file: File): Promise<AxiosResponse<any, any>> {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("file", file);
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "multipart/form-data",
|
||||||
|
},
|
||||||
|
onUploadProgress: (progressEvent: AxiosProgressEvent) => {
|
||||||
|
const { loaded, total = 1 } = progressEvent;
|
||||||
|
console.log("progress", Math.floor((loaded * 100) / total));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await http.post("/admin/backup/upload", formData, options);
|
||||||
|
this.fetchBackups();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -24,47 +24,37 @@ export const useUserStore = defineStore("user", {
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchUserById(id: number): Promise<AxiosResponse<any, any>> {
|
fetchUserById(id: string): Promise<AxiosResponse<any, any>> {
|
||||||
return http.get(`/admin/user/${id}`);
|
return http.get(`/admin/user/${id}`);
|
||||||
},
|
},
|
||||||
updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
return http
|
const result = await http.patch(`/admin/user/${user.id}`, {
|
||||||
.patch(`/admin/user/${user.id}`, {
|
username: user.username,
|
||||||
username: user.username,
|
firstname: user.firstname,
|
||||||
firstname: user.firstname,
|
lastname: user.lastname,
|
||||||
lastname: user.lastname,
|
mail: user.mail,
|
||||||
mail: user.mail,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateActiveUserPermissions(user: number, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http
|
|
||||||
.patch(`/admin/user/${user}/permissions`, {
|
|
||||||
permissions: permission,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateActiveUserRoles(user: number, roles: Array<number>): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http
|
|
||||||
.patch(`/admin/user/${user}/roles`, {
|
|
||||||
roleIds: roles,
|
|
||||||
})
|
|
||||||
.then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
deleteUser(user: number): Promise<AxiosResponse<any, any>> {
|
|
||||||
return http.delete(`/admin/user/${user}`).then((result) => {
|
|
||||||
this.fetchUsers();
|
|
||||||
return result;
|
|
||||||
});
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async updateActiveUserPermissions(userId: string, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.patch(`/admin/user/${userId}/permissions`, {
|
||||||
|
permissions: permission,
|
||||||
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async updateActiveUserRoles(userId: string, roles: Array<number>): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.patch(`/admin/user/${userId}/roles`, {
|
||||||
|
roleIds: roles,
|
||||||
|
});
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
async deleteUser(userId: string): Promise<AxiosResponse<any, any>> {
|
||||||
|
const result = await http.delete(`/admin/user/${userId}`);
|
||||||
|
this.fetchUsers();
|
||||||
|
return result;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
24
src/types/backupTypes.ts
Normal file
24
src/types/backupTypes.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
export type BackupSection =
|
||||||
|
| "member"
|
||||||
|
| "memberBase"
|
||||||
|
| "protocol"
|
||||||
|
| "newsletter"
|
||||||
|
| "newsletter_config"
|
||||||
|
| "calendar"
|
||||||
|
| "query"
|
||||||
|
| "template"
|
||||||
|
| "user"
|
||||||
|
| "webapi";
|
||||||
|
|
||||||
|
export const backupSections: Array<BackupSection> = [
|
||||||
|
"member",
|
||||||
|
"memberBase",
|
||||||
|
"protocol",
|
||||||
|
"newsletter",
|
||||||
|
"newsletter_config",
|
||||||
|
"calendar",
|
||||||
|
"query",
|
||||||
|
"template",
|
||||||
|
"user",
|
||||||
|
"webapi",
|
||||||
|
];
|
|
@ -19,7 +19,8 @@ export type PermissionModule =
|
||||||
| "query"
|
| "query"
|
||||||
| "query_store"
|
| "query_store"
|
||||||
| "template"
|
| "template"
|
||||||
| "template_usage";
|
| "template_usage"
|
||||||
|
| "backup";
|
||||||
|
|
||||||
export type PermissionType = "read" | "create" | "update" | "delete";
|
export type PermissionType = "read" | "create" | "update" | "delete";
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ export const permissionModules: Array<PermissionModule> = [
|
||||||
"query_store",
|
"query_store",
|
||||||
"template",
|
"template",
|
||||||
"template_usage",
|
"template_usage",
|
||||||
|
"backup",
|
||||||
];
|
];
|
||||||
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
||||||
export const sectionsAndModules: SectionsAndModulesObject = {
|
export const sectionsAndModules: SectionsAndModulesObject = {
|
||||||
|
@ -80,5 +82,5 @@ export const sectionsAndModules: SectionsAndModulesObject = {
|
||||||
"template_usage",
|
"template_usage",
|
||||||
"newsletter_config",
|
"newsletter_config",
|
||||||
],
|
],
|
||||||
user: ["user", "role", "webapi"],
|
user: ["user", "role", "webapi", "backup"],
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { MembershipViewModel } from "./membership.models";
|
||||||
import type { SalutationViewModel } from "../../settings/salutation.models";
|
import type { SalutationViewModel } from "../../settings/salutation.models";
|
||||||
|
|
||||||
export interface MemberViewModel {
|
export interface MemberViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutation: SalutationViewModel;
|
salutation: SalutationViewModel;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
@ -18,7 +18,7 @@ export interface MemberViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemberStatisticsViewModel {
|
export interface MemberStatisticsViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutation: string;
|
salutation: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
@ -39,7 +39,7 @@ export interface CreateMemberViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateMemberViewModel {
|
export interface UpdateMemberViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
salutationId: number;
|
salutationId: number;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
|
|
@ -9,10 +9,11 @@ export interface MembershipViewModel {
|
||||||
|
|
||||||
export interface MembershipStatisticsViewModel {
|
export interface MembershipStatisticsViewModel {
|
||||||
durationInDays: number;
|
durationInDays: number;
|
||||||
durationInYears: string;
|
durationInYears: number;
|
||||||
|
exactDuration: string;
|
||||||
status: string;
|
status: string;
|
||||||
statusId: number;
|
statusId: number;
|
||||||
memberId: number;
|
memberId: string;
|
||||||
memberSalutation: string;
|
memberSalutation: string;
|
||||||
memberFirstname: string;
|
memberFirstname: string;
|
||||||
memberLastname: string;
|
memberLastname: string;
|
||||||
|
|
|
@ -2,10 +2,10 @@ import type { MemberViewModel } from "../member/member.models";
|
||||||
|
|
||||||
export interface NewsletterRecipientsViewModel {
|
export interface NewsletterRecipientsViewModel {
|
||||||
newsletterId: number;
|
newsletterId: number;
|
||||||
memberId: number;
|
memberId: string;
|
||||||
member: MemberViewModel;
|
member: MemberViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SyncNewsletterRecipientsViewModel {
|
export interface SyncNewsletterRecipientsViewModel {
|
||||||
memberId: number;
|
memberId: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
export interface ProtocolPresenceViewModel {
|
export interface ProtocolPresenceViewModel {
|
||||||
memberId: number;
|
memberId: string;
|
||||||
absent: boolean;
|
absent: boolean;
|
||||||
excused: boolean;
|
excused: boolean;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SyncProtocolPresenceViewModel {
|
export interface SyncProtocolPresenceViewModel {
|
||||||
memberIds: Array<number>;
|
memberIds: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
8
src/viewmodels/admin/user/backup.models.ts
Normal file
8
src/viewmodels/admin/user/backup.models.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import type { BackupSection } from "../../../types/backupTypes";
|
||||||
|
|
||||||
|
export interface BackupRestoreViewModel {
|
||||||
|
filename: string;
|
||||||
|
partial: boolean;
|
||||||
|
include: Array<BackupSection>;
|
||||||
|
overwrite: boolean;
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ import type { PermissionObject } from "@/types/permissionTypes";
|
||||||
import type { RoleViewModel } from "./role.models";
|
import type { RoleViewModel } from "./role.models";
|
||||||
|
|
||||||
export interface UserViewModel {
|
export interface UserViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
mail: string;
|
mail: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
@ -21,7 +21,7 @@ export interface CreateUserViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpdateUserViewModel {
|
export interface UpdateUserViewModel {
|
||||||
id: number;
|
id: string;
|
||||||
username: string;
|
username: string;
|
||||||
mail: string;
|
mail: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
|
|
@ -157,7 +157,7 @@ export default defineComponent({
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
let updateMember: UpdateMemberViewModel = {
|
let updateMember: UpdateMemberViewModel = {
|
||||||
id: this.member.id,
|
id: this.member.id,
|
||||||
salutationId: formData.salutation.value,
|
salutationId: formData["salutation[id]"].value,
|
||||||
firstname: formData.firstname.value,
|
firstname: formData.firstname.value,
|
||||||
lastname: formData.lastname.value,
|
lastname: formData.lastname.value,
|
||||||
nameaffix: formData.nameaffix.value,
|
nameaffix: formData.nameaffix.value,
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
{{ stat.status }} für gesamt {{ stat.durationInDays }} Tage
|
{{ stat.status }} für gesamt {{ stat.durationInDays }} Tage
|
||||||
<span class="whitespace-nowrap"> ~> {{ stat.durationInYears.replace("_", "") }} Jahre</span>
|
<span class="whitespace-nowrap"> ~> {{ stat.exactDuration }}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -154,7 +154,7 @@ export default defineComponent({
|
||||||
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
|
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
|
||||||
...mapActions(useQueryStoreStore, ["fetchQueries"]),
|
...mapActions(useQueryStoreStore, ["fetchQueries"]),
|
||||||
...mapActions(useQueryBuilderStore, ["sendQuery"]),
|
...mapActions(useQueryBuilderStore, ["sendQuery"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: string) {
|
||||||
let index = this.recipients.findIndex((s) => s == id);
|
let index = this.recipients.findIndex((s) => s == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.recipients.splice(index, 1);
|
this.recipients.splice(index, 1);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
:model-value="presence.map((p) => p.memberId)"
|
:model-value="presence.map((p) => p.memberId)"
|
||||||
:disabled="!can('create', 'club', 'protocol')"
|
:disabled="!can('create', 'club', 'protocol')"
|
||||||
@add:difference="
|
@add:difference="
|
||||||
(id: number) =>
|
(id: string) =>
|
||||||
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
|
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
|
||||||
"
|
"
|
||||||
@add:member="(s) => members.push(s)"
|
@add:member="(s) => members.push(s)"
|
||||||
|
@ -78,7 +78,7 @@ export default defineComponent({
|
||||||
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
getMember() {
|
getMember() {
|
||||||
return (memberId: number) => {
|
return (memberId: string) => {
|
||||||
return this.members.find((m) => memberId == m.id);
|
return this.members.find((m) => memberId == m.id);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -86,7 +86,7 @@ export default defineComponent({
|
||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: string) {
|
||||||
let index = this.presence.findIndex((s) => s.memberId == id);
|
let index = this.presence.findIndex((s) => s.memberId == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.presence.splice(index, 1);
|
this.presence.splice(index, 1);
|
||||||
|
|
78
src/views/admin/user/backup/BackupRouting.vue
Normal file
78
src/views/admin/user/backup/BackupRouting.vue
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
<template>
|
||||||
|
<MainTemplate>
|
||||||
|
<template #topBar>
|
||||||
|
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
||||||
|
<h1 class="font-bold text-xl h-8">Backups</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #diffMain>
|
||||||
|
<div class="flex flex-col gap-2 grow px-7 overflow-hidden">
|
||||||
|
<div class="flex flex-col grow gap-2 overflow-hidden">
|
||||||
|
<div class="w-full flex flex-row max-lg:flex-wrap justify-center">
|
||||||
|
<RouterLink
|
||||||
|
v-for="tab in tabs"
|
||||||
|
:key="tab.route"
|
||||||
|
v-slot="{ isActive }"
|
||||||
|
:to="{ name: tab.route }"
|
||||||
|
class="w-1/2 p-0.5 first:pl-0 last:pr-0"
|
||||||
|
>
|
||||||
|
<p
|
||||||
|
:class="[
|
||||||
|
'w-full rounded-lg py-2.5 text-sm text-center font-medium leading-5 focus:ring-0 outline-none',
|
||||||
|
isActive ? 'bg-red-200 shadow border-b-2 border-primary rounded-b-none' : ' hover:bg-red-200',
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
{{ tab.title }}
|
||||||
|
</p>
|
||||||
|
</RouterLink>
|
||||||
|
</div>
|
||||||
|
<RouterView />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</MainTemplate>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
import BackupListItem from "@/components/admin/user/backup/BackupListItem.vue";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tabs: [
|
||||||
|
{ route: "admin-user-backup-generated", title: "Erstellt" },
|
||||||
|
{ route: "admin-user-backup-uploaded", title: "Uploads" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useBackupStore, ["backups"]),
|
||||||
|
...mapState(useAbilityStore, ["can"]),
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchBackups();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useBackupStore, ["fetchBackups"]),
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
openCreateModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/CreateBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
openUploadModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/UploadBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
48
src/views/admin/user/backup/GeneratedBackup.vue
Normal file
48
src/views/admin/user/backup/GeneratedBackup.vue
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-4 h-full pl-7">
|
||||||
|
<div class="flex flex-col gap-2 grow overflow-y-scroll pr-7">
|
||||||
|
<BackupListItem v-for="backup in backups" :key="backup" :backup="backup" />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button v-if="can('create', 'user', 'backup')" primary class="!w-fit" @click="openCreateModal">
|
||||||
|
Backup erstellen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
import BackupListItem from "@/components/admin/user/backup/BackupListItem.vue";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
computed: {
|
||||||
|
...mapState(useBackupStore, ["backups"]),
|
||||||
|
...mapState(useAbilityStore, ["can"]),
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchBackups();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useBackupStore, ["fetchBackups"]),
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
openCreateModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/CreateBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
openUploadModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/UploadBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
48
src/views/admin/user/backup/UploadedBackup.vue
Normal file
48
src/views/admin/user/backup/UploadedBackup.vue
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col gap-4 h-full pl-7">
|
||||||
|
<div class="flex flex-col gap-2 grow overflow-y-scroll pr-7">
|
||||||
|
<BackupListItem v-for="backup in backups" :key="backup" :backup="backup" />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button v-if="can('create', 'user', 'backup')" primary class="!w-fit" @click="openUploadModal">
|
||||||
|
Backup hochladen
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
|
import { useBackupStore } from "@/stores/admin/user/backup";
|
||||||
|
import BackupListItem from "@/components/admin/user/backup/BackupListItem.vue";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
computed: {
|
||||||
|
...mapState(useBackupStore, ["backups"]),
|
||||||
|
...mapState(useAbilityStore, ["can"]),
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.fetchBackups();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useBackupStore, ["fetchBackups"]),
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
openCreateModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/CreateBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
openUploadModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/user/backup/UploadBackupModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -95,7 +95,7 @@ export default defineComponent({
|
||||||
this.user = cloneDeep(this.origin);
|
this.user = cloneDeep(this.origin);
|
||||||
},
|
},
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.user = result.data;
|
this.user = result.data;
|
||||||
this.origin = cloneDeep(result.data);
|
this.origin = cloneDeep(result.data);
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
|
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.user = result.data;
|
this.user = result.data;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
|
|
|
@ -111,7 +111,7 @@ export default defineComponent({
|
||||||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||||
},
|
},
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchUserById(parseInt(this.id ?? ""))
|
this.fetchUserById(this.id ?? "")
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = cloneDeep(result.data);
|
this.origin = cloneDeep(result.data);
|
||||||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||||
|
|
|
@ -11,53 +11,53 @@
|
||||||
<component v-if="markdownComponent" :is="markdownComponent" />
|
<component v-if="markdownComponent" :is="markdownComponent" />
|
||||||
<p v-else>Diese Seite existiert nicht.</p>
|
<p v-else>Diese Seite existiert nicht.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MainTemplate>
|
</MainTemplate>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent, defineComponent, markRaw} from "vue";
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import 'highlight.js/styles/atom-one-dark.css';
|
import "highlight.js/styles/atom-one-dark.css";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
page: String
|
page: String,
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
page() {
|
page() {
|
||||||
this.loadPage()
|
this.loadPage();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
markdownComponent: null,
|
markdownComponent: null as any,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.loadPage()
|
this.loadPage();
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
loadPage(){
|
loadPage() {
|
||||||
this.markdownComponent = null
|
this.markdownComponent = null;
|
||||||
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
|
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.markdown-container {
|
.markdown-container {
|
||||||
font-family: 'Open Sans', sans-serif;
|
font-family: "Open Sans", sans-serif;
|
||||||
color: #555;
|
color: #555;
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
border: 2px solid gray;
|
border: 2px solid gray;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
height: 100%
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.markdown-container h1 {
|
.markdown-container h1 {
|
||||||
|
@ -84,4 +84,4 @@ export default defineComponent({
|
||||||
list-style-type: disc;
|
list-style-type: disc;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Add table
Reference in a new issue