11import React from 'react'
22import { Base } from '../Base'
33import { Header , Button , Modal , Table , DropdownItemProps , Icon , Confirm , Form , Grid } from 'semantic-ui-react'
4- import { DjangoCGDSStudy , DjangoMethylationPlatform , DjangoTag , DjangoUserFile , TagType } from '../../utils/django_interfaces'
4+ import { DjangoCGDSStudy , DjangoTag , DjangoUserFile , TagType } from '../../utils/django_interfaces'
55import ky , { Options } from 'ky'
66import { getDjangoHeader , alertGeneralError , formatDateLocale , cleanRef , getFilenameFromSource , makeSourceAndAppend , getDefaultSource , getDefaultNewTag , copyObject } from '../../utils/util_functions'
7- import { Nullable , CustomAlert , CustomAlertTypes , SourceType , OkResponse , ConfirmModal , FileType } from '../../utils/interfaces'
7+ import { Nullable , CustomAlert , CustomAlertTypes , SourceType , OkResponse , ConfirmModal } from '../../utils/interfaces'
88import { Biomarker , BiomarkerType , BiomarkerOrigin , FormBiomarkerData , MoleculesSectionData , MoleculesTypeOfSelection , SaveBiomarkerStructure , SaveMoleculeStructure , FeatureSelectionPanelData , SourceStateBiomarker , FeatureSelectionAlgorithm , FitnessFunction , FitnessFunctionParameters , BiomarkerState , AdvancedAlgorithm as AdvancedAlgorithmParameters , BBHAVersion , BiomarkerSimple } from './types'
99import { ManualForm } from './modalContentBiomarker/manualForm/ManualForm'
1010import { PaginatedTable , PaginationCustomFilter } from '../common/PaginatedTable'
@@ -26,7 +26,6 @@ import { EditBiomarkerIcon } from './EditBiomarkerIcon'
2626import { SwitchPublicButton } from '../common/SwitchPublicButton'
2727import { PopupIcons } from '../common/PopupIcons'
2828import { TagsPanel } from '../files-manager/TagsPanel'
29- import { NewFile } from '../files-manager/FilesManager'
3029
3130// URLs defined in biomarkers.html
3231declare const urlBiomarkersCRUD : string
@@ -46,7 +45,7 @@ declare const urlCloneBiomarker: string
4645declare const urlStopFSExperiment : string
4746
4847const REQUEST_TIMEOUT = 120000 // 2 minutes in milliseconds
49- const FILE_INPUT_LABEL = 'Add a new file'
48+
5049/** A matched molecule with the search query and the validated alias. */
5150type MoleculeFinderResult = { molecule : string , standard : string }
5251
@@ -102,7 +101,6 @@ interface BiomarkersPanelState {
102101 modalInstitutions : SharedInstitutionsBiomarkerPropsExtend ,
103102 /** modal to handle shared users */
104103 modalUsers : SharedUsersBiomarkerPropsExtend ,
105- newFile : NewFile ,
106104 showDeleteTagModal : boolean ,
107105 deletingTag : boolean ,
108106}
@@ -141,7 +139,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
141139 addingTag : false ,
142140 modalInstitutions : this . defaultModalInstitutions ( ) ,
143141 modalUsers : this . defaultModalUsers ( ) ,
144- newFile : this . getDefaultNewFile ( ) ,
145142 showDeleteTagModal : false ,
146143 deletingTag : false ,
147144 }
@@ -161,24 +158,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
161158 this . setState ( { modalInstitutions : this . defaultModalInstitutions ( ) } )
162159 }
163160
164- /**
165- * Generates a default new file form
166- * @returns An object with all the field with default values
167- */
168- getDefaultNewFile ( ) : NewFile {
169- return {
170- newFileName : FILE_INPUT_LABEL ,
171- newFileNameUser : '' ,
172- newFileDescription : '' ,
173- newFileType : FileType . MRNA ,
174- newTag : null ,
175- institutions : [ ] ,
176- isCpGSiteId : false ,
177- platform : DjangoMethylationPlatform . PLATFORM_450 ,
178- survivalColumns : [ ]
179- }
180- }
181-
182161 /**
183162 * default modal institution
184163 * @returns default modal shared institution object
@@ -1411,17 +1390,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
14111390 } ) )
14121391 }
14131392
1414- /**
1415- * Handles input changes in the New File Form
1416- * @param name State field to change
1417- * @param value Value to assign to the specified field
1418- */
1419- handleAddFileInputsChange = ( name : string , value : any ) => {
1420- const newFileForm = this . state . newFile
1421- newFileForm [ name ] = value
1422- this . setState ( { newFile : newFileForm } )
1423- }
1424-
14251393 /**
14261394 * Cleans the new/edit biomarker form
14271395 */
@@ -1475,19 +1443,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
14751443 this . setState ( { showDeleteBiomarkerModal : false } )
14761444 }
14771445
1478- /**
1479- * Removes a Survival data tuple for a CGDSDataset
1480- * @param idxSurvivalTuple Index in survival tuple
1481- */
1482- removeSurvivalFormTuple = ( idxSurvivalTuple : number ) => {
1483- this . setState ( prevState => ( {
1484- newFile : {
1485- ...prevState . newFile ,
1486- survivalColumns : prevState . newFile . survivalColumns . filter ( ( _ , i ) => i !== idxSurvivalTuple ) ,
1487- } ,
1488- } ) )
1489- }
1490-
14911446 /**
14921447 * Generates the modal to confirm a biomarker deletion
14931448 * @returns Modal component. Null if no Tag was selected to delete
@@ -1564,23 +1519,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
15641519 this . setState ( { featureSelection } )
15651520 }
15661521
1567- /**
1568- * Handles CGDS Dataset form changes in fields of Survival data tuples
1569- * @param idxSurvivalTuple Index in survival tuple
1570- * @param name Field of the CGDS dataset to change
1571- * @param value Value to assign to the specified field
1572- */
1573- handleSurvivalFormDatasetChanges = ( idxSurvivalTuple : number , name : string , value : any ) => {
1574- this . setState ( prevState => ( {
1575- newFile : {
1576- ...prevState . newFile ,
1577- survivalColumns : prevState . newFile . survivalColumns . map ( ( t , i ) =>
1578- i === idxSurvivalTuple ? { ...t , [ name ] : value } : t
1579- ) ,
1580- } ,
1581- } ) )
1582- }
1583-
15841522 /**
15851523 * Function to go back to step 1
15861524 */
@@ -2215,9 +2153,6 @@ export class BiomarkersPanel extends React.Component<unknown, BiomarkersPanelSta
22152153 return { key : id , value : id , text : tag . name }
22162154 } )
22172155 ] }
2218- handleAddFileInputsChange = { this . handleAddFileInputsChange }
2219- handleSurvivalFormDatasetChanges = { this . handleSurvivalFormDatasetChanges }
2220- removeSurvivalFormTuple = { this . removeSurvivalFormTuple }
22212156 />
22222157 ) }
22232158
0 commit comments