From 50c24c77f4099c8807dd0ea157a76de8c7386f43 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 12 Jul 2021 09:25:41 -0400 Subject: [PATCH] Island: Use Pluralize to display ransomware propagation stats --- .../report-components/RansomwareReport.js | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js index 1f5f9b0d7..52ca82c42 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/RansomwareReport.js @@ -2,6 +2,7 @@ import React from 'react'; import ReportHeader, {ReportTypes} from './common/ReportHeader'; import ReportLoader from './common/ReportLoader'; +import pluralize from 'pluralize' class RansomwareReport extends React.Component { stillLoadingDataFromServer() { @@ -41,22 +42,13 @@ class RansomwareReport extends React.Component { for (let exploit in exploit_counts) { let count = exploit_counts[exploit]; - if (count === 1) { - exploitation_details.push( -
- {count} machine was exploited by - the {exploit}. -
- ); - } - else { - exploitation_details.push( -
- {count} machines were exploited by - the {exploit}. -
- ); - } + exploitation_details.push( +
+ {count}  + {pluralize('machine', count)} {pluralize('was', count)} exploited by the  + {exploit}. +
+ ); } return exploitation_details;