From 61f0edc5e89dd0e1b8983ce2de90cb2dce80eac5 Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 27 Apr 2021 16:09:43 -0400 Subject: [PATCH] Fix `Each child in a list should have a unique "key" prop` warnings in unit tests --- .../JobList/JobListCancelButton.jsx | 28 +++++++++---------- .../ScheduleList/ScheduleListItem.jsx | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/awx/ui_next/src/components/JobList/JobListCancelButton.jsx b/awx/ui_next/src/components/JobList/JobListCancelButton.jsx index 9b6d15c661..cfa18a43ef 100644 --- a/awx/ui_next/src/components/JobList/JobListCancelButton.jsx +++ b/awx/ui_next/src/components/JobList/JobListCancelButton.jsx @@ -58,13 +58,13 @@ function JobListCancelButton({ i18n, jobsToCancel, onCancel }) { one="You do not have permission to cancel the following job:" other="You do not have permission to cancel the following jobs:" /> - {cannotCancelPermissions.map((job, i) => - i === cannotCancelPermissions.length - 1 ? ( - {job} - ) : ( - {job}, - ) - )} + {cannotCancelPermissions.map((job, i) => ( + + {' '} + {job} + {i !== cannotCancelPermissions.length - 1 ? ',' : ''} + + ))} )} {cannotCancelNotRunning.length > 0 && ( @@ -74,13 +74,13 @@ function JobListCancelButton({ i18n, jobsToCancel, onCancel }) { one="You cannot cancel the following job because it is not running:" other="You cannot cancel the following jobs because they are not running:" /> - {cannotCancelNotRunning.map((job, i) => - i === cannotCancelNotRunning.length - 1 ? ( - {job} - ) : ( - {job}, - ) - )} + {cannotCancelNotRunning.map((job, i) => ( + + {' '} + {job} + {i !== cannotCancelNotRunning.length - 1 ? ',' : ''} + + ))} )} diff --git a/awx/ui_next/src/components/Schedule/ScheduleList/ScheduleListItem.jsx b/awx/ui_next/src/components/Schedule/ScheduleList/ScheduleListItem.jsx index c241e5b201..1e6bd30f1e 100644 --- a/awx/ui_next/src/components/Schedule/ScheduleList/ScheduleListItem.jsx +++ b/awx/ui_next/src/components/Schedule/ScheduleList/ScheduleListItem.jsx @@ -82,9 +82,9 @@ function ScheduleListItem({ {Boolean(isMissingInventory || isMissingSurvey) && ( ( -
{message}
- ))} + content={[isMissingInventory, isMissingSurvey].map(message => + message ?
{message}
: null + )} position="right" >