Skip to content

Commit b89ffa5

Browse files
committed
Removed unused functions and state variables
1 parent a0d5a3d commit b89ffa5

3 files changed

Lines changed: 6 additions & 139 deletions

File tree

src/frontend/static/frontend/src/components/biomarkers/BiomarkersPanel.tsx

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react'
22
import { Base } from '../Base'
33
import { 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'
55
import ky, { Options } from 'ky'
66
import { 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'
88
import { Biomarker, BiomarkerType, BiomarkerOrigin, FormBiomarkerData, MoleculesSectionData, MoleculesTypeOfSelection, SaveBiomarkerStructure, SaveMoleculeStructure, FeatureSelectionPanelData, SourceStateBiomarker, FeatureSelectionAlgorithm, FitnessFunction, FitnessFunctionParameters, BiomarkerState, AdvancedAlgorithm as AdvancedAlgorithmParameters, BBHAVersion, BiomarkerSimple } from './types'
99
import { ManualForm } from './modalContentBiomarker/manualForm/ManualForm'
1010
import { PaginatedTable, PaginationCustomFilter } from '../common/PaginatedTable'
@@ -26,7 +26,6 @@ import { EditBiomarkerIcon } from './EditBiomarkerIcon'
2626
import { SwitchPublicButton } from '../common/SwitchPublicButton'
2727
import { PopupIcons } from '../common/PopupIcons'
2828
import { TagsPanel } from '../files-manager/TagsPanel'
29-
import { NewFile } from '../files-manager/FilesManager'
3029

3130
// URLs defined in biomarkers.html
3231
declare const urlBiomarkersCRUD: string
@@ -46,7 +45,7 @@ declare const urlCloneBiomarker: string
4645
declare const urlStopFSExperiment: string
4746

4847
const 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. */
5150
type 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

src/frontend/static/frontend/src/components/biomarkers/modalContentBiomarker/manualForm/ManualForm.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ import { DjangoTag } from '../../../../utils/django_interfaces'
99
interface ManualFormProps {
1010
tagOptions: DropdownItemProps[]
1111
tags: DjangoTag[]
12-
handleAddFileInputsChange: (name: string, value: any) => void
1312
biomarkerForm: FormBiomarkerData,
1413
/** Value for Checkbox. */
1514
checkedIgnoreProposedAlias: boolean,
1615
/** Handle change for Checkbox. */
1716
handleChangeIgnoreProposedAlias: (value: boolean) => void,
18-
removeSurvivalFormTuple: (idx: number) => void,
19-
handleSurvivalFormDatasetChanges: (idx: number, name: string, value) => void,
2017
cleanForm: () => void,
2118
isFormEmpty: () => boolean,
2219
handleChangeMoleculeSelected: (value: BiomarkerType) => void,

src/frontend/static/frontend/src/components/pipeline/experiment-result/BiomarkerFromCorrelationModal.tsx

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import React from 'react'
22
// Update the import path to the correct location of Base component
33
import { Modal, DropdownItemProps, Icon, Form, Button, Confirm } from 'semantic-ui-react'
4-
import { DjangoCGDSStudy, DjangoMethylationPlatform, DjangoMRNAxGEMResultRow, DjangoSurvivalColumnsTupleSimple, DjangoTag, DjangoUserFile } from '../../../utils/django_interfaces'
4+
import { DjangoCGDSStudy, DjangoMRNAxGEMResultRow, DjangoSurvivalColumnsTupleSimple, DjangoTag, DjangoUserFile } from '../../../utils/django_interfaces'
55
import ky, { Options } from 'ky'
66
import { getDjangoHeader, cleanRef, getFilenameFromSource, getDefaultSource } from '../../../utils/util_functions'
7-
import { NameOfCGDSDataset, Nullable, CustomAlert, CustomAlertTypes, SourceType, ConfirmModal, ExperimentInfo, ExperimentResultTableControl, FileType } from '../../../utils/interfaces'
7+
import { NameOfCGDSDataset, Nullable, CustomAlert, CustomAlertTypes, SourceType, ConfirmModal, ExperimentInfo, ExperimentResultTableControl } from '../../../utils/interfaces'
88
import { Biomarker, BiomarkerType, BiomarkerOrigin, FormBiomarkerData, MoleculesSectionData, MoleculesTypeOfSelection, SaveBiomarkerStructure, SaveMoleculeStructure, FeatureSelectionPanelData, SourceStateBiomarker, FeatureSelectionAlgorithm, FitnessFunction, FitnessFunctionParameters, BiomarkerState, AdvancedAlgorithm as AdvancedAlgorithmParameters, BBHAVersion, BiomarkerSimple, CrossValidationParameters } from '../../biomarkers/types'
99
import { ManualForm } from '../../biomarkers/modalContentBiomarker/manualForm/ManualForm'
1010
import { PaginationCustomFilter } from '../../common/PaginatedTable'
1111
import { isEqual } from 'lodash'
1212
import { getDefaultClusteringParameters, getDefaultRFParameters, getDefaultSvmParameters } from '../../biomarkers/utils'
1313
import { BiomarkerDetailsModal } from '../../biomarkers/BiomarkerDetailsModal'
1414
import { Alert } from '../../common/Alert'
15-
import { NewFile } from '../../files-manager/FilesManager'
1615

1716
// URLs defined in gem.html
1817
declare const urlBiomarkersCRUD: string
@@ -26,7 +25,7 @@ declare const urlMethylationSitesFinder: string
2625
declare const urlGeneSymbolsFinder: string
2726

2827
const REQUEST_TIMEOUT = 120000 // 2 minutes in milliseconds
29-
const FILE_INPUT_LABEL = 'Add a new file'
28+
3029
type SelectedOption = 'selectAll' | 'selectWithFilters'
3130

3231
/** A matched molecule with the search query and the validated alias. */
@@ -87,7 +86,6 @@ interface BiomarkerFromCorrelationModalState {
8786
openSelectOptionModal: boolean,
8887
experimentInfoWithoutFilters: ExperimentInfo,
8988
modalReady: boolean,
90-
newFile: NewFile,
9189
}
9290

9391
/**
@@ -128,7 +126,6 @@ export class BiomarkerFromCorrelationModal extends React.Component<BiomarkerFrom
128126
...props.experimentInfo,
129127
rows: [...props.experimentInfo.rows]
130128
},
131-
newFile: this.getDefaultNewFile(),
132129
}
133130
}
134131

@@ -140,24 +137,6 @@ export class BiomarkerFromCorrelationModal extends React.Component<BiomarkerFrom
140137
this.abortController.abort()
141138
}
142139

143-
/**
144-
* Generates a default new file form
145-
* @returns An object with all the field with default values
146-
*/
147-
getDefaultNewFile (): NewFile {
148-
return {
149-
newFileName: FILE_INPUT_LABEL,
150-
newFileNameUser: '',
151-
newFileDescription: '',
152-
newFileType: FileType.MRNA,
153-
newTag: null,
154-
institutions: [],
155-
isCpGSiteId: false,
156-
platform: DjangoMethylationPlatform.PLATFORM_450,
157-
survivalColumns: []
158-
}
159-
}
160-
161140
/**
162141
* Generates default feature selection creation structure
163142
* @returns Default the default Alert
@@ -1317,36 +1296,6 @@ export class BiomarkerFromCorrelationModal extends React.Component<BiomarkerFrom
13171296
}
13181297
}
13191298

1320-
/**
1321-
* Removes a Survival data tuple for a CGDSDataset
1322-
* @param idxSurvivalTuple Index in survival tuple
1323-
*/
1324-
removeSurvivalFormTuple = (idxSurvivalTuple: number) => {
1325-
this.setState(prevState => ({
1326-
newFile: {
1327-
...prevState.newFile,
1328-
survivalColumns: prevState.newFile.survivalColumns.filter((_, i) => i !== idxSurvivalTuple),
1329-
},
1330-
}))
1331-
}
1332-
1333-
/**
1334-
* Handles CGDS Dataset form changes in fields of Survival data tuples
1335-
* @param idxSurvivalTuple Index in survival tuple
1336-
* @param name Field of the CGDS dataset to change
1337-
* @param value Value to assign to the specified field
1338-
*/
1339-
handleSurvivalFormDatasetChanges = (idxSurvivalTuple: number, name: string, value: any) => {
1340-
this.setState(prevState => ({
1341-
newFile: {
1342-
...prevState.newFile,
1343-
survivalColumns: prevState.newFile.survivalColumns.map((t, i) =>
1344-
i === idxSurvivalTuple ? { ...t, [name]: value } : t
1345-
),
1346-
},
1347-
}))
1348-
}
1349-
13501299
/**
13511300
* Checks if the form is entirely empty. Useful to enable 'Cancel' button
13521301
* @returns True is any of the form's field contains any data. False otherwise
@@ -1433,17 +1382,6 @@ export class BiomarkerFromCorrelationModal extends React.Component<BiomarkerFrom
14331382
})
14341383
}
14351384

1436-
/**
1437-
* Handles input changes in the New File Form
1438-
* @param name State field to change
1439-
* @param value Value to assign to the specified field
1440-
*/
1441-
handleAddFileInputsChange = (name: string, value: any) => {
1442-
const newFileForm = this.state.newFile
1443-
newFileForm[name] = value
1444-
this.setState({ newFile: newFileForm })
1445-
}
1446-
14471385
/**
14481386
* Generates default table's Filters.
14491387
* @returns Default object for table's Filters
@@ -1587,9 +1525,6 @@ export class BiomarkerFromCorrelationModal extends React.Component<BiomarkerFrom
15871525
handleChangeCheckBox={this.handleChangeCheckBox}
15881526
handleRestartSection={this.handleRestartSection}
15891527
tagOptions={[]}
1590-
handleAddFileInputsChange={this.handleAddFileInputsChange}
1591-
handleSurvivalFormDatasetChanges={this.handleSurvivalFormDatasetChanges}
1592-
removeSurvivalFormTuple={this.removeSurvivalFormTuple}
15931528
tags={this.state.tags}
15941529
/>
15951530

0 commit comments

Comments
 (0)