Skip to content

Commit

Permalink
fix: fix Management > Rules search bar filters
Browse files Browse the repository at this point in the history
Add id field
Fix groups filter in Rule info flyout
Remove onFiltersChange handler
  • Loading branch information
Desvelao committed Aug 2, 2023
1 parent 76a4feb commit 0696698
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { WzRequest } from '../../../../../../react-services/wz-request';
const rulesItems = {
field(currentValue) {
return [
{ label: 'id', description: 'filter by ID' },
{ label: 'filename', description: 'filter by filename' },
{ label: 'gdpr', description: 'filter by GDPR requirement' },
{ label: 'gpg13', description: 'filter by GPG requirement' },
Expand All @@ -20,6 +21,21 @@ const rulesItems = {
value: async (currentValue, { field }) => {
try {
switch (field) {
case 'id': {
const filter = {
distinct: true,
limit: 30,
select: field,
sort: `+${field}`,
...(currentValue ? { q: `id~${currentValue}` } : {}),
};
const result = await WzRequest.apiReq('GET', '/rules', {
params: filter,
});
return result?.data?.data?.affected_items.map(label => ({
label: label[field],
}));
}
case 'status': {
return ['enabled', 'disabled'].map(label => ({ label }));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ const RulesFlyoutTable = ({
downloadCsv={true}
showReload={true}
filters={filters}
onFiltersChange={updateFilters}
tablePageSizeOptions={[10, 25, 50, 100]}
/>
{isFlyoutVisible && (
Expand Down
Loading

0 comments on commit 0696698

Please sign in to comment.