Skip to content
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

Decoupling tabs in the experiment page and display them after validating #375

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f0677d3
Initial commit on decoupling tabs in the experiment page
upendrakumbham Dec 12, 2023
a21e6ee
Merge branch 'develop' into bugfix/decouple-experiment-page-tabs-and-…
upendrakumbham Dec 12, 2023
7a48932
Add multiple ternary conditional operator
upendrakumbham Jan 9, 2024
a071970
Merge branch 'develop' into bugfix/decouple-experiment-page-tabs-and-…
upendrakumbham Jan 9, 2024
aa55ced
Improved version of code after a tweak of tab conditions
upendrakumbham Jan 17, 2024
585972d
Add fubctions to validate tabs and it's props
upendrakumbham Jan 30, 2024
25ef163
Remove compilation errors and improve functions
upendrakumbham Feb 2, 2024
13e7ee2
Remove unused code and improve function
upendrakumbham Feb 9, 2024
532389c
remove hardcode strings and reuse code
upendrakumbham Feb 19, 2024
1f9aa46
Add tabtype 'resources' conditional check
upendrakumbham Feb 19, 2024
2c05e1a
Add empty object check and null, undefined function and update tab va…
upendrakumbham Feb 19, 2024
ca946ac
Fix camel casing in the function
upendrakumbham Feb 19, 2024
ea37496
Initiate tabTypeComponent = []; before return statement to clear data
upendrakumbham Jun 6, 2024
fcaab7c
Remove log messages
upendrakumbham Jun 6, 2024
05d2fb2
Improved code by removing if, else conditions & removed redundant code
upendrakumbham Jun 7, 2024
35bceb9
Merge branch 'develop' into bugfix/decouple-experiment-page-tabs-and-…
upendrakumbham Jun 7, 2024
99088cf
Move all helper functions to tabConfig.js file as part of ExperiemntP…
upendrakumbham Jun 10, 2024
b1cf7e5
Move PropTypes to propTypes.js file as part of ExperiemntPageRouter.j…
upendrakumbham Jun 10, 2024
5eaf719
Improved file
upendrakumbham Jun 10, 2024
dcf06f8
Add validation fields (common & specific)for the tabs
upendrakumbham Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,50 @@ const TabCommonPropTypes = {
}

// What component each tab type should render, coupled to ExperimentController.java
const tabTypeComponent = {
'results' : TSnePlotViewRoute,
'experiment-design' : ExperimentDesignRoute,
'supplementary-information' : SupplementaryInformationRoute,
'downloads' : DownloadsRoute
let tabTypeComponent = []

function validateCommonRequiredProps({speciesName},{atlasUrl},{experimentAccession}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused why we need this function at all.
We defined the types of the props in the definition of the prop types and we also defined whether they are required or not.
Why do we need another way to validate all of these again?

if ( (typeof speciesName == 'string' && speciesName instanceof String) &&
(typeof atlasUrl == 'string' && atlasUrl instanceof String) &&
(typeof experimentAccession == 'string' && experimentAccession instanceof String)) {
return true;
}
else return false;
}

function validateTab({tabType}) {
if (tabType === 'results') {
if ( validateCommonRequiredProps({speciesName},atlasUrl,experimentAccession) && Array.isArray(tab.props.ks)) {
console.log("result **************",tabTypeComponent.push({'results' : TSnePlotViewRoute}))
}
}
else if (tabType === 'experiment-design') {
if (Array.isArray(tab.props.table.data) && validateCommonRequiredProps({speciesName},{atlasUrl},{experimentAccession})) {
console.log("experiment-design **************",tabTypeComponent.push({'experiment-design' : ExperimentDesignRoute}));
}
}
else if(tabType === 'supplementary-information') {
if (Array.isArray(tab.props.sections) && validateCommonRequiredProps({speciesName},{atlasUrl},{experimentAccession})) {
console.log("supplementary-information **************", tabTypeComponent.push({'supplementary-information' : SupplementaryInformationRoute}))
}
}
else {
if (Array.isArray(tab.props.data) && validateCommonRequiredProps({speciesName},{atlasUrl},{experimentAccession})) {
console.log('download********', tabTypeComponent.push({'resources' : DownloadsRoute}))
}
}
}



const TopRibbon = ({tabs, routeProps}) =>
<ul className={`tabs`}>
{
tabs.map((tab) =>
<li title={tab.name} key={tab.type} className={`tabs-title`}>
{
validateTab(tab.type)
}
<NavLink to={{pathname:`/${tab.type}`, search: routeProps.location.search, hash: routeProps.location.hash}}
activeClassName={`active`}>
{tab.name}
Expand Down
Loading