mirror of https://github.com/wg-easy/wg-easy
Browse Source
- rename: components - fix: label for & form child id - i18n french suppull/1397/head
committed by
Bernd Storath
9 changed files with 141 additions and 29 deletions
@ -0,0 +1,64 @@ |
|||
<template> |
|||
<div> |
|||
<p class="text-lg p-8 text-center"> |
|||
{{ $t('setup.messageSetupMigration') }} |
|||
</p> |
|||
<div> |
|||
<Label for="migration">{{ $t('setup.migration') }}</Label> |
|||
<input id="migration" type="file" @change="onChangeFile" /> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
import { FetchError } from 'ofetch'; |
|||
|
|||
// const setupStore = useSetupStore(); |
|||
const { t } = useI18n(); |
|||
|
|||
const emit = defineEmits(['validated']); |
|||
|
|||
const props = defineProps<{ |
|||
next: boolean; |
|||
}>(); |
|||
|
|||
const next = toRef(props, 'next'); |
|||
const backupFile = ref<null | File>(null); |
|||
|
|||
watch(next, async (newVal) => { |
|||
if (newVal) { |
|||
await sendFile(); |
|||
} |
|||
}); |
|||
|
|||
function onChangeFile(evt: Event) { |
|||
const target = evt.target as HTMLInputElement; |
|||
const file = target.files?.[0]; |
|||
|
|||
if (file) { |
|||
backupFile.value = file; |
|||
} |
|||
} |
|||
|
|||
async function sendFile() { |
|||
if (!backupFile.value) { |
|||
emit('validated', { |
|||
title: t('setup.requirements'), |
|||
message: t('setup.emptyFields'), |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
try { |
|||
// TODO: handle migration |
|||
emit('validated', null); |
|||
} catch (error) { |
|||
if (error instanceof FetchError) { |
|||
emit('validated', { |
|||
title: t('setup.requirements'), |
|||
message: error.data.message, |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,29 @@ |
|||
<template> |
|||
<div> |
|||
<p class="text-2xl pt-8 px-8 text-center"> |
|||
{{ $t('setup.messageWelcome.whatIs') }} |
|||
</p> |
|||
<p class="text-2xl pt-2 text-center text-red-600"> |
|||
{{ $t('setup.messageWelcome.warning') }} |
|||
</p> |
|||
<p class="text-2xl pt-3 text-center"> |
|||
{{ $t('setup.messageWelcome.next') }} |
|||
</p> |
|||
</div> |
|||
</template> |
|||
|
|||
<script setup lang="ts"> |
|||
const emit = defineEmits(['validated']); |
|||
|
|||
const props = defineProps<{ |
|||
next: boolean; |
|||
}>(); |
|||
|
|||
const next = toRef(props, 'next'); |
|||
|
|||
watch(next, (newVal) => { |
|||
if (newVal) { |
|||
emit('validated', null); |
|||
} |
|||
}); |
|||
</script> |
Loading…
Reference in new issue