[enh] Improve UX in validation

This commit is contained in:
ljf 2021-09-13 02:36:16 +02:00
parent b9b0dd906f
commit abfd018a46
6 changed files with 9 additions and 8 deletions

View file

@ -46,12 +46,12 @@ export default {
computed: {
disabled () {
return this.validation ? this.validation.$invalid : false
return false // this.validation ? this.validation.$invalid : false
},
errorFeedback () {
if (this.serverError) return this.serverError
else if (this.validation && this.validation.$invalid) {
return this.$t('invalid_form')
else if (this.validation && this.validation.$anyError) {
return this.$i18n.t('form_errors.invalid_form')
} else return ''
}
},

View file

@ -2,7 +2,8 @@
<b-alert :variant="type" show>
<icon :iname="icon_" />
<vue-showdown :markdown="label" flavor="github"
tag="span" class="markdown" />
tag="span" class="markdown"
/>
</b-alert>
</template>

View file

@ -100,7 +100,7 @@ export function formatYunoHostArgument (arg) {
if (!isNaN(parseInt(arg.max))) {
validation.maxValue = validators.maxValue(parseInt(arg.max))
}
validation.numValue = validators.numeric
validation.numValue = validators.helpers.regex('Please provide an integer', new RegExp('^-?[0-9]+$'))
}
},
{

View file

@ -183,7 +183,8 @@
"passwordMatch": "Passwords don't match.",
"required": "Field is required.",
"remote": "{message}",
"pattern": "{type}"
"pattern": "{type}",
"invalid_form": "The form contains some errors."
},
"form_input_example": "Example: {example}",
"from_to": "from {0} to {1}",

View file

@ -26,7 +26,6 @@
<icon iname="download" /> {{ $t('users_export') }}
</b-dropdown-item>
</b-dropdown>
</template>
<b-list-group>