@@ -65,6 +65,8 @@ interface KaplanMeierChartState {
65
65
selectedSurvivalColumnId : Nullable < number > ,
66
66
/** Flag of survival data request */
67
67
gettingSurvivalData : boolean ,
68
+ /** Flag to check if source is being unlink */
69
+ unlinkingSource : boolean ,
68
70
}
69
71
70
72
/**
@@ -83,7 +85,8 @@ class KaplanMeierChart extends React.Component<KaplanMeierChartProps, KaplanMeie
83
85
couldInferFieldsOfInterest : false ,
84
86
survivalColumns : [ ] ,
85
87
selectedSurvivalColumnId : null ,
86
- gettingSurvivalData : false
88
+ gettingSurvivalData : false ,
89
+ unlinkingSource : false
87
90
}
88
91
}
89
92
@@ -207,14 +210,24 @@ class KaplanMeierChart extends React.Component<KaplanMeierChartProps, KaplanMeie
207
210
} )
208
211
}
209
212
213
+ /**
214
+ * Unlink dataset if experiment is not created by cBioportal datasets
215
+ */
210
216
handleUnlinkClinicalSource ( ) {
211
- const myHeaders = getDjangoHeader ( )
217
+ // validate if is dataset from cBioportal
218
+ if ( this . props . gem_source . cgds_dataset || this . props . mRNA_source . cgds_dataset ) {
219
+ return
220
+ }
212
221
222
+ const myHeaders = getDjangoHeader ( )
223
+ let unlinkingSource = true
224
+ this . setState ( { unlinkingSource } )
213
225
const url = `${ urlUnlinkClinicalSourceUserFile } /${ this . props . experimentId } /`
214
226
ky . patch ( url , { headers : myHeaders } ) . then ( ( response ) => {
215
227
response . json ( ) . then ( ( response : DjangoCommonResponse ) => {
216
228
if ( response . status . code === DjangoResponseCode . SUCCESS ) {
217
- // Todo: callback para success
229
+ unlinkingSource = false
230
+ this . setState ( { unlinkingSource } )
218
231
} else {
219
232
alertGeneralError ( )
220
233
}
@@ -324,15 +337,14 @@ class KaplanMeierChart extends React.Component<KaplanMeierChartProps, KaplanMeie
324
337
</ Label >
325
338
</ Grid . Column >
326
339
< Grid . Column style = { { display : 'flex' , justifyContent : 'flex-end' } } >
327
- < div style = { { margin : '0 2rem 0 0' } } >
340
+ < div style = { { margin : '0 2rem 0 0' , display : this . props . gem_source . cgds_dataset || this . props . mRNA_source . cgds_dataset ? 'none' : 'normal' } } >
328
341
< Button
329
342
color = 'orange'
330
343
fluid
331
344
title = 'Unlink clinical dataset from this experiment'
332
345
onClick = { ( ) => this . handleUnlinkClinicalSource ( ) }
333
- /* loading={this.state.unlinkingSource}
334
- onClick={this.unlinkClinicalSource}
335
- disabled={isProcessing} */
346
+ loading = { this . state . unlinkingSource }
347
+ disabled = { this . state . unlinkingSource }
336
348
>
337
349
Unlink DataSet
338
350
</ Button >
0 commit comments