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

[Backport 4.5-7.16]Change the search bar to the one that does not make the request on rendering #5505

Merged
merged 2 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to the Wazuh app project will be documented in this file.

- Changed of regular expression in RBAC. [#5201](https://github.com/wazuh/wazuh-kibana-app/pull/5201)
- Migrate the timeFilter, metaFields, maxBuckets health checks inside the pattern check. [#5384](https://github.com/wazuh/wazuh-kibana-app/pull/5384)
- Changed the search bar in management/log to the one used in the rest of the app. [#5476](https://github.com/wazuh/wazuh-kibana-app/pull/5476)

### Fixed

Expand Down
44 changes: 0 additions & 44 deletions public/components/wz-field-search-bar/wz-field-search-bar.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import {
withUserAuthorizationPrompt,
} from '../../../../../components/common/hocs';
import { compose } from 'redux';
import { WzFieldSearch } from '../../../../../components/wz-field-search-bar/wz-field-search-bar';
import { UI_LOGGER_LEVELS } from '../../../../../../common/constants';
import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchestrator/types';
import { getErrorOrchestrator } from '../../../../../react-services/common-services';
import { WzFieldSearchDelay } from '../../../../../components/common/search';

export default compose(
withGlobalBreadcrumb([{ text: '' }, { text: 'Management', href: '#/manager' }, { text: 'Logs' }]),
Expand Down Expand Up @@ -182,8 +182,8 @@ export default compose(
const tmpResult = await WzRequest.apiReq('GET', logsPath, {
params: this.buildFilters(customOffset),
});
const resultItems = ((tmpResult || {}).data.data || {}).affected_items;
totalItems = ((tmpResult || {}).data.data || {}).total_affected_items;
const resultItems = tmpResult?.data?.data?.affected_items;
totalItems = tmpResult?.data?.data?.total_affected_items;
result = this.parseLogsToText(resultItems) || '';
} catch (error) {
throw new Error('Error fetching logs: ' + error);
Expand Down Expand Up @@ -221,14 +221,14 @@ export default compose(
try {
const clusterStatus = await WzRequest.apiReq('GET', '/cluster/status', {});
const clusterEnabled =
(((clusterStatus || {}).data || {}).data || {}).running === 'yes' &&
(((clusterStatus || {}).data || {}).data || {}).enabled === 'yes';
clusterStatus?.data?.data?.running === 'yes' &&
clusterStatus?.data?.data?.enabled === 'yes';

if (clusterEnabled) {
let nodeList = '';
let selectedNode = '';
const nodeListTmp = await WzRequest.apiReq('GET', '/cluster/nodes', {});
if (Array.isArray((((nodeListTmp || {}).data || {}).data || {}).affected_items)) {
if (Array.isArray(nodeListTmp?.data?.data?.affected_items)) {
nodeList = nodeListTmp.data.data.affected_items;
selectedNode = nodeListTmp.data.data.affected_items.filter(
(item) => item.type === 'master'
Expand Down Expand Up @@ -480,8 +480,8 @@ export default compose(
<EuiSpacer size={'s'} />
<EuiFlexGroup>
<EuiFlexItem>
<WzFieldSearch
searchDelay={500}
<WzFieldSearchDelay
delay={500}
onChange={this.onSearchBarChange}
onSearch={this.onSearchBarSearch}
placeholder="Filter logs"
Expand Down Expand Up @@ -515,7 +515,7 @@ export default compose(
fontSize="s"
paddingSize="m"
color="dark"
overflowHeight={`calc(100vh - ${this.HEIGHT_WITHOUT_CODE_EDITOR}px)`}
overflowHeight={window.innerHeight - this.HEIGHT_WITHOUT_CODE_EDITOR}
>
{this.state.logsList}
</EuiCodeBlock>
Expand Down