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

Removes unnecessary requests in config, inventory data or statistics #5460

Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -36,6 +36,7 @@ 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 making unnecessary requests in inventory data and configurations of an agent. [#5460](https://github.com/wazuh/wazuh-kibana-app/pull/5460)

## Wazuh v4.4.1 - 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)}>
yenienserrano marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -500,9 +500,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 @@ -511,9 +511,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 @@ -761,7 +760,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 @@ -837,7 +835,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