From c235acbf6bfb00bf1b71a0ec781d4d5c434b909b Mon Sep 17 00:00:00 2001 From: Federico Rodriguez Date: Tue, 7 Mar 2023 15:53:46 +0100 Subject: [PATCH] Remove trailing `-` character for OS value in the list of agents (#4828) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 (cherry picked from commit 6a50c9b9f29f4fe86ca2d03c2c6bc444b92f8b66) --- CHANGELOG.md | 3 ++- .../agent/components/agents-table.js | 19 +++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e27b12cf77..46bc8a2c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/public/controllers/agent/components/agents-table.js b/public/controllers/agent/components/agents-table.js index 69d227731b..ed1ab8dd7f 100644 --- a/public/controllers/agent/components/agents-table.js +++ b/public/controllers/agent/components/agents-table.js @@ -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 { @@ -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, @@ -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'; @@ -349,10 +343,7 @@ 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 ( @@ -360,7 +351,7 @@ export const AgentsTable = withErrorBoundary( className={`fa fa-${icon} AgentsTable__soBadge AgentsTable__soBadge--${icon}`} aria-hidden="true" >{' '} - {os_name === '- -' ? '-' : os_name} + {os_name.trim() || '-'} ); }