@@ -15,7 +15,6 @@ type deleteTupleState = {
1515 dependencies : Array < any > , // list of dependencies fetched from API
1616 deleteStatusMessage : string , // for GUI to show
1717 isGettingDependencies : boolean , // for loading animation status
18- isDeletingEntry : boolean // for loading animation status
1918 deleteAccessible : boolean // valdiation result of accessibility from check dependency component
2019}
2120
@@ -26,7 +25,8 @@ class DeleteTuple extends React.Component<{
2625 tableAttributesInfo ?: TableAttributesInfo ,
2726 fetchTableContent : any ,
2827 clearEntrySelection : any ,
29- selectedTableEntry ?: any
28+ selectedTableEntry ?: any ,
29+ deleteInAction : any // for loading animation status
3030 } ,
3131 deleteTupleState > {
3232 constructor ( props : any ) {
@@ -35,7 +35,6 @@ class DeleteTuple extends React.Component<{
3535 dependencies : [ ] ,
3636 deleteStatusMessage : '' ,
3737 isGettingDependencies : false ,
38- isDeletingEntry : false ,
3938 deleteAccessible : false ,
4039 }
4140
@@ -89,7 +88,7 @@ class DeleteTuple extends React.Component<{
8988 }
9089
9190 // set status true for deleting entry, switch to false once api responds
92- this . setState ( { isDeletingEntry : true } )
91+ this . props . deleteInAction ( true )
9392
9493 // TODO: Run api fetch for list of dependencies/permission
9594 fetch ( `${ process . env . REACT_APP_DJLABBOOK_BACKEND_PREFIX } /delete_tuple` , {
@@ -99,7 +98,8 @@ class DeleteTuple extends React.Component<{
9998 } )
10099 . then ( result => {
101100 // set deleting status to done
102- this . setState ( { isDeletingEntry : false , dependencies : [ ] } )
101+ this . setState ( { dependencies : [ ] } )
102+ this . props . deleteInAction ( false )
103103
104104 // Check for error mesage 500, if so throw error - shouldn't happen as often once real dependency check is in place
105105 if ( result . status === 500 || result . status === 409 ) {
@@ -126,6 +126,7 @@ class DeleteTuple extends React.Component<{
126126
127127 } )
128128 . catch ( error => {
129+ this . props . deleteInAction ( false ) ;
129130 this . setState ( { deleteStatusMessage : error . message } ) ;
130131 } )
131132 }
@@ -184,7 +185,6 @@ class DeleteTuple extends React.Component<{
184185 < button className = "cancelActionButton" onClick = { ( ) => { this . setState ( { dependencies : [ ] } ) ; this . props . clearEntrySelection ( ) ; } } > Cancel</ button >
185186 </ div >
186187 < div className = "deleting" >
187- { this . state . isDeletingEntry ? < p > Deleting entry might take a while...</ p > : '' } { /* TODO: replace with proper animation */ }
188188 { this . state . deleteStatusMessage ? (
189189 < div className = "errorMessage" > { this . state . deleteStatusMessage } < button className = "dismiss" onClick = { ( ) => this . setState ( { deleteStatusMessage : '' } ) } > dismiss</ button > </ div >
190190 ) : '' }
0 commit comments