Skip to content

Commit

Permalink
feat(core): Add advancedFilters feature flag (#5638)
Browse files Browse the repository at this point in the history
adds advancedFilters feature flag
  • Loading branch information
flipswitchingmonkey committed Mar 7, 2023
1 parent 6c1286f commit 0b5ef09
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ export interface IN8nUISettings {
ldap: boolean;
saml: boolean;
logStreaming: boolean;
advancedFilters: boolean;
};
hideUsagePage: boolean;
license: {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/License.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() ?? [];
}
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -328,6 +332,7 @@ class Server extends AbstractServer {
logStreaming: isLogStreamingEnabled(),
ldap: isLdapEnabled(),
saml: isSamlLicensed(),
advancedFilters: isAdvancedFiltersEnabled(),
});

if (isLdapEnabled()) {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,10 @@ export const schema = {
format: Boolean,
default: false,
},
advancedFilters: {
format: Boolean,
default: false,
},
},
},

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
9 changes: 8 additions & 1 deletion packages/cli/src/executions/executionHelpers.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -16,3 +18,8 @@ export function getStatusUsingPreviousExecutionStatusMethod(
return 'unknown';
}
}

export function isAdvancedFiltersEnabled(): boolean {
const license = getLicense();
return config.getEnv('enterprise.features.advancedFilters') || license.isAdvancedFiltersEnabled();
}

0 comments on commit 0b5ef09

Please sign in to comment.