1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-22 07:42:36 +00:00
bramw_baserow/web-frontend/modules/builder/components/domain/CustomDomainForm.vue
2024-07-05 16:02:05 +00:00

66 lines
1.6 KiB
Vue

<template>
<form @submit.prevent="submit">
<FormGroup
small-label
required
:label="$t('customDomainForm.domainNameLabel')"
:error="
fieldHasErrors('domain_name') || Boolean(serverErrors.domain_name)
"
>
<FormInput
v-model="values.domain_name"
size="large"
@input="serverErrors.domain_name = null"
@blur="$v.values.domain_name.$touch()"
/>
<template #error>
<template v-if="$v.values.domain_name.$dirty">
<span v-if="!$v.values.domain_name.required">
{{ $t('error.requiredField') }}
</span>
<span v-if="!$v.values.domain_name.maxLength">
{{ $t('error.maxLength', { max: 255 }) }}
</span>
</template>
<div v-if="serverErrors.domain_name">
<span v-if="serverErrors.domain_name.code === 'invalid'">
{{ $t('domainForm.invalidDomain') }}
</span>
<span v-if="serverErrors.domain_name.code === 'unique'">
{{ $t('domainForm.notUniqueDomain') }}
</span>
</div>
</template>
</FormGroup>
</form>
</template>
<script>
import { required, maxLength } from 'vuelidate/lib/validators'
import domainForm from '@baserow/modules/builder/mixins/domainForm'
export default {
name: 'CustomDomainForm',
mixins: [domainForm],
data() {
return {
values: {
domain_name: '',
},
}
},
validations() {
return {
values: {
domain_name: {
required,
maxLength: maxLength(255),
},
},
}
},
}
</script>