Skip to content

Commit

Permalink
Merge branch 'feat/4312-search-bar-replace-tablewzapi' of https://git…
Browse files Browse the repository at this point in the history
…hub.com/wazuh/wazuh-kibana-app into feat/4312-search-bar-replace-explore-agent-modal
  • Loading branch information
Desvelao committed Aug 2, 2023
2 parents 086782f + 0696698 commit 02af0a9
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 02af0a9

Please sign in to comment.