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

Intermediate PR: Additional model search functionality #58

Merged
merged 23 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
46cf7ec
addition of mui datepicker and day.js
PhillipsOwen May 16, 2024
d320fe3
tidying up
PhillipsOwen May 16, 2024
0157cfc
checkpointing progress
PhillipsOwen May 16, 2024
ce98b41
moving the tanstack query clien/provider from the obs dialog to the r…
PhillipsOwen May 16, 2024
a798343
Merge remote-tracking branch 'origin/model-selection-data' into model…
PhillipsOwen May 17, 2024
460aa82
renaming main view of the model selection tray
PhillipsOwen May 21, 2024
ad2d965
renaming model selection tray
PhillipsOwen May 21, 2024
ba2652c
component to create dropdown options from web service data
PhillipsOwen May 21, 2024
0e93d37
component to render the synoptic model selection tab
PhillipsOwen May 21, 2024
f162a94
component to render the tropical model selection tab
PhillipsOwen May 21, 2024
13dd932
adding control to render search results.
PhillipsOwen May 22, 2024
76a3ab5
adding additional error checking
PhillipsOwen May 22, 2024
609adb0
adding the retrieval and rendering of search results.
PhillipsOwen May 22, 2024
c4c9126
renaming main view of the model selection tray
PhillipsOwen May 21, 2024
673da85
renaming model selection tray
PhillipsOwen May 21, 2024
34d5629
component to create dropdown options from web service data
PhillipsOwen May 21, 2024
9fee14c
component to render the synoptic model selection tab
PhillipsOwen May 21, 2024
ac122d9
component to render the tropical model selection tab
PhillipsOwen May 21, 2024
8b88f44
adding control to render search results.
PhillipsOwen May 22, 2024
e1cdce7
adding additional error checking
PhillipsOwen May 22, 2024
81af940
adding the retrieval and rendering of search results.
PhillipsOwen May 22, 2024
c43dc67
Merge remote-tracking branch 'origin/model-selection-data' into model…
PhillipsOwen May 22, 2024
ec8f75a
suppresses the re-chart errors reported in the console
PhillipsOwen May 22, 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
11 changes: 11 additions & 0 deletions src/components/dialog/observation-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ export default function ObservationChart(url) {
return (<CreateObsChart url={ url.url } />);
}

/**
* this suppresses the re-chart errors on the x/y-axis rendering.
*
* @type {{(message?: any, ...optionalParams: any[]): void, (...data: any[]): void}}
*/
const error = console.error;
console.error = (...args) => {
if (/defaultProps/.test(args[0])) return;
error(...args);
};

/**
* Retrieves and returns the chart data in json format
*
Expand Down
45 changes: 45 additions & 0 deletions src/components/model-selection/DropDownOptions.js
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>
);
}
}
}
78 changes: 78 additions & 0 deletions src/components/model-selection/catalogItems.js
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>
);
}
}
}
179 changes: 0 additions & 179 deletions src/components/model-selection/modelSelectionForm.js

This file was deleted.

40 changes: 40 additions & 0 deletions src/components/model-selection/modelSelectionTray.js
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 = () => {
//
// };
Loading