1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 03:55:22 +02:00

feat: Paprika/Mealie Migration support (#873)

* feat:  paprika support - partial

* feat:  add full paprika support

* re-organize data directory

* add data directory auto-gen

* rewrite migration tests

* remove print statements

* remove hard-coded paths

* add auto-tag support

* add mealie migration support

* add looking for migraiton button
This commit is contained in:
Hayden 2021-12-09 19:52:53 -09:00 committed by GitHub
parent 5839992c19
commit 8d77f4b31e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 718 additions and 4056 deletions

View file

@ -42,6 +42,14 @@
{{ fileObject.name || "No file selected" }}
</v-card-text>
<v-card-text>
<v-checkbox v-model="addMigrationTag">
<template #label>
Tag all recipes with <b class="mx-1"> {{ migrationType }} </b> tag
</template>
</v-checkbox>
</v-card-text>
<v-card-actions class="justify-end">
<BaseButton :disabled="!fileObject.name" submit @click="startMigration">
{{ $t("general.submit") }}</BaseButton
@ -65,6 +73,8 @@ import { useUserApi } from "~/composables/api";
const MIGRATIONS = {
nextcloud: "nextcloud",
chowdown: "chowdown",
paprika: "paprika",
mealie: "mealie_alpha",
};
export default defineComponent({
@ -75,6 +85,7 @@ export default defineComponent({
const api = useUserApi();
const state = reactive({
addMigrationTag: false,
loading: false,
treeState: true,
migrationType: MIGRATIONS.nextcloud as SupportedMigration,
@ -91,6 +102,14 @@ export default defineComponent({
text: "Chowdown",
value: MIGRATIONS.chowdown,
},
{
text: "Paprika",
value: MIGRATIONS.paprika,
},
{
text: "Mealie",
value: MIGRATIONS.mealie,
},
];
const _content = {
@ -128,8 +147,95 @@ export default defineComponent({
},
[MIGRATIONS.chowdown]: {
text: "Mealie natively supports the chowdown repository format. Download the code repository as a .zip file and upload it below",
tree: [
{
id: 1,
icon: $globals.icons.zip,
name: "nextcloud.zip",
children: [
{
id: 2,
name: "Recipe 1",
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: "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: "Mealie can import recipes from the Paprika application. Export your recipes from paprika, rename the export extension to .zip and upload it below.",
tree: false,
},
[MIGRATIONS.mealie]: {
text: "Mealie can import recipes from the Mealie application from a pre v1.0 release. Export your recipes from your old instance, and upload the zip file below. Note that only recipes can be imported from the export.",
tree: [
{
id: 1,
icon: $globals.icons.zip,
name: "mealie.zip",
children: [
{
id: 2,
name: "recipes",
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 },
],
},
],
},
],
},
],
},
],
},
};
function setFileObject(fileObject: File) {
@ -139,6 +245,7 @@ export default defineComponent({
async function startMigration() {
state.loading = true;
const payload = {
addMigrationTag: state.addMigrationTag,
migrationType: state.migrationType,
archive: state.fileObject,
};