mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
refactor: Fix Enteprise type errors (#9442)
This commit is contained in:
parent
feba07ba8b
commit
b2c17034c2
|
@ -1925,3 +1925,20 @@ export type NewConnectionInfo = {
|
|||
export type AIAssistantConnectionInfo = NewConnectionInfo & {
|
||||
stepName: string;
|
||||
};
|
||||
|
||||
export type EnterpriseEditionFeatureKey =
|
||||
| 'AdvancedExecutionFilters'
|
||||
| 'Sharing'
|
||||
| 'Ldap'
|
||||
| 'LogStreaming'
|
||||
| 'Variables'
|
||||
| 'Saml'
|
||||
| 'SourceControl'
|
||||
| 'ExternalSecrets'
|
||||
| 'AuditLogs'
|
||||
| 'DebugInEditor'
|
||||
| 'WorkflowHistory'
|
||||
| 'WorkerView'
|
||||
| 'AdvancedPermissions';
|
||||
|
||||
export type EnterpriseEditionFeatureValue = keyof Omit<IN8nUISettings['enterprise'], 'projects'>;
|
||||
|
|
|
@ -68,6 +68,11 @@ export const defaultSettings: IN8nUISettings = {
|
|||
externalSecrets: false,
|
||||
workerView: false,
|
||||
advancedPermissions: false,
|
||||
projects: {
|
||||
team: {
|
||||
limit: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
expressions: {
|
||||
evaluator: 'tournament',
|
||||
|
|
|
@ -9,11 +9,16 @@ import {
|
|||
getNodeAuthOptions,
|
||||
isAuthRelatedParameter,
|
||||
} from '@/utils/nodeTypesUtils';
|
||||
import type { INodeProperties, INodeTypeDescription, NodeParameterValue } from 'n8n-workflow';
|
||||
import type {
|
||||
ICredentialType,
|
||||
INodeProperties,
|
||||
INodeTypeDescription,
|
||||
NodeParameterValue,
|
||||
} from 'n8n-workflow';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
|
||||
export interface Props {
|
||||
credentialType: object;
|
||||
credentialType: ICredentialType;
|
||||
}
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
|
|
@ -142,7 +142,7 @@ import { defineComponent } from 'vue';
|
|||
import type { PropType } from 'vue';
|
||||
import { mapStores } from 'pinia';
|
||||
|
||||
import type { ICredentialType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import type { ICredentialType, INodeProperties, INodeTypeDescription } from 'n8n-workflow';
|
||||
import { getAppNameFromCredType, isCommunityPackageName } from '@/utils/nodeTypesUtils';
|
||||
|
||||
import Banner from '../Banner.vue';
|
||||
|
@ -177,13 +177,15 @@ export default defineComponent({
|
|||
},
|
||||
props: {
|
||||
credentialType: {
|
||||
type: Object,
|
||||
type: Object as PropType<ICredentialType>,
|
||||
required: true,
|
||||
},
|
||||
credentialProperties: {
|
||||
type: Array,
|
||||
type: Array as PropType<INodeProperties[]>,
|
||||
required: true,
|
||||
},
|
||||
parentTypes: {
|
||||
type: Array,
|
||||
type: Array as PropType<string[]>,
|
||||
},
|
||||
credentialData: {},
|
||||
credentialId: {
|
||||
|
|
|
@ -60,7 +60,11 @@
|
|||
@select="onTabSelect"
|
||||
></n8n-menu>
|
||||
</div>
|
||||
<div v-if="activeTab === 'connection'" ref="content" :class="$style.mainContent">
|
||||
<div
|
||||
v-if="activeTab === 'connection' && credentialType"
|
||||
ref="content"
|
||||
:class="$style.mainContent"
|
||||
>
|
||||
<CredentialConfig
|
||||
:credential-type="credentialType"
|
||||
:credential-properties="credentialProperties"
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import type { EnterpriseEditionFeature } from '@/constants';
|
||||
import { type PropType, defineComponent } from 'vue';
|
||||
import type { EnterpriseEditionFeatureValue } from '@/Interface';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
|
||||
|
@ -15,18 +15,15 @@ export default defineComponent({
|
|||
name: 'EnterpriseEdition',
|
||||
props: {
|
||||
features: {
|
||||
type: Array,
|
||||
default: () => [] as EnterpriseEditionFeature[],
|
||||
type: Array as PropType<EnterpriseEditionFeatureValue[]>,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapStores(useSettingsStore),
|
||||
canAccess(): boolean {
|
||||
return this.features.reduce((acc: boolean, feature) => {
|
||||
return (
|
||||
acc &&
|
||||
!!this.settingsStore.isEnterpriseFeatureEnabled(feature as EnterpriseEditionFeature)
|
||||
);
|
||||
return acc && !!this.settingsStore.isEnterpriseFeatureEnabled(feature);
|
||||
}, true);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
import type { NodeCreatorOpenSource } from './Interface';
|
||||
import type {
|
||||
EnterpriseEditionFeatureKey,
|
||||
EnterpriseEditionFeatureValue,
|
||||
NodeCreatorOpenSource,
|
||||
} from './Interface';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
export const MAX_WORKFLOW_SIZE = 1024 * 1024 * 16; // Workflow size limit in bytes
|
||||
|
@ -541,21 +545,25 @@ export const enum WORKFLOW_MENU_ACTIONS {
|
|||
/**
|
||||
* Enterprise edition
|
||||
*/
|
||||
export const enum EnterpriseEditionFeature {
|
||||
AdvancedExecutionFilters = 'advancedExecutionFilters',
|
||||
Sharing = 'sharing',
|
||||
Ldap = 'ldap',
|
||||
LogStreaming = 'logStreaming',
|
||||
Variables = 'variables',
|
||||
Saml = 'saml',
|
||||
SourceControl = 'sourceControl',
|
||||
ExternalSecrets = 'externalSecrets',
|
||||
AuditLogs = 'auditLogs',
|
||||
DebugInEditor = 'debugInEditor',
|
||||
WorkflowHistory = 'workflowHistory',
|
||||
WorkerView = 'workerView',
|
||||
AdvancedPermissions = 'advancedPermissions',
|
||||
}
|
||||
export const EnterpriseEditionFeature: Record<
|
||||
EnterpriseEditionFeatureKey,
|
||||
EnterpriseEditionFeatureValue
|
||||
> = {
|
||||
AdvancedExecutionFilters: 'advancedExecutionFilters',
|
||||
Sharing: 'sharing',
|
||||
Ldap: 'ldap',
|
||||
LogStreaming: 'logStreaming',
|
||||
Variables: 'variables',
|
||||
Saml: 'saml',
|
||||
SourceControl: 'sourceControl',
|
||||
ExternalSecrets: 'externalSecrets',
|
||||
AuditLogs: 'auditLogs',
|
||||
DebugInEditor: 'debugInEditor',
|
||||
WorkflowHistory: 'workflowHistory',
|
||||
WorkerView: 'workerView',
|
||||
AdvancedPermissions: 'advancedPermissions',
|
||||
};
|
||||
|
||||
export const MAIN_NODE_PANEL_WIDTH = 360;
|
||||
|
||||
export const enum MAIN_HEADER_TABS {
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from '@/api/ldap';
|
||||
import { getPromptsData, getSettings, submitContactInfo, submitValueSurvey } from '@/api/settings';
|
||||
import { testHealthEndpoint } from '@/api/templates';
|
||||
import type { EnterpriseEditionFeature } from '@/constants';
|
||||
import type { EnterpriseEditionFeatureValue } from '@/Interface';
|
||||
import {
|
||||
CONTACT_PROMPT_MODAL_KEY,
|
||||
STORES,
|
||||
|
@ -79,7 +79,8 @@ export const useSettingsStore = defineStore(STORES.SETTINGS, {
|
|||
}),
|
||||
getters: {
|
||||
isEnterpriseFeatureEnabled() {
|
||||
return (feature: EnterpriseEditionFeature): boolean => this.settings.enterprise?.[feature];
|
||||
return (feature: EnterpriseEditionFeatureValue): boolean =>
|
||||
Boolean(this.settings.enterprise?.[feature]);
|
||||
},
|
||||
versionCli(): string {
|
||||
return this.settings.versionCli;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import type { EnterpriseEditionFeature } from '@/constants';
|
||||
import type { Resource, ScopeOptions, Scope } from '@n8n/permissions';
|
||||
import type { IRole } from '@/Interface';
|
||||
import type { EnterpriseEditionFeatureValue, IRole } from '@/Interface';
|
||||
|
||||
export type AuthenticatedPermissionOptions = {
|
||||
bypass?: () => boolean;
|
||||
|
@ -9,7 +8,7 @@ export type CustomPermissionOptions<C = {}> = RBACPermissionCheck<C>;
|
|||
export type DefaultUserMiddlewareOptions = {};
|
||||
export type InstanceOwnerMiddlewareOptions = {};
|
||||
export type EnterprisePermissionOptions = {
|
||||
feature?: EnterpriseEditionFeature | EnterpriseEditionFeature[];
|
||||
feature?: EnterpriseEditionFeatureValue | EnterpriseEditionFeatureValue[];
|
||||
mode?: 'oneOf' | 'allOf';
|
||||
};
|
||||
export type GuestPermissionOptions = {};
|
||||
|
|
|
@ -5,8 +5,6 @@ import type {
|
|||
INodeProperties,
|
||||
INodeTypeDescription,
|
||||
NodeParameterValueType,
|
||||
INodePropertyOptions,
|
||||
INodePropertyCollection,
|
||||
ResourceMapperField,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
|
@ -271,7 +269,7 @@ export const getNodeCredentialForSelectedAuthType = (
|
|||
export const getAuthTypeForNodeCredential = (
|
||||
nodeType: INodeTypeDescription | null | undefined,
|
||||
credentialType: INodeCredentialDescription | null | undefined,
|
||||
): INodePropertyOptions | INodeProperties | INodePropertyCollection | null => {
|
||||
): NodeAuthenticationOption | null => {
|
||||
if (nodeType && credentialType) {
|
||||
const authField = getMainAuthField(nodeType);
|
||||
const authFieldName = authField ? authField.name : '';
|
||||
|
|
Loading…
Reference in a new issue