Vuelidate, I18n, and filter are upgraded to vue3
While navigating to the pages i18n, vuelidate, and filters errors
occurred. i18n, and vuelidate code changes in each page adapted to
vue3. Filter global function for date and time format implemented
in the main.js file and those files which as called the filter
functions.
Change-Id: If1a2ee22d47750faef1c35ef2c263299067d9a20
Signed-off-by: Surya Venkatesan <suryav@ami.com>
diff --git a/src/views/SecurityAndAccess/Ldap/Ldap.vue b/src/views/SecurityAndAccess/Ldap/Ldap.vue
index 28d2b1c..eab2737 100644
--- a/src/views/SecurityAndAccess/Ldap/Ldap.vue
+++ b/src/views/SecurityAndAccess/Ldap/Ldap.vue
@@ -44,7 +44,7 @@
:disabled="
!caCertificateExpiration || !ldapCertificateExpiration
"
- @change="$v.form.secureLdapEnabled.$touch()"
+ @change="v$.form.secureLdapEnabled.$touch()"
>
{{ $t('global.action.enable') }}
</b-form-checkbox>
@@ -52,12 +52,12 @@
<dl>
<dt>{{ $t('pageLdap.form.caCertificateValidUntil') }}</dt>
<dd v-if="caCertificateExpiration">
- {{ caCertificateExpiration }}
+ {{ $filters.formatDate(caCertificateExpiration) }}
</dd>
<dd v-else>--</dd>
<dt>{{ $t('pageLdap.form.ldapCertificateValidUntil') }}</dt>
<dd v-if="ldapCertificateExpiration">
- {{ ldapCertificateExpiration }}
+ {{ $filters.formatDate(ldapCertificateExpiration) }}
</dd>
<dd v-else>--</dd>
</dl>
@@ -105,8 +105,8 @@
id="server-uri"
v-model="form.serverUri"
data-test-id="ldap-input-serverUri"
- :state="getValidationState($v.form.serverUri)"
- @change="$v.form.serverUri.$touch()"
+ :state="getValidationState(v$.form.serverUri)"
+ @change="v$.form.serverUri.$touch()"
/>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.fieldRequired') }}
@@ -123,8 +123,8 @@
id="bind-dn"
v-model="form.bindDn"
data-test-id="ldap-input-bindDn"
- :state="getValidationState($v.form.bindDn)"
- @change="$v.form.bindDn.$touch()"
+ :state="getValidationState(v$.form.bindDn)"
+ @change="v$.form.bindDn.$touch()"
/>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.fieldRequired') }}
@@ -143,9 +143,9 @@
id="bind-password"
v-model="form.bindPassword"
type="password"
- :state="getValidationState($v.form.bindPassword)"
+ :state="getValidationState(v$.form.bindPassword)"
class="form-control-with-button"
- @change="$v.form.bindPassword.$touch()"
+ @change="v$.form.bindPassword.$touch()"
/>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.fieldRequired') }}
@@ -162,8 +162,8 @@
id="base-dn"
v-model="form.baseDn"
data-test-id="ldap-input-baseDn"
- :state="getValidationState($v.form.baseDn)"
- @change="$v.form.baseDn.$touch()"
+ :state="getValidationState(v$.form.baseDn)"
+ @change="v$.form.baseDn.$touch()"
/>
<b-form-invalid-feedback role="alert">
{{ $t('global.form.fieldRequired') }}
@@ -182,7 +182,7 @@
id="user-id-attribute"
v-model="form.userIdAttribute"
data-test-id="ldap-input-userIdAttribute"
- @change="$v.form.userIdAttribute.$touch()"
+ @change="v$.form.userIdAttribute.$touch()"
/>
</b-form-group>
</b-col>
@@ -198,7 +198,7 @@
id="group-id-attribute"
v-model="form.groupIdAttribute"
data-test-id="ldap-input-groupIdAttribute"
- @change="$v.form.groupIdAttribute.$touch()"
+ @change="v$.form.groupIdAttribute.$touch()"
/>
</b-form-group>
</b-col>
@@ -243,6 +243,7 @@
import PageSection from '@/components/Global/PageSection';
import InfoTooltip from '@/components/Global/InfoTooltip';
import TableRoleGroups from './TableRoleGroups';
+import { useI18n } from 'vue-i18n';
export default {
name: 'Ldap',
@@ -265,6 +266,7 @@
},
data() {
return {
+ $t: useI18n().t,
form: {
ldapAuthenticationEnabled: this.$store.getters['ldap/isServiceEnabled'],
secureLdapEnabled: false,
@@ -388,8 +390,8 @@
this.form.groupIdAttribute = groupsAttribute;
},
handleSubmit() {
- this.$v.$touch();
- if (this.$v.$invalid) return;
+ this.v$.$touch();
+ if (this.v$.$invalid) return;
const data = {
serviceEnabled: this.form.ldapAuthenticationEnabled,
activeDirectoryEnabled: this.form.activeDirectoryEnabled,
@@ -411,12 +413,12 @@
})
.finally(() => {
this.form.bindPassword = '';
- this.$v.form.$reset();
+ this.v$.form.$reset();
this.endLoader();
});
},
onChangeServiceType(isActiveDirectoryEnabled) {
- this.$v.form.activeDirectoryEnabled.$touch();
+ this.v$.form.activeDirectoryEnabled.$touch();
const serviceType = isActiveDirectoryEnabled
? this.activeDirectory
: this.ldap;
@@ -425,7 +427,7 @@
this.setFormValues(serviceType);
},
onChangeldapAuthenticationEnabled(isServiceEnabled) {
- this.$v.form.ldapAuthenticationEnabled.$touch();
+ this.v$.form.ldapAuthenticationEnabled.$touch();
if (!isServiceEnabled) {
// Request will fail if sent with empty values.
// The frontend only checks for required fields