Island UI: add keys to items in ransomware report, breach section

This commit is contained in:
VakarisZ 2021-07-26 11:45:29 +03:00
parent fcb52b8223
commit e6a87839d6
2 changed files with 7 additions and 5 deletions

View File

@ -24,11 +24,13 @@ export let renderLimitedArray = function (array,
} else {
element = (<>{array[i]}</>);
}
elements.push(<div className={className}>{element}</div>);
elements.push(<div className={className} key={array[i]}>{element}</div>);
}
let remainder = array.length - limit;
if(remainder > 0){
elements.push(<div className={className}>&nbsp;and {remainder} more</div>);
elements.push(<div className={className} key={'remainder'}>
&nbsp;and {remainder} more
</div>);
}
return elements
}

View File

@ -25,7 +25,7 @@ function BreachSection() {
function getBreachSectionBody(machines) {
let machineList = [];
for(let i = 0; i < machines.length; i++){
machineList.push(<li>{getMachine(machines[i])}</li>);
machineList.push(getMachine(machines[i]));
}
return (
<div className={'ransomware-breach-section'}>
@ -39,10 +39,10 @@ function getBreachSectionBody(machines) {
function getMachine(machine) {
return (
<>
<li key={machine['hostname']}>
<b>{machine['hostname']}</b>
({renderLimitedArray(machine['ip_addresses'], 2, 'ip-address')}) at {machine['start_time']}
</>
</li>
)
}