Skip to content

Commit

Permalink
Deploy test (#286)
Browse files Browse the repository at this point in the history
* Feature/277 Other Reports (#278)
* add OtherReportsPage; fix changelog link;
* change wording;
* hazard chart automcomplete expands horizontally; (#279)
* Feature/280 Model Components (#282)
* update model component page; add to menu and router;
* remove text;
* feature/238_PGA_boxplot (#281)
* update toshi-nest;
* update deploy-test env;
* Fix/cypress tests (#284)
* fix cypress tests;
* removes changelog text from start of changelog page; adds new intro text; (#285)
* v1.0.3
* update version;
* update deploy env for prod;
  • Loading branch information
benjamineac authored Nov 10, 2022
1 parent d69d134 commit b36b157
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy_prod_to_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ jobs:
echo "REACT_APP_SA_PERIODMAX=10" >> .env
echo "REACT_APP_SA_PERIODMIN=0" >> .env
echo "REACT_APP_SA_PERIODMAX_LOG=10" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.01" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.03" >> .env
echo "REACT_APP_SA_GMAX=auto" >> .env
echo "REACT_APP_SA_GMIN=0" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.02" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.04" >> .env
echo
echo "REACT_APP_MEAN=mean" >> .env
echo "REACT_APP_UPPER1=0.9" >> .env
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_test_to_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ jobs:
echo "REACT_APP_SA_PERIODMAX=10" >> .env
echo "REACT_APP_SA_PERIODMIN=0" >> .env
echo "REACT_APP_SA_PERIODMAX_LOG=10" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.01" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.03" >> .env
echo "REACT_APP_SA_GMAX=auto" >> .env
echo "REACT_APP_SA_GMIN=0" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.02" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.04" >> .env
echo
echo "REACT_APP_MEAN=mean" >> .env
echo "REACT_APP_UPPER1=0.9" >> .env
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_to_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
echo "REACT_APP_SA_PERIODMAX=10" >> .env
echo "REACT_APP_SA_PERIODMIN=0" >> .env
echo "REACT_APP_SA_PERIODMAX_LOG=10" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.01" >> .env
echo "REACT_APP_SA_PERIODMIN_LOG=0.03" >> .env
echo "REACT_APP_SA_GMAX=auto" >> .env
echo "REACT_APP_SA_GMIN=0" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.02" >> .env
echo "REACT_APP_SA_LOG_PGA_SUBSTITUTE=0.04" >> .env
echo
echo "REACT_APP_MEAN=mean" >> .env
echo "REACT_APP_UPPER1=0.9" >> .env
Expand Down
14 changes: 8 additions & 6 deletions cypress/e2e/HazardCurves.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Hazard Curves', () => {
});

it('Displays inital charts when first visiting page', () => {
cy.get('[role="curve"]').should('have.length', 9);
cy.get('[role="curve"]').should('have.length', 10);
});

it('Displays out of range error when POE over 100 or below 0 is selected', () => {
Expand Down Expand Up @@ -40,8 +40,9 @@ describe('Hazard Curves', () => {
cy.get('li[data-value="SA(0.1)"]').click();
cy.get('li[data-value="SA(0.2)"]').click();
cy.get('li[data-value="SA(0.3)"]').click();
cy.get('body').click();
cy.get('[type="submit"]').click({ force: true });
cy.get('[role="curve"]').should('have.length', 16);
cy.get('[role="curve"]').should('have.length', 20);
});

it('Displays tooltips for all selected spectral periods', () => {
Expand All @@ -56,16 +57,17 @@ describe('Hazard Curves', () => {
cy.get('li[data-value="SA(0.1)"]').click();
cy.get('li[data-value="SA(0.2)"]').click();
cy.get('li[data-value="SA(0.3)"]').click();
cy.get('body').click();
cy.get('[type="submit"]').click({ force: true });
cy.get('[role="curve"]').should('have.length', 4);
cy.get('[role="curve"]').should('have.length', 5);
cy.get('[role="listbox"]').focus().type('{esc}');
});

it('Displays multiple curves when user selects more than one location', () => {
cy.get('[data-testid="ArrowDropDownIcon"]').first().click({ force: true });
cy.get('li').contains('Christchurch').click({ force: true });
cy.get('[type="submit"]').click({ force: true });
cy.get('[role="curve"]').should('have.length', 8);
cy.get('[role="curve"]').should('have.length', 10);
cy.get('div[class="visx-legend-label"]').should('contain.text', '400m/s PGA Christchurch 400m/s PGA Wellington');
});

Expand All @@ -75,15 +77,15 @@ describe('Hazard Curves', () => {
cy.get('li').contains('Wellington').click({ force: true });
cy.get('[class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedEnd css-1x51dt5-MuiInputBase-input-MuiInput-input"]').first().type('-42, 173');
cy.get('[type="submit"]').click({ force: true });
cy.get('[role="curve"]').should('have.length', 4);
cy.get('[role="curve"]').should('have.length', 5);
cy.get('div[class="visx-legend-label"]').should('contain.text', '400m/s PGA -42.0, 173.0');
});

it.skip('Displays multiple curves when user selects more than one VS30', () => {
cy.get('div').contains('400').click();
cy.get('li').contains('350').click();
cy.get('[type="submit"]').click({ force: true });
cy.get('[role="curve"]').should('have.length', 4);
cy.get('[role="curve"]').should('have.length', 5);
cy.get('[role="listbox"]').focus().type('{esc}');
});

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "kororaa",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"dependencies": {
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@gns-science/toshi-nest": "^3.6.3",
"@gns-science/toshi-nest": "^3.6.5",
"@mui/icons-material": "^5.6.2",
"@mui/material": "^5.6.4",
"adblock-detect-react": "^1.1.0",
Expand Down
4 changes: 4 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import ContactPage from './views/contact/ContactPage';
import AboutPage from './views/about/AboutPage';
import TechInfoPage from './views/techinfo/TechInfoPage';
import ChangelogPage from './views/changelog/ChangelogPage';
import OtherDocumentsPage from './views/info/OtherDocumentsPage';
import ModelComponentsPage from './views/info/ModelComponentsPage';

// The Home component needs to know how to access the Relay environment, and we
// need to specify a fallback in case it suspends:
Expand Down Expand Up @@ -67,6 +69,8 @@ function App(props: { environment?: Environment }) {
<Route path="/Contacts" element={<ContactPage />} />
<Route path="/Releases" element={<ChangelogPage />} />
<Route path="/Resources/ScienceReports" element={<ScienceReportsPage />} />
<Route path="/Resources/OtherDocuments" element={<OtherDocumentsPage />} />
<Route path="/Resources/ModelComponents" element={<ModelComponentsPage />} />
<Route path="/" element={<Home />} />
</Routes>
</DisclaimerLayer>
Expand Down
16 changes: 14 additions & 2 deletions src/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [1.0.2](https://github.com/GNS-Science/kororaa/compare/1.0.1...1.0.2)
## [v1.0.3](https://github.com/GNS-Science/kororaa/compare/v1.0.2...v1.0.3)

### Merged

- removes changelog text from start of changelog page; adds new intro text; [`#285`](https://github.com/GNS-Science/kororaa/pull/285)
- Fix/cypress tests [`#284`](https://github.com/GNS-Science/kororaa/pull/284)
- feature/238_PGA_boxplot [`#281`](https://github.com/GNS-Science/kororaa/pull/281)
- Feature/280 Model Components [`#282`](https://github.com/GNS-Science/kororaa/pull/282)
- hazard chart automcomplete expands horizontally; [`#279`](https://github.com/GNS-Science/kororaa/pull/279)
- Feature/277 Other Reports [`#278`](https://github.com/GNS-Science/kororaa/pull/278)
- Deploy test [`#276`](https://github.com/GNS-Science/kororaa/pull/276)

## [v1.0.2](https://github.com/GNS-Science/kororaa/compare/v1.0.1...v1.0.2) - 2022-10-26

### Merged

Expand All @@ -18,7 +30,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

- update nest; add cov property to map component; adds tooltip to map; [`2b14a0d`](https://github.com/GNS-Science/kororaa/commit/2b14a0d7b50917fa8f3196b16dda2bcbb27e90f6)

## [1.0.1](https://github.com/GNS-Science/kororaa/compare/v1.0.0...v1.0.1) - 2022-10-20
## [v1.0.1](https://github.com/GNS-Science/kororaa/compare/v1.0.0...v1.0.1) - 2022-10-20

### Merged

Expand Down
8 changes: 7 additions & 1 deletion src/components/common/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ const NavBar: React.FC = () => {
{ name: 'Coming Features', path: '/Previews' },
{
name: 'Resources',
submenu: [{ name: 'Science reports', path: '/Resources/ScienceReports' }],
submenu: [
{ name: 'Science reports', path: '/Resources/ScienceReports' },
{ name: 'Other Documents', path: '/Resources/OtherDocuments' },
{ name: 'Model Components', path: '/Resources/ModelComponents' },
],
},
{
name: 'Help',
Expand All @@ -193,6 +197,8 @@ const NavBar: React.FC = () => {
{ name: 'Hazard Maps', path: '/HazardMaps' },
{ name: 'Coming Features', path: '/Previews' },
{ name: 'Science Reports', path: '/Resources/ScienceReports' },
{ name: 'Other Documents', path: '/Resources/OtherDocuments' },
{ name: 'Model Components', path: '/Resources/ModelComponents' },
{ name: 'About', path: '/About' },
{ name: 'Technical Info', path: '/TechInfo' },
{ name: 'Contacts', path: '/Contacts' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { SA_LOG_PGA_SUBSTITUTE } from '../../../utils/environmentVariables';

export const expected = [
[0.001, 1.5840401423927233],
[SA_LOG_PGA_SUBSTITUTE, 1.5840401423927233],
[0.1, 2.8186969404092443],
[0.2, 3.6533775147057184],
[0.3, 3.7181320251892513],
Expand Down
14 changes: 13 additions & 1 deletion src/views/changelog/ChangelogPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ const TitleContainer = styled('div')({
paddingBottom: '1rem',
});

const markdownToRemove = `# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Generated by [\`auto-changelog\`](https://github.com/CookPete/auto-changelog).`;

const ChangelogPage: React.FC = () => {
const [markdown, setMarkdown] = useState('');

useEffect(() => {
fetch(CHANGELOG)
.then((res) => res.text())
.then((text) => setMarkdown(text.replace('# Changelog', '')));
.then((text) => setMarkdown(text.replace(markdownToRemove, '')));
}, []);

return (
Expand All @@ -36,6 +45,9 @@ const ChangelogPage: React.FC = () => {
<Grid item xs={12}>
<TitleContainer>
<Typography variant="h2">Releases</Typography>
<Typography variant="body1">
<strong>This is a changelog for the NSHM webapp service. The changelog tracks updates only to the web interface and not to the model itself.</strong>
</Typography>
</TitleContainer>
</Grid>
<Grid item>
Expand Down
2 changes: 1 addition & 1 deletion src/views/hazardCharts/HazardChartsControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const HazardChartsControls: React.FC<HazardChartsControlsProps> = ({ state, disp
setInputValue(newInputValue);
}}
options={hazardPageOptions.locations.sort()}
style={{ width: 230, marginLeft: 16 }}
style={{ minWidth: 240, maxWidth: 270, marginLeft: 16 }}
renderInput={(params) => (
<Tooltip title={locationTooltip} arrow placement="top">
<TextField {...params} label="Locations" variant="standard" />
Expand Down
69 changes: 21 additions & 48 deletions src/views/info/ModelComponentsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,43 @@
import React from 'react';
import { styled } from '@mui/material/styles';
import Grid from '@mui/material/Grid';
import { Link } from 'react-router-dom';

import { Paper, Typography } from '@mui/material';
import { Typography } from '@mui/material';

const PageContainer = styled('div')({
width: '100%',
// display: 'flex',
// flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
padding: '4rem',
padding: '2rem',
marginBottom: '2rem',
});

const InfoContainer = styled('div')({
// display: 'flex',
// flexDirection: 'column',
const TitleContainer = styled('div')({
justifyContent: 'left',
textAlign: 'left',
width: '100%',
// padding: '4rem',
paddingBottom: '1rem',
});

interface InfoCardProps {
title: string;
text: string;
}

const ModelComponent: React.FC<InfoCardProps> = ({ title, text }: InfoCardProps) => {
return (
<Grid item xs={12}>
<Paper>
<Grid container spacing={3}>
<Grid item xs={2}>
<Typography variant="h5">{title}</Typography>
</Grid>
<Grid item xs={4}>
<Typography>{text}</Typography>
</Grid>
</Grid>
</Paper>
</Grid>
);
};

const ModelComponentsPage: React.FC = () => {
return (
<PageContainer>
<Grid container spacing={3} columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={12}>
<InfoContainer>
<Typography variant="h2">
<Link to="/Resources">Resources :: </Link>
Model Components
</Typography>
</InfoContainer>
</Grid>
<Grid item xs={12}>
<InfoContainer>
<Typography variant="h3">Source Models</Typography>
</InfoContainer>
<Grid container columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={2} />
<Grid item xs={8}>
<Grid container spacing={2} columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={12}>
<TitleContainer>
<Typography variant="h2">Model Components</Typography>
</TitleContainer>
</Grid>
<Grid item xs={12}>
<Typography variant="body1">
Please contact us at <a href="mailto:[email protected]">[email protected]</a> for OpenQuake input files and instructions on how to run the NSHM.
</Typography>
</Grid>
</Grid>
</Grid>
<ModelComponent title="Source 1" text="from json." />
<ModelComponent title="Source 2 " text="from json." />
{/*<InfoCard title="Model Information, Reports, and Input Files" text="More Information" />*/}
<Grid item xs={2} />
</Grid>
</PageContainer>
);
Expand Down
71 changes: 71 additions & 0 deletions src/views/info/OtherDocumentsPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';
import { styled } from '@mui/material/styles';
import Grid from '@mui/material/Grid';
import { Card, CardContent, Typography, Link, Button } from '@mui/material';

const StyledCard = styled(Card)(() => ({
justifyContent: 'center',
alignItems: 'center',
}));

const PageContainer = styled('div')({
width: '100%',
justifyContent: 'center',
alignItems: 'center',
padding: '2rem',
});

const SectionContainer = styled('div')({
justifyContent: 'left',
textAlign: 'left',
width: '100%',
paddingTop: '2rem',
paddingBottom: '1rem',
});

const OtherDocumentsPage: React.FC = () => {
return (
<PageContainer>
<Grid container columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={2} />
<Grid spacing={3} item xs={8}>
<Typography variant="h2">Other Documents</Typography>
<SectionContainer>
<Grid container spacing={3} columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={12}>
<StyledCard>
<CardContent>
<Grid container spacing={1} columns={{ sm: 6, md: 8, lg: 12 }}>
<Grid item xs={10}>
<Typography variant="h4">NSHM Project Assurance Review</Typography>
</Grid>
<Grid item xs={2}>
<Link
component={Button}
target="_blank"
rel="noopener"
color="primary"
href={'https://nshm-static-reports.gns.cri.nz/NSHM/ScienceReports/NSHM%20Project%20Assurance_FINAL%20DRAFT_28Jul22.pdf'}
>
View report
</Link>
</Grid>
</Grid>
<Typography>
Led by Hugh Cowan, the purpose of the Assurance and Lessons Review is to support the uptake of the new National Seismic Hazard Model into policy and practice, and to inform how
future iterations of the Model and its development may ensure best practice. It provides assurance to decision-makers that the processes followed for development of the revised
NSHM facilitated reasonable and legitimate scientific review, and led to best practice science and a rational consensus model.
</Typography>
</CardContent>
</StyledCard>
</Grid>
</Grid>
</SectionContainer>
</Grid>
<Grid item xs={2} />
</Grid>
</PageContainer>
);
};

export default OtherDocumentsPage;
Loading

0 comments on commit b36b157

Please sign in to comment.