-
Notifications
You must be signed in to change notification settings - Fork 303
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
Add async hide/show check for custom tabs #4167
Conversation
1d0c3ee
to
20d38ec
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.
Wow, this was quite the project! Looks good. I have some remarks and questions.
my-index.ejs
Outdated
|
||
// serverConfig:{ | ||
// | ||
// // custom_tabs:[ | ||
// // { | ||
// // "title": "Custom Tab", | ||
// // "location": "RESULTS_PAGE", | ||
// // "mountCallbackName": "renderCustomTab1", | ||
// // "hide":false, |
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.
Should this file be committed?
@computed get customTabs() { | ||
return prepareCustomTabConfigurations( | ||
getServerConfig().custom_tabs, | ||
'COMPARISON_PAGE' |
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.
So, you extended the custom tabs to Comparison Page? Nice would be good to make that clean in docs and release notes.
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.
agreed
// {getServerConfig().custom_tabs && | ||
// getServerConfig() | ||
// .custom_tabs.filter( | ||
// (tab: any) => | ||
// tab.location === 'PATIENT_PAGE' | ||
// ) | ||
// .map((tab: any, i: number) => { | ||
// return ( | ||
// <MSKTab | ||
// key={getPatientViewResourceTabId( | ||
// 'customTab' + i | ||
// )} | ||
// id={getPatientViewResourceTabId( | ||
// 'customTab' + i | ||
// )} | ||
// unmountOnHide={ | ||
// tab.unmountOnHide === | ||
// true | ||
// } |
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.
Remove commented lines?
studyViewRegex.test(location.pathname) || | ||
customTabRegex.test(location.pathname) |
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 asking, but should there not be a comparisonView test as well?
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.
probably yes : )
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'll make a ticket for it and do it separately
|
||
runTests('ResultsView', resultsUrl, 'RESULTS_PAGE'); | ||
|
||
runTests('PatientView', patientUrl, 'PATIENT_PAGE'); |
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 noticed that Comparison View is also supported not. Should we not include a test for it?
3ed77c5
to
1bcaa6b
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.
Nice work, and thanks again for doing this.
Introduce a way to configure custom tabs such that an async check can be run to see whether or not the tab should show for a given view of the page. E.g. we should rerun this check when the query changes on the result page or when the patient/sample change on patient page.
The hideAsync property is a function which MUST return a promise. When the promise resolves with a boolean value, we will either show or hide the tab button. Note that if the user is already routed to the tab, we should always show the button even if the hydeAsync function returns false. In that case we should render some N/A placeholder for the tab content.