-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gene Panel Modal in Patient View #2782
Gene Panel Modal in Patient View #2782
Conversation
b8c5b84
to
9b10cea
Compare
0e4e4ba
to
1fab19a
Compare
1fab19a
to
2ac0966
Compare
97015d0
to
1ee9305
Compare
4843f14
to
5c9e64c
Compare
1ee9305
to
6f8a259
Compare
d35881d
to
7d2b3d4
Compare
7d2b3d4
to
50454c4
Compare
> { | ||
constructor(props: IGenesListProps) { | ||
super(props); | ||
this.state = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we should stick to just using mobx observables in this project (instead of traditional React component state).
Using both will cause confusion. So, no setState please.
this.setState({ filter: value }); | ||
}; | ||
|
||
filterGenes = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be computed property. That will avoid unecessary recomputation
@@ -947,6 +954,14 @@ export class PatientViewPageStore { | |||
@action clearErrors() { | |||
this.ajaxErrors = []; | |||
} | |||
|
|||
@autobind | |||
@action toggleModal(name?:string|undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above. should be on view and needs more specific name
|
||
export default class Tracks extends React.Component<TracksPropTypes, {}> { | ||
export const DEFAULT_GENOME_BUILD="GRCh37"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure but i think this constant already exists elsequere. we should have it one place unless it's only the default for this specific feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I searched through the source code and only found this constant used in this feature, so I think it's alright to keep it here.
export default class Tracks extends React.Component<TracksPropTypes, TracksStateTypes> { | ||
constructor(props:TracksPropTypes) { | ||
super(props); | ||
this.state = { genePanelInTooltip: '' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no state
@@ -57,6 +56,27 @@ const getGenePanelIds = (props:PanelColumnFormatterProps) => { | |||
return []; | |||
}; | |||
|
|||
const getGenePanelLinks = (props:PanelColumnFormatterProps) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make this a React Functional Component and type it as such. Then use it in code via JSX: <GenePanelLinks ... >
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Outdated
Show resolved
Hide resolved
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Outdated
Show resolved
Hide resolved
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Outdated
Show resolved
Hide resolved
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Outdated
Show resolved
Hide resolved
@@ -36,6 +37,36 @@ export default class ClinicalInformationPatientTable extends React.Component<ICl | |||
} | |||
return ret; | |||
} | |||
|
|||
handleClick = (name:string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to clarify, I think @alisman means handleClick(name:string) { ... }
src/pages/patientView/clinicalInformation/ClinicalInformationPatientTable.tsx
Show resolved
Hide resolved
src/pages/patientView/clinicalInformation/PatientViewPageStore.ts
Outdated
Show resolved
Hide resolved
@ngocnn1104 we put a lot of comments on this! let me know if you need any clarification or want to discuss. |
1a29a48
to
ff22695
Compare
ff22695
to
cd8206c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for addressing comments! almost there
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Outdated
Show resolved
Hide resolved
src/pages/patientView/PatientViewGenePanelModal/PatientViewGenePanelModal.tsx
Show resolved
Hide resolved
@action toggleGenePanelModal(genePanelId?:string|undefined) { | ||
this.genePanelModal = { | ||
isOpen: !this.genePanelModal.isOpen, | ||
genePanelId: typeof genePanelId === 'string' ? genePanelId : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genePanelId: genePanelId || ''
is easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and have updated according to your suggestion. However, this function was passed directly to handle the onHide
event of Bootstrap Modal and onClick
event of Bootstrap Button, and whenever the function was called, an event object would get passed to the parent component and be seen as genePanelId
. In order to avoid this, I modified the shared GenePanelModal
component like below:
@autobind handleClose() {
this.props.onHide();
}
render() {
return (
<Modal
show={this.props.show}
onHide={this.handleClose} // instead of onHide={this.props.onHide}
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I understand. can you please add a comment explaining that?
src/pages/patientView/clinicalInformation/ClinicalInformationPatientTable.tsx
Show resolved
Hide resolved
cd8206c
to
3ff699f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment as discussed here #2782 (comment), and other than that looks good thanks!
3ff699f
to
53f26fb
Compare
done. Thank you! |
53f26fb
to
bed8995
Compare
bed8995
to
69afd24
Compare
- Created gene panel modal component in patient view with unit tests - Trigger gene panel modal from genomic tracks and patient header - Trigger gene panel modal from mutations and copy number tables - Implemented local e2e tests & format new files with prettier Signed-off-by: Ngoc Nguyen <nguyennhungoc1104@gmail.com>
69afd24
to
ee56e42
Compare
Gene Panel Modal in Patient View
Resolves cBioPortal/cbioportal#6670
Describe changes proposed in this pull request:
GIF