generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from RENCI/model-selection-data
Intermediate PR: Additional model search functionality
- Loading branch information
Showing
8 changed files
with
518 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, {Fragment} from "react"; | ||
import PropTypes from 'prop-types'; | ||
import {Option} from '@mui/joy'; | ||
|
||
/** | ||
* returns a list of drop down options for that data/type. | ||
* | ||
* @param data | ||
* @param type | ||
* @constructor | ||
*/ | ||
export default function DropDownOptions(data) { | ||
// set component prop types | ||
DropDownOptions.propTypes = { data: PropTypes.any }; | ||
|
||
// do not render if there is no data | ||
if (data.data != null) { | ||
// if there is a warning getting the result | ||
if (data.data['Warning'] !== undefined) { | ||
return ( | ||
<div> | ||
Warning: {data.data['Warning']} | ||
</div> | ||
); | ||
} | ||
// if there is an error getting the result | ||
else if(data.data['Error'] !== undefined) { | ||
return ( | ||
<div> | ||
Error: {data.data['Error']} | ||
</div> | ||
); | ||
} | ||
// return all the options | ||
else { | ||
return ( | ||
<Fragment> | ||
{data.data[data.type].filter(item => item !== "").map(item => ( | ||
<Option key={item} value={item}>{item}</Option> | ||
))} | ||
</Fragment> | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React, {Fragment, useState} from "react"; | ||
import PropTypes from 'prop-types'; | ||
import {AccordionGroup, Accordion, AccordionSummary, AccordionDetails, Stack} from '@mui/joy'; | ||
|
||
/** | ||
* returns a list of drop down options for that data/type. | ||
* | ||
* @param data | ||
* @param type | ||
* @constructor | ||
*/ | ||
export default function CatalogItems(data) { | ||
// set component prop types | ||
CatalogItems.propTypes = { data: PropTypes.any }; | ||
|
||
// create some state for what catalog accordian is expanded/not expanded | ||
const [accordianIndex, setAccordianIndex] = useState(-1); | ||
|
||
// do not render if there is no data | ||
if (data.data != null) { | ||
// if there is a warning getting the result | ||
if (data.data['Warning'] !== undefined) { | ||
return ( | ||
<div> | ||
Warning: {data.data['Warning']} | ||
</div> | ||
); | ||
} | ||
// if there is an error getting the result | ||
else if(data.data['Error'] !== undefined) { | ||
return ( | ||
<div> | ||
Error: {data.data['Error']} | ||
</div> | ||
); | ||
} | ||
// return all the data cards | ||
else { | ||
return ( | ||
<Fragment> | ||
<AccordionGroup sx={{maxWidth: 410, size: "sm", variant: "soft"}}> | ||
{ | ||
data | ||
.data['catalog'] | ||
.filter(catalogs => catalogs !== "") | ||
.map((catalog, itemIndex) => | ||
( | ||
<Stack key={ itemIndex } spacing={1}> | ||
<Accordion | ||
key={ itemIndex } | ||
sx={{ p: 0 }} | ||
expanded={accordianIndex === itemIndex} | ||
onChange={(event, expanded) => { | ||
setAccordianIndex(expanded ? itemIndex : null); | ||
}}> | ||
|
||
<AccordionSummary> | ||
Model date: {catalog['id']} | ||
</AccordionSummary> | ||
|
||
<AccordionDetails> | ||
{catalog['members'].map((member, memberIndex) => ( | ||
<Stack key={ memberIndex }> | ||
{member['id'] } | ||
</Stack> | ||
))} | ||
</AccordionDetails> | ||
</Accordion> | ||
</Stack> | ||
) | ||
) | ||
} | ||
</AccordionGroup> | ||
</Fragment> | ||
); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, {Fragment} from 'react'; | ||
import {Tab, Tabs, TabList, TabPanel} from '@mui/joy'; | ||
import {SynopticTabForm} from "@model-selection/synopticTab"; | ||
import {TropicalTabForm} from "@model-selection/tropicalTab"; | ||
|
||
/** | ||
* This component renders the layer selection form | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const ModelSelectionTray = () => { | ||
// render the form | ||
return ( | ||
<Fragment> | ||
<Tabs aria-label="Type tabs" defaultValue={0}> | ||
<TabList> | ||
<Tab>Tropical</Tab> | ||
<Tab>Synoptic</Tab> | ||
</TabList> | ||
|
||
<TabPanel value={0}> | ||
<TropicalTabForm/> | ||
</TabPanel> | ||
|
||
<TabPanel value={1}> | ||
<SynopticTabForm/> | ||
</TabPanel> | ||
</Tabs> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
/** | ||
* this method populates the controls on the form. | ||
* | ||
*/ | ||
// const dataLoader = () => { | ||
// | ||
// }; |
Oops, something went wrong.