@@ -9,8 +9,10 @@ import { Stack } from "components/Stack/Stack"
9
9
import { UserAvatar } from "components/UserAvatar/UserAvatar"
10
10
import { t } from "i18next"
11
11
import { ComponentProps , useState } from "react"
12
+ import { MONOSPACE_FONT_FAMILY } from "theme/constants"
12
13
import { createDayString } from "util/createDayString"
13
14
import { AuditLogDiff } from "./AuditLogDiff"
15
+ import userAgentParser from "ua-parser-js"
14
16
15
17
const pillTypeByHttpStatus = ( httpStatus : number ) : ComponentProps < typeof Pill > [ "type" ] => {
16
18
if ( httpStatus >= 300 && httpStatus < 500 ) {
@@ -58,6 +60,7 @@ export const AuditLogRow: React.FC<AuditLogRowProps> = ({
58
60
const [ isDiffOpen , setIsDiffOpen ] = useState ( defaultIsDiffOpen )
59
61
const diffs = Object . entries ( auditLog . diff )
60
62
const shouldDisplayDiff = diffs . length > 0
63
+ const userAgent = userAgentParser ( auditLog . user_agent )
61
64
62
65
const toggle = ( ) => {
63
66
if ( shouldDisplayDiff ) {
@@ -66,11 +69,7 @@ export const AuditLogRow: React.FC<AuditLogRowProps> = ({
66
69
}
67
70
68
71
return (
69
- < TableRow
70
- key = { auditLog . id }
71
- hover = { shouldDisplayDiff }
72
- data-testid = { `audit-log-row-${ auditLog . id } ` }
73
- >
72
+ < TableRow key = { auditLog . id } data-testid = { `audit-log-row-${ auditLog . id } ` } >
74
73
< TableCell className = { styles . auditLogCell } >
75
74
< Stack
76
75
style = { { cursor : shouldDisplayDiff ? "pointer" : undefined } }
@@ -120,7 +119,10 @@ export const AuditLogRow: React.FC<AuditLogRowProps> = ({
120
119
< strong > IP</ strong > { auditLog . ip }
121
120
</ div >
122
121
< div >
123
- < strong > Agent</ strong > { auditLog . user_agent }
122
+ < strong > OS</ strong > { userAgent . os . name }
123
+ </ div >
124
+ < div >
125
+ < strong > Browser</ strong > { userAgent . browser . name } { userAgent . browser . version }
124
126
</ div >
125
127
</ Stack >
126
128
</ Stack >
@@ -148,6 +150,10 @@ const useStyles = makeStyles((theme) => ({
148
150
149
151
auditLogRow : {
150
152
padding : theme . spacing ( 2 , 4 ) ,
153
+
154
+ "&:hover" : {
155
+ backgroundColor : theme . palette . action . hover ,
156
+ } ,
151
157
} ,
152
158
153
159
auditLogRowInfo : {
@@ -162,6 +168,7 @@ const useStyles = makeStyles((theme) => ({
162
168
163
169
auditLogTime : {
164
170
...theme . typography . body2 ,
171
+ fontSize : 12 ,
165
172
fontFamily : "inherit" ,
166
173
color : theme . palette . text . secondary ,
167
174
display : "block" ,
@@ -173,7 +180,7 @@ const useStyles = makeStyles((theme) => ({
173
180
174
181
auditLogExtraInfo : {
175
182
...theme . typography . body2 ,
176
- fontFamily : "inherit" ,
183
+ fontFamily : MONOSPACE_FONT_FAMILY ,
177
184
color : theme . palette . text . secondary ,
178
185
whiteSpace : "nowrap" ,
179
186
} ,
0 commit comments