Skip to content

Commit

Permalink
[8.6] [Enterprise Search] Only show specifically enabled filtering fe…
Browse files Browse the repository at this point in the history
…atures (#145383) (#145545)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Enterprise Search] Only show specifically enabled filtering features
(#145383)](#145383)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-11-17T11:46:00Z","message":"[Enterprise
Search] Only show specifically enabled filtering features
(#145383)\n\nThis hides a specific filtering feature from the user if
it's not\r\nenabled for the connector they're
using.","sha":"ed14ba0e29ae17f176d8fc87db4ccf4a1edf73a5","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:EnterpriseSearch","v8.6.0","v8.7.0"],"number":145383,"url":"https://github.com/elastic/kibana/pull/145383","mergeCommit":{"message":"[Enterprise
Search] Only show specifically enabled filtering features
(#145383)\n\nThis hides a specific filtering feature from the user if
it's not\r\nenabled for the connector they're
using.","sha":"ed14ba0e29ae17f176d8fc87db4ccf4a1edf73a5"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145383","number":145383,"mergeCommit":{"message":"[Enterprise
Search] Only show specifically enabled filtering features
(#145383)\n\nThis hides a specific filtering feature from the user if
it's not\r\nenabled for the connector they're
using.","sha":"ed14ba0e29ae17f176d8fc87db4ccf4a1edf73a5"}}]}]
BACKPORT-->

Co-authored-by: Sander Philipse <[email protected]>
  • Loading branch information
kibanamachine and sphilipse authored Nov 17, 2022
1 parent cbdfade commit 4aa7678
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 60 deletions.
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

0 comments on commit 4aa7678

Please sign in to comment.