added migration to frontend and cleaned up migration page

This commit is contained in:
Michael Genson 2024-03-21 16:11:33 +00:00
parent 95c15504d0
commit 7dcf2ca33d
2 changed files with 102 additions and 89 deletions

View File

@ -362,7 +362,7 @@
"choose-migration-type": "Choose Migration Type",
"tag-all-recipes": "Tag all recipes with {tag-name} tag",
"nextcloud-text": "Nextcloud recipes can be imported from a zip file that contains the data stored in Nextcloud. See the example folder structure below to ensure your recipes are able to be imported.",
"chowdown-text": "Mealie natively supports the chowdown repository format. Download the code repository as a .zip file and upload it below",
"chowdown-text": "Mealie natively supports the chowdown repository format. Download the code repository as a .zip file and upload it below.",
"recipe-1": "Recipe 1",
"recipe-2": "Recipe 2",
"paprika-text": "Mealie can import recipes from the Paprika application. Export your recipes from paprika, rename the export extension to .zip and upload it below.",
@ -370,6 +370,10 @@
"plantoeat": {
"title": "Plan to Eat",
"description-long": "Mealie can import recipies from Plan to Eat."
},
"myrecipebox" : {
"title": "My Recipe Box",
"description-long": "Mealie can import recipes from My Recipe Box. Export your recipes in CSV format, then upload the .csv file below."
}
},
"new-recipe": {

View File

@ -31,7 +31,7 @@
<v-card-title class="mt-0"> {{ $t('general.upload-file') }} </v-card-title>
<v-card-text>
<AppButtonUpload
accept=".zip"
accept=".zip,.csv"
class="mb-2"
:post="false"
file-name="file"
@ -75,13 +75,14 @@ import { useUserApi } from "~/composables/api";
import { SupportedMigrations } from "~/lib/api/types/group";
const MIGRATIONS = {
nextcloud: "nextcloud",
mealie: "mealie_alpha",
chowdown: "chowdown",
copymethat: "copymethat",
myrecipebox: "myrecipebox",
nextcloud: "nextcloud",
paprika: "paprika",
mealie: "mealie_alpha",
tandoor: "tandoor",
plantoeat: "plantoeat",
tandoor: "tandoor",
};
export default defineComponent({
@ -95,15 +96,16 @@ export default defineComponent({
addMigrationTag: false,
loading: false,
treeState: true,
migrationType: MIGRATIONS.nextcloud as SupportedMigrations,
migrationType: MIGRATIONS.mealie as SupportedMigrations,
fileObject: {} as File,
reports: [] as ReportSummary[],
});
const items: MenuItem[] = [
{
text: i18n.tc("migration.nextcloud.title"),
value: MIGRATIONS.nextcloud,
text: i18n.tc("migration.mealie-pre-v1.title"),
value: MIGRATIONS.mealie,
divider: true,
},
{
text: i18n.tc("migration.chowdown.title"),
@ -113,51 +115,77 @@ export default defineComponent({
text: i18n.tc("migration.copymethat.title"),
value: MIGRATIONS.copymethat,
},
{
text: i18n.tc("migration.myrecipebox.title"),
value: MIGRATIONS.myrecipebox,
},
{
text: i18n.tc("migration.nextcloud.title"),
value: MIGRATIONS.nextcloud,
},
{
text: i18n.tc("migration.paprika.title"),
value: MIGRATIONS.paprika,
},
{
text: i18n.tc("migration.mealie-pre-v1.title"),
value: MIGRATIONS.mealie,
},
{
text: i18n.tc("migration.tandoor.title"),
value: MIGRATIONS.tandoor,
},
{
text: i18n.tc("migration.plantoeat.title"),
value: MIGRATIONS.plantoeat,
},
{
text: i18n.tc("migration.tandoor.title"),
value: MIGRATIONS.tandoor,
},
];
const _content = {
[MIGRATIONS.nextcloud]: {
text: i18n.tc("migration.nextcloud.description-long"),
[MIGRATIONS.mealie]: {
text: i18n.tc("migration.mealie-pre-v1.description-long"),
tree: [
{
id: 1,
icon: $globals.icons.zip,
name: "nextcloud.zip",
name: "mealie.zip",
children: [
{
id: 2,
name: i18n.t("migration.recipe-1"),
name: "recipes",
icon: $globals.icons.folderOutline,
children: [
{ id: 3, name: "recipe.json", icon: $globals.icons.codeJson },
{ id: 4, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 5, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
{
id: 6,
name: i18n.t("migration.recipe-2"),
icon: $globals.icons.folderOutline,
children: [
{ id: 7, name: "recipe.json", icon: $globals.icons.codeJson },
{ id: 8, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 9, name: "thumb.jpg", icon: $globals.icons.fileImage },
{
id: 3,
name: "recipe-name",
icon: $globals.icons.folderOutline,
children: [
{ id: 4, name: "recipe-name.json", icon: $globals.icons.codeJson },
{
id: 5,
name: "images",
icon: $globals.icons.folderOutline,
children: [
{ id: 6, name: "original.webp", icon: $globals.icons.codeJson },
{ id: 7, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 8, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
],
},
{
id: 9,
name: "recipe-name-1",
icon: $globals.icons.folderOutline,
children: [
{ id: 10, name: "recipe-name-1.json", icon: $globals.icons.codeJson },
{
id: 11,
name: "images",
icon: $globals.icons.folderOutline,
children: [
{ id: 12, name: "original.webp", icon: $globals.icons.codeJson },
{ id: 13, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 14, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
],
},
],
},
],
@ -219,65 +247,59 @@ export default defineComponent({
}
],
},
[MIGRATIONS.paprika]: {
text: i18n.tc("migration.paprika.description-long"),
[MIGRATIONS.myrecipebox]: {
text: i18n.tc("migration.myrecipebox.description-long"),
tree: false,
},
[MIGRATIONS.mealie]: {
text: i18n.tc("migration.mealie-pre-v1.description-long"),
[MIGRATIONS.nextcloud]: {
text: i18n.tc("migration.nextcloud.description-long"),
tree: [
{
id: 1,
icon: $globals.icons.zip,
name: "mealie.zip",
name: "nextcloud.zip",
children: [
{
id: 2,
name: "recipes",
name: i18n.t("migration.recipe-1"),
icon: $globals.icons.folderOutline,
children: [
{
id: 3,
name: "recipe-name",
icon: $globals.icons.folderOutline,
children: [
{ id: 4, name: "recipe-name.json", icon: $globals.icons.codeJson },
{
id: 5,
name: "images",
icon: $globals.icons.folderOutline,
children: [
{ id: 6, name: "original.webp", icon: $globals.icons.codeJson },
{ id: 7, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 8, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
],
},
{
id: 9,
name: "recipe-name-1",
icon: $globals.icons.folderOutline,
children: [
{ id: 10, name: "recipe-name-1.json", icon: $globals.icons.codeJson },
{
id: 11,
name: "images",
icon: $globals.icons.folderOutline,
children: [
{ id: 12, name: "original.webp", icon: $globals.icons.codeJson },
{ id: 13, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 14, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
],
},
{ id: 3, name: "recipe.json", icon: $globals.icons.codeJson },
{ id: 4, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 5, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
{
id: 6,
name: i18n.t("migration.recipe-2"),
icon: $globals.icons.folderOutline,
children: [
{ id: 7, name: "recipe.json", icon: $globals.icons.codeJson },
{ id: 8, name: "full.jpg", icon: $globals.icons.fileImage },
{ id: 9, name: "thumb.jpg", icon: $globals.icons.fileImage },
],
},
],
},
],
},
[MIGRATIONS.paprika]: {
text: i18n.tc("migration.paprika.description-long"),
tree: false,
},
[MIGRATIONS.plantoeat]: {
text: i18n.tc("migration.plantoeat.description-long"),
tree: [
{
id: 1,
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 },
],
}
],
},
[MIGRATIONS.tandoor]: {
text: i18n.tc("migration.tandoor.description-long"),
tree: [
@ -317,19 +339,6 @@ export default defineComponent({
}
],
},
[MIGRATIONS.plantoeat]: {
text: i18n.tc("migration.plantoeat.description-long"),
tree: [
{
id: 1,
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 },
],
}
],
},
};
function setFileObject(fileObject: File) {