Page MenuHomePhorge

No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None
diff --git a/src/components/exporter/exporter.js b/src/components/exporter/exporter.js
index 51912ac3ef..fc75372e35 100644
--- a/src/components/exporter/exporter.js
+++ b/src/components/exporter/exporter.js
@@ -1,55 +1,45 @@
import { library } from '@fortawesome/fontawesome-svg-core'
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons'
library.add(
faCircleNotch
)
const Exporter = {
props: {
getContent: {
type: Function,
required: true
},
filename: {
type: String,
default: 'export.csv'
},
- exportButtonLabel: {
- type: String,
- default () {
- return this.$t('exporter.export')
- }
- },
- processingMessage: {
- type: String,
- default () {
- return this.$t('exporter.processing')
- }
- }
+ exportButtonLabel: { type: String },
+ processingMessage: { type: String }
},
data () {
return {
processing: false
}
},
methods: {
process () {
this.processing = true
this.getContent()
.then((content) => {
const fileToDownload = document.createElement('a')
fileToDownload.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(content))
fileToDownload.setAttribute('download', this.filename)
fileToDownload.style.display = 'none'
document.body.appendChild(fileToDownload)
fileToDownload.click()
document.body.removeChild(fileToDownload)
// Add delay before hiding processing state since browser takes some time to handle file download
setTimeout(() => { this.processing = false }, 2000)
})
}
}
}
export default Exporter
diff --git a/src/components/exporter/exporter.vue b/src/components/exporter/exporter.vue
index d6a030880e..79defdf6f7 100644
--- a/src/components/exporter/exporter.vue
+++ b/src/components/exporter/exporter.vue
@@ -1,30 +1,30 @@
<template>
<div class="exporter">
<div v-if="processing">
<FAIcon
icon="circle-notch"
size="lg"
spin
/>
- <span>{{ processingMessage }}</span>
+ <span>{{ processingMessage || $t('exporter.processing') }}</span>
</div>
<button
v-else
class="btn button-default"
@click="process"
>
- {{ exportButtonLabel }}
+ {{ exportButtonLabel || $t('exporter.export') }}
</button>
</div>
</template>
<script src="./exporter.js"></script>
<style lang="scss">
.exporter {
&-processing {
margin: 0.25em;
}
}
</style>
diff --git a/src/components/importer/importer.js b/src/components/importer/importer.js
index 59f9beb141..da86a223c4 100644
--- a/src/components/importer/importer.js
+++ b/src/components/importer/importer.js
@@ -1,64 +1,49 @@
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faCircleNotch,
faTimes
} from '@fortawesome/free-solid-svg-icons'
library.add(
faCircleNotch,
faTimes
)
const Importer = {
props: {
submitHandler: {
type: Function,
required: true
},
- submitButtonLabel: {
- type: String,
- default () {
- return this.$t('importer.submit')
- }
- },
- successMessage: {
- type: String,
- default () {
- return this.$t('importer.success')
- }
- },
- errorMessage: {
- type: String,
- default () {
- return this.$t('importer.error')
- }
- }
+ submitButtonLabel: { type: String },
+ successMessage: { type: String },
+ errorMessage: { type: String }
},
data () {
return {
file: null,
error: false,
success: false,
submitting: false
}
},
methods: {
change () {
this.file = this.$refs.input.files[0]
},
submit () {
this.dismiss()
this.submitting = true
this.submitHandler(this.file)
.then(() => { this.success = true })
.catch(() => { this.error = true })
.finally(() => { this.submitting = false })
},
dismiss () {
this.success = false
this.error = false
}
}
}
export default Importer
diff --git a/src/components/importer/importer.vue b/src/components/importer/importer.vue
index 210823f513..466e15b9de 100644
--- a/src/components/importer/importer.vue
+++ b/src/components/importer/importer.vue
@@ -1,49 +1,49 @@
<template>
<div class="importer">
<form>
<input
ref="input"
type="file"
@change="change"
>
</form>
<FAIcon
v-if="submitting"
class="importer-uploading"
spin
icon="circle-notch"
/>
<button
v-else
class="btn button-default"
@click="submit"
>
- {{ submitButtonLabel }}
+ {{ submitButtonLabel || $t('importer.submit') }}
</button>
<div v-if="success">
<FAIcon
icon="times"
@click="dismiss"
/>
- <p>{{ successMessage }}</p>
+ <p>{{ successMessage || $t('importer.success')}}</p>
</div>
<div v-else-if="error">
<FAIcon
icon="times"
@click="dismiss"
/>
- <p>{{ errorMessage }}</p>
+ <p>{{ errorMessage || $t('importer.error')}}</p>
</div>
</div>
</template>
<script src="./importer.js"></script>
<style lang="scss">
.importer {
&-uploading {
font-size: 1.5em;
margin: 0.25em;
}
}
</style>

File Metadata

Mime Type
text/x-diff
Expires
Sat, Aug 8, 6:02 PM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1723794
Default Alt Text
(5 KB)

Event Timeline