Skip to content

Commit

Permalink
Change the search bar to the one that does not make the request on re…
Browse files Browse the repository at this point in the history
…ndering (#5476)

* Add state confirm search

* Change search bar

* Remove unused search bar

* Add changelog
  • Loading branch information
yenienserrano authored May 29, 2023
1 parent 7d409b0 commit c2944dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Changed the title of step 3 of the deploy a new agent section. [#5429](https://github.com/wazuh/wazuh-kibana-app/pull/5429)
- Changed the description of step 3 of the deploy a new agent section. [#5429](https://github.com/wazuh/wazuh-kibana-app/pull/5429)
- Changed the placeholder of the agent name input of the deploy a new agent section. [#5429](https://github.com/wazuh/wazuh-kibana-app/pull/5429)
- 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

0 comments on commit c2944dc

Please sign in to comment.