1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +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:
Hoa (Kyle) Trinh 2025-06-20 00:09:12 +07:00 committed by GitHub
parent 89ab7fac25
commit c24d532608
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
403 changed files with 23959 additions and 19557 deletions

View file

@ -3,32 +3,51 @@
<BasePageTitle divider>
<template #header>
<v-img
width="100%"
max-height="200"
max-width="200"
class="mb-2"
:src="require('~/static/svgs/manage-data-migrations.svg')"
></v-img>
/>
</template>
<template #title>
{{ $t('migration.recipe-data-migrations') }}
</template>
<template #title> {{ $t('migration.recipe-data-migrations') }}</template>
{{ $t('migration.recipe-data-migrations-explanation') }}
</BasePageTitle>
<v-container>
<BaseCardSectionTitle :title="$i18n.tc('migration.new-migration')"> </BaseCardSectionTitle>
<v-card outlined :loading="loading">
<BaseCardSectionTitle :title="$t('migration.new-migration')" />
<v-card
variant="outlined"
:loading="loading"
>
<v-card-title> {{ $t('migration.choose-migration-type') }} </v-card-title>
<v-card-text v-if="content" class="pb-0">
<v-card-text
v-if="content"
class="pb-0"
>
<div class="mb-2">
<BaseOverflowButton v-model="migrationType" mode="model" :items="items" />
<BaseOverflowButton
v-model="migrationType"
mode="model"
:items="items"
/>
</div>
{{ content.text }}
<v-treeview v-if="content.tree" dense :items="content.tree">
<v-treeview
v-if="content.tree"
density="compact"
:items="content.tree"
>
<template #prepend="{ item }">
<v-icon> {{ item.icon }}</v-icon>
</template>
</v-treeview>
</v-card-text>
<v-card-title class="mt-0"> {{ $t('general.upload-file') }} </v-card-title>
<v-card-title class="mt-0">
{{ $t('general.upload-file') }}
</v-card-title>
<v-card-text>
<AppButtonUpload
:accept="content.acceptedFileType || '.zip'"
@ -38,41 +57,47 @@
:text-btn="false"
@uploaded="setFileObject"
/>
{{ fileObject.name || $i18n.tc('migration.no-file-selected') }}
{{ fileObject.name || $t('migration.no-file-selected') }}
</v-card-text>
<v-card-text>
<v-checkbox v-model="addMigrationTag">
<template #label>
<i18n path="migration.tag-all-recipes">
<template #tag-name>
<b class="mx-1"> {{ migrationType }} </b>
</template>
</i18n>
<i18n-t keypath="migration.tag-all-recipes">
<template #tag-name>
<b class="mx-1"> {{ migrationType }} </b>
</template>
</i18n-t>
</template>
</v-checkbox>
</v-card-text>
<v-card-actions class="justify-end">
<BaseButton :disabled="!fileObject.name" submit @click="startMigration">
{{ $t("general.submit") }}</BaseButton
<BaseButton
:disabled="!fileObject.name"
submit
@click="startMigration"
>
{{ $t("general.submit") }}
</BaseButton>
</v-card-actions>
</v-card>
</v-container>
<v-container>
<BaseCardSectionTitle :title="$i18n.tc('migration.previous-migrations')"> </BaseCardSectionTitle>
<ReportTable :items="reports" @delete="deleteReport" />
<BaseCardSectionTitle :title="$t('migration.previous-migrations')" />
<ReportTable
:items="reports"
@delete="deleteReport"
/>
</v-container>
</v-container>
</template>
<script lang="ts">
import { defineComponent, reactive, toRefs, useContext, computed, onMounted } from "@nuxtjs/composition-api";
import { ReportSummary } from "~/lib/api/types/reports";
import { MenuItem } from "~/components/global/BaseOverflowButton.vue";
import type { ReportSummary } from "~/lib/api/types/reports";
import type { MenuItem } from "~/components/global/BaseOverflowButton.vue";
import { useUserApi } from "~/composables/api";
import { SupportedMigrations } from "~/lib/api/types/group";
import type { SupportedMigrations } from "~/lib/api/types/group";
const MIGRATIONS = {
mealie: "mealie_alpha",
@ -86,10 +111,15 @@ const MIGRATIONS = {
tandoor: "tandoor",
};
export default defineComponent({
middleware: ["auth", "advanced-only"],
export default defineNuxtComponent({
middleware: ["sidebase-auth", "advanced-only"],
setup() {
const { $globals, i18n } = useContext();
const i18n = useI18n();
const { $globals } = useNuxtApp();
useSeoMeta({
title: i18n.t("settings.migrations"),
});
const api = useUserApi();
@ -104,46 +134,46 @@ export default defineComponent({
const items: MenuItem[] = [
{
text: i18n.tc("migration.mealie-pre-v1.title"),
text: i18n.t("migration.mealie-pre-v1.title"),
value: MIGRATIONS.mealie,
divider: true,
},
{
text: i18n.tc("migration.chowdown.title"),
text: i18n.t("migration.chowdown.title"),
value: MIGRATIONS.chowdown,
},
{
text: i18n.tc("migration.copymethat.title"),
text: i18n.t("migration.copymethat.title"),
value: MIGRATIONS.copymethat,
},
{
text: i18n.tc("migration.myrecipebox.title"),
text: i18n.t("migration.myrecipebox.title"),
value: MIGRATIONS.myrecipebox,
},
{
text: i18n.tc("migration.nextcloud.title"),
text: i18n.t("migration.nextcloud.title"),
value: MIGRATIONS.nextcloud,
},
{
text: i18n.tc("migration.paprika.title"),
text: i18n.t("migration.paprika.title"),
value: MIGRATIONS.paprika,
},
{
text: i18n.tc("migration.plantoeat.title"),
text: i18n.t("migration.plantoeat.title"),
value: MIGRATIONS.plantoeat,
},
{
text: i18n.tc("migration.recipekeeper.title"),
text: i18n.t("migration.recipekeeper.title"),
value: MIGRATIONS.recipekeeper,
},
{
text: i18n.tc("migration.tandoor.title"),
text: i18n.t("migration.tandoor.title"),
value: MIGRATIONS.tandoor,
},
];
const _content = {
[MIGRATIONS.mealie]: {
text: i18n.tc("migration.mealie-pre-v1.description-long"),
text: i18n.t("migration.mealie-pre-v1.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -199,7 +229,7 @@ export default defineComponent({
],
},
[MIGRATIONS.chowdown]: {
text: i18n.tc("migration.chowdown.description-long"),
text: i18n.t("migration.chowdown.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -232,7 +262,7 @@ export default defineComponent({
],
},
[MIGRATIONS.copymethat]: {
text: i18n.tc("migration.copymethat.description-long"),
text: i18n.t("migration.copymethat.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -250,18 +280,18 @@ export default defineComponent({
{ id: 5, name: "recipe_3_j75qg.jpg", icon: $globals.icons.fileImage },
],
},
{ id: 6, name: "recipes.html", icon: $globals.icons.codeJson }
]
}
{ id: 6, name: "recipes.html", icon: $globals.icons.codeJson },
],
},
],
},
[MIGRATIONS.myrecipebox]: {
text: i18n.tc("migration.myrecipebox.description-long"),
text: i18n.t("migration.myrecipebox.description-long"),
acceptedFileType: ".csv",
tree: false,
},
[MIGRATIONS.nextcloud]: {
text: i18n.tc("migration.nextcloud.description-long"),
text: i18n.t("migration.nextcloud.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -294,12 +324,12 @@ export default defineComponent({
],
},
[MIGRATIONS.paprika]: {
text: i18n.tc("migration.paprika.description-long"),
text: i18n.t("migration.paprika.description-long"),
acceptedFileType: ".zip",
tree: false,
},
[MIGRATIONS.plantoeat]: {
text: i18n.tc("migration.plantoeat.description-long"),
text: i18n.t("migration.plantoeat.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -307,13 +337,13 @@ export default defineComponent({
icon: $globals.icons.zip,
name: "plantoeat-recipes-508318_10-13-2023.zip",
children: [
{ id: 9, name: "plantoeat-recipes-508318_10-13-2023.csv", icon: $globals.icons.codeJson },
{ id: 9, name: "plantoeat-recipes-508318_10-13-2023.csv", icon: $globals.icons.codeJson },
],
}
},
],
},
[MIGRATIONS.recipekeeper]: {
text: i18n.tc("migration.recipekeeper.description-long"),
text: i18n.t("migration.recipekeeper.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -321,19 +351,20 @@ export default defineComponent({
icon: $globals.icons.zip,
name: "recipekeeperhtml.zip",
children: [
{ id: 2, name: "recipes.html", icon: $globals.icons.codeJson },
{ id: 3, name: "images", icon: $globals.icons.folderOutline,
children: [
{ id: 4, name: "image1.jpg", icon: $globals.icons.fileImage },
{ id: 5, name: "image2.jpg", icon: $globals.icons.fileImage },
]
},
{ id: 2, name: "recipes.html", icon: $globals.icons.codeJson },
{
id: 3, name: "images", icon: $globals.icons.folderOutline,
children: [
{ id: 4, name: "image1.jpg", icon: $globals.icons.fileImage },
{ id: 5, name: "image2.jpg", icon: $globals.icons.fileImage },
],
},
],
}
},
],
},
[MIGRATIONS.tandoor]: {
text: i18n.tc("migration.tandoor.description-long"),
text: i18n.t("migration.tandoor.description-long"),
acceptedFileType: ".zip",
tree: [
{
@ -348,7 +379,7 @@ export default defineComponent({
children: [
{ id: 3, name: "image.jpeg", icon: $globals.icons.fileImage },
{ id: 4, name: "recipe.json", icon: $globals.icons.codeJson },
]
],
},
{
id: 5,
@ -357,7 +388,7 @@ export default defineComponent({
children: [
{ id: 6, name: "image.jpeg", icon: $globals.icons.fileImage },
{ id: 7, name: "recipe.json", icon: $globals.icons.codeJson },
]
],
},
{
id: 8,
@ -366,10 +397,10 @@ export default defineComponent({
children: [
{ id: 9, name: "image.jpeg", icon: $globals.icons.fileImage },
{ id: 10, name: "recipe.json", icon: $globals.icons.codeJson },
]
}
]
}
],
},
],
},
],
},
};
@ -417,7 +448,8 @@ export default defineComponent({
if (data) {
return data;
} else {
}
else {
return {
text: "",
acceptedFileType: ".zip",
@ -436,11 +468,6 @@ export default defineComponent({
getMigrationReports,
};
},
head() {
return {
title: this.$tc("settings.migrations"),
};
},
});
</script>