@@ -16,52 +16,25 @@ import {
16
16
import { Switch } from "@stacklok/ui-kit" ;
17
17
import { AlertConversation } from "@/api/generated" ;
18
18
import { Tooltip , TooltipTrigger } from "@stacklok/ui-kit" ;
19
- import { getMaliciousPackage } from "@/lib/utils" ;
19
+ import { sanitizeQuestionPrompt , parsingPromptText } from "@/lib/utils" ;
20
20
import { Search } from "lucide-react" ;
21
21
import { useAlertSearch } from "@/hooks/useAlertSearch" ;
22
22
import { useCallback } from "react" ;
23
23
import { useSearchParams } from "react-router-dom" ;
24
24
import { useFilteredAlerts } from "@/hooks/useAlertsData" ;
25
25
import { useClientSidePagination } from "@/hooks/useClientSidePagination" ;
26
26
27
- const wrapObjectOutput = ( input : AlertConversation [ "trigger_string" ] ) => {
28
- const data = getMaliciousPackage ( input ) ;
29
- if ( data === null ) return "N/A" ;
30
- if ( typeof data === "string" ) {
31
- return (
32
- < div className = "p-4 line-clamp-1 text-clip" >
33
- { data . split ( "\n" ) [ 0 ] ?? "" }
34
- </ div >
35
- ) ;
36
- }
37
- if ( ! data . type || ! data . name ) return "N/A" ;
38
-
39
- return (
40
- < div className = "max-h-40 w-fit overflow-y-auto whitespace-pre-wrap p-2" >
41
- < label className = "font-medium" > Package:</ label >
42
-
43
- < a
44
- href = { `https://www.insight.stacklok.com/report/${ data . type } /${ data . name } ` }
45
- target = "_blank"
46
- rel = "noopener noreferrer"
47
- className = "text-brand-500 hover:underline"
48
- >
49
- { data . type } /{ data . name }
50
- </ a >
51
- { data . status && (
52
- < >
53
- < br />
54
- < label className = "font-medium" > Status:</ label > { data . status }
55
- </ >
56
- ) }
57
- { data . description && (
58
- < >
59
- < br />
60
- < label className = "font-medium" > Description:</ label > { data . description }
61
- </ >
62
- ) }
63
- </ div >
27
+ const getTitle = ( alert : AlertConversation ) => {
28
+ const prompt = alert . conversation ;
29
+ const title = parsingPromptText (
30
+ sanitizeQuestionPrompt ( {
31
+ question : prompt . question_answers ?. [ 0 ] ?. question . message ?? "" ,
32
+ answer : prompt . question_answers ?. [ 0 ] ?. answer ?. message ?? "" ,
33
+ } ) ,
34
+ prompt . conversation_timestamp ,
64
35
) ;
36
+
37
+ return title ;
65
38
} ;
66
39
67
40
export function AlertsTable ( ) {
@@ -179,9 +152,7 @@ export function AlertsTable() {
179
152
} ) }
180
153
</ Cell >
181
154
< Cell className = "truncate" > { alert . trigger_type } </ Cell >
182
- < Cell className = "overflow-auto whitespace-nowrap max-w-80" >
183
- { wrapObjectOutput ( alert . trigger_string ) }
184
- </ Cell >
155
+ < Cell className = "truncate" > { getTitle ( alert ) } </ Cell >
185
156
</ Row >
186
157
) ) }
187
158
</ TableBody >
0 commit comments