mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-04 03:27:05 -04:00
69 lines
2.0 KiB
Vue
69 lines
2.0 KiB
Vue
<template>
|
|
<section>
|
|
<h5>
|
|
<T>profile.backup.header</T>
|
|
</h5>
|
|
<ul class="list-inline">
|
|
<li class="list-inline-item">
|
|
<a
|
|
:href="exportLink"
|
|
:class="['btn btn-outline-primary', exportStarted ? 'disabled' : '']"
|
|
:aria-disabled="exportStarted"
|
|
@click="startExport"
|
|
>
|
|
<Icon v="cloud-download" />
|
|
<T>profile.backup.export.action</T>
|
|
</a>
|
|
</li>
|
|
<li class="list-inline-item">
|
|
<FileUploader
|
|
:url="importLink"
|
|
mime="application/gzip"
|
|
classes="btn btn-outline-primary"
|
|
@uploaded="importDone"
|
|
>
|
|
<Icon v="cloud-upload" />
|
|
<T>profile.backup.import.action</T>
|
|
</FileUploader>
|
|
</li>
|
|
</ul>
|
|
<div v-if="exportStarted" class="alert alert-success">
|
|
<Icon v="check-circle" />
|
|
<T>profile.backup.export.success</T>
|
|
</div>
|
|
<div v-if="importSuccessful" class="alert alert-success">
|
|
<Icon v="check-circle" />
|
|
<T>profile.backup.import.success</T>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
exportStarted: false,
|
|
importSuccessful: false,
|
|
};
|
|
},
|
|
computed: {
|
|
exportLink() {
|
|
return `${this.$config.public.baseUrl}/api/profile/export`;
|
|
},
|
|
importLink() {
|
|
return `${this.$config.public.baseUrl}/api/profile/import`;
|
|
},
|
|
},
|
|
methods: {
|
|
startExport() {
|
|
this.exportStarted = true;
|
|
setTimeout(() => this.exportStarted = false, 5000);
|
|
},
|
|
importDone() {
|
|
this.importSuccessful = true;
|
|
setTimeout(() => window.location.reload(), 3000);
|
|
},
|
|
},
|
|
};
|
|
</script>
|