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