mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 05:25:26 +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:
parent
5839992c19
commit
8d77f4b31e
76 changed files with 718 additions and 4056 deletions
|
@ -3,9 +3,10 @@ import { ReportSummary } from "./group-reports";
|
|||
|
||||
const prefix = "/api";
|
||||
|
||||
export type SupportedMigration = "nextcloud" | "chowdown";
|
||||
export type SupportedMigration = "nextcloud" | "chowdown" | "mealie_alpha" | "paprika";
|
||||
|
||||
export interface MigrationPayload {
|
||||
addMigrationTag: boolean;
|
||||
migrationType: SupportedMigration;
|
||||
archive: File;
|
||||
}
|
||||
|
@ -17,6 +18,7 @@ const routes = {
|
|||
export class GroupMigrationApi extends BaseAPI {
|
||||
async startMigration(payload: MigrationPayload) {
|
||||
const form = new FormData();
|
||||
form.append("add_migration_tag", String(payload.addMigrationTag));
|
||||
form.append("migration_type", payload.migrationType);
|
||||
form.append("archive", payload.archive);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export default {
|
||||
mode: "universal",
|
||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||
head: {
|
||||
title: "Home",
|
||||
|
|
|
@ -306,6 +306,10 @@
|
|||
</v-card-actions>
|
||||
</section>
|
||||
</v-container>
|
||||
|
||||
<v-container v-if="$auth.user.advanced" class="narrow-container d-flex justify-end">
|
||||
<v-btn outlined rounded to="/user/group/data/migrations"> Looking For Migrations? </v-btn>
|
||||
</v-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue