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 links las registered agent and agent most active #6244

Merged
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Changed

- Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226)
- Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226) [#6244](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6244)
- Changed dashboards. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035)
- Change the display order of tabs in all modules. [#6067](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6067)
- Upgraded the `axios` dependency to `1.6.1` [#5062](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5062)
Expand All @@ -27,7 +27,7 @@ All notable changes to the Wazuh app project will be documented in this file.
- Fixed a problem with the agent menu header when the side menu is docked [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840)
- Fixed how the query filters apply on the Security Alerts table [#6102](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6102)
- Fixed exception in IT-Hygiene when an agent doesn't have policies [#6177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6177)
- Fixed exception in Inventory when agents don't have S.O. information [#6177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6177)
- Fixed exception in Inventory when agents don't have OS information [#6177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6177)
- Fixed pinned agent state in URL [#6177](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6177)
- Fixed invalid date format in about and agent views [#6234](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6234)

Expand Down
84 changes: 50 additions & 34 deletions plugins/main/public/controllers/agent/components/agents-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
EuiCard,
EuiLink,
EuiProgress,
EuiText,
} from '@elastic/eui';
import { AgentsTable } from './agents-table';
import { WzRequest } from '../../../react-services/wz-request';
Expand Down Expand Up @@ -54,8 +55,9 @@ import {
agentStatusColorByAgentStatus,
agentStatusLabelByAgentStatus,
} from '../../../../common/services/wz_agent_status';
import { AppNavigate } from '../../../react-services/app-navigate.js';
import { endpointSumary } from '../../../utils/applications';
import { endpointSumary, itHygiene } from '../../../utils/applications';
import { getCore } from '../../../kibana-services';
import { RedirectAppLinks } from '../../../../../../src/plugins/opensearch_dashboards_react/public';

export const AgentsPreview = compose(
withErrorBoundary,
Expand Down Expand Up @@ -313,26 +315,33 @@ export const AgentsPreview = compose(
<EuiFlexGroup className='mt-0'>
<EuiFlexItem className='agents-link-item'>
<EuiStat
titleElement='div'
className='euiStatLink last-agents-link'
isLoading={this.state.loadingAgents}
title={
<EuiToolTip
position='top'
content='View agent details'
>
<EuiLink
onClick={ev => {
ev.stopPropagation();
AppNavigate.navigateToModule(ev, 'agents', {
tab: 'welcome',
agent: this.state.lastRegisteredAgent?.id,
});
}
}
this.state.lastRegisteredAgent?.id ? (
<EuiToolTip
position='top'
content='View agent details'
>
{this.state.lastRegisteredAgent?.name || '-'}
</EuiLink>
</EuiToolTip>
<RedirectAppLinks
application={getCore().application}
>
<EuiLink
href={getCore().application.getUrlForApp(
itHygiene.id,
{
path: `#/agents?tab=welcome&agent=${this.state.lastRegisteredAgent?.id}`,
},
)}
>
{this.state.lastRegisteredAgent?.name}
</EuiLink>
</RedirectAppLinks>
</EuiToolTip>
) : (
<EuiText>-</EuiText>
)
}
titleSize='s'
description='Last registered agent'
Expand All @@ -342,30 +351,37 @@ export const AgentsPreview = compose(
{
<EuiFlexItem className='agents-link-item'>
<EuiStat
titleElement='div'
className={
this.state.agentMostActive?.name
? 'euiStatLink'
: ''
}
isLoading={this.state.loadingAgents}
title={
<EuiToolTip
position='top'
content='View agent details'
>
<EuiLink
onClick={ev => {
ev.stopPropagation();
AppNavigate.navigateToModule(ev, 'agents', {
tab: 'welcome',
agent: this.state.agentMostActive?.id,
});
}
}
this.state.agentMostActive?.id ? (
<EuiToolTip
position='top'
content='View agent details'
>
{this.state.agentMostActive?.name || '-'}
</EuiLink>
</EuiToolTip>
<RedirectAppLinks
application={getCore().application}
>
<EuiLink
href={getCore().application.getUrlForApp(
itHygiene.id,
{
path: `#/agents?tab=welcome&agent=${this.state.agentMostActive?.id}`,
},
)}
>
{this.state.agentMostActive?.name}
</EuiLink>
</RedirectAppLinks>
</EuiToolTip>
) : (
<EuiText>-</EuiText>
)
}
titleSize='s'
description='Most active agent'
Expand Down
Loading