Skip to content

Commit

Permalink
BC-5506: fix ldap sections v-model
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Oct 17, 2023
1 parent 43edc90 commit 7224770
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 68 deletions.
32 changes: 17 additions & 15 deletions src/components/organisms/Ldap/LdapClassesSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
:placeholder="$t('pages.administration.ldap.classes.path.title')"
:label="$t('pages.administration.ldap.classes.path.title')"
:info="$t('pages.administration.ldap.classes.path.info')"
:validation-model="v$.value.classPath"
:validation-model="v$.modelValue.classPath"
:validation-messages="classPathValidationMessage"
datatest-id="ldapDataClassesclassPath"
@update:modelValue="$emit('input', { ...value, classPath: $event })"
@update:modelValue="$emit('input', { ...modelValue, classPath: $event })"
>
<template #icon>
<v-icon :color="classesActivatedColor">$mdiFileTreeOutline</v-icon>
Expand All @@ -36,15 +36,17 @@
</p>
<base-input
data-testid="ldapDataClassesNameAttribute"
:modelValue="value.nameAttribute"
:modelValue="modelValue.nameAttribute"
:disabled="checked === false"
type="text"
class="mt--xl"
:label="$t('pages.administration.ldap.classes.notice.title')"
:validation-model="v$.value.nameAttribute"
:validation-model="v$.modelValue.nameAttribute"
:validation-messages="classesValidationMessage"
datatest-id="ldapDataClassesNameAttribute"
@update:modelValue="$emit('input', { ...value, nameAttribute: $event })"
@update:modelValue="
$emit('input', { ...modelValue, nameAttribute: $event })
"
>
<template #icon>
<v-icon :color="classesActivatedColor" class="custom-icon"
Expand All @@ -54,16 +56,16 @@
</base-input>
<base-input
data-testid="ldapDataClassesNameparticipantAttribute"
:modelValue="value.participantAttribute"
:modelValue="modelValue.participantAttribute"
:disabled="checked === false"
type="text"
class="mt--xl"
:label="$t('pages.administration.ldap.classes.participant.title')"
:validation-model="v$.value.participantAttribute"
:validation-model="v$.modelValue.participantAttribute"
:validation-messages="classesValidationMessage"
datatest-id="ldapDataClassesParticipantsAttribute"
@update:modelValue="
$emit('input', { ...value, participantAttribute: $event })
$emit('input', { ...modelValue, participantAttribute: $event })
"
>
<template #icon>
Expand All @@ -84,7 +86,7 @@ export default defineComponent({
return { v$: useVuelidate() };
},
props: {
value: {
modelValue: {
type: Object,
default() {
return {};
Expand Down Expand Up @@ -115,10 +117,10 @@ export default defineComponent({
if (this.checked === false) {
return "";
}
return this.value.classPath;
return this.modelValue.classPath;
},
classPathChanged() {
return this.value.classPath;
return this.modelValue.classPath;
},
},
watch: {
Expand All @@ -136,16 +138,16 @@ export default defineComponent({
}
},
classPathChanged: function () {
this.checked = !!this.value.classPath;
this.checked = !!this.modelValue.classPath;
},
},
beforeMount() {
if (this.value.classPath) this.checked = true;
if (this.modelValue.classPath) this.checked = true;
},
validations() {
if (this.checked === true) {
return {
value: {
modelValue: {
classPath: {
required,
ldapPathRegexValidator: ldapPathRegexValidator,
Expand All @@ -156,7 +158,7 @@ export default defineComponent({
};
}
return {
value: {},
modelValue: {},
};
},
});
Expand Down
28 changes: 14 additions & 14 deletions src/components/organisms/Ldap/LdapConnectionSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,65 @@

<base-input
data-testid="ldapDataConnectionUrl"
:modelValue="value.url"
:modelValue="modelValue.url"
type="text"
class="mt--xl"
:label="$t('pages.administration.ldap.connection.server.url')"
:placeholder="$t('pages.administration.ldap.connection.server.url')"
:info="$t('pages.administration.ldap.connection.server.info')"
:validation-model="v$.value.url"
:validation-model="v$.modelValue.url"
:validation-messages="urlValidationMessages"
@update:modelValue="$emit('input', { ...value, url: $event })"
@update:modelValue="$emit('input', { ...modelValue, url: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiDnsOutline</v-icon>
</template>
</base-input>
<base-input
data-testid="ldapDataConnectionBasisPath"
:modelValue="value.basisPath"
:modelValue="modelValue.basisPath"
type="text"
class="mt--xl"
:label="$t('pages.administration.ldap.connection.basis.path')"
:placeholder="$t('pages.administration.ldap.connection.basis.path')"
:info="$t('pages.administration.ldap.connection.basis.path.info')"
:validation-model="v$.value.basisPath"
:validation-model="v$.modelValue.basisPath"
:validation-messages="pathSearchValidationMessages"
@update:modelValue="$emit('input', { ...value, basisPath: $event })"
@update:modelValue="$emit('input', { ...modelValue, basisPath: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiFileTreeOutline</v-icon>
</template>
</base-input>
<base-input
data-testid="ldapDataConnectionSearchUser"
:modelValue="value.searchUser"
:modelValue="modelValue.searchUser"
type="text"
class="mt--xl"
:label="$t('pages.administration.ldap.connection.search.user')"
:placeholder="$t('pages.administration.ldap.connection.search.user')"
:info="$t('pages.administration.ldap.connection.search.user.info')"
:validation-model="v$.value.searchUser"
:validation-model="v$.modelValue.searchUser"
:validation-messages="pathSearchValidationMessages"
@update:modelValue="$emit('input', { ...value, searchUser: $event })"
@update:modelValue="$emit('input', { ...modelValue, searchUser: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiAccountCircleOutline</v-icon>
</template>
</base-input>
<base-input
data-testid="ldapDataConnectionSearchUserPassword"
:modelValue="value.searchUserPassword"
:modelValue="modelValue.searchUserPassword"
type="password"
class="mt--xl"
:label="$t('pages.administration.ldap.connection.search.user.password')"
:placeholder="
$t('pages.administration.ldap.connection.search.user.password')
"
:validation-model="v$.value.searchUserPassword"
:validation-model="v$.modelValue.searchUserPassword"
:validation-messages="passwordValidationMessages"
@update:modelValue="
$emit('input', { ...value, searchUserPassword: $event })
$emit('input', { ...modelValue, searchUserPassword: $event })
"
><template #icon>
<v-icon :color="fillColor">$mdiLockOutline</v-icon>
Expand All @@ -88,7 +88,7 @@ export default defineComponent({
return { v$: useVuelidate() };
},
props: {
value: {
modelValue: {
type: Object,
default() {
return {};
Expand Down Expand Up @@ -134,7 +134,7 @@ export default defineComponent({
},
validations() {
return {
value: {
modelValue: {
url: {
required,
ldapURLValidator: this.insecureLDAPURLAllowed
Expand Down
42 changes: 23 additions & 19 deletions src/components/organisms/Ldap/LdapRolesSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
name="group"
style="margin-right: var(--space-sm)"
value="group"
@update:modelValue="$emit('input', { ...value, groupOption: $event })"
@update:modelValue="
$emit('input', { ...modelValue, groupOption: $event })
"
>
</base-input>
<base-input
Expand All @@ -29,89 +31,91 @@
"
name="group"
value="user_attribute"
@update:modelValue="$emit('input', { ...value, groupOption: $event })"
@update:modelValue="
$emit('input', { ...modelValue, groupOption: $event })
"
>
</base-input>
<p class="text-sm" style="margin-top: var(--space-xs)">
{{ $t("pages.administration.ldapEdit.roles.labels.radio.description") }}
</p>
</div>
<base-input
:modelValue="value.member"
:modelValue="modelValue.member"
:disabled="groupOption === 'group'"
type="text"
:label="$t('pages.administration.ldapEdit.roles.labels.member')"
:placeholder="
$t('pages.administration.ldapEdit.roles.placeholder.member')
"
style="margin-bottom: var(--space-xl)"
:validation-model="v$.value.member"
:validation-model="v$.modelValue.member"
:validation-messages="memberValidationMessages"
data-testid="ldapDataRolesMember"
@update:modelValue="$emit('input', { ...value, member: $event })"
@update:modelValue="$emit('input', { ...modelValue, member: $event })"
>
<template #icon>
<v-icon :color="ldapActivatedColor">$mdiAccountOutline</v-icon>
</template>
</base-input>
<base-input
:modelValue="value.student"
:modelValue="modelValue.student"
type="text"
v-bind="$attrs"
:label="$t('pages.administration.ldapEdit.roles.labels.student')"
:placeholder="
$t('pages.administration.ldapEdit.roles.placeholder.student')
"
:info="$t('pages.administration.ldapEdit.roles.info.student')"
:validation-model="v$.value.student"
:validation-model="v$.modelValue.student"
:validation-messages="rolesValidationMessages"
data-testid="ldapDataRolesStudent"
@update:modelValue="$emit('input', { ...value, student: $event })"
@update:modelValue="$emit('input', { ...modelValue, student: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiAccountSchoolOutline</v-icon>
</template>
</base-input>
<base-input
:modelValue="value.teacher"
:modelValue="modelValue.teacher"
type="text"
:label="$t('pages.administration.ldapEdit.roles.labels.teacher')"
:placeholder="
$t('pages.administration.ldapEdit.roles.placeholder.teacher')
"
:info="$t('pages.administration.ldapEdit.roles.info.teacher')"
:validation-model="v$.value.teacher"
:validation-model="v$.modelValue.teacher"
:validation-messages="rolesValidationMessages"
data-testid="ldapDataRolesTeacher"
@update:modelValue="$emit('input', { ...value, teacher: $event })"
@update:modelValue="$emit('input', { ...modelValue, teacher: $event })"
>
<template #icon>
<v-icon :color="fillColor" class="custom-icon">$teacher</v-icon>
</template>
</base-input>
<base-input
:modelValue="value.admin"
:modelValue="modelValue.admin"
type="text"
:label="$t('pages.administration.ldapEdit.roles.labels.admin')"
:placeholder="$t('pages.administration.ldapEdit.roles.placeholder.admin')"
:info="$t('pages.administration.ldapEdit.roles.info.admin')"
:validation-model="v$.value.admin"
:validation-model="v$.modelValue.admin"
:validation-messages="rolesValidationMessages"
data-testid="ldapDataRolesAdmin"
@update:modelValue="$emit('input', { ...value, admin: $event })"
@update:modelValue="$emit('input', { ...modelValue, admin: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiShieldAccountVariantOutline</v-icon>
</template>
</base-input>
<base-input
:modelValue="value.user"
:modelValue="modelValue.user"
type="text"
:label="$t('pages.administration.ldapEdit.roles.labels.user')"
:placeholder="$t('pages.administration.ldapEdit.roles.placeholder.user')"
:info="$t('pages.administration.ldapEdit.roles.info.user')"
data-testid="ldapDataRolesUser"
@update:modelValue="$emit('input', { ...value, user: $event })"
@update:modelValue="$emit('input', { ...modelValue, user: $event })"
>
<template #icon>
<v-icon :color="fillColor">$mdiAccountOffOutline</v-icon>
Expand All @@ -131,7 +135,7 @@ export default defineComponent({
return { v$: useVuelidate() };
},
props: {
value: {
modelValue: {
type: Object,
default() {
return {};
Expand All @@ -157,7 +161,7 @@ export default defineComponent({
},
computed: {
groupOption() {
return this.value.groupOption || "undefined";
return this.modelValue.groupOption || "undefined";
},
fillColor() {
Expand All @@ -180,7 +184,7 @@ export default defineComponent({
validations() {
if (this.groupOption === "group") {
return {
value: {
modelValue: {
member: { required },
student: { ldapPathRegexValidator },
teacher: { ldapPathRegexValidator },
Expand Down
Loading

0 comments on commit 7224770

Please sign in to comment.