Merge pull request 'minor v1.3.0' (#57) from develop into main
Reviewed-on: #57
This commit is contained in:
commit
f9fa60f999
37 changed files with 840 additions and 111 deletions
81
package-lock.json
generated
81
package-lock.json
generated
|
@ -17,7 +17,7 @@
|
|||
"@headlessui/vue": "^1.7.13",
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"@vueup/vue-quill": "^1.2.0",
|
||||
"axios": "^0.26.1",
|
||||
"axios": "^1.7.9",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
"grapesjs": "^0.22.4",
|
||||
"grapesjs-preset-newsletter": "^1.0.2",
|
||||
|
@ -3951,6 +3951,12 @@
|
|||
"integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==",
|
||||
"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": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz",
|
||||
|
@ -4013,11 +4019,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
"version": "1.7.9",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
|
||||
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
|
||||
"license": "MIT",
|
||||
"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": {
|
||||
|
@ -4515,6 +4524,18 @@
|
|||
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
|
||||
"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": {
|
||||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
|
@ -4875,6 +4896,15 @@
|
|||
"integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
|
||||
"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": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",
|
||||
|
@ -5714,6 +5744,20 @@
|
|||
"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": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz",
|
||||
|
@ -7172,6 +7216,27 @@
|
|||
"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": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
|
@ -8115,6 +8180,12 @@
|
|||
"integrity": "sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==",
|
||||
"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": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"@headlessui/vue": "^1.7.13",
|
||||
"@heroicons/vue": "^2.1.5",
|
||||
"@vueup/vue-quill": "^1.2.0",
|
||||
"axios": "^0.26.1",
|
||||
"axios": "^1.7.9",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
"grapesjs": "^0.22.4",
|
||||
"grapesjs-preset-newsletter": "^1.0.2",
|
||||
|
|
|
@ -82,27 +82,30 @@ const props = defineProps({
|
|||
});
|
||||
|
||||
const slots = defineSlots<{
|
||||
pageRow(props: { row: T }): void;
|
||||
pageRow(props: { row: T; key: number }): void;
|
||||
}>();
|
||||
|
||||
const timer = ref(undefined) as undefined | any;
|
||||
const currentPage = ref(0);
|
||||
const searchString = ref("");
|
||||
const deferingSearch = ref(false)
|
||||
const deferingSearch = ref(false);
|
||||
|
||||
watch(searchString, async () => {
|
||||
deferingSearch.value = true
|
||||
deferingSearch.value = true;
|
||||
clearTimeout(timer.value);
|
||||
timer.value = setTimeout(() => {
|
||||
currentPage.value = 0;
|
||||
deferingSearch.value = false
|
||||
deferingSearch.value = false;
|
||||
emit("search", searchString.value);
|
||||
}, 600);
|
||||
});
|
||||
|
||||
watch(() => props.totalCount, async () => {
|
||||
watch(
|
||||
() => props.totalCount,
|
||||
async () => {
|
||||
currentPage.value = 0;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits({
|
||||
submit(id: number) {
|
||||
|
|
|
@ -93,7 +93,7 @@ import Spinner from "../Spinner.vue";
|
|||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Array as PropType<Array<number>>,
|
||||
type: Array as PropType<Array<string>>,
|
||||
default: [],
|
||||
},
|
||||
title: String,
|
||||
|
@ -133,7 +133,7 @@ export default defineComponent({
|
|||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val: Array<number>) {
|
||||
set(val: Array<string>) {
|
||||
this.$emit("update:model-value", val);
|
||||
if (this.modelValue.length < val.length) {
|
||||
let diff = difference(val, this.modelValue);
|
||||
|
@ -166,7 +166,7 @@ export default defineComponent({
|
|||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getMemberFromSearch(id: number) {
|
||||
getMemberFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
},
|
||||
loadMembersInitial() {
|
||||
|
|
|
@ -178,12 +178,12 @@ export default defineComponent({
|
|||
if (!this.permissionUpdate[section]) {
|
||||
this.permissionUpdate[section] = {};
|
||||
}
|
||||
this.permissionUpdate[section].all = permissions;
|
||||
this.permissionUpdate[section]!.all = permissions;
|
||||
} else {
|
||||
if (!this.permissionUpdate[section]) {
|
||||
this.permissionUpdate[section] = {};
|
||||
}
|
||||
this.permissionUpdate[section][modul] = permissions;
|
||||
this.permissionUpdate[section]![modul] = permissions;
|
||||
}
|
||||
},
|
||||
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>
|
112
src/components/admin/user/backup/RestoreBackupModal.vue
Normal file
112
src/components/admin/user/backup/RestoreBackupModal.vue
Normal file
|
@ -0,0 +1,112 @@
|
|||
<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> -->
|
||||
|
||||
<p>Backups ersetzen den aktuellen Stand vollständig.</p>
|
||||
|
||||
<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: false,
|
||||
include: [],
|
||||
overwrite: false,
|
||||
// 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 as HTMLInputElement).value = '';
|
||||
}
|
||||
"
|
||||
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>
|
||||
<div class="flex flex-row">
|
||||
<RouterLink
|
||||
v-if="can('update', 'user', 'user')"
|
||||
v-if="can('admin', 'user', 'user')"
|
||||
:to="{ name: 'admin-user-user-roles', params: { id: user.id } }"
|
||||
>
|
||||
<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 { resetNewsletterStores, setNewsletterId } from "./newsletterGuard";
|
||||
import { config } from "../config";
|
||||
import { setBackupPage } from "./backupGuard";
|
||||
|
||||
const router = createRouter({
|
||||
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 }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
activeMember: null as number | null,
|
||||
activeMember: null as string | null,
|
||||
activeMemberObj: null as MemberViewModel | null,
|
||||
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
|
@ -50,8 +50,12 @@ export const useMemberStore = defineStore("member", {
|
|||
return { ...res, data: res.data.members };
|
||||
});
|
||||
},
|
||||
async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
|
||||
async getMembersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/member/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.members };
|
||||
});
|
||||
},
|
||||
|
@ -72,7 +76,7 @@ export const useMemberStore = defineStore("member", {
|
|||
this.loadingActive = "failed";
|
||||
});
|
||||
},
|
||||
fetchMemberById(id: number) {
|
||||
fetchMemberById(id: string) {
|
||||
return http.get(`/admin/member/${id}`);
|
||||
},
|
||||
fetchMemberStatisticsByActiveId() {
|
||||
|
@ -83,7 +87,7 @@ export const useMemberStore = defineStore("member", {
|
|||
})
|
||||
.catch((err) => {});
|
||||
},
|
||||
fetchMemberStatisticsById(id: number) {
|
||||
fetchMemberStatisticsById(id: string) {
|
||||
return http.get(`/admin/member/${id}/statistics`);
|
||||
},
|
||||
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
||||
|
|
|
@ -12,8 +12,8 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
|
|||
state: () => {
|
||||
return {
|
||||
initialized: false as boolean,
|
||||
recipients: [] as Array<number>,
|
||||
origin: [] as Array<number>,
|
||||
recipients: [] as Array<string>,
|
||||
origin: [] as Array<string>,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||
};
|
||||
|
|
|
@ -22,8 +22,12 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
|||
getters: {
|
||||
detectedChangeProtocolPresence: (state) =>
|
||||
!isEqual(
|
||||
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
||||
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
||||
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) =>
|
||||
a.memberId.localeCompare(b.memberId)
|
||||
),
|
||||
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) =>
|
||||
a.memberId.localeCompare(b.memberId)
|
||||
)
|
||||
) && state.syncingProtocolPresence != "syncing",
|
||||
},
|
||||
actions: {
|
||||
|
|
|
@ -133,6 +133,7 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
...(abilityStore.can("read", "user", "user") ? [{ key: "user", title: "Benutzer" }] : []),
|
||||
...(abilityStore.can("read", "user", "role") ? [{ key: "role", title: "Rollen" }] : []),
|
||||
...(abilityStore.can("read", "user", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []),
|
||||
...(abilityStore.can("read", "user", "backup") ? [{ key: "backup", title: "Backups" }] : []),
|
||||
],
|
||||
},
|
||||
} 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";
|
||||
});
|
||||
},
|
||||
fetchUserById(id: number): Promise<AxiosResponse<any, any>> {
|
||||
fetchUserById(id: string): Promise<AxiosResponse<any, any>> {
|
||||
return http.get(`/admin/user/${id}`);
|
||||
},
|
||||
updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
||||
return http
|
||||
.patch(`/admin/user/${user.id}`, {
|
||||
async updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/user/${user.id}`, {
|
||||
username: user.username,
|
||||
firstname: user.firstname,
|
||||
lastname: user.lastname,
|
||||
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`, {
|
||||
async updateActiveUserPermissions(userId: string, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/user/${userId}/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`, {
|
||||
async updateActiveUserRoles(userId: string, roles: Array<number>): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/user/${userId}/roles`, {
|
||||
roleIds: roles,
|
||||
})
|
||||
.then((result) => {
|
||||
});
|
||||
this.fetchUsers();
|
||||
return result;
|
||||
});
|
||||
},
|
||||
deleteUser(user: number): Promise<AxiosResponse<any, any>> {
|
||||
return http.delete(`/admin/user/${user}`).then((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_store"
|
||||
| "template"
|
||||
| "template_usage";
|
||||
| "template_usage"
|
||||
| "backup";
|
||||
|
||||
export type PermissionType = "read" | "create" | "update" | "delete";
|
||||
|
||||
|
@ -63,6 +64,7 @@ export const permissionModules: Array<PermissionModule> = [
|
|||
"query_store",
|
||||
"template",
|
||||
"template_usage",
|
||||
"backup",
|
||||
];
|
||||
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
||||
export const sectionsAndModules: SectionsAndModulesObject = {
|
||||
|
@ -80,5 +82,5 @@ export const sectionsAndModules: SectionsAndModulesObject = {
|
|||
"template_usage",
|
||||
"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";
|
||||
|
||||
export interface MemberViewModel {
|
||||
id: number;
|
||||
id: string;
|
||||
salutation: SalutationViewModel;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
|
@ -18,7 +18,7 @@ export interface MemberViewModel {
|
|||
}
|
||||
|
||||
export interface MemberStatisticsViewModel {
|
||||
id: number;
|
||||
id: string;
|
||||
salutation: string;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
|
@ -39,7 +39,7 @@ export interface CreateMemberViewModel {
|
|||
}
|
||||
|
||||
export interface UpdateMemberViewModel {
|
||||
id: number;
|
||||
id: string;
|
||||
salutationId: number;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
|
|
|
@ -9,10 +9,11 @@ export interface MembershipViewModel {
|
|||
|
||||
export interface MembershipStatisticsViewModel {
|
||||
durationInDays: number;
|
||||
durationInYears: string;
|
||||
durationInYears: number;
|
||||
exactDuration: string;
|
||||
status: string;
|
||||
statusId: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
memberSalutation: string;
|
||||
memberFirstname: string;
|
||||
memberLastname: string;
|
||||
|
|
|
@ -2,10 +2,10 @@ import type { MemberViewModel } from "../member/member.models";
|
|||
|
||||
export interface NewsletterRecipientsViewModel {
|
||||
newsletterId: number;
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
member: MemberViewModel;
|
||||
}
|
||||
|
||||
export interface SyncNewsletterRecipientsViewModel {
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
export interface ProtocolPresenceViewModel {
|
||||
memberId: number;
|
||||
memberId: string;
|
||||
absent: boolean;
|
||||
excused: boolean;
|
||||
protocolId: number;
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
export interface UserViewModel {
|
||||
id: number;
|
||||
id: string;
|
||||
username: string;
|
||||
mail: string;
|
||||
firstname: string;
|
||||
|
@ -21,7 +21,7 @@ export interface CreateUserViewModel {
|
|||
}
|
||||
|
||||
export interface UpdateUserViewModel {
|
||||
id: number;
|
||||
id: string;
|
||||
username: string;
|
||||
mail: string;
|
||||
firstname: string;
|
||||
|
|
|
@ -157,7 +157,7 @@ export default defineComponent({
|
|||
let formData = e.target.elements;
|
||||
let updateMember: UpdateMemberViewModel = {
|
||||
id: this.member.id,
|
||||
salutationId: formData.salutation.value,
|
||||
salutationId: formData["salutation[id]"].value,
|
||||
firstname: formData.firstname.value,
|
||||
lastname: formData.lastname.value,
|
||||
nameaffix: formData.nameaffix.value,
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
>
|
||||
<p>
|
||||
{{ 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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -111,7 +111,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div v-if="activeMemberObj.sendNewsletter">
|
||||
<p>Newsletter Kommunikationswege</p>
|
||||
<p>sende Newsletter an:</p>
|
||||
<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>
|
||||
|
|
|
@ -154,7 +154,7 @@ export default defineComponent({
|
|||
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
|
||||
...mapActions(useQueryStoreStore, ["fetchQueries"]),
|
||||
...mapActions(useQueryBuilderStore, ["sendQuery"]),
|
||||
removeSelected(id: number) {
|
||||
removeSelected(id: string) {
|
||||
let index = this.recipients.findIndex((s) => s == id);
|
||||
if (index != -1) {
|
||||
this.recipients.splice(index, 1);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
:model-value="presence.map((p) => p.memberId)"
|
||||
:disabled="!can('create', 'club', 'protocol')"
|
||||
@add:difference="
|
||||
(id: number) =>
|
||||
(id: string) =>
|
||||
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
|
||||
"
|
||||
@add:member="(s) => members.push(s)"
|
||||
|
@ -22,7 +22,7 @@
|
|||
<p>Anwesenheit</p>
|
||||
<div class="flex flex-col gap-2 grow overflow-y-auto">
|
||||
<div
|
||||
v-for="member in presence"
|
||||
v-for="member in sortedPresence"
|
||||
:key="member.memberId"
|
||||
class="flex flex-row h-fit w-full border border-primary rounded-md bg-primary p-2 text-white justify-between items-center"
|
||||
>
|
||||
|
@ -78,15 +78,24 @@ export default defineComponent({
|
|||
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
getMember() {
|
||||
return (memberId: number) => {
|
||||
return (memberId: string) => {
|
||||
return this.members.find((m) => memberId == m.id);
|
||||
};
|
||||
},
|
||||
sortedPresence() {
|
||||
return this.presence.toSorted((a, b) => {
|
||||
const memberA = this.getMember(a.memberId);
|
||||
const memberB = this.getMember(b.memberId);
|
||||
return `${memberA?.lastname}, ${memberA?.firstname}`.localeCompare(
|
||||
`${memberB?.lastname}, ${memberB?.firstname}`
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
||||
removeSelected(id: number) {
|
||||
removeSelected(id: string) {
|
||||
let index = this.presence.findIndex((s) => s.memberId == id);
|
||||
if (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);
|
||||
},
|
||||
fetchItem() {
|
||||
this.fetchUserById(parseInt(this.id ?? ""))
|
||||
this.fetchUserById(this.id ?? "")
|
||||
.then((result) => {
|
||||
this.user = result.data;
|
||||
this.origin = cloneDeep(result.data);
|
||||
|
|
|
@ -57,7 +57,7 @@ export default defineComponent({
|
|||
methods: {
|
||||
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
|
||||
fetchItem() {
|
||||
this.fetchUserById(parseInt(this.id ?? ""))
|
||||
this.fetchUserById(this.id ?? "")
|
||||
.then((result) => {
|
||||
this.user = result.data;
|
||||
this.loading = "fetched";
|
||||
|
|
|
@ -111,7 +111,7 @@ export default defineComponent({
|
|||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||
},
|
||||
fetchItem() {
|
||||
this.fetchUserById(parseInt(this.id ?? ""))
|
||||
this.fetchUserById(this.id ?? "")
|
||||
.then((result) => {
|
||||
this.origin = cloneDeep(result.data);
|
||||
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
|
||||
|
|
|
@ -19,45 +19,45 @@
|
|||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, defineComponent, markRaw } from "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 lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
page: String
|
||||
page: String,
|
||||
},
|
||||
watch: {
|
||||
page() {
|
||||
this.loadPage()
|
||||
}
|
||||
this.loadPage();
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
markdownComponent: null,
|
||||
markdownComponent: null as any,
|
||||
};
|
||||
},
|
||||
async mounted() {
|
||||
this.loadPage()
|
||||
this.loadPage();
|
||||
},
|
||||
methods: {
|
||||
loadPage() {
|
||||
this.markdownComponent = null
|
||||
this.markdownComponent = null;
|
||||
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.markdown-container {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-family: "Open Sans", sans-serif;
|
||||
color: #555;
|
||||
background-color: #f8f8f8;
|
||||
border: 2px solid gray;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
height: 100%
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.markdown-container h1 {
|
||||
|
|
Loading…
Add table
Reference in a new issue