chore(i18n): updated translations
This commit is contained in:
@@ -59,10 +59,8 @@
|
||||
<template #body>
|
||||
<div class="flex flex-col px-2 space-y-2">
|
||||
<SmartItem
|
||||
v-tippy="{ theme: 'tooltip' }"
|
||||
:title="t('action.preserve_current')"
|
||||
svg="folder-plus"
|
||||
:label="t('import.json')"
|
||||
:label="t('import.from_json')"
|
||||
@click.native="openDialogChooseFileToImportFrom"
|
||||
/>
|
||||
<input
|
||||
@@ -72,20 +70,6 @@
|
||||
accept="application/json"
|
||||
@change="importFromJSON"
|
||||
/>
|
||||
<SmartItem
|
||||
v-tippy="{ theme: 'tooltip' }"
|
||||
:title="t('action.replace_current')"
|
||||
svg="file"
|
||||
:label="t('action.replace_json')"
|
||||
@click.native="openDialogChooseFileToReplaceWith"
|
||||
/>
|
||||
<input
|
||||
ref="inputChooseFileToReplaceWith"
|
||||
class="input"
|
||||
type="file"
|
||||
accept="application/json"
|
||||
@change="replaceWithJSON"
|
||||
/>
|
||||
<hr />
|
||||
<SmartItem
|
||||
v-tippy="{ theme: 'tooltip' }"
|
||||
@@ -131,7 +115,6 @@ const currentUser = useReadonlyStream(currentUser$, null)
|
||||
|
||||
// Template refs
|
||||
const options = ref<any>()
|
||||
const inputChooseFileToReplaceWith = ref<HTMLInputElement>()
|
||||
const inputChooseFileToImportFrom = ref<HTMLInputElement>()
|
||||
|
||||
const environmentJson = computed(() => {
|
||||
@@ -211,56 +194,11 @@ const hideModal = () => {
|
||||
emit("hide-modal")
|
||||
}
|
||||
|
||||
const openDialogChooseFileToReplaceWith = () => {
|
||||
if (inputChooseFileToReplaceWith.value)
|
||||
inputChooseFileToReplaceWith.value.click()
|
||||
}
|
||||
|
||||
const openDialogChooseFileToImportFrom = () => {
|
||||
if (inputChooseFileToImportFrom.value)
|
||||
inputChooseFileToImportFrom.value.click()
|
||||
}
|
||||
|
||||
const replaceWithJSON = () => {
|
||||
if (!inputChooseFileToReplaceWith.value) return
|
||||
|
||||
if (
|
||||
!inputChooseFileToReplaceWith.value.files ||
|
||||
inputChooseFileToReplaceWith.value.files.length === 0
|
||||
) {
|
||||
toast.show(t("action.choose_file").toString())
|
||||
return
|
||||
}
|
||||
|
||||
const reader = new FileReader()
|
||||
|
||||
reader.onload = ({ target }) => {
|
||||
const content = target!.result as string | null
|
||||
|
||||
if (!content) {
|
||||
toast.show(t("action.choose_file").toString())
|
||||
return
|
||||
}
|
||||
|
||||
const environments = JSON.parse(content)
|
||||
|
||||
// TODO: File validation
|
||||
if (environments[0]) {
|
||||
const [name, variables] = Object.keys(environments[0])
|
||||
if (name === "name" && variables === "variables") {
|
||||
// Do nothing
|
||||
}
|
||||
} else {
|
||||
failedImport()
|
||||
}
|
||||
|
||||
replaceEnvironments(environments)
|
||||
fileImported()
|
||||
}
|
||||
reader.readAsText(inputChooseFileToReplaceWith.value.files[0])
|
||||
inputChooseFileToReplaceWith.value.value = ""
|
||||
}
|
||||
|
||||
const importFromJSON = () => {
|
||||
if (!inputChooseFileToImportFrom.value) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user