diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/connector_filtering.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/connector_filtering.tsx index 875a4e9a9c6a..fac8afe06ccc 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/connector_filtering.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/connector_filtering.tsx @@ -31,7 +31,8 @@ import { EditFilteringFlyout } from './edit_filtering_flyout'; import { FilteringStateCallouts } from './filtering_callouts'; export const ConnectorFiltering: React.FC = () => { - const { indexName } = useValues(IndexViewLogic); + const { indexName, hasAdvancedFilteringFeature, hasBasicFilteringFeature } = + useValues(IndexViewLogic); const { applyDraft, setLocalFilteringRules, setLocalAdvancedSnippet, setIsEditing } = useActions(ConnectorFilteringLogic); const { advancedSnippet, draftState, filteringRules, hasDraft, isEditing } = @@ -41,6 +42,8 @@ export const ConnectorFiltering: React.FC = () => { <> {isEditing && ( setLocalFilteringRules(filteringRules)} revertLocalAdvancedFiltering={() => setLocalAdvancedSnippet(advancedSnippet)} setIsEditing={setIsEditing} @@ -115,37 +118,39 @@ export const ConnectorFiltering: React.FC = () => { - - - - - -

- {i18n.translate( - 'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersTitle', - { - defaultMessage: 'Basic filters', - } - )} -

-
- - -

- {i18n.translate( - 'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersDescription', - { - defaultMessage: 'These filters apply to documents in post-processing.', - } - )} -

-
-
- -
-
-
- {!!advancedSnippet && ( + {hasBasicFilteringFeature && ( + + + + + +

+ {i18n.translate( + 'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersTitle', + { + defaultMessage: 'Basic filters', + } + )} +

+
+ + +

+ {i18n.translate( + 'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersDescription', + { + defaultMessage: 'These filters apply to documents in post-processing.', + } + )} +

+
+
+ +
+
+
+ )} + {hasAdvancedFilteringFeature && !!advancedSnippet && ( diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/edit_filtering_flyout.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/edit_filtering_flyout.tsx index 7d4fe096fd99..fecaabc6b156 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/edit_filtering_flyout.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/filtering/edit_filtering_flyout.tsx @@ -23,6 +23,8 @@ import { EditFilteringTab } from './edit_filtering_tab'; import { FilteringRulesTable } from './editable_filtering_rules_table'; interface EditFilteringFlyoutProps { + hasAdvancedFilteringFeature: boolean; + hasBasicFilteringFeature: boolean; revertLocalAdvancedFiltering: () => void; revertLocalFilteringRules: () => void; setIsEditing: (value: boolean) => void; @@ -34,39 +36,49 @@ enum FilteringTabs { } export const EditFilteringFlyout: React.FC = ({ + hasAdvancedFilteringFeature, + hasBasicFilteringFeature, revertLocalFilteringRules, revertLocalAdvancedFiltering, setIsEditing, }) => { const tabs: EuiTabbedContentTab[] = [ - { - content: ( - - - - ), - id: FilteringTabs.BASIC, - name: i18n.translate( - 'xpack.enterpriseSearch.content.index.connector.filtering.basicTabTitle', - { - defaultMessage: 'Basic filters', - } - ), - }, - { - content: ( - - - - ), - id: FilteringTabs.ADVANCED, - name: i18n.translate( - 'xpack.enterpriseSearch.content.index.connector.filtering.advancedTabTitle', - { - defaultMessage: 'Advanced filters', - } - ), - }, + ...(hasBasicFilteringFeature + ? [ + { + content: ( + + + + ), + id: FilteringTabs.BASIC, + name: i18n.translate( + 'xpack.enterpriseSearch.content.index.connector.filtering.basicTabTitle', + { + defaultMessage: 'Basic filters', + } + ), + }, + ] + : []), + ...(hasAdvancedFilteringFeature + ? [ + { + content: ( + + + + ), + id: FilteringTabs.ADVANCED, + name: i18n.translate( + 'xpack.enterpriseSearch.content.index.connector.filtering.advancedTabTitle', + { + defaultMessage: 'Advanced filters', + } + ), + }, + ] + : []), ]; return (