| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <v-container> | 
					
						
							|  |  |  |     <BasePageTitle divider> | 
					
						
							|  |  |  |       <template #header> | 
					
						
							|  |  |  |         <v-img | 
					
						
							|  |  |  |           max-height="200" | 
					
						
							|  |  |  |           max-width="200" | 
					
						
							|  |  |  |           class="mb-2" | 
					
						
							|  |  |  |           :src="require('~/static/svgs/manage-data-migrations.svg')" | 
					
						
							|  |  |  |         ></v-img> | 
					
						
							|  |  |  |       </template> | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |       <template #title> {{ $t('migration.recipe-data-migrations') }}</template> | 
					
						
							|  |  |  |       {{ $t('migration.recipe-data-migrations-explanation') }} | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |     </BasePageTitle> | 
					
						
							|  |  |  |     <v-container> | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |       <BaseCardSectionTitle :title="$i18n.tc('migration.new-migration')"> </BaseCardSectionTitle> | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       <v-card outlined :loading="loading"> | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |         <v-card-title> {{ $t('migration.choose-migration-type') }} </v-card-title> | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         <v-card-text v-if="content" class="pb-0"> | 
					
						
							|  |  |  |           <div class="mb-2"> | 
					
						
							|  |  |  |             <BaseOverflowButton v-model="migrationType" mode="model" :items="items" /> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |           {{ content.text }} | 
					
						
							|  |  |  |           <v-treeview v-if="content.tree" dense :items="content.tree"> | 
					
						
							|  |  |  |             <template #prepend="{ item }"> | 
					
						
							|  |  |  |               <v-icon> {{ item.icon }}</v-icon> | 
					
						
							|  |  |  |             </template> | 
					
						
							|  |  |  |           </v-treeview> | 
					
						
							|  |  |  |         </v-card-text> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |         <v-card-title class="mt-0"> {{ $t('general.upload-file') }} </v-card-title> | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         <v-card-text> | 
					
						
							|  |  |  |           <AppButtonUpload | 
					
						
							|  |  |  |             accept=".zip" | 
					
						
							|  |  |  |             class="mb-2" | 
					
						
							|  |  |  |             :post="false" | 
					
						
							|  |  |  |             file-name="file" | 
					
						
							|  |  |  |             :text-btn="false" | 
					
						
							|  |  |  |             @uploaded="setFileObject" | 
					
						
							|  |  |  |           /> | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |           {{ fileObject.name || $i18n.tc('migration.no-file-selected') }} | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         </v-card-text> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         <v-card-text> | 
					
						
							|  |  |  |           <v-checkbox v-model="addMigrationTag"> | 
					
						
							|  |  |  |             <template #label> | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |           <i18n path="migration.tag-all-recipes"> | 
					
						
							|  |  |  |             <template #tag-name> | 
					
						
							|  |  |  |               <b class="mx-1"> {{ migrationType }} </b> | 
					
						
							|  |  |  |             </template> | 
					
						
							|  |  |  |           </i18n> | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |             </template> | 
					
						
							|  |  |  |           </v-checkbox> | 
					
						
							|  |  |  |         </v-card-text> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         <v-card-actions class="justify-end"> | 
					
						
							|  |  |  |           <BaseButton :disabled="!fileObject.name" submit @click="startMigration"> | 
					
						
							|  |  |  |             {{ $t("general.submit") }}</BaseButton | 
					
						
							|  |  |  |           > | 
					
						
							|  |  |  |         </v-card-actions> | 
					
						
							|  |  |  |       </v-card> | 
					
						
							|  |  |  |     </v-container> | 
					
						
							|  |  |  |     <v-container> | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |       <BaseCardSectionTitle :title="$i18n.tc('migration.previous-migrations')"> </BaseCardSectionTitle> | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       <ReportTable :items="reports" @delete="deleteReport" /> | 
					
						
							|  |  |  |     </v-container> | 
					
						
							|  |  |  |   </v-container> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							|  |  |  | import { defineComponent, reactive, toRefs, useContext, computed, onMounted } from "@nuxtjs/composition-api"; | 
					
						
							| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { ReportSummary } from "~/lib/api/types/reports"; | 
					
						
							| 
									
										
										
										
											2022-01-16 03:38:11 +01:00
										 |  |  | import { MenuItem } from "~/components/global/BaseOverflowButton.vue"; | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | import { useUserApi } from "~/composables/api"; | 
					
						
							| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | import { SupportedMigrations } from "~/lib/api/types/group"; | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  | const MIGRATIONS = { | 
					
						
							|  |  |  |   nextcloud: "nextcloud", | 
					
						
							|  |  |  |   chowdown: "chowdown", | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |   copymethat: "copymethat", | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |   paprika: "paprika", | 
					
						
							|  |  |  |   mealie: "mealie_alpha", | 
					
						
							| 
									
										
										
										
											2023-07-23 12:52:09 -05:00
										 |  |  |   tandoor: "tandoor", | 
					
						
							| 
									
										
										
										
											2023-10-15 16:01:07 -04:00
										 |  |  |   plantoeat: "plantoeat", | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default defineComponent({ | 
					
						
							| 
									
										
										
										
											2024-02-02 15:36:10 +00:00
										 |  |  |   middleware: ["auth", "advanced-only"], | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |   setup() { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |     const { $globals, i18n } = useContext(); | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | 
 | 
					
						
							|  |  |  |     const api = useUserApi(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const state = reactive({ | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |       addMigrationTag: false, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       loading: false, | 
					
						
							|  |  |  |       treeState: true, | 
					
						
							| 
									
										
										
										
											2022-05-21 21:22:02 +02:00
										 |  |  |       migrationType: MIGRATIONS.nextcloud as SupportedMigrations, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       fileObject: {} as File, | 
					
						
							|  |  |  |       reports: [] as ReportSummary[], | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-16 03:38:11 +01:00
										 |  |  |     const items: MenuItem[] = [ | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.nextcloud.title"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         value: MIGRATIONS.nextcloud, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.chowdown.title"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         value: MIGRATIONS.chowdown, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |       { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.copymethat.title"), | 
					
						
							|  |  |  |         value: MIGRATIONS.copymethat, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         text: i18n.tc("migration.paprika.title"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         value: MIGRATIONS.paprika, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.mealie-pre-v1.title"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         value: MIGRATIONS.mealie, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2023-07-23 12:52:09 -05:00
										 |  |  |       { | 
					
						
							|  |  |  |         text: i18n.tc("migration.tandoor.title"), | 
					
						
							|  |  |  |         value: MIGRATIONS.tandoor, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2023-10-15 16:01:07 -04:00
										 |  |  |       { | 
					
						
							|  |  |  |         text: i18n.tc("migration.plantoeat.title"), | 
					
						
							|  |  |  |         value: MIGRATIONS.plantoeat, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |     ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const _content = { | 
					
						
							|  |  |  |       [MIGRATIONS.nextcloud]: { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.nextcloud.description-long"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         tree: [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             id: 1, | 
					
						
							|  |  |  |             icon: $globals.icons.zip, | 
					
						
							|  |  |  |             name: "nextcloud.zip", | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 2, | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |                 name: i18n.t("migration.recipe-1"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |                 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, | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |                 name: i18n.t("migration.recipe-2"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |                 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.chowdown]: { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.chowdown.description-long"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         tree: [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             id: 1, | 
					
						
							|  |  |  |             icon: $globals.icons.zip, | 
					
						
							|  |  |  |             name: "nextcloud.zip", | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 2, | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |                 name: i18n.t("migration.recipe-1"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |                 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, | 
					
						
							| 
									
										
										
										
											2023-03-21 20:45:27 +01:00
										 |  |  |                 name: i18n.t("migration.recipe-2"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |                 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 }, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |       [MIGRATIONS.copymethat]: { | 
					
						
							|  |  |  |         text: i18n.tc("migration.copymethat.description-long"), | 
					
						
							|  |  |  |         tree: [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             id: 1, | 
					
						
							|  |  |  |             icon: $globals.icons.zip, | 
					
						
							|  |  |  |             name: "Copy_Me_That_20230306.zip", | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 2, | 
					
						
							|  |  |  |                 name: "images", | 
					
						
							|  |  |  |                 icon: $globals.icons.folderOutline, | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   { id: 3, name: "recipe_1_an5zy.jpg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                   { id: 4, name: "recipe_2_82el8.jpg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                   { id: 5, name: "recipe_3_j75qg.jpg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |               { id: 6, name: "recipes.html", icon: $globals.icons.codeJson } | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |       [MIGRATIONS.paprika]: { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.paprika.description-long"), | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         tree: false, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |       [MIGRATIONS.mealie]: { | 
					
						
							| 
									
										
										
										
											2023-03-12 15:37:24 -05:00
										 |  |  |         text: i18n.tc("migration.mealie-pre-v1.description-long"), | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         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 }, | 
					
						
							|  |  |  |                         ], | 
					
						
							|  |  |  |                       }, | 
					
						
							|  |  |  |                     ], | 
					
						
							|  |  |  |                   }, | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2023-07-23 12:52:09 -05:00
										 |  |  |       [MIGRATIONS.tandoor]: { | 
					
						
							|  |  |  |         text: i18n.tc("migration.tandoor.description-long"), | 
					
						
							|  |  |  |         tree: [ | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             id: 1, | 
					
						
							|  |  |  |             icon: $globals.icons.zip, | 
					
						
							|  |  |  |             name: "tandoor_default_export_full_2023-06-29.zip", | 
					
						
							|  |  |  |             children: [ | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 2, | 
					
						
							|  |  |  |                 name: "1.zip", | 
					
						
							|  |  |  |                 icon: $globals.icons.zip, | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   { id: 3, name: "image.jpeg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                   { id: 4, name: "recipe.json", icon: $globals.icons.codeJson }, | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 5, | 
					
						
							|  |  |  |                 name: "2.zip", | 
					
						
							|  |  |  |                 icon: $globals.icons.zip, | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   { id: 6, name: "image.jpeg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                   { id: 7, name: "recipe.json", icon: $globals.icons.codeJson }, | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |               }, | 
					
						
							|  |  |  |               { | 
					
						
							|  |  |  |                 id: 8, | 
					
						
							|  |  |  |                 name: "3.zip", | 
					
						
							|  |  |  |                 icon: $globals.icons.zip, | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   { id: 9, name: "image.jpeg", icon: $globals.icons.fileImage }, | 
					
						
							|  |  |  |                   { id: 10, name: "recipe.json", icon: $globals.icons.codeJson }, | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             ] | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2023-10-15 16:01:07 -04:00
										 |  |  |       [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 }, | 
					
						
							|  |  |  |             ], | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function setFileObject(fileObject: File) { | 
					
						
							|  |  |  |       state.fileObject = fileObject; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     async function startMigration() { | 
					
						
							|  |  |  |       state.loading = true; | 
					
						
							|  |  |  |       const payload = { | 
					
						
							| 
									
										
										
										
											2021-12-09 19:52:53 -09:00
										 |  |  |         addMigrationTag: state.addMigrationTag, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  |         migrationType: state.migrationType, | 
					
						
							|  |  |  |         archive: state.fileObject, | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       const { data } = await api.groupMigration.startMigration(payload); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       state.loading = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (data) { | 
					
						
							|  |  |  |         state.reports.unshift(data); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     async function getMigrationReports() { | 
					
						
							|  |  |  |       const { data } = await api.groupReports.getAll("migration"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (data) { | 
					
						
							|  |  |  |         state.reports = data; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     async function deleteReport(id: string) { | 
					
						
							|  |  |  |       await api.groupReports.deleteOne(id); | 
					
						
							|  |  |  |       getMigrationReports(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     onMounted(() => { | 
					
						
							|  |  |  |       getMigrationReports(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const content = computed(() => { | 
					
						
							|  |  |  |       const data = _content[state.migrationType]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (data) { | 
					
						
							|  |  |  |         return data; | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |           text: "", | 
					
						
							|  |  |  |           tree: false, | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       ...toRefs(state), | 
					
						
							|  |  |  |       items, | 
					
						
							|  |  |  |       content, | 
					
						
							|  |  |  |       setFileObject, | 
					
						
							|  |  |  |       deleteReport, | 
					
						
							|  |  |  |       startMigration, | 
					
						
							|  |  |  |       getMigrationReports, | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2023-10-26 15:26:14 +02:00
										 |  |  |   head() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       title: this.$tc("settings.migrations"), | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2021-11-26 22:37:06 -09:00
										 |  |  | }); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-22 11:51:07 -08:00
										 |  |  | <style lang="scss" scoped></style> |