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", "choose-migration-type": "Choose Migration Type",
"tag-all-recipes": "Tag all recipes with {tag-name} tag", "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.", "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-1": "Recipe 1",
"recipe-2": "Recipe 2", "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.", "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": { "plantoeat": {
"title": "Plan to Eat", "title": "Plan to Eat",
"description-long": "Mealie can import recipies from 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": { "new-recipe": {

View File

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