@@ -13,6 +13,7 @@ import type {
1313 GetRecordsCrossmatchResponse ,
1414 RecordCrossmatch ,
1515 RecordCrossmatchStatus ,
16+ RecordTriageStatus ,
1617 ValidationError ,
1718} from "../clients/admin/types.gen" ;
1819import { getResource } from "../resources/resources" ;
@@ -27,28 +28,44 @@ import { adminClient } from "../clients/config";
2728interface CrossmatchFiltersProps {
2829 tableName : string | null ;
2930 status : RecordCrossmatchStatus | null ;
31+ triageStatus : string | null ;
3032 pageSize : number ;
31- onApplyFilters : ( tableName : string , status : string , pageSize : number ) => void ;
33+ onApplyFilters : (
34+ tableName : string ,
35+ status : string ,
36+ triageStatus : string ,
37+ pageSize : number ,
38+ ) => void ;
3239}
3340
3441function CrossmatchFilters ( {
3542 tableName,
3643 status,
44+ triageStatus,
3745 pageSize,
3846 onApplyFilters,
3947} : CrossmatchFiltersProps ) : ReactElement {
4048 const [ localStatus , setLocalStatus ] = useState < string > ( status || "all" ) ;
49+ const [ localTriageStatus , setLocalTriageStatus ] = useState < string > (
50+ triageStatus ?? "pending" ,
51+ ) ;
4152 const [ localPageSize , setLocalPageSize ] = useState < number > ( pageSize ) ;
4253 const [ localTableName , setLocalTableName ] = useState < string > ( tableName || "" ) ;
4354
4455 useEffect ( ( ) => {
4556 setLocalStatus ( status || "all" ) ;
57+ setLocalTriageStatus ( triageStatus ?? "pending" ) ;
4658 setLocalPageSize ( pageSize ) ;
4759 setLocalTableName ( tableName || "" ) ;
48- } , [ status , pageSize , tableName ] ) ;
60+ } , [ status , triageStatus , pageSize , tableName ] ) ;
4961
5062 function applyFilters ( ) : void {
51- onApplyFilters ( localTableName , localStatus , localPageSize ) ;
63+ onApplyFilters (
64+ localTableName ,
65+ localStatus ,
66+ localTriageStatus ,
67+ localPageSize ,
68+ ) ;
5269 }
5370
5471 return (
@@ -73,6 +90,16 @@ function CrossmatchFilters({
7390 value = { localStatus }
7491 onChange = { setLocalStatus }
7592 />
93+ < DropdownFilter
94+ title = "Manual check status"
95+ options = { [
96+ { value : "all" , label : "All" } ,
97+ { value : "pending" , label : "Pending" } ,
98+ { value : "resolved" , label : "Resolved" } ,
99+ ] }
100+ value = { localTriageStatus }
101+ onChange = { setLocalTriageStatus }
102+ />
76103 < DropdownFilter
77104 title = "Page size"
78105 options = { [
@@ -133,6 +160,10 @@ function CrossmatchResults({
133160 return getResource ( `crossmatch.status.${ status } ` ) . Title ;
134161 }
135162
163+ function getTriageStatusLabel ( triageStatus : RecordTriageStatus ) : string {
164+ return getResource ( `crossmatch.triage.${ triageStatus } ` ) . Title ;
165+ }
166+
136167 const columns : Column [ ] = [
137168 {
138169 name : "Record name" ,
@@ -144,6 +175,7 @@ function CrossmatchResults({
144175 } ,
145176 } ,
146177 { name : "Status" } ,
178+ { name : "Manual check status" } ,
147179 {
148180 name : "Candidates" ,
149181 renderCell : ( recordIndex : CellPrimitive ) => {
@@ -159,6 +191,7 @@ function CrossmatchResults({
159191 data ?. records . map ( ( record : RecordCrossmatch , index : number ) => ( {
160192 "Record name" : index ,
161193 Status : getStatusLabel ( record . status ) ,
194+ "Manual check status" : getTriageStatusLabel ( record . triage_status ) ,
162195 Candidates : index ,
163196 } ) ) || [ ] ;
164197
@@ -168,6 +201,7 @@ function CrossmatchResults({
168201async function fetcher (
169202 tableName : string | null ,
170203 status : RecordCrossmatchStatus | null ,
204+ triageStatus : RecordTriageStatus | null ,
171205 page : number ,
172206 pageSize : number ,
173207) : Promise < GetRecordsCrossmatchResponse > {
@@ -180,6 +214,7 @@ async function fetcher(
180214 query : {
181215 table_name : tableName ,
182216 status : status ,
217+ triage_status : triageStatus ,
183218 page : page ,
184219 page_size : pageSize ,
185220 } ,
@@ -205,6 +240,13 @@ export function CrossmatchResultsPage(): ReactElement {
205240
206241 const tableName = searchParams . get ( "table_name" ) ;
207242 const status = searchParams . get ( "status" ) as RecordCrossmatchStatus | null ;
243+ const triageStatusParam = searchParams . get ( "triage_status" ) ;
244+ const apiTriageStatus : RecordTriageStatus | null =
245+ triageStatusParam === null || triageStatusParam === ""
246+ ? "pending"
247+ : triageStatusParam === "all"
248+ ? null
249+ : ( triageStatusParam as RecordTriageStatus ) ;
208250 const page = parseInt ( searchParams . get ( "page" ) || "0" ) ;
209251 const pageSize = parseInt ( searchParams . get ( "page_size" ) || "25" ) ;
210252
@@ -213,8 +255,8 @@ export function CrossmatchResultsPage(): ReactElement {
213255 } , [ tableName ] ) ;
214256
215257 const { data, loading, error } = useDataFetching (
216- ( ) => fetcher ( tableName , status , page , pageSize ) ,
217- [ tableName , status , page , pageSize ] ,
258+ ( ) => fetcher ( tableName , status , apiTriageStatus , page , pageSize ) ,
259+ [ tableName , status , apiTriageStatus , page , pageSize ] ,
218260 ) ;
219261
220262 function handlePageChange ( newPage : number ) : void {
@@ -226,6 +268,7 @@ export function CrossmatchResultsPage(): ReactElement {
226268 function handleApplyFilters (
227269 newTableName : string ,
228270 newStatus : string ,
271+ newTriageStatus : string ,
229272 newPageSize : number ,
230273 ) : void {
231274 const newSearchParams = new URLSearchParams ( searchParams ) ;
@@ -242,6 +285,12 @@ export function CrossmatchResultsPage(): ReactElement {
242285 newSearchParams . set ( "status" , newStatus ) ;
243286 }
244287
288+ if ( newTriageStatus === "all" ) {
289+ newSearchParams . set ( "triage_status" , "all" ) ;
290+ } else {
291+ newSearchParams . set ( "triage_status" , newTriageStatus ) ;
292+ }
293+
245294 newSearchParams . set ( "page_size" , newPageSize . toString ( ) ) ;
246295 newSearchParams . set ( "page" , "0" ) ;
247296
@@ -272,6 +321,7 @@ export function CrossmatchResultsPage(): ReactElement {
272321 < CrossmatchFilters
273322 tableName = { tableName }
274323 status = { status }
324+ triageStatus = { triageStatusParam }
275325 pageSize = { pageSize }
276326 onApplyFilters = { handleApplyFilters }
277327 />
0 commit comments