2020-01-19 19:23:06 +00:00
|
|
|
<template>
|
|
|
|
<div class="content">
|
2020-05-24 13:31:27 +00:00
|
|
|
<h1>Import your data from {{ name }} to Vikunja</h1>
|
|
|
|
<p>Vikunja will import all lists, tasks, notes, reminders and files you have access to.</p>
|
2020-07-05 15:31:15 +00:00
|
|
|
<template v-if="isMigrating === false && message === '' && lastMigrationDate === null">
|
2020-05-24 13:31:27 +00:00
|
|
|
<p>To authorize Vikunja to access your {{ name }} Account, click the button below.</p>
|
2020-07-05 15:31:15 +00:00
|
|
|
<a
|
2020-09-05 20:35:52 +00:00
|
|
|
:class="{'is-loading': migrationService.loading}"
|
|
|
|
:disabled="migrationService.loading"
|
|
|
|
:href="authUrl"
|
|
|
|
class="button is-primary">
|
2020-07-05 15:31:15 +00:00
|
|
|
Get Started
|
|
|
|
</a>
|
2020-01-19 19:23:06 +00:00
|
|
|
</template>
|
2020-07-05 15:31:15 +00:00
|
|
|
<div
|
2020-09-05 20:35:52 +00:00
|
|
|
class="migration-in-progress-container"
|
|
|
|
v-else-if="isMigrating === true && message === '' && lastMigrationDate === null">
|
2020-01-19 19:23:06 +00:00
|
|
|
<div class="migration-in-progress">
|
2020-09-05 20:35:52 +00:00
|
|
|
<img :alt="name" :src="`/images/migration/${identifier}.png`"/>
|
2020-01-19 19:23:06 +00:00
|
|
|
<div class="progress-dots">
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
<span></span>
|
|
|
|
</div>
|
2020-09-05 20:35:52 +00:00
|
|
|
<img alt="Vikunja" src="/images/logo.svg">
|
2020-01-19 19:23:06 +00:00
|
|
|
</div>
|
2020-01-20 21:22:32 +00:00
|
|
|
<p>Importing in progress, hang tight...</p>
|
|
|
|
</div>
|
2020-05-24 13:49:58 +00:00
|
|
|
<div v-else-if="lastMigrationDate">
|
2020-01-20 21:22:32 +00:00
|
|
|
<p>
|
2020-05-24 13:49:58 +00:00
|
|
|
It looks like you've already imported your stuff from {{ name }} at {{ formatDate(lastMigrationDate) }}.<br/>
|
2020-01-20 21:22:32 +00:00
|
|
|
Importing again is possible, but might create duplicates.
|
|
|
|
Are you sure?
|
|
|
|
</p>
|
|
|
|
<div class="buttons">
|
2020-09-05 20:35:52 +00:00
|
|
|
<button @click="migrate" class="button is-primary">I am sure, please start migrating now!</button>
|
2020-01-20 21:22:32 +00:00
|
|
|
<router-link :to="{name: 'home'}" class="button is-danger is-outlined">Cancel</router-link>
|
|
|
|
</div>
|
2020-01-19 19:23:06 +00:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<div class="message is-primary">
|
|
|
|
<div class="message-body">
|
|
|
|
{{ message }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<router-link :to="{name: 'home'}" class="button is-primary">Refresh</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-09-05 20:35:52 +00:00
|
|
|
import AbstractMigrationService from '../../services/migrator/abstractMigrationService'
|
2020-01-19 19:23:06 +00:00
|
|
|
|
2020-09-05 20:35:52 +00:00
|
|
|
export default {
|
|
|
|
name: 'migration',
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
authUrl: '',
|
|
|
|
isMigrating: false,
|
|
|
|
lastMigrationDate: null,
|
|
|
|
message: '',
|
|
|
|
wunderlistCode: '',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2020-01-19 19:23:06 +00:00
|
|
|
},
|
2020-09-05 20:35:52 +00:00
|
|
|
identifier: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2020-05-24 13:31:27 +00:00
|
|
|
},
|
2020-09-05 20:35:52 +00:00
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.migrationService = new AbstractMigrationService(this.identifier)
|
|
|
|
this.getAuthUrl()
|
|
|
|
this.message = ''
|
2020-01-19 19:23:06 +00:00
|
|
|
|
2020-09-05 20:35:52 +00:00
|
|
|
if (typeof this.$route.query.code !== 'undefined') {
|
|
|
|
this.wunderlistCode = this.$route.query.code
|
|
|
|
this.migrationService.getStatus()
|
|
|
|
.then(r => {
|
|
|
|
if (r.time) {
|
|
|
|
this.lastMigrationDate = new Date(r.time)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.migrate()
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.error(e, this)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getAuthUrl() {
|
|
|
|
this.migrationService.getAuthUrl()
|
|
|
|
.then(r => {
|
|
|
|
this.authUrl = r.url
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.error(e, this)
|
|
|
|
})
|
2020-01-19 19:23:06 +00:00
|
|
|
},
|
2020-09-05 20:35:52 +00:00
|
|
|
migrate() {
|
|
|
|
this.isMigrating = true
|
|
|
|
this.lastMigrationDate = 0
|
|
|
|
this.migrationService.migrate({code: this.wunderlistCode})
|
|
|
|
.then(r => {
|
|
|
|
this.message = r.message
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
this.error(e, this)
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.isMigrating = false
|
|
|
|
})
|
2020-01-19 19:23:06 +00:00
|
|
|
},
|
2020-09-05 20:35:52 +00:00
|
|
|
},
|
|
|
|
}
|
2020-01-19 19:23:06 +00:00
|
|
|
</script>
|