diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json
index 625ce4aa7..a16ff0959 100644
--- a/src/i18n/lang/en.json
+++ b/src/i18n/lang/en.json
@@ -6,6 +6,7 @@
"welcomeEvening": "Good Evening {username}!",
"lastViewed": "Last viewed",
"addToHomeScreen": "Add this app to your home screen for faster access and improved experience.",
+ "goToOverview": "Go to overview",
"project": {
"importText": "Import your projects and tasks from other services into Vikunja:",
"import": "Import your data into Vikunja"
@@ -424,7 +425,9 @@
"alreadyMigrated2": "Importing again is possible, but might create duplicates. Are you sure?",
"confirm": "I am sure, please start migrating now!",
"importUpload": "To import data from {name} into Vikunja, click the button below to select a file.",
- "upload": "Upload file"
+ "upload": "Upload file",
+ "migrationStartedWillReciveEmail": "Vikunja will now import your lists/projects, tasks, notes, reminders and files from {service}. As this will take a while, we will send you an email once done. You can close this window now.",
+ "migrationInProgress": "A migration is currently in progress. Please wait until it is done."
},
"label": {
"title": "Labels",
diff --git a/src/views/migrate/MigrationHandler.vue b/src/views/migrate/MigrationHandler.vue
index 7305e459d..d02b9e445 100644
--- a/src/views/migrate/MigrationHandler.vue
+++ b/src/views/migrate/MigrationHandler.vue
@@ -3,7 +3,7 @@
{{ $t('migrate.titleService', {name: migrator.name}) }}
{{ $t('migrate.descriptionDo') }}
-
+
{{ $t('migrate.importUpload', {name: migrator.name}) }}
@@ -46,21 +46,35 @@
{{ $t('migrate.inProgress') }}
-
+
- {{ $t('migrate.alreadyMigrated1', {name: migrator.name, date: formatDateLong(lastMigrationDate)}) }}
+ {{ $t('migrate.migrationInProgress') }}
+
+
{{ $t('home.goToOverview') }}
+
+
+
+ {{
+ $t('migrate.alreadyMigrated1', {name: migrator.name, date: formatDateLong(lastMigrationFinishedAt)})
+ }}
{{ $t('migrate.alreadyMigrated2') }}
{{ $t('migrate.confirm') }}
- {{ $t('misc.cancel') }}
+
+ {{ $t('misc.cancel') }}
+
-
+
{{ message }}
- {{ $t('misc.refresh') }}
+
+ {{ $t('migrate.migrationStartedWillReciveEmail', {service: migrator.name}) }}
+
+
+ {{ $t('home.goToOverview') }}
@@ -82,13 +96,13 @@ import {useI18n} from 'vue-i18n'
import Logo from '@/assets/logo.svg?component'
import Message from '@/components/misc/message.vue'
-import AbstractMigrationService, { type MigrationConfig } from '@/services/migrator/abstractMigration'
+import AbstractMigrationService, {type MigrationConfig} from '@/services/migrator/abstractMigration'
import AbstractMigrationFileService from '@/services/migrator/abstractMigrationFile'
import {formatDateLong} from '@/helpers/time/formatDate'
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
-import {MIGRATORS} from './migrators'
+import {MIGRATORS, Migrator} from './migrators'
import {useTitle} from '@/composables/useTitle'
import {useProjectStore} from '@/stores/projects'
@@ -104,11 +118,12 @@ const {t} = useI18n({useScope: 'global'})
const progressDotsCount = ref(PROGRESS_DOTS_COUNT)
const authUrl = ref('')
const isMigrating = ref(false)
-const lastMigrationDate = ref(null)
+const lastMigrationFinishedAt = ref(null)
+const lastMigrationStartedAt = ref(null)
const message = ref('')
const migratorAuthCode = ref('')
-const migrator = computed(() => MIGRATORS[props.service])
+const migrator = computed(() => MIGRATORS[props.service])
const migrationService = shallowReactive(new AbstractMigrationService(migrator.value.id))
const migrationFileService = shallowReactive(new AbstractMigrationFileService(migrator.value.id))
@@ -130,23 +145,32 @@ async function initMigration() {
if (!migratorAuthCode.value) {
return
}
- const {time} = await migrationService.getStatus()
- if (time) {
- lastMigrationDate.value = parseDateOrNull(time)
-
- if (lastMigrationDate.value) {
+ const {startedAt, finishedAt} = await migrationService.getStatus()
+ if (startedAt) {
+ lastMigrationStartedAt.value = parseDateOrNull(startedAt)
+ }
+ if (finishedAt) {
+ lastMigrationFinishedAt.value = parseDateOrNull(finishedAt)
+ if (lastMigrationFinishedAt.value) {
return
}
}
+
+ if (lastMigrationStartedAt.value && lastMigrationFinishedAt.value === null) {
+ // Migration already in progress
+ return
+ }
+
await migrate()
}
initMigration()
const uploadInput = ref(null)
+
async function migrate() {
isMigrating.value = true
- lastMigrationDate.value = null
+ lastMigrationFinishedAt.value = null
message.value = ''
let migrationConfig: MigrationConfig | File = {code: migratorAuthCode.value}