diff options
Diffstat (limited to 'src/views/_sila/Overview/DateTime')
-rw-r--r-- | src/views/_sila/Overview/DateTime/DateTime.vue | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index 66871699..796a57ac 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -145,6 +145,9 @@ @blur="$v.form.ntp.firstAddress.$touch()" /> <b-form-invalid-feedback role="alert"> + <div v-if="!$v.form.ntp.firstAddress.pattern"> + {{ $t('global.form.invalidFormat') }} + </div> <div v-if="!$v.form.ntp.firstAddress.required"> {{ $t('global.form.fieldRequired') }} </div> @@ -161,9 +164,16 @@ <b-form-input id="input-ntp-2" v-model="form.ntp.secondAddress" + :state="getValidationState($v.form.ntp.secondAddress)" :disabled="manualOptionSelected" data-test-id="dateTime-input-ntpServer2" + @blur="$v.form.ntp.secondAddress.$touch()" /> + <b-form-invalid-feedback role="alert"> + <div v-if="!$v.form.ntp.secondAddress.pattern"> + {{ $t('global.form.invalidFormat') }} + </div> + </b-form-invalid-feedback> </b-input-group> </b-form-group> </b-col> @@ -176,9 +186,16 @@ <b-form-input id="input-ntp-3" v-model="form.ntp.thirdAddress" + :state="getValidationState($v.form.ntp.thirdAddress)" :disabled="manualOptionSelected" data-test-id="dateTime-input-ntpServer3" + @blur="$v.form.ntp.thirdAddress.$touch()" /> + <b-form-invalid-feedback role="alert"> + <div v-if="!$v.form.ntp.thirdAddress.pattern"> + {{ $t('global.form.invalidFormat') }} + </div> + </b-form-invalid-feedback> </b-input-group> </b-form-group> </b-col> @@ -208,13 +225,15 @@ import LoadingBarMixin, { } from '@/components/_sila/Mixins/LoadingBarMixin'; import LocalTimezoneLabelMixin from '@/components/_sila/Mixins/LocalTimezoneLabelMixin'; import VuelidateMixin from '@/components/_sila/Mixins/VuelidateMixin.js'; +import { + isoDateRegex, + isoTimeRegex, + isoNtpRegex, +} from '@/utilities/_sila/regexConstants'; import { mapState } from 'vuex'; import { requiredIf, helpers } from 'vuelidate/lib/validators'; -const isoDateRegex = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/; -const isoTimeRegex = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/; - export default { name: 'DateTime', components: { Alert, IconCalendar, PageTitle, PageSection }, @@ -264,6 +283,13 @@ export default { required: requiredIf(function () { return this.form.configurationSelected === 'ntp'; }), + pattern: helpers.regex('pattern', isoNtpRegex), + }, + secondAddress: { + pattern: helpers.regex('pattern', isoNtpRegex), + }, + thirdAddress: { + pattern: helpers.regex('pattern', isoNtpRegex), }, }, }, |