feat(core): Add advancedFilters feature flag (#5638)

adds advancedFilters feature flag
This commit is contained in:
Michael Auerswald 2023-03-07 14:18:10 +01:00 committed by GitHub
parent 6c1286fadf
commit 0b5ef09e7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 2 deletions

View file

@ -524,6 +524,7 @@ export interface IN8nUISettings {
ldap: boolean;
saml: boolean;
logStreaming: boolean;
advancedFilters: boolean;
};
hideUsagePage: boolean;
license: {

View file

@ -106,6 +106,10 @@ export class License {
return this.isFeatureEnabled(LICENSE_FEATURES.SAML);
}
isAdvancedFiltersEnabled() {
return this.isFeatureEnabled(LICENSE_FEATURES.ADVANCED_FILTERS);
}
getCurrentEntitlements() {
return this.manager?.getCurrentEntitlements() ?? [];
}

View file

@ -144,7 +144,10 @@ import { PostHogClient } from './posthog';
import { eventBus } from './eventbus';
import { Container } from 'typedi';
import { InternalHooks } from './InternalHooks';
import { getStatusUsingPreviousExecutionStatusMethod } from './executions/executionHelpers';
import {
getStatusUsingPreviousExecutionStatusMethod,
isAdvancedFiltersEnabled,
} from './executions/executionHelpers';
import { getSamlLoginLabel, isSamlLoginEnabled, isSamlLicensed } from './sso/saml/samlHelpers';
import { samlControllerPublic } from './sso/saml/routes/saml.controller.public.ee';
import { SamlService } from './sso/saml/saml.service.ee';
@ -300,6 +303,7 @@ class Server extends AbstractServer {
ldap: false,
saml: false,
logStreaming: config.getEnv('enterprise.features.logStreaming'),
advancedFilters: config.getEnv('enterprise.features.advancedFilters'),
},
hideUsagePage: config.getEnv('hideUsagePage'),
license: {
@ -328,6 +332,7 @@ class Server extends AbstractServer {
logStreaming: isLogStreamingEnabled(),
ldap: isLdapEnabled(),
saml: isSamlLicensed(),
advancedFilters: isAdvancedFiltersEnabled(),
});
if (isLdapEnabled()) {

View file

@ -1008,6 +1008,10 @@ export const schema = {
format: Boolean,
default: false,
},
advancedFilters: {
format: Boolean,
default: false,
},
},
},

View file

@ -72,6 +72,7 @@ export enum LICENSE_FEATURES {
LDAP = 'feat:ldap',
SAML = 'feat:saml',
LOG_STREAMING = 'feat:logStreaming',
ADVANCED_FILTERS = 'feat:advancedFilters',
}
export const CREDENTIAL_BLANKING_VALUE = '__n8n_BLANK_VALUE_e5362baf-c777-4d57-a609-6eaf1f9e87f6';

View file

@ -1,5 +1,7 @@
import type { IExecutionFlattedDb } from '../Interfaces';
import type { IExecutionFlattedDb } from '@/Interfaces';
import type { ExecutionStatus } from 'n8n-workflow';
import { getLicense } from '@/License';
import config from '@/config';
export function getStatusUsingPreviousExecutionStatusMethod(
execution: IExecutionFlattedDb,
@ -16,3 +18,8 @@ export function getStatusUsingPreviousExecutionStatusMethod(
return 'unknown';
}
}
export function isAdvancedFiltersEnabled(): boolean {
const license = getLicense();
return config.getEnv('enterprise.features.advancedFilters') || license.isAdvancedFiltersEnabled();
}