Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search] Only show specifically enabled filtering features #145383

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 } =
Expand All @@ -41,6 +42,8 @@ export const ConnectorFiltering: React.FC = () => {
<>
{isEditing && (
<EditFilteringFlyout
hasAdvancedFilteringFeature={hasAdvancedFilteringFeature}
hasBasicFilteringFeature={hasBasicFilteringFeature}
revertLocalFilteringRules={() => setLocalFilteringRules(filteringRules)}
revertLocalAdvancedFiltering={() => setLocalAdvancedSnippet(advancedSnippet)}
setIsEditing={setIsEditing}
Expand Down Expand Up @@ -115,37 +118,39 @@ export const ConnectorFiltering: React.FC = () => {
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiPanel color="plain" hasShadow={false} hasBorder>
<EuiFlexGroup direction="column">
<EuiFlexItem>
<EuiTitle size="s">
<h3>
{i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersTitle',
{
defaultMessage: 'Basic filters',
}
)}
</h3>
</EuiTitle>
<EuiSpacer />
<EuiText size="s">
<p>
{i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersDescription',
{
defaultMessage: 'These filters apply to documents in post-processing.',
}
)}
</p>
</EuiText>
</EuiFlexItem>
<FilteringRulesTable filteringRules={filteringRules} showOrder />
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
{!!advancedSnippet && (
{hasBasicFilteringFeature && (
<EuiFlexItem>
<EuiPanel color="plain" hasShadow={false} hasBorder>
<EuiFlexGroup direction="column">
<EuiFlexItem>
<EuiTitle size="s">
<h3>
{i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersTitle',
{
defaultMessage: 'Basic filters',
}
)}
</h3>
</EuiTitle>
<EuiSpacer />
<EuiText size="s">
<p>
{i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicFiltersDescription',
{
defaultMessage: 'These filters apply to documents in post-processing.',
}
)}
</p>
</EuiText>
</EuiFlexItem>
<FilteringRulesTable filteringRules={filteringRules} showOrder />
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
)}
{hasAdvancedFilteringFeature && !!advancedSnippet && (
<EuiFlexItem>
<EuiPanel color="plain" hasShadow={false} hasBorder>
<EuiFlexGroup direction="column">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,39 +36,49 @@ enum FilteringTabs {
}

export const EditFilteringFlyout: React.FC<EditFilteringFlyoutProps> = ({
hasAdvancedFilteringFeature,
hasBasicFilteringFeature,
revertLocalFilteringRules,
revertLocalAdvancedFiltering,
setIsEditing,
}) => {
const tabs: EuiTabbedContentTab[] = [
{
content: (
<EditFilteringTab revertAction={revertLocalFilteringRules}>
<FilteringRulesTable />
</EditFilteringTab>
),
id: FilteringTabs.BASIC,
name: i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicTabTitle',
{
defaultMessage: 'Basic filters',
}
),
},
{
content: (
<EditFilteringTab revertAction={revertLocalAdvancedFiltering}>
<AdvancedFilteringRules />
</EditFilteringTab>
),
id: FilteringTabs.ADVANCED,
name: i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.advancedTabTitle',
{
defaultMessage: 'Advanced filters',
}
),
},
...(hasBasicFilteringFeature
? [
{
content: (
<EditFilteringTab revertAction={revertLocalFilteringRules}>
<FilteringRulesTable />
</EditFilteringTab>
),
id: FilteringTabs.BASIC,
name: i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.basicTabTitle',
{
defaultMessage: 'Basic filters',
}
),
},
]
: []),
...(hasAdvancedFilteringFeature
? [
{
content: (
<EditFilteringTab revertAction={revertLocalAdvancedFiltering}>
<AdvancedFilteringRules />
</EditFilteringTab>
),
id: FilteringTabs.ADVANCED,
name: i18n.translate(
'xpack.enterpriseSearch.content.index.connector.filtering.advancedTabTitle',
{
defaultMessage: 'Advanced filters',
}
),
},
]
: []),
];

return (
Expand Down