mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Fix type errors in the SettingsLdapView.vue
(no-changelog) (#9308)
This commit is contained in:
parent
22b6f90950
commit
552cf8f3db
|
@ -57,6 +57,7 @@ export type IFormInput = {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
labelSize?: 'small' | 'medium' | 'large';
|
labelSize?: 'small' | 'medium' | 'large';
|
||||||
labelAlignment?: 'left' | 'right' | 'center';
|
labelAlignment?: 'left' | 'right' | 'center';
|
||||||
|
tooltipText?: string;
|
||||||
};
|
};
|
||||||
shouldDisplay?: (values: { [key: string]: unknown }) => boolean;
|
shouldDisplay?: (values: { [key: string]: unknown }) => boolean;
|
||||||
};
|
};
|
||||||
|
|
16
packages/editor-ui/src/v3-infinite-loading.d.ts
vendored
Normal file
16
packages/editor-ui/src/v3-infinite-loading.d.ts
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
declare module 'v3-infinite-loading' {
|
||||||
|
import { Plugin, DefineComponent } from 'vue';
|
||||||
|
|
||||||
|
interface InfiniteLoadingProps {
|
||||||
|
target: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Events {
|
||||||
|
infinite: (state: { loaded: () => void; complete: () => void }) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const InfiniteLoading: DefineComponent<InfiniteLoadingProps, {}, {}, {}, {}, {}, {}, Events> &
|
||||||
|
Plugin;
|
||||||
|
|
||||||
|
export default InfiniteLoading;
|
||||||
|
}
|
|
@ -138,6 +138,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import type { CSSProperties } from 'vue';
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { capitalizeFirstLetter } from '@/utils/htmlUtils';
|
import { capitalizeFirstLetter } from '@/utils/htmlUtils';
|
||||||
import { convertToDisplayDate } from '@/utils/typesUtils';
|
import { convertToDisplayDate } from '@/utils/typesUtils';
|
||||||
|
@ -155,16 +156,14 @@ import { MODAL_CONFIRM } from '@/constants';
|
||||||
|
|
||||||
import humanizeDuration from 'humanize-duration';
|
import humanizeDuration from 'humanize-duration';
|
||||||
import { ElTable, ElTableColumn } from 'element-plus';
|
import { ElTable, ElTableColumn } from 'element-plus';
|
||||||
|
import type { Events } from 'v3-infinite-loading';
|
||||||
import InfiniteLoading from 'v3-infinite-loading';
|
import InfiniteLoading from 'v3-infinite-loading';
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
import { useUsersStore } from '@/stores/users.store';
|
import { useUsersStore } from '@/stores/users.store';
|
||||||
import { useSettingsStore } from '@/stores/settings.store';
|
import { useSettingsStore } from '@/stores/settings.store';
|
||||||
import { useUIStore } from '@/stores/ui.store';
|
import { useUIStore } from '@/stores/ui.store';
|
||||||
import { createEventBus } from 'n8n-design-system/utils';
|
import { createEventBus } from 'n8n-design-system/utils';
|
||||||
import type { N8nFormInputs } from 'n8n-design-system';
|
import type { TableColumnCtx } from 'element-plus';
|
||||||
import type { CellStyle } from 'element-plus';
|
|
||||||
|
|
||||||
type N8nFormInputsRef = InstanceType<typeof N8nFormInputs>;
|
|
||||||
|
|
||||||
type TableRow = {
|
type TableRow = {
|
||||||
status: string;
|
status: string;
|
||||||
|
@ -174,6 +173,38 @@ type TableRow = {
|
||||||
runMode: string;
|
runMode: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type LDAPConfigForm = {
|
||||||
|
loginEnabled: boolean;
|
||||||
|
loginLabel: string;
|
||||||
|
serverAddress: string;
|
||||||
|
allowUnauthorizedCerts: boolean;
|
||||||
|
port: number;
|
||||||
|
connectionSecurity: string;
|
||||||
|
baseDn: string;
|
||||||
|
bindingType: 'admin' | 'anonymous';
|
||||||
|
adminDn: string;
|
||||||
|
adminPassword: string;
|
||||||
|
email: string;
|
||||||
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
|
loginId: string;
|
||||||
|
ldapId: string;
|
||||||
|
userFilter: string;
|
||||||
|
synchronizationEnabled: boolean;
|
||||||
|
synchronizationInterval: string;
|
||||||
|
pageSize: string;
|
||||||
|
searchTimeout: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type CellClassStyleMethodParams<T> = {
|
||||||
|
data: {
|
||||||
|
row: T;
|
||||||
|
rowIndex: number;
|
||||||
|
column: TableColumnCtx<T>;
|
||||||
|
columnIndex: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'SettingsLdapView',
|
name: 'SettingsLdapView',
|
||||||
components: {
|
components: {
|
||||||
|
@ -205,10 +236,6 @@ export default defineComponent({
|
||||||
syncEnabled: false,
|
syncEnabled: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async mounted() {
|
|
||||||
if (!this.isLDAPFeatureEnabled) return;
|
|
||||||
await this.getLdapConfig();
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUsersStore, useSettingsStore, useUIStore),
|
...mapStores(useUsersStore, useSettingsStore, useUIStore),
|
||||||
currentUser(): null | IUser {
|
currentUser(): null | IUser {
|
||||||
|
@ -218,11 +245,16 @@ export default defineComponent({
|
||||||
return this.settingsStore.settings.enterprise.ldap;
|
return this.settingsStore.settings.enterprise.ldap;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
async mounted() {
|
||||||
|
if (!this.isLDAPFeatureEnabled) return;
|
||||||
|
await this.getLdapConfig();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goToUpgrade() {
|
goToUpgrade() {
|
||||||
void this.uiStore.goToUpgrade('ldap', 'upgrade-ldap');
|
void this.uiStore.goToUpgrade('ldap', 'upgrade-ldap');
|
||||||
},
|
},
|
||||||
cellClassStyle({ row, column }: CellStyle<TableRow>) {
|
cellClassStyle({ data }: 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' };
|
||||||
|
@ -270,7 +302,8 @@ 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 N8nFormInputsRef | undefined;
|
const formInputsRef = this.$refs.ldapConfigForm as { values: LDAPConfigForm };
|
||||||
|
|
||||||
if (!this.hasAnyChanges || !formInputsRef) {
|
if (!this.hasAnyChanges || !formInputsRef) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -681,7 +714,7 @@ export default defineComponent({
|
||||||
this.showError(error, this.$locale.baseText('settings.ldap.configurationError'));
|
this.showError(error, this.$locale.baseText('settings.ldap.configurationError'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getLdapSynchronizations(state: { loaded: () => void; complete: () => void }) {
|
async getLdapSynchronizations(state: Parameters<Events['infinite']>[0]) {
|
||||||
try {
|
try {
|
||||||
this.loadingTable = true;
|
this.loadingTable = true;
|
||||||
const data = await this.settingsStore.getLdapSynchronizations({
|
const data = await this.settingsStore.getLdapSynchronizations({
|
||||||
|
|
Loading…
Reference in a new issue