Files
mealie/frontend/src/components/Settings/Migration/index.vue

99 lines
2.4 KiB
Vue
Raw Normal View History

2021-01-01 16:51:55 -09:00
<template>
<div>
<SuccessFailureAlert
:title="$t('migration.migration-report')"
ref="report"
:failedHeader="$t('migration.failed-imports')"
:failed="failed"
:successHeader="$t('migration.successful-imports')"
:success="success"
/>
<v-card :loading="loading">
<v-card-title class="headline">
{{ $t("migration.recipe-migration") }}
</v-card-title>
<v-divider></v-divider>
</v-card>
2021-01-09 18:04:53 -09:00
<v-row dense>
<v-col
:sm="6"
:md="6"
:lg="4"
:xl="3"
v-for="migration in migrations"
:key="migration.title"
>
<MigrationCard
:title="migration.title"
:folder="migration.urlVariable"
:description="migration.description"
:available="migration.availableImports"
@refresh="getAvailableMigrations"
@imported="showReport"
/>
</v-col>
</v-row>
</div>
2021-01-01 16:51:55 -09:00
</template>
2021-01-09 18:04:53 -09:00
2021-01-01 16:51:55 -09:00
<script>
import MigrationCard from "./MigrationCard";
import SuccessFailureAlert from "../../UI/SuccessFailureAlert";
import api from "../../../api";
2021-01-01 16:51:55 -09:00
export default {
2021-01-09 18:04:53 -09:00
components: {
MigrationCard,
SuccessFailureAlert,
2021-01-09 18:04:53 -09:00
},
2021-01-01 16:51:55 -09:00
data() {
return {
loading: false,
success: [],
failed: [],
migrations: {
nextcloud: {
title: this.$t("migration.nextcloud.title"),
description: this.$t("migration.nextcloud.description"),
urlVariable: "nextcloud",
availableImports: [],
},
chowdown: {
title: this.$t("migration.chowdown.title"),
description: this.$t("migration.chowdown.description"),
urlVariable: "chowdown",
availableImports: [],
},
},
2021-01-01 16:51:55 -09:00
};
},
mounted() {
this.getAvailableMigrations();
},
2021-01-01 16:51:55 -09:00
methods: {
2021-01-09 18:04:53 -09:00
finished() {
2021-01-01 16:51:55 -09:00
this.loading = false;
2021-01-09 18:04:53 -09:00
this.$store.dispatch("requestRecentRecipes");
2021-01-01 16:51:55 -09:00
},
async getAvailableMigrations() {
let response = await api.migrations.getMigrations();
response.forEach(element => {
if (element.type === "nextcloud") {
this.migrations.nextcloud.availableImports = element.files;
} else if (element.type === "chowdown") {
this.migrations.chowdown.availableImports = element.files;
}
});
},
showReport(successful, failed) {
this.success = successful;
this.failed = failed;
this.$refs.report.open();
},
2021-01-01 16:51:55 -09:00
},
};
</script>
<style>
</style>