diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d54066a41..0f69bb0440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to the Wazuh app project will be documented in this file. ### Fixed +- Fixed the propagation event so that the flyout data, in the decoders, does not change when the button is pressed. [#5597](https://github.com/wazuh/wazuh-kibana-app/pull/5597) - Fixed the color of the agent name in the groups section in dark mode. [#5676](https://github.com/wazuh/wazuh-kibana-app/pull/5676) ## Wazuh v4.6.0 - OpenSearch Dashboards 2.6.0 - Revision 01 diff --git a/plugins/main/public/controllers/management/components/management/decoders/views/decoder-info.tsx b/plugins/main/public/controllers/management/components/management/decoders/views/decoder-info.tsx index 5e9446c259..04a7705ac9 100644 --- a/plugins/main/public/controllers/management/components/management/decoders/views/decoder-info.tsx +++ b/plugins/main/public/controllers/management/components/management/decoders/views/decoder-info.tsx @@ -14,7 +14,10 @@ import { EuiFlexGrid, } from '@elastic/eui'; -import { ResourcesHandler, ResourcesConstants } from '../../common/resources-handler'; +import { + ResourcesHandler, + ResourcesConstants, +} from '../../common/resources-handler'; import { colors } from '../../common/colors'; import { TableWzAPI } from '../../../../../../components/common/tables'; import { UI_ERROR_SEVERITIES } from '../../../../../../react-services/error-orchestrator/types'; @@ -22,19 +25,27 @@ import { UI_LOGGER_LEVELS } from '../../../../../../../common/constants'; import { getErrorOrchestrator } from '../../../../../../react-services/common-services'; export default class WzDecoderInfo extends Component { + columns: object[]; + resourcesHandler; + constructor(props) { super(props); this.onClickRow = this.onClickRow.bind(this); this.state = { - currentInfo: {} + currentInfo: {}, }; this.resourcesHandler = new ResourcesHandler(ResourcesConstants.DECODERS); - const handleFileClick = async (value, item) => { + const handleFileClick = async (event, value, item) => { + event.stopPropagation(); try { const result = await this.resourcesHandler.getFileContent(value); - const file = { name: value, content: result, path: item.relative_dirname }; + const file = { + name: value, + content: result, + path: item.relative_dirname, + }; this.props.updateFileContent(file); } catch (error) { const options = { @@ -77,8 +88,12 @@ export default class WzDecoderInfo extends Component { sortable: true, render: (value, item) => { return ( - - handleFileClick(value, item)}>{value} + + handleFileClick(event, value, item)} + > + {value} + ); }, @@ -97,7 +112,7 @@ export default class WzDecoderInfo extends Component { document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera this.setState({ - currentId: this.props.item + currentId: this.props.item, }); } @@ -119,17 +134,19 @@ export default class WzDecoderInfo extends Component { renderInfo(position, file, path) { return ( - + Position {position} - + File - + - this.setNewFiltersAndBack([{ field: 'filename', value: file }]) + this.setNewFiltersAndBack([ + { field: 'filename', value: file }, + ]) } >  {file} @@ -137,13 +154,15 @@ export default class WzDecoderInfo extends Component { - + Path - + - this.setNewFiltersAndBack([{ field: 'relative_dirname', value: path }]) + this.setNewFiltersAndBack([ + { field: 'relative_dirname', value: path }, + ]) } >  {path} @@ -151,7 +170,7 @@ export default class WzDecoderInfo extends Component { - + ); } @@ -162,17 +181,21 @@ export default class WzDecoderInfo extends Component { */ renderDetails(details) { const detailsToRender = []; - const capitalize = (str) => str[0].toUpperCase() + str.slice(1); + const capitalize = str => str[0].toUpperCase() + str.slice(1); - Object.keys(details).forEach((key) => { + Object.keys(details).forEach(key => { let content = details[key]; if (key === 'order') { content = this.colorOrder(content); } else if (typeof details[key] === 'object') { content = ( ); } else { - content = {details[key]}; + content = {details[key]}; } detailsToRender.push( {capitalize(key)}
{content}
-
+ , ); }); @@ -208,8 +231,13 @@ export default class WzDecoderInfo extends Component { const result = []; for (let i = 0, len = valuesArray.length; i < len; i++) { const coloredString = ( - - {valuesArray[i].startsWith(' ') ? valuesArray[i] : ` ${valuesArray[i]}`} + + {valuesArray[i].startsWith(' ') + ? valuesArray[i] + : ` ${valuesArray[i]}`} ); result.push(coloredString); @@ -224,7 +252,7 @@ export default class WzDecoderInfo extends Component { colorRegex(regex) { regex = regex.toString(); const starts = ( - + {regex.split('(')[0]} ); @@ -232,7 +260,10 @@ export default class WzDecoderInfo extends Component { const result = [starts]; for (let i = 0, len = valuesArray.length; i < len; i++) { const coloredString = ( - + {valuesArray[i]} ); @@ -241,53 +272,54 @@ export default class WzDecoderInfo extends Component { return result; } -/** - * Update decoder details with the selected detail row - * @param decoder - */ + /** + * Update decoder details with the selected detail row + * @param decoder + */ onClickRow(decoder) { return { onClick: () => { this.setState({ currentDecoder: decoder }); }, }; - }; + } render() { const currentDecoder = - this.state && this.state.currentDecoder ? this.state.currentDecoder : this.props.item; - const { position, details, filename, name, relative_dirname } = currentDecoder; + this.state && this.state.currentDecoder + ? this.state.currentDecoder + : this.props.item; + const { position, details, filename, name, relative_dirname } = + currentDecoder; return ( <> - + {/* Decoder description name */} - - {name} - + {name} - - {/* Cards */} + + {/* Cards */} {/* General info */} +

Information

} - paddingSize="none" + paddingSize='none' initialIsOpen={true} > -
+
{this.renderInfo(position, filename, relative_dirname)}
@@ -296,16 +328,18 @@ export default class WzDecoderInfo extends Component { +

Details

} - paddingSize="none" + paddingSize='none' initialIsOpen={true} > -
{this.renderDetails(details)}
+
+ {this.renderDetails(details)} +
@@ -313,19 +347,19 @@ export default class WzDecoderInfo extends Component { +

Related decoders

} - paddingSize="none" + paddingSize='none' initialIsOpen={true} > -
+
- {currentDecoder?.filename && + {currentDecoder?.filename && ( - } + )}