Add Wunderlist migration #46

Merged
konrad merged 7 commits from feature/migration into master 2020-01-19 19:23:07 +00:00
2 changed files with 25 additions and 4 deletions
Showing only changes of commit d4fa8f7cf1 - Show all commits

View File

@ -2,11 +2,11 @@
<div class="content">
<h1>Import your data from Wunderlist to Vikunja</h1>
<p>Vikunja will import all folders, lists, tasks, notes, reminders and files you have access to.</p>
<template v-if="isMigrating === false">
<template v-if="isMigrating === false && message === ''">
<p>To authorize Vikunja to access your Wunderlist Account, click the button below.</p>
<a :href="authUrl" class="button is-primary" :class="{'is-loading': migrationService.loading}" :disabled="migrationService.loading">Get Started</a>
</template>
<div class="migration-in-progress-container" v-else>
<div class="migration-in-progress-container" v-else-if="isMigrating === true && message === ''">
<div class="migration-in-progress">
<img src="/images/migration/wunderlist.png" alt="Wunderlist Logo"/>
<div class="progress-dots">
@ -23,6 +23,14 @@
</div>
<p>Migration in progress, hang tight...</p>
</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>
@ -37,16 +45,19 @@
migrationService: WunderlistMigrationService,
authUrl: '',
isMigrating: false,
message: '',
wunderlistCode: '',
}
},
created() {
this.migrationService = new WunderlistMigrationService()
this.getAuthUrl()
this.message = ''
if(typeof this.$route.query.code !== 'undefined') {
this.isMigrating = true
this.wunderlistCode = this.$route.query.code
this.migrate()
}
},
methods: {
@ -60,6 +71,16 @@
})
},
migrate() {
this.migrationService.migrate({code: this.wunderlistCode})
.then(r => {
this.message = r.message
})
.catch(e => {
message.error(e, this)
})
.finally(() => {
this.isMigrating = false
})
},
},
}

View File

@ -14,7 +14,7 @@ export default class AbstractMigrationService extends AbstractService {
return this.get({})
}
migrate() {
return this.update({})
migrate(data) {
return this.update(data)
}
}