From 3dd6eb487e10d8deb71e22aa427801ae35ac206b Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 28 Feb 2023 16:10:53 -0500 Subject: [PATCH] fix(striker-ui): hide password related in fence list --- .../ManageFence/ManageFencePanel.tsx | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/striker-ui/components/ManageFence/ManageFencePanel.tsx b/striker-ui/components/ManageFence/ManageFencePanel.tsx index efa60324..212d181a 100644 --- a/striker-ui/components/ManageFence/ManageFencePanel.tsx +++ b/striker-ui/components/ManageFence/ManageFencePanel.tsx @@ -3,6 +3,7 @@ import { FC, FormEventHandler, ReactElement, + ReactNode, useMemo, useRef, useState, @@ -267,9 +268,28 @@ const ManageFencePanel: FC = () => { {fenceName} - {Object.entries(fenceParameters).reduce( - (previous, [parameterId, parameterValue]) => - `${previous} ${parameterId}="${parameterValue}"`, + {Object.entries(fenceParameters).reduce( + (previous, [parameterId, parameterValue]) => { + let current: ReactNode = <>{parameterId}="; + + current = /passw/i.test(parameterId) ? ( + <> + {current} + {parameterValue} + + ) : ( + <> + {current} + {parameterValue} + + ); + + return ( + <> + {previous} {current}" + + ); + }, fenceAgent, )}