mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 05:04:05 -08:00
fix(editor): Fix saving and connecting on LDAP setup form (#10163)
Co-authored-by: Ricardo Espinoza <ricardo@n8n.io>
This commit is contained in:
parent
e46341ac46
commit
30784fb76c
|
@ -64,6 +64,12 @@ function onValidate(name: string, isValid: boolean) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getValues() {
|
||||||
|
return { ...values };
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ getValues });
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
showValidationWarnings.value = true;
|
showValidationWarnings.value = true;
|
||||||
|
|
||||||
|
|
|
@ -84,28 +84,23 @@
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
prop="status"
|
prop="status"
|
||||||
:label="$locale.baseText('settings.ldap.synchronizationTable.column.status')"
|
:label="$locale.baseText('settings.ldap.synchronizationTable.column.status')"
|
||||||
>
|
/>
|
||||||
</ElTableColumn>
|
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
prop="endedAt"
|
prop="endedAt"
|
||||||
:label="$locale.baseText('settings.ldap.synchronizationTable.column.endedAt')"
|
:label="$locale.baseText('settings.ldap.synchronizationTable.column.endedAt')"
|
||||||
>
|
/>
|
||||||
</ElTableColumn>
|
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
prop="runMode"
|
prop="runMode"
|
||||||
:label="$locale.baseText('settings.ldap.synchronizationTable.column.runMode')"
|
:label="$locale.baseText('settings.ldap.synchronizationTable.column.runMode')"
|
||||||
>
|
/>
|
||||||
</ElTableColumn>
|
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
prop="runTime"
|
prop="runTime"
|
||||||
:label="$locale.baseText('settings.ldap.synchronizationTable.column.runTime')"
|
:label="$locale.baseText('settings.ldap.synchronizationTable.column.runTime')"
|
||||||
>
|
/>
|
||||||
</ElTableColumn>
|
|
||||||
<ElTableColumn
|
<ElTableColumn
|
||||||
prop="details"
|
prop="details"
|
||||||
:label="$locale.baseText('settings.ldap.synchronizationTable.column.details')"
|
:label="$locale.baseText('settings.ldap.synchronizationTable.column.details')"
|
||||||
>
|
/>
|
||||||
</ElTableColumn>
|
|
||||||
<template #empty>{{
|
<template #empty>{{
|
||||||
$locale.baseText('settings.ldap.synchronizationTable.empty.message')
|
$locale.baseText('settings.ldap.synchronizationTable.empty.message')
|
||||||
}}</template>
|
}}</template>
|
||||||
|
@ -197,13 +192,11 @@ type LDAPConfigForm = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type CellClassStyleMethodParams<T> = {
|
type CellClassStyleMethodParams<T> = {
|
||||||
data: {
|
|
||||||
row: T;
|
row: T;
|
||||||
rowIndex: number;
|
rowIndex: number;
|
||||||
column: TableColumnCtx<T>;
|
column: TableColumnCtx<T>;
|
||||||
columnIndex: number;
|
columnIndex: number;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'SettingsLdapView',
|
name: 'SettingsLdapView',
|
||||||
|
@ -253,8 +246,7 @@ export default defineComponent({
|
||||||
goToUpgrade() {
|
goToUpgrade() {
|
||||||
void this.uiStore.goToUpgrade('ldap', 'upgrade-ldap');
|
void this.uiStore.goToUpgrade('ldap', 'upgrade-ldap');
|
||||||
},
|
},
|
||||||
cellClassStyle({ data }: CellClassStyleMethodParams<TableRow>): CSSProperties {
|
cellClassStyle({ row, column }: CellClassStyleMethodParams<TableRow>): CSSProperties {
|
||||||
const { row, column } = data;
|
|
||||||
if (column.property === 'status') {
|
if (column.property === 'status') {
|
||||||
if (row.status === 'Success') {
|
if (row.status === 'Success') {
|
||||||
return { color: 'green' };
|
return { color: 'green' };
|
||||||
|
@ -302,34 +294,33 @@ export default defineComponent({
|
||||||
async onSubmit(): Promise<void> {
|
async onSubmit(): Promise<void> {
|
||||||
// We want to save all form values (incl. the hidden onces), so we are using
|
// We want to save all form values (incl. the hidden onces), so we are using
|
||||||
// `values` data prop of the `FormInputs` child component since they are all preserved there
|
// `values` data prop of the `FormInputs` child component since they are all preserved there
|
||||||
const formInputsRef = this.$refs.ldapConfigForm as { values: LDAPConfigForm };
|
const formInputsRef = this.$refs.ldapConfigForm as { getValues: () => LDAPConfigForm };
|
||||||
|
const formValues = formInputsRef.getValues();
|
||||||
|
|
||||||
if (!this.hasAnyChanges || !formInputsRef) {
|
if (!this.hasAnyChanges || !formInputsRef) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newConfiguration: ILdapConfig = {
|
const newConfiguration: ILdapConfig = {
|
||||||
loginEnabled: formInputsRef.values.loginEnabled,
|
loginEnabled: formValues.loginEnabled,
|
||||||
loginLabel: formInputsRef.values.loginLabel,
|
loginLabel: formValues.loginLabel,
|
||||||
connectionUrl: formInputsRef.values.serverAddress,
|
connectionUrl: formValues.serverAddress,
|
||||||
allowUnauthorizedCerts: formInputsRef.values.allowUnauthorizedCerts,
|
allowUnauthorizedCerts: formValues.allowUnauthorizedCerts,
|
||||||
connectionPort: +formInputsRef.values.port,
|
connectionPort: +formValues.port,
|
||||||
connectionSecurity: formInputsRef.values.connectionSecurity,
|
connectionSecurity: formValues.connectionSecurity,
|
||||||
baseDn: formInputsRef.values.baseDn,
|
baseDn: formValues.baseDn,
|
||||||
bindingAdminDn:
|
bindingAdminDn: formValues.bindingType === 'admin' ? formValues.adminDn : '',
|
||||||
formInputsRef.values.bindingType === 'admin' ? formInputsRef.values.adminDn : '',
|
bindingAdminPassword: formValues.bindingType === 'admin' ? formValues.adminPassword : '',
|
||||||
bindingAdminPassword:
|
emailAttribute: formValues.email,
|
||||||
formInputsRef.values.bindingType === 'admin' ? formInputsRef.values.adminPassword : '',
|
firstNameAttribute: formValues.firstName,
|
||||||
emailAttribute: formInputsRef.values.email,
|
lastNameAttribute: formValues.lastName,
|
||||||
firstNameAttribute: formInputsRef.values.firstName,
|
loginIdAttribute: formValues.loginId,
|
||||||
lastNameAttribute: formInputsRef.values.lastName,
|
ldapIdAttribute: formValues.ldapId,
|
||||||
loginIdAttribute: formInputsRef.values.loginId,
|
userFilter: formValues.userFilter,
|
||||||
ldapIdAttribute: formInputsRef.values.ldapId,
|
synchronizationEnabled: formValues.synchronizationEnabled,
|
||||||
userFilter: formInputsRef.values.userFilter,
|
synchronizationInterval: +formValues.synchronizationInterval,
|
||||||
synchronizationEnabled: formInputsRef.values.synchronizationEnabled,
|
searchPageSize: +formValues.pageSize,
|
||||||
synchronizationInterval: +formInputsRef.values.synchronizationInterval,
|
searchTimeout: +formValues.searchTimeout,
|
||||||
searchPageSize: +formInputsRef.values.pageSize,
|
|
||||||
searchTimeout: +formInputsRef.values.searchTimeout,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let saveForm = true;
|
let saveForm = true;
|
||||||
|
|
Loading…
Reference in a new issue