Skip to content

Commit

Permalink
Remove trailing - character for OS value in the list of agents (#4828)
Browse files Browse the repository at this point in the history
* Remove - character when version is empty

* Simplify field default value

* Add changelog

* Update CHANGELOG.md

* Update CHANGELOG.md

* Change group default value to -

* Conflit resolution

---------

Co-authored-by: Álex <alejandro.ruiz.becerra@wazuh.com>
  • Loading branch information
asteriscos and AlexRuiz7 authored Mar 7, 2023
1 parent 4c113f7 commit 6a50c9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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

0 comments on commit 6a50c9b

Please sign in to comment.