forked from p34709852/monkey
Fixed code review comments - JS linting and readability
This commit is contained in:
parent
c1f52ee994
commit
85b5a156fc
|
@ -1,6 +1,6 @@
|
||||||
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';
|
||||||
|
|
||||||
let renderArray = function (val) {
|
let renderArray = function (val) {
|
||||||
return <div>{val.map(x => <div>{x}</div>)}</div>;
|
return <div>{val.map(x => <div>{x}</div>)}</div>;
|
||||||
|
@ -38,7 +38,7 @@ class BreachedServersComponent extends React.Component {
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
The Monkey successfully breached <span
|
The Monkey successfully breached <span
|
||||||
className="label label-danger">{this.props.data.length}</span> {Pluralize('machines', this.props.data.length)}:
|
className="label label-danger">{this.props.data.length}</span> {Pluralize('machine', this.props.data.length)}:
|
||||||
</p>
|
</p>
|
||||||
<div className="data-table-container">
|
<div className="data-table-container">
|
||||||
<ReactTable
|
<ReactTable
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
||||||
|
|
||||||
let renderArray = function (val) {
|
let renderArray = function (val) {
|
||||||
return <span>{val.map(x => <span key={x}> {x}</span>)}</span>;
|
return <span>{val.map(x => <span key={x}> {x}</span>)}</span>;
|
||||||
|
@ -63,13 +63,13 @@ class PostBreachComponent extends React.Component {
|
||||||
});
|
});
|
||||||
let defaultPageSize = pbaMachines.length > pageSize ? pageSize : pbaMachines.length;
|
let defaultPageSize = pbaMachines.length > pageSize ? pageSize : pbaMachines.length;
|
||||||
let showPagination = pbaMachines > pageSize;
|
let showPagination = pbaMachines > pageSize;
|
||||||
const howManyPBAs = pbaMachines.reduce((accumulated, pbaMachine) => accumulated+pbaMachine["pba_results"].length,0)
|
const pbaCount = pbaMachines.reduce((accumulated, pbaMachine) => accumulated+pbaMachine["pba_results"].length, 0);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
The Monkey performed <span
|
The Monkey performed <span
|
||||||
className="label label-danger">{howManyPBAs}</span> post-breach {Pluralize('actions', howManyPBAs)} on <span
|
className="label label-danger">{pbaCount}</span> post-breach {Pluralize('action', pbaCount)} on <span
|
||||||
className="label label-warning">{pbaMachines.length}</span> {Pluralize('machines', pbaMachines.length)}:
|
className="label label-warning">{pbaMachines.length}</span> {Pluralize('machine', pbaMachines.length)}:
|
||||||
</p>
|
</p>
|
||||||
<div className="data-table-container">
|
<div className="data-table-container">
|
||||||
<ReactTable
|
<ReactTable
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
||||||
|
|
||||||
let renderArray = function (val) {
|
let renderArray = function (val) {
|
||||||
return <div>{val.map(x => <div>{x}</div>)}</div>;
|
return <div>{val.map(x => <div>{x}</div>)}</div>;
|
||||||
|
@ -37,16 +37,19 @@ class ScannedServersComponent extends React.Component {
|
||||||
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;
|
||||||
|
|
||||||
const howManyScannedMachines = this.props.data.length;
|
const scannedMachinesCount = this.props.data.length;
|
||||||
const reducerFromScannedServerToServicesAmount = (accumulated, scannedServer) => accumulated + scannedServer["services"].length;
|
const reducerFromScannedServerToServicesAmount = (accumulated, scannedServer) => accumulated + scannedServer["services"].length;
|
||||||
const howManyScannedServices = this.props.data.reduce(reducerFromScannedServerToServicesAmount, 0);
|
const scannedServicesAmount = this.props.data.reduce(reducerFromScannedServerToServicesAmount, 0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
The Monkey discovered <span
|
The Monkey discovered
|
||||||
className="label label-danger">{howManyScannedServices}</span> open {Pluralize('services', howManyScannedServices)} on <span
|
<span className="label label-danger">{scannedServicesAmount}</span>
|
||||||
className="label label-warning">{howManyScannedMachines}</span> {Pluralize('machines', howManyScannedMachines)}:
|
open {Pluralize('service', scannedServicesAmount)}
|
||||||
|
on
|
||||||
|
<span className="label label-warning">{scannedMachinesCount}</span>
|
||||||
|
{Pluralize('machine', scannedMachinesCount)}:
|
||||||
</p>
|
</p>
|
||||||
<div className="data-table-container">
|
<div className="data-table-container">
|
||||||
<ReactTable
|
<ReactTable
|
||||||
|
|
Loading…
Reference in New Issue