Skip to content

Commit

Permalink
Merge pull request #16027 from qmonmert/react/sonar
Browse files Browse the repository at this point in the history
[React] Sonar: Extract this nested ternary operation into an independent statement
  • Loading branch information
DanielFran authored Aug 22, 2021
2 parents 07ebaca + d700de4 commit 73ed7da
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export const HealthPage = () => {
setHealthObject({ ...healthObj, name });
};

const getBadgeType = (status: string) => status !== 'UP' ? 'danger' : 'success';

const handleClose = () => setShowModal(false);

const renderModal = () => <HealthModal healthObject={healthObject} handleClose={handleClose} showModal={showModal} />;
Expand Down Expand Up @@ -84,7 +86,7 @@ export const HealthPage = () => {
<tr key={configPropIndex}>
<td>{configPropKey}</td>
<td>
<Badge color={data[configPropKey].status !== 'UP' ? 'danger' : 'success'}>{data[configPropKey].status}</Badge>
<Badge color={getBadgeType(data[configPropKey].status)}>{data[configPropKey].status}</Badge>
</td>
<td>
{data[configPropKey].details ? (
Expand Down

0 comments on commit 73ed7da

Please sign in to comment.