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] Remove trailing - character for OS value in the list of agents #5266

Merged
merged 1 commit into from
Mar 9, 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ All notable changes to the Wazuh app project will be documented in this file.

### Fixed

- Fixed an issue that caused incorrect visualization of IPv6 addresses. [#4909](https://github.com/wazuh/wazuh-kibana-app/pull/4909)
- Fixed trailing hyphen character for OS value in the list of agents [#4828](https://github.com/wazuh/wazuh-kibana-app/pull/4828)
- Fixed an issue that caused incorrect visualization of IPv6 addresses ([#4909](https://github.com/wazuh/wazuh-kibana-app/pull/4909)).
- Fixed several typos in the code, by @jctello [#4911](https://github.com/wazuh/wazuh-kibana-app/pull/4911)
- Fixed the display of more than one protocol in the Global configuration section [#4917](https://github.com/wazuh/wazuh-kibana-app/pull/4917)
- Handling endpoint response was done when there is no data to show [#4918](https://github.com/wazuh/wazuh-kibana-app/pull/4918)
Expand Down
19 changes: 5 additions & 14 deletions public/controllers/agent/components/agents-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ export const AgentsTable = withErrorBoundary(
}

formatAgent(agent) {
const checkField = (field) => {
return field !== undefined ? field : '-';
};
const agentVersion = agent.version !== undefined ? agent.version.split(' ')[1] : '-';
const node_name = agent.node_name && agent.node_name !== 'unknown' ? agent.node_name : '-';
return {
Expand All @@ -292,7 +289,7 @@ export const AgentsTable = withErrorBoundary(
ip: compressIPv6(agent.ip),
status: agent.status,
group_config_status: agent.group_config_status,
group: checkField(agent.group),
group: agent?.group || '-',
os_name: agent,
version: agentVersion,
node_name: node_name,
Expand Down Expand Up @@ -336,11 +333,8 @@ export const AgentsTable = withErrorBoundary(
}

addIconPlatformRender(agent) {
let icon = false;
const checkField = (field) => {
return field !== undefined ? field : '-';
};
const os = (agent || {}).os;
let icon = '';
const os = agent?.os || {};

if ((os?.uname || '').includes('Linux')) {
icon = 'linux';
Expand All @@ -349,18 +343,15 @@ export const AgentsTable = withErrorBoundary(
} else if (os?.platform === 'darwin') {
icon = 'apple';
}
const os_name =
checkField(agent?.os?.name) +
' ' +
checkField(agent?.os?.version);
const os_name = `${agent?.os?.name || ''} ${agent?.os?.version || ''}`;

return (
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false} ><i
className={`fa fa-${icon} AgentsTable__soBadge AgentsTable__soBadge--${icon}`}
aria-hidden="true"
></i></EuiFlexItem>{' '}
<EuiFlexItem>{os_name === '- -' ? '-' : os_name}</EuiFlexItem>
<EuiFlexItem>{os_name.trim() || '-'}</EuiFlexItem>
</EuiFlexGroup>
);
}
Expand Down