[Security Solution][Detection Rules] Fixes rules table tag display bug (#85229)
This commit is contained in:
parent
943bce1512
commit
8c8e96ff88
|
@ -503,6 +503,7 @@ export const AllRules = React.memo<AllRulesProps>(
|
|||
onFilterChanged={onFilterChangedCallback}
|
||||
rulesCustomInstalled={rulesCustomInstalled}
|
||||
rulesInstalled={rulesInstalled}
|
||||
currentFilterTags={filterOptions.tags ?? []}
|
||||
/>
|
||||
</HeaderSection>
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ describe('RulesTableFilters', () => {
|
|||
onFilterChanged={jest.fn()}
|
||||
rulesCustomInstalled={null}
|
||||
rulesInstalled={null}
|
||||
currentFilterTags={[]}
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -37,6 +38,7 @@ describe('RulesTableFilters', () => {
|
|||
onFilterChanged={jest.fn()}
|
||||
rulesCustomInstalled={10}
|
||||
rulesInstalled={9}
|
||||
currentFilterTags={[]}
|
||||
/>
|
||||
);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ interface RulesTableFiltersProps {
|
|||
onFilterChanged: (filterOptions: Partial<FilterOptions>) => void;
|
||||
rulesCustomInstalled: number | null;
|
||||
rulesInstalled: number | null;
|
||||
currentFilterTags: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,6 +38,7 @@ const RulesTableFiltersComponent = ({
|
|||
onFilterChanged,
|
||||
rulesCustomInstalled,
|
||||
rulesInstalled,
|
||||
currentFilterTags,
|
||||
}: RulesTableFiltersProps) => {
|
||||
const [filter, setFilter] = useState<string>('');
|
||||
const [selectedTags, setSelectedTags] = useState<string[]>([]);
|
||||
|
@ -94,6 +96,7 @@ const RulesTableFiltersComponent = ({
|
|||
onSelectedTagsChanged={handleSelectedTags}
|
||||
selectedTags={selectedTags}
|
||||
tags={tags}
|
||||
currentFilterTags={currentFilterTags}
|
||||
data-test-subj="allRulesTagPopover"
|
||||
/>
|
||||
</EuiFilterGroup>
|
||||
|
|
|
@ -16,6 +16,7 @@ describe('TagsFilterPopover', () => {
|
|||
tags={[]}
|
||||
selectedTags={[]}
|
||||
onSelectedTagsChanged={jest.fn()}
|
||||
currentFilterTags={[]}
|
||||
isLoading={false}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -33,6 +33,7 @@ interface TagsFilterPopoverProps {
|
|||
selectedTags: string[];
|
||||
tags: string[];
|
||||
onSelectedTagsChanged: Dispatch<SetStateAction<string[]>>;
|
||||
currentFilterTags: string[];
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
isLoading: boolean; // TO DO reimplement?
|
||||
}
|
||||
|
@ -62,8 +63,12 @@ const TagsFilterPopoverComponent = ({
|
|||
tags,
|
||||
selectedTags,
|
||||
onSelectedTagsChanged,
|
||||
currentFilterTags,
|
||||
}: TagsFilterPopoverProps) => {
|
||||
const sortedTags = useMemo(() => caseInsensitiveSort(tags), [tags]);
|
||||
const sortedTags = useMemo(
|
||||
() => caseInsensitiveSort(Array.from(new Set([...tags, ...currentFilterTags]))),
|
||||
[tags, currentFilterTags]
|
||||
);
|
||||
const [isTagPopoverOpen, setIsTagPopoverOpen] = useState(false);
|
||||
const [searchInput, setSearchInput] = useState('');
|
||||
const [filterTags, setFilterTags] = useState(sortedTags);
|
||||
|
|
Loading…
Reference in a new issue