@@ -37,16 +37,19 @@ export default function KeystoresDeleteDialog({
3737 const [ keystoresDelete , setKeystoresDelete ] = useState < Web3signerDeleteResponse > ( ) ;
3838 const [ keystoresDeleteError , setKeystoresDeleteError ] = useState < string > ( ) ;
3939 const [ loading , setLoading ] = useState ( false ) ;
40+ const [ deletedPubkeys , setDeletedPubkeys ] = useState < string [ ] > ( [ ] ) ;
4041 const theme = useTheme ( ) ;
4142 const isMobile = useMediaQuery ( theme . breakpoints . down ( "sm" ) ) ;
4243
4344 async function deleteSelectedKeystores ( ) {
4445 try {
4546 setKeystoresDelete ( undefined ) ;
4647 setLoading ( true ) ;
48+ const pubkeysToDelete = selectedRows . map ( ( row ) => rows [ parseInt ( row . toString ( ) ) ] ?. pubkey ) ;
49+ setDeletedPubkeys ( pubkeysToDelete ) ;
4750 setKeystoresDelete (
4851 await rpcClient . call ( "deleteValidators" , {
49- pubkeys : selectedRows . map ( ( row ) => rows [ parseInt ( row . toString ( ) ) ] . pubkey )
52+ pubkeys : pubkeysToDelete
5053 } )
5154 ) ;
5255 setLoading ( false ) ;
@@ -61,6 +64,7 @@ export default function KeystoresDeleteDialog({
6164 const handleClose = ( ) => {
6265 setOpen ( false ) ;
6366 } ;
67+
6468 return (
6569 < Dialog
6670 disableEscapeKeyDown = { true }
@@ -76,28 +80,33 @@ export default function KeystoresDeleteDialog({
7680 aria-describedby = "alert-dialog-description"
7781 TransitionComponent = { SlideTransition }
7882 >
79- < DialogTitle id = "alert-dialog-title" > { keystoresDelete ? "Done" : "Delete Keystores?" } </ DialogTitle >
83+ < DialogTitle id = "alert-dialog-title" >
84+ { keystoresDelete ? "Keys deleted successfully" : "Delete Keystores?" }
85+ </ DialogTitle >
8086 < DialogContent >
8187 < Box sx = { importDialogBoxStyle } >
8288 { keystoresDeleteError ? (
8389 `Error: ${ keystoresDeleteError } `
8490 ) : keystoresDelete ?. data ? (
8591 < div >
86- { keystoresDelete . data . map ( ( result , index ) => (
87- < div style = { { marginBottom : "20px" } } >
88- < Typography variant = "h5" color = "GrayText" >
89- { shortenPubkey ( rows [ index ] ?. pubkey ) }
90- </ Typography >
91- < Typography variant = "h6" >
92- < b > Status:</ b > { result . status } { getEmoji ( result . status ) }
93- </ Typography >
94- { result . message ? (
92+ { keystoresDelete . data . map ( ( result , index ) => {
93+ const pubkey = deletedPubkeys [ index ] ;
94+ return (
95+ < div style = { { marginBottom : "20px" } } key = { pubkey || index } >
96+ < Typography variant = "h5" color = "GrayText" >
97+ { shortenPubkey ( pubkey ) }
98+ </ Typography >
9599 < Typography variant = "h6" >
96- < b > Message :</ b > { result . message }
100+ < b > Status :</ b > { result . status } { getEmoji ( result . status ) }
97101 </ Typography >
98- ) : null }
99- </ div >
100- ) ) }
102+ { result . message ? (
103+ < Typography variant = "h6" >
104+ < b > Message:</ b > { result . message }
105+ </ Typography >
106+ ) : null }
107+ </ div >
108+ ) ;
109+ } ) }
101110 { keystoresDelete . slashing_protection ? (
102111 < div >
103112 < Alert severity = "warning" sx = { { marginTop : 2 , marginBottom : 2 } } variant = "filled" >
0 commit comments