Skip to content

Commit

Permalink
Removes unnecessary requests in config, inventory data or statistics (#…
Browse files Browse the repository at this point in the history
…5460)

* Add dont make the queries in config or inventory

* Update changelog

* Fix stats request

---------

Co-authored-by: Álex Ruiz <[email protected]>
  • Loading branch information
yenienserrano and AlexRuiz7 authored May 29, 2023
1 parent c2944dc commit f5be86d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed the GitHub and Office 365 modules appear in the main menu when they were not configured [#5376](https://github.com/wazuh/wazuh-kibana-app/pull/5376)
- Fixed TypeError in FIM Inventory using new error handler [#5364](https://github.com/wazuh/wazuh-kibana-app/pull/5364)
- Fixed error when using invalid group configuration [#5423](https://github.com/wazuh/wazuh-kibana-app/pull/5423)
- Fixed repeated requests in inventory data and configurations of an agent. [#5460](https://github.com/wazuh/wazuh-kibana-app/pull/5460)
- Fixed repeated requests in the group table when adding a group or refreshing the table [#5465](https://github.com/wazuh/wazuh-kibana-app/pull/5465)

### Removed

- Removed deprecated request and code in agent's view [#5451](https://github.com/wazuh/wazuh-kibana-app/pull/5451)

### Removed

- Removed unnecessary dashboard queries caused by the deploy agent view. [#5453](https://github.com/wazuh/wazuh-kibana-app/pull/5453)

## Wazuh v4.4.3 - OpenSearch Dashboards 2.6.0 - Revision 01
Expand Down
8 changes: 5 additions & 3 deletions public/components/common/welcome/agents-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class AgentsWelcome extends Component {

renderTitle() {

const notNeedStatus = true;

return (
<EuiFlexGroup>
<EuiFlexItem className="wz-module-header-agent-title">
Expand Down Expand Up @@ -321,21 +323,21 @@ class AgentsWelcome extends Component {
<EuiFlexItem grow={false} style={{ marginTop: 7 }}>
<EuiButtonEmpty
iconType="inspect"
onClick={() => this.props.switchTab('syscollector')}>
onClick={() => this.props.switchTab('syscollector', notNeedStatus)}>
Inventory data
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ marginTop: 7 }}>
<EuiButtonEmpty
iconType="stats"
onClick={() => this.props.switchTab('stats')}>
onClick={() => this.props.switchTab('stats', notNeedStatus)}>
Stats
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ marginTop: 7 }}>
<EuiButtonEmpty
iconType="gear"
onClick={() => this.props.switchTab('configuration')}>
onClick={() => this.props.switchTab('configuration', notNeedStatus)}>
Configuration
</EuiButtonEmpty>
</EuiFlexItem>
Expand Down
10 changes: 4 additions & 6 deletions public/controllers/agent/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ export class AgentsController {
}

// Update agent status
if (!force && ((this.$scope || {}).agent || false)) {
if (!force && this.$scope.agent) {
try {
const agentInfo = await WzRequest.apiReq('GET', `/agents`, {
const agentInfo = await WzRequest.apiReq('GET', '/agents', {
params: {
agents_list: this.$scope.agent.id,
select: 'status',
Expand All @@ -395,9 +395,8 @@ export class AgentsController {
this.$scope.agent.status =
agentInfo?.data?.data?.affected_items?.[0]?.status ||
this.$scope.agent.status;
this.$scope.isSynchronized = this.$scope.agent.status?.synced;

this.$scope.$applyAsync();
this.$scope.$applyAsync();
} catch (error) {
throw new Error(error);
}
Expand Down Expand Up @@ -582,7 +581,6 @@ export class AgentsController {
async getAgent(newAgentId) {
try {
this.$scope.emptyAgent = false;
this.$scope.isSynchronized = false;
this.$scope.load = true;
this.changeAgent = true;

Expand Down Expand Up @@ -654,7 +652,7 @@ export class AgentsController {
*/
loadWelcomeCardsProps() {
this.$scope.welcomeCardsProps = {
switchTab: (tab) => this.switchTab(tab),
switchTab: (tab, force) => this.switchTab(tab, force),
extensions: this.cleanExtensions(this.$scope.extensions),
agent: this.$scope.agent,
api: AppState.getCurrentAPI(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ import WzConfigurationPath from './util-components/configuration-path';
import WzRefreshClusterInfoButton from './util-components/refresh-cluster-info-button';
import { withUserAuthorizationPrompt } from '../../../../../components/common/hocs';

import { clusterNodes, clusterReq } from './utils/wz-fetch';
import {
clusterNodes,
clusterReq,
agentIsSynchronized,
} from './utils/wz-fetch';
import {
updateClusterNodes,
updateClusterNodeSelected,
Expand All @@ -64,7 +68,6 @@ import { compose } from 'redux';

import { EuiPage, EuiPanel, EuiSpacer, EuiButtonEmpty, EuiFlexItem } from '@elastic/eui';

import { agentIsSynchronized } from './utils/wz-fetch';
import { WzRequest } from '../../../../../react-services/wz-request';
import { API_NAME_AGENT_STATUS, UI_LOGGER_LEVELS } from '../../../../../../common/constants';
import { UI_ERROR_SEVERITIES } from '../../../../../react-services/error-orchestrator/types';
Expand Down

0 comments on commit f5be86d

Please sign in to comment.