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

Fix the search in the agent inventory data tables #5196

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Unify the SCA check result label name [#5031](https://github.com/wazuh/wazuh-kibana-app/pull/5031)
- Updated `mocha` dependency to `10.1.0` [#5062](https://github.com/wazuh/wazuh-kibana-app/pull/5062)
- Updated `pdfmake` dependency to `0.2.7` [#5062](https://github.com/wazuh/wazuh-kibana-app/pull/5062)
- Change the search method in the agents inventory tables [#5196](https://github.com/wazuh/wazuh-kibana-app/pull/5196)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { AppState } from '../../../../react-services/app-state';


export function SyscollectorTable({ tableParams }) {
const [params, setParams] = useState({ limit: 10, offset: 0, });
const [params, setParams] = useState<{ limit: number, offset: number, select:string, q?: string}>({
limit: 10,
offset: 0,
select: tableParams.columns.map(({id}) => id).join(",")
});
const [pageIndex, setPageIndex] = useState(0);
const [searchBarValue, setSearchBarValue] = useState("");
const [pageSize, setPageSize] = useState(10);
Expand Down Expand Up @@ -67,7 +71,13 @@ export function SyscollectorTable({ tableParams }) {
setSearchBarValue(value);
timerDelaySearch && clearTimeout(timerDelaySearch);
const timeoutId = setTimeout(() => {
const newParams = { ...params, search: value };
const { q, ...rest} = params;
const newParams = {
...rest,
...(value ? {
q: tableParams.columns.map(({id}) => `${id}~${value}`).join(",")
}: {})
};
setParams(newParams);
setPageIndex(0);
}, 400)
Expand All @@ -85,7 +95,7 @@ export function SyscollectorTable({ tableParams }) {
await AppState.downloadCsv(
tableParams.path,
tableParams.exportFormatted,
!!params.search ? [{ name: 'search', value: params.search }] : []
!!params.q ? [{ name: 'q', value: params.q }] : []
)
}

Expand Down