UI: Fix the rendering of scanned machines in UI

This commit is contained in:
vakaris_zilius 2022-09-30 12:42:28 +00:00 committed by Kekoa Kaaikala
parent 9048f72030
commit d0d08f7649
3 changed files with 10 additions and 4 deletions

View File

@ -538,9 +538,11 @@ class ReportPageComponent extends AuthComponent {
<BreachedServers /> <BreachedServers />
</div> </div>
{/* Post breach data should be separated from scanned machines
<div style={{marginBottom: '20px'}}> <div style={{marginBottom: '20px'}}>
<PostBreach data={this.state.report.glance.scanned}/> <PostBreach data={this.state.report.glance.scanned}/>
</div> </div>
*/}
<div style={{marginBottom: '20px'}}> <div style={{marginBottom: '20px'}}>
<StolenPasswords <StolenPasswords

View File

@ -9,6 +9,10 @@ export let renderIpAddresses = function (val) {
</div>; </div>;
}; };
export let renderMachineArray = function(array) {
return <>{array.map(x => <div key={x.network_interfaces[0]}>{x.network_interfaces[0]}</div>)}</>;
}
export let renderLimitedArray = function (array, export let renderLimitedArray = function (array,
limit, limit,
className='', className='',

View File

@ -1,19 +1,20 @@
import React from 'react'; import React from 'react';
import ReactTable from 'react-table'; import ReactTable from 'react-table';
import Pluralize from 'pluralize'; import Pluralize from 'pluralize';
import {renderArray, renderIpAddresses} from '../common/RenderArrays'; import {renderArray, renderIpAddresses, renderMachineArray} from '../common/RenderArrays';
const columns = [ const columns = [
{ {
Header: 'Scanned Servers', Header: 'Scanned Servers',
columns: [ columns: [
{Header: 'Machine', accessor: 'label'}, {Header: 'Machine', id: 'machine', accessor: x => x.ip_addresses[0]},
{ {
Header: 'IP Addresses', id: 'ip_addresses', Header: 'IP Addresses', id: 'ip_addresses',
accessor: x => renderIpAddresses(x) accessor: x => renderIpAddresses(x)
}, },
{Header: 'Accessible From', id: 'accessible_from_nodes', accessor: x => renderArray(x.accessible_from_nodes)}, {Header: 'Accessible From', id: 'accessible_from_nodes',
accessor: x => renderMachineArray(x.accessible_from_nodes)},
{Header: 'Services', id: 'services', accessor: x => renderArray(x.services)} {Header: 'Services', id: 'services', accessor: x => renderArray(x.services)}
] ]
} }
@ -27,7 +28,6 @@ class ScannedServersComponent extends React.Component {
} }
render() { render() {
let defaultPageSize = this.props.data.length > pageSize ? pageSize : this.props.data.length; let defaultPageSize = this.props.data.length > pageSize ? pageSize : this.props.data.length;
let showPagination = this.props.data.length > pageSize; let showPagination = this.props.data.length > pageSize;