From 193636e85431a4ed86cb8a0ba77603e084d84187 Mon Sep 17 00:00:00 2001 From: Sander Philipse <94373878+sphilipse@users.noreply.github.com> Date: Wed, 18 Jan 2023 10:45:01 +0100 Subject: [PATCH] [Enterprise Search] Implement new feature toggle structure (#149033) ## Summary This updates our feature toggle structure to match the new contract. --- .../common/connectors/native_connectors.ts | 11 ++++++++++- .../common/types/connectors.ts | 18 ++++++++++++++++-- .../search_index/index_view_logic.ts | 10 ++++++++-- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts b/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts index e2518ce9918b4..a19b1e2bb7c19 100644 --- a/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts +++ b/x-pack/plugins/enterprise_search/common/connectors/native_connectors.ts @@ -70,6 +70,10 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record | null; export interface Connector { api_key_id: string | null; configuration: ConnectorConfiguration; description: string | null; error: string | null; - features: Partial> | null; + features: ConnectorFeatures; filtering: FilteringConfig[]; id: string; index_name: string; diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts index 2d3651a598fc1..26c1f823b479d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/index_view_logic.ts @@ -197,12 +197,18 @@ export const IndexViewLogic = kea [selectors.connector], (connector?: Connector) => - connector?.features ? connector.features[FeatureName.FILTERING_ADVANCED_CONFIG] : false, + connector?.features + ? connector.features[FeatureName.SYNC_RULES]?.advanced?.enabled ?? + connector.features[FeatureName.FILTERING_ADVANCED_CONFIG] + : false, ], hasBasicFilteringFeature: [ () => [selectors.connector], (connector?: Connector) => - connector?.features ? connector.features[FeatureName.FILTERING_RULES] : false, + connector?.features + ? connector.features[FeatureName.SYNC_RULES]?.basic?.enabled ?? + connector.features[FeatureName.FILTERING_RULES] + : false, ], hasFilteringFeature: [ () => [selectors.hasAdvancedFilteringFeature, selectors.hasBasicFilteringFeature],