mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
89ab7fac25
commit
c24d532608
403 changed files with 23959 additions and 19557 deletions
|
@ -4,9 +4,10 @@
|
|||
<!-- Delete Dialog -->
|
||||
<BaseDialog
|
||||
v-model="deleteDialog"
|
||||
:title="$tc('settings.backup.delete-backup')"
|
||||
:title="$t('settings.backup.delete-backup')"
|
||||
color="error"
|
||||
:icon="$globals.icons.alertCircle"
|
||||
can-confirm
|
||||
@confirm="deleteBackup()"
|
||||
>
|
||||
<v-card-text>
|
||||
|
@ -15,60 +16,83 @@
|
|||
</BaseDialog>
|
||||
|
||||
<!-- Import Dialog -->
|
||||
<BaseDialog v-model="importDialog" color="error" :title="$t('settings.backup.backup-restore')" :icon="$globals.icons.database">
|
||||
<v-divider></v-divider>
|
||||
<BaseDialog
|
||||
v-model="importDialog"
|
||||
color="error"
|
||||
:title="$t('settings.backup.backup-restore')"
|
||||
:icon="$globals.icons.database"
|
||||
>
|
||||
<v-divider />
|
||||
<v-card-text>
|
||||
<i18n path="settings.backup.back-restore-description">
|
||||
<i18n-t keypath="settings.backup.back-restore-description">
|
||||
<template #cannot-be-undone>
|
||||
<b> {{ $t('settings.backup.cannot-be-undone') }} </b>
|
||||
</template>
|
||||
</i18n>
|
||||
</i18n-t>
|
||||
|
||||
<p class="mt-3">
|
||||
<i18n path="settings.backup.postgresql-note">
|
||||
<i18n-t keypath="settings.backup.postgresql-note">
|
||||
<template #backup-restore-process>
|
||||
<a href="https://nightly.mealie.io/documentation/getting-started/usage/backups-and-restoring/" >{{ $t('settings.backup.backup-restore-process-in-the-documentation') }}</a >
|
||||
<a href="https://nightly.mealie.io/documentation/getting-started/usage/backups-and-restoring/">{{
|
||||
$t('settings.backup.backup-restore-process-in-the-documentation') }}</a>
|
||||
</template>
|
||||
</i18n>
|
||||
</i18n-t>
|
||||
{{ $t('') }}
|
||||
</p>
|
||||
|
||||
|
||||
<v-checkbox
|
||||
v-model="confirmImport"
|
||||
class="checkbox-top"
|
||||
color="error"
|
||||
hide-details
|
||||
:label="$t('settings.backup.irreversible-acknowledgment')"
|
||||
></v-checkbox>
|
||||
/>
|
||||
</v-card-text>
|
||||
<v-card-actions class="justify-center pt-0">
|
||||
<BaseButton delete :disabled="!confirmImport || runningRestore" @click="restoreBackup(selected)">
|
||||
<template #icon> {{ $globals.icons.database }} </template>
|
||||
<BaseButton
|
||||
delete
|
||||
:disabled="!confirmImport || runningRestore"
|
||||
@click="restoreBackup(selected)"
|
||||
>
|
||||
<template #icon>
|
||||
{{ $globals.icons.database }}
|
||||
</template>
|
||||
{{ $t('settings.backup.restore-backup') }}
|
||||
</BaseButton>
|
||||
</v-card-actions>
|
||||
<p class="caption pb-0 mb-1 text-center">
|
||||
{{ selected }}
|
||||
</p>
|
||||
<v-progress-linear v-if="runningRestore" indeterminate></v-progress-linear>
|
||||
<v-progress-linear
|
||||
v-if="runningRestore"
|
||||
indeterminate
|
||||
/>
|
||||
</BaseDialog>
|
||||
|
||||
<section>
|
||||
<BaseCardSectionTitle :title="$tc('settings.backup-and-exports')">
|
||||
<BaseCardSectionTitle :title="$t('settings.backup-and-exports')">
|
||||
<v-card-text class="py-0 px-1">
|
||||
<i18n path="settings.backup.experimental-description" />
|
||||
<i18n-t keypath="settings.backup.experimental-description" />
|
||||
</v-card-text>
|
||||
</BaseCardSectionTitle>
|
||||
<v-toolbar color="transparent" flat class="justify-between">
|
||||
<BaseButton class="mr-2" @click="createBackup"> {{ $t("settings.backup.create-heading") }} </BaseButton>
|
||||
<AppButtonUpload
|
||||
:text-btn="false"
|
||||
url="/api/admin/backups/upload"
|
||||
accept=".zip"
|
||||
color="info"
|
||||
@uploaded="refreshBackups()"
|
||||
/>
|
||||
<v-toolbar
|
||||
color="transparent"
|
||||
flat
|
||||
class="justify-between"
|
||||
>
|
||||
<BaseButton
|
||||
class="mr-2"
|
||||
@click="createBackup"
|
||||
>
|
||||
{{ $t("settings.backup.create-heading") }}
|
||||
</BaseButton>
|
||||
<AppButtonUpload
|
||||
:text-btn="false"
|
||||
url="/api/admin/backups/upload"
|
||||
accept=".zip"
|
||||
color="info"
|
||||
@uploaded="refreshBackups()"
|
||||
/>
|
||||
</v-toolbar>
|
||||
|
||||
<v-data-table
|
||||
|
@ -80,14 +104,15 @@
|
|||
:search="search"
|
||||
@click:row="setSelected"
|
||||
>
|
||||
<template #item.date="{ item }">
|
||||
<template #[`item.date`]="{ item }">
|
||||
{{ $d(Date.parse(item.date), "medium") }}
|
||||
</template>
|
||||
<template #item.actions="{ item }">
|
||||
<template #[`item.actions`]="{ item }">
|
||||
<v-btn
|
||||
icon
|
||||
class="mx-1"
|
||||
color="error"
|
||||
variant="text"
|
||||
@click.stop="
|
||||
deleteDialog = true;
|
||||
deleteTarget = item.name;
|
||||
|
@ -95,18 +120,27 @@
|
|||
>
|
||||
<v-icon> {{ $globals.icons.delete }} </v-icon>
|
||||
</v-btn>
|
||||
<BaseButton small download :download-url="backupsFileNameDownload(item.name)" class="mx-1" @click.stop="() => {}"/>
|
||||
<BaseButton small @click.stop="setSelected(item); importDialog = true">
|
||||
<template #icon> {{ $globals.icons.backupRestore }}</template>
|
||||
<BaseButton
|
||||
small
|
||||
download
|
||||
:download-url="backupsFileNameDownload(item.name)"
|
||||
class="mx-1"
|
||||
@click.stop="() => { }"
|
||||
/>
|
||||
<BaseButton
|
||||
small
|
||||
@click.stop="setSelected(item); importDialog = true"
|
||||
>
|
||||
<template #icon>
|
||||
{{ $globals.icons.backupRestore }}
|
||||
</template>
|
||||
{{ $t("settings.backup.backup-restore") }}
|
||||
</BaseButton>
|
||||
</BaseButton>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
<v-divider />
|
||||
<div class="d-flex justify-end mt-6">
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div />
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -117,17 +151,20 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, reactive, ref, toRefs, useContext, onMounted, useRoute } from "@nuxtjs/composition-api";
|
||||
import { useAdminApi } from "~/composables/api";
|
||||
import { AllBackups } from "~/lib/api/types/admin";
|
||||
import type { AllBackups } from "~/lib/api/types/admin";
|
||||
import { alert } from "~/composables/use-toast";
|
||||
|
||||
export default defineComponent({
|
||||
layout: "admin",
|
||||
export default defineNuxtComponent({
|
||||
setup() {
|
||||
const { i18n, $auth } = useContext();
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
});
|
||||
|
||||
const i18n = useI18n();
|
||||
const $auth = useMealieAuth();
|
||||
const route = useRoute();
|
||||
const groupSlug = computed(() => route.value.params.groupSlug || $auth.user?.groupSlug || "");
|
||||
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
|
||||
|
||||
const adminApi = useAdminApi();
|
||||
const selected = ref("");
|
||||
|
@ -149,9 +186,10 @@ export default defineComponent({
|
|||
|
||||
if (data?.error === false) {
|
||||
refreshBackups();
|
||||
alert.success(i18n.tc("settings.backup.backup-created"));
|
||||
} else {
|
||||
alert.error(i18n.tc("settings.backup.error-creating-backup-see-log-file"));
|
||||
alert.success(i18n.t("settings.backup.backup-created"));
|
||||
}
|
||||
else {
|
||||
alert.error(i18n.t("settings.backup.error-creating-backup-see-log-file"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,10 +201,13 @@ export default defineComponent({
|
|||
console.log(error);
|
||||
state.importDialog = false;
|
||||
state.runningRestore = false;
|
||||
alert.error(i18n.tc("settings.backup.restore-fail"));
|
||||
} else {
|
||||
alert.success(i18n.tc("settings.backup.restore-success"));
|
||||
$auth.logout();
|
||||
alert.error(i18n.t("settings.backup.restore-fail"));
|
||||
}
|
||||
else {
|
||||
alert.success(i18n.t("settings.backup.restore-success"));
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +217,7 @@ export default defineComponent({
|
|||
const { data } = await adminApi.backups.delete(deleteTarget.value);
|
||||
|
||||
if (!data?.error) {
|
||||
alert.success(i18n.tc("settings.backup.backup-deleted"));
|
||||
alert.success(i18n.t("settings.backup.backup-deleted"));
|
||||
refreshBackups();
|
||||
}
|
||||
}
|
||||
|
@ -189,10 +230,10 @@ export default defineComponent({
|
|||
runningRestore: false,
|
||||
search: "",
|
||||
headers: [
|
||||
{ text: i18n.t("general.name"), value: "name" },
|
||||
{ text: i18n.t("general.created"), value: "date" },
|
||||
{ text: i18n.t("export.size"), value: "size" },
|
||||
{ text: "", value: "actions", align: "right" },
|
||||
{ title: i18n.t("general.name"), value: "name" },
|
||||
{ title: i18n.t("general.created"), value: "date" },
|
||||
{ title: i18n.t("export.size"), value: "size" },
|
||||
{ title: "", value: "actions", align: "right" },
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -205,6 +246,10 @@ export default defineComponent({
|
|||
|
||||
const backupsFileNameDownload = (fileName: string) => `api/admin/backups/${fileName}`;
|
||||
|
||||
useSeoMeta({
|
||||
title: i18n.t("sidebar.backups"),
|
||||
});
|
||||
|
||||
onMounted(refreshBackups);
|
||||
|
||||
return {
|
||||
|
@ -223,7 +268,7 @@ export default defineComponent({
|
|||
},
|
||||
head() {
|
||||
return {
|
||||
title: this.$t("sidebar.backups") as string,
|
||||
title: useI18n().t("sidebar.backups"),
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue