From 08b36ee2bd2003f3f8dc6be2ba8fcc4113492adf Mon Sep 17 00:00:00 2001 From: Nikhil Shahi Date: Sun, 28 Aug 2022 04:34:56 -0500 Subject: [PATCH] (chore) update full detail view --- .../src/components/Alert/AlertComponent.tsx | 34 +- frontend/src/components/Alert/AlertDetail.tsx | 330 +++++++++--------- 2 files changed, 195 insertions(+), 169 deletions(-) diff --git a/frontend/src/components/Alert/AlertComponent.tsx b/frontend/src/components/Alert/AlertComponent.tsx index f7659732..feaaad49 100644 --- a/frontend/src/components/Alert/AlertComponent.tsx +++ b/frontend/src/components/Alert/AlertComponent.tsx @@ -45,6 +45,11 @@ export const AlertComponent: React.FC = ({ alert.resolutionMessage, ) + const closeModal = () => { + setResolutionMessage(alert.resolutionMessage) + onClose() + } + return ( = ({ - + - - {alert.type} - - + + + + {alert.type} + + {alert.riskScore} + + + + + {alert && ( = ({ }) => { const colorMode = useColorMode().colorMode const theme = useColorModeValue(lightTheme, darkTheme) - const panelColor = useColorModeValue("#F6F8FA", "#2A2734") const scrollRef = useRef(null) const topDivRef = useRef(null) - let panel = null + let leftPanel = null + let rightPanel = null const executeScroll = () => { scrollRef.current?.scrollIntoView() @@ -85,185 +89,183 @@ export const AlertDetail: React.FC = ({ break } } - panel = ( - - - - Spec - - - - {({ - className, - style, - tokens, - getLineProps, - getTokenProps, - }) => { - return ( -
-                      {tokens.map((line, i) => {
-                        const lineProps = getLineProps({ line, key: i })
-                        if (i + 1 === lineNumber) {
-                          lineProps.className = `${lineProps.className} highlight-line ${colorMode}`
-                        }
-                        return (
-                          
+          
+            
+              
+                
+                  Differing Trace
+                
+                
+              
+              
+                
+                  Request Path
+                  
+                    {trace.path}
+                  
+                
+                
+              
+            
+          
+        
+      )
+      rightPanel = (
+        
+          
+            
+              {({ className, style, tokens, getLineProps, getTokenProps }) => {
+                return (
+                  
+                    {tokens.map((line, i) => {
+                      const lineProps = getLineProps({ line, key: i })
+                      if (i + 1 === lineNumber) {
+                        lineProps.className = `${lineProps.className} highlight-line ${colorMode}`
+                      }
+                      return (
+                        
+                          
-                            
-                              {i + 1}
-                            
-                            
-                              {line.map((token, key) => (
-                                
-                              ))}
-                            
-                          
- ) - })} -
- ) - }} -
-
-
- - - Differing Trace - - - - Request Path - - {trace.path} - - - - + {i + 1} + + + {line.map((token, key) => ( + + ))} + +
+ ) + })} +
+ ) + }} +
-
+
) break default: - panel = } return ( - - - - - - Status - - {alert.status} - - - - - - Time - - {getDateTimeString(alert.createdAt)} - - - - - - Endpoint - + + + + + + + Status - {alert.apiEndpoint.method.toUpperCase()} + {alert.status} + + + + + Created At - {alert.apiEndpoint.path} + {getDateTimeString(alert.createdAt)} - - - - - - Risk Score - - {alert.riskScore} - - - - - - Description - - {alert.description} - - - {panel} - {alert.status !== Status.IGNORED && ( + + + + + Endpoint + + + {alert.apiEndpoint.method.toUpperCase()} + + + {alert.apiEndpoint.path} + + + + + - Resolution Reason -