Skip to content

Commit

Permalink
fix: improve table row key and update nvt preference for better text …
Browse files Browse the repository at this point in the history
…wrapping (#4257)
  • Loading branch information
daniele-mng authored Dec 23, 2024
1 parent 3530774 commit 01da4b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/web/components/table/row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import React from 'react';

import PropTypes from '../../utils/proptypes';

const TableRow = ({items = [], children, ...other}) => {
const data = items.map((item, i) => {
return <th key={i}>{item}</th>;
return (
<th key={item.id && item.name ? `${item.id}-${item.name}` : i}>{item}</th>
);
});
return (
<tr {...other}>
Expand All @@ -20,6 +20,7 @@ const TableRow = ({items = [], children, ...other}) => {
};

TableRow.propTypes = {
children: PropTypes.node,
items: PropTypes.array,
};

Expand Down
2 changes: 2 additions & 0 deletions src/web/pages/scanconfigs/nvtpreferences.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import PropTypes from 'web/utils/proptypes';

const StyledTableData = styled(TableData)`
overflow-wrap: break-word;
white-space: normal;
word-break: break-word;
`;

const shouldComponentUpdate = (props, nextProps) =>
Expand Down

0 comments on commit 01da4b8

Please sign in to comment.