@@ -6,14 +6,13 @@ import Tooltip from "@mui/material/Tooltip";
6
6
import type { AuditLog } from "api/typesGenerated" ;
7
7
import { Avatar } from "components/Avatar/Avatar" ;
8
8
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow" ;
9
- import { Pill } from "components/Pill/Pill" ;
10
9
import { Stack } from "components/Stack/Stack" ;
10
+ import { StatusPill } from "components/StatusPill/StatusPill" ;
11
11
import { TimelineEntry } from "components/Timeline/TimelineEntry" ;
12
12
import { InfoIcon } from "lucide-react" ;
13
13
import { NetworkIcon } from "lucide-react" ;
14
14
import { type FC , useState } from "react" ;
15
15
import { Link as RouterLink } from "react-router-dom" ;
16
- import type { ThemeRole } from "theme/roles" ;
17
16
import userAgentParser from "ua-parser-js" ;
18
17
import { AuditLogDescription } from "./AuditLogDescription/AuditLogDescription" ;
19
18
import { AuditLogDiff } from "./AuditLogDiff/AuditLogDiff" ;
@@ -22,21 +21,6 @@ import {
22
21
determineIdPSyncMappingDiff ,
23
22
} from "./AuditLogDiff/auditUtils" ;
24
23
25
- const httpStatusColor = ( httpStatus :number ) :ThemeRole => {
26
- // Treat server errors (500) as errors
27
- if ( httpStatus >= 500 ) {
28
- return "error" ;
29
- }
30
-
31
- // Treat client errors (400) as warnings
32
- if ( httpStatus >= 400 ) {
33
- return "warning" ;
34
- }
35
-
36
- // OK (200) and redirects (300) are successful
37
- return "success" ;
38
- } ;
39
-
40
24
interface AuditLogRowProps {
41
25
auditLog :AuditLog ;
42
26
// Useful for Storybook
@@ -139,7 +123,7 @@ export const AuditLogRow: FC<AuditLogRowProps> = ({
139
123
</ Stack >
140
124
141
125
< Stack direction = "row" alignItems = "center" >
142
- < StatusPill code = { auditLog . status_code } />
126
+ < StatusPill isHttpCode = { true } code = { auditLog . status_code } />
143
127
144
128
{ /* With multi-org, there is not enough space so show
145
129
everything in a tooltip. */ }
@@ -243,19 +227,6 @@ export const AuditLogRow: FC<AuditLogRowProps> = ({
243
227
) ;
244
228
} ;
245
229
246
- function StatusPill ( { code} :{ code :number } ) {
247
- const isHttp = code >= 100 ;
248
-
249
- return (
250
- < Pill
251
- css = { styles . statusCodePill }
252
- type = { isHttp ?httpStatusColor ( code ) :code === 0 ?"success" :"error" }
253
- >
254
- { code . toString ( ) }
255
- </ Pill >
256
- ) ;
257
- }
258
-
259
230
const styles = {
260
231
auditLogCell :{
261
232
padding :"0 !important" ,
@@ -311,14 +282,6 @@ const styles = {
311
282
width :"100%" ,
312
283
} ,
313
284
314
- statusCodePill :{
315
- fontSize :10 ,
316
- height :20 ,
317
- paddingLeft :10 ,
318
- paddingRight :10 ,
319
- fontWeight :600 ,
320
- } ,
321
-
322
285
deletedLabel :( theme ) => ( {
323
286
...( theme . typography . caption as CSSObject ) ,
324
287
color :theme . palette . text . secondary ,