Add downloading a user data export
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
ef5be83064
commit
5063b56b4e
|
@ -57,7 +57,7 @@
|
||||||
@click.prevent.stop="downloadAttachment(a)"
|
@click.prevent.stop="downloadAttachment(a)"
|
||||||
v-tooltip="$t('task.attachment.downloadTooltip')"
|
v-tooltip="$t('task.attachment.downloadTooltip')"
|
||||||
>
|
>
|
||||||
{{ $t('task.attachment.download') }}
|
{{ $t('misc.download') }}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
@click.stop="copyUrl(a)"
|
@click.stop="copyUrl(a)"
|
||||||
|
|
|
@ -441,7 +441,8 @@
|
||||||
"saving": "Saving…",
|
"saving": "Saving…",
|
||||||
"saved": "Saved!",
|
"saved": "Saved!",
|
||||||
"default": "Default",
|
"default": "Default",
|
||||||
"close": "Close"
|
"close": "Close",
|
||||||
|
"download": "Download"
|
||||||
},
|
},
|
||||||
"input": {
|
"input": {
|
||||||
"resetColor": "Reset Color",
|
"resetColor": "Reset Color",
|
||||||
|
@ -572,7 +573,6 @@
|
||||||
"attachment": {
|
"attachment": {
|
||||||
"title": "Attachments",
|
"title": "Attachments",
|
||||||
"createdBy": "created {0} by {1}",
|
"createdBy": "created {0} by {1}",
|
||||||
"download": "Download",
|
|
||||||
"downloadTooltip": "Download this attachment",
|
"downloadTooltip": "Download this attachment",
|
||||||
"upload": "Upload attachment",
|
"upload": "Upload attachment",
|
||||||
"drop": "Drop files here to upload",
|
"drop": "Drop files here to upload",
|
||||||
|
|
|
@ -10,6 +10,7 @@ import About from '../views/About'
|
||||||
import LoginComponent from '../views/user/Login'
|
import LoginComponent from '../views/user/Login'
|
||||||
import RegisterComponent from '../views/user/Register'
|
import RegisterComponent from '../views/user/Register'
|
||||||
import OpenIdAuth from '../views/user/OpenIdAuth'
|
import OpenIdAuth from '../views/user/OpenIdAuth'
|
||||||
|
import DataExportDownload from '../views/user/DataExportDownload'
|
||||||
// Tasks
|
// Tasks
|
||||||
import ShowTasksInRangeComponent from '../views/tasks/ShowTasksInRange'
|
import ShowTasksInRangeComponent from '../views/tasks/ShowTasksInRange'
|
||||||
import LinkShareAuthComponent from '../views/sharing/LinkSharingAuth'
|
import LinkShareAuthComponent from '../views/sharing/LinkSharingAuth'
|
||||||
|
@ -149,6 +150,11 @@ export default new Router({
|
||||||
name: 'user.settings',
|
name: 'user.settings',
|
||||||
component: UserSettingsComponent,
|
component: UserSettingsComponent,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/user/export/download',
|
||||||
|
name: 'user.export.download',
|
||||||
|
component: DataExportDownload,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/share/:share/auth',
|
path: '/share/:share/auth',
|
||||||
name: 'link-share.auth',
|
name: 'link-share.auth',
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default class DataExportService extends AbstractService {
|
||||||
}
|
}
|
||||||
|
|
||||||
download(password) {
|
download(password) {
|
||||||
this.getBlobUrl('/user/export/download', 'POST', {password})
|
return this.getBlobUrl('/user/export/download', 'POST', {password})
|
||||||
.then(url => downloadBlob(url, 'vikunja-export.zip'))
|
.then(url => downloadBlob(url, 'vikunja-export.zip'))
|
||||||
}
|
}
|
||||||
}
|
}
|
64
src/views/user/DataExportDownload.vue
Normal file
64
src/views/user/DataExportDownload.vue
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<template>
|
||||||
|
<div class="content">
|
||||||
|
<h1>{{ $t('user.export.downloadTitle') }}</h1>
|
||||||
|
<p>{{ $t('user.export.descriptionPasswordRequired') }}</p>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="currentPasswordDataExport">
|
||||||
|
{{ $t('user.settings.currentPassword') }}
|
||||||
|
</label>
|
||||||
|
<div class="control">
|
||||||
|
<input
|
||||||
|
class="input"
|
||||||
|
:class="{'is-danger': errPasswordRequired}"
|
||||||
|
id="currentPasswordDataExport"
|
||||||
|
:placeholder="$t('user.settings.currentPasswordPlaceholder')"
|
||||||
|
type="password"
|
||||||
|
v-model="password"
|
||||||
|
@keyup="() => errPasswordRequired = password === ''"
|
||||||
|
ref="passwordInput"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p class="help is-danger" v-if="errPasswordRequired">
|
||||||
|
{{ $t('user.deletion.passwordRequired') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<x-button
|
||||||
|
v-focus
|
||||||
|
:loading="dataExportService.loading"
|
||||||
|
@click="download()"
|
||||||
|
class="mt-4">
|
||||||
|
{{ $t('misc.download') }}
|
||||||
|
</x-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import DataExportService from '../../services/dataExport'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'data-export-download',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataExportService: DataExportService,
|
||||||
|
password: '',
|
||||||
|
errPasswordRequired: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.dataExportService = new DataExportService()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
download() {
|
||||||
|
if (this.password === '') {
|
||||||
|
this.errPasswordRequired = true
|
||||||
|
this.$refs.passwordInput.focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dataExportService.download(this.password)
|
||||||
|
.catch(e => this.error(e))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
Reference in New Issue
Block a user