Skip to content

Commit

Permalink
Move into test (#615)
Browse files Browse the repository at this point in the history
* Update README.md

* First commit (#566)

* First commit

* Upload

* Update the sec produre for unseceruing an attachment

* Version update

* Update for single upload button

* New fixtures

* Update

* Survey script

* delete survey

* Spacing

* Update access request page: remove regional offices section, remove non-supported roles from dropdown (#610)

* [BHBC-1449] Add Help Link (#614)

* Update template validation schemas (#612)

* Add migration to update moose SRB/Composition Validation schema
* Add Summary Statistics file to resources page
* Add Date column to recruitment survey
* Fix dependency warnings
* Remove unused test function

* Update deployStatic.yml

Co-authored-by: Nick Phura <[email protected]>
Co-authored-by: jeznorth <[email protected]>
  • Loading branch information
3 people authored Oct 20, 2021
1 parent 6c95791 commit 00a88d3
Show file tree
Hide file tree
Showing 14 changed files with 1,875 additions and 284 deletions.
1 change: 0 additions & 1 deletion .github/workflows/deployStatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ jobs:
- deployAPP
- deployAPI
- deployDatabaseSetup
- cypress-run
steps:
- name: Notify
uses: nobrayner/discord-webhook@v1
Expand Down
204 changes: 133 additions & 71 deletions app/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import AppBar from '@material-ui/core/AppBar';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import Divider from '@material-ui/core/Divider';
import IconButton from '@material-ui/core/IconButton';
import { Theme } from '@material-ui/core/styles/createMuiTheme';
import makeStyles from '@material-ui/core/styles/makeStyles';
import Toolbar from '@material-ui/core/Toolbar';
import { mdiAccountCircle, mdiLoginVariant } from '@mdi/js';
import Typography from '@material-ui/core/Typography';
import { mdiAccountCircle, mdiHelpCircle, mdiLoginVariant } from '@mdi/js';
import Icon from '@mdi/react';
import headerImageLarge from 'assets/images/gov-bc-logo-horiz.png';
import headerImageSmall from 'assets/images/gov-bc-logo-vert.png';
Expand All @@ -14,6 +20,7 @@ import { AuthStateContext } from 'contexts/authStateContext';
import { ConfigContext } from 'contexts/configContext';
import React, { useContext } from 'react';
import { Link } from 'react-router-dom';
import OtherLink from '@material-ui/core/Link';
import { isAuthenticated } from 'utils/authUtils';

const useStyles = makeStyles((theme: Theme) => ({
Expand Down Expand Up @@ -77,6 +84,9 @@ const useStyles = makeStyles((theme: Theme) => ({
textDecoration: 'underline'
}
},
govHeaderIconButton: {
color: '#ffffff'
},
mainNav: {
backgroundColor: '#38598a'
},
Expand All @@ -94,6 +104,11 @@ const useStyles = makeStyles((theme: Theme) => ({
'& a:first-child': {
marginLeft: theme.spacing(-2)
}
},
'.MuiDialogContent-root': {
'& p + p': {
marginTop: theme.spacing(2)
}
}
}));

Expand All @@ -109,14 +124,20 @@ const Header: React.FC = () => {

return (
<Box display="flex" className={classes.userProfile} my="auto" alignItems="center">
<Icon path={mdiAccountCircle} size={1.25} />
<Icon path={mdiAccountCircle} size={1.12} />
<Box ml={1}>{loggedInUserDisplayName}</Box>
<Box px={2}>
<Divider orientation="vertical" />
</Box>
<Link to="/logout" data-testid="menu_log_out">
Log Out
</Link>
<Box pl={2}>
<Divider orientation="vertical" />
</Box>
<IconButton className={classes.govHeaderIconButton} onClick={showSupportDialog}>
<Icon path={mdiHelpCircle} size={1.12} />
</IconButton>
</Box>
);
};
Expand All @@ -132,10 +153,16 @@ const Header: React.FC = () => {
variant="contained"
color="primary"
disableElevation
startIcon={<Icon path={mdiLoginVariant} size={1} />}
startIcon={<Icon path={mdiLoginVariant} size={1.12} />}
data-testid="login">
Log In
</Button>
<Box pl={2}>
<Divider orientation="vertical" />
</Box>
<IconButton className={classes.govHeaderIconButton} onClick={showSupportDialog}>
<Icon path={mdiHelpCircle} size={1.12} />
</IconButton>
</Box>
);
};
Expand All @@ -152,81 +179,116 @@ const Header: React.FC = () => {
);
};

const [open, setOpen] = React.useState(false);
const preventDefault = (event: React.SyntheticEvent) => event.preventDefault();

const showSupportDialog = () => {
setOpen(true);
};

const hideSupportDialog = () => {
setOpen(false);
};

return (
<AppBar position="sticky" style={{ boxShadow: 'none' }}>
<Box className={classes.govHeader}>
<Toolbar className={classes.govHeaderToolbar}>
<Box display="flex" justifyContent="space-between" width="100%">
<Link to="/projects" className={classes.brand} aria-label="Go to SIMS Home">
<picture>
<source srcSet={headerImageLarge} media="(min-width: 1200px)"></source>
<source srcSet={headerImageSmall} media="(min-width: 600px)"></source>
<img src={headerImageSmall} alt={'Government of British Columbia'} />
</picture>
<span>
Species Inventory Management System
<sup
className={classes.appPhaseTag}
aria-label="This application is currently in beta phase of development">
Beta
</sup>
{config?.REACT_APP_NODE_ENV !== 'prod' && (
<>
<AppBar position="sticky" style={{ boxShadow: 'none' }}>
<Box className={classes.govHeader}>
<Toolbar className={classes.govHeaderToolbar}>
<Box display="flex" justifyContent="space-between" width="100%">
<Link to="/projects" className={classes.brand} aria-label="Go to SIMS Home">
<picture>
<source srcSet={headerImageLarge} media="(min-width: 1200px)"></source>
<source srcSet={headerImageSmall} media="(min-width: 600px)"></source>
<img src={headerImageSmall} alt={'Government of British Columbia'} />
</picture>
<span>
Species Inventory Management System
<sup
className={classes.appPhaseTag}
aria-label={`This application is currently being run in the ${config?.REACT_APP_NODE_ENV} environment`}>
& {config?.REACT_APP_NODE_ENV}
aria-label="This application is currently in beta phase of development">
Beta
</sup>
)}
</span>
</Link>
{!isAuthenticated(keycloakWrapper) && <PublicViewUser />}
{isAuthenticated(keycloakWrapper) && <LoggedInUser />}
</Box>
</Toolbar>
</Box>
<Box className={classes.mainNav}>
<Toolbar variant="dense" className={classes.mainNavToolbar} role="navigation" aria-label="Main Navigation">
{isAuthenticated(keycloakWrapper) && (
{config?.REACT_APP_NODE_ENV !== 'prod' && (
<sup
className={classes.appPhaseTag}
aria-label={`This application is currently being run in the ${config?.REACT_APP_NODE_ENV} environment`}>
& {config?.REACT_APP_NODE_ENV}
</sup>
)}
</span>
</Link>
{!isAuthenticated(keycloakWrapper) && <PublicViewUser />}
{isAuthenticated(keycloakWrapper) && <LoggedInUser />}
</Box>
</Toolbar>
</Box>
<Box className={classes.mainNav}>
<Toolbar variant="dense" className={classes.mainNavToolbar} role="navigation" aria-label="Main Navigation">
{isAuthenticated(keycloakWrapper) && (
<SecureLink
to="/admin/projects"
label="Projects"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_projects"
/>
)}
{!isAuthenticated(keycloakWrapper) && (
<>
<SecureLink to="/" label="Projects" validRoles={[]} id="menu_projects" />
<SecureLink to="/search" label="Map" validRoles={[]} id="menu_search" />
</>
)}
<SecureLink
to="/admin/projects"
label="Projects"
to="/admin/permits"
label="Permits"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_projects"
id="menu_permits"
/>
)}
{!isAuthenticated(keycloakWrapper) && (
<>
<SecureLink to="/" label="Projects" validRoles={[]} id="menu_projects" />
<SecureLink to="/search" label="Map" validRoles={[]} id="menu_search" />
</>
)}
<SecureLink
to="/admin/permits"
label="Permits"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_permits"
/>
<SecureLink
to="/admin/users"
label="Manage Users"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN]}
id="menu_admin_users"
/>
<SecureLink
to="/admin/search"
label="Map"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_search"
/>
<SecureLink
to="/admin/resources"
label="Resources"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_resources"
/>
</Toolbar>
</Box>
</AppBar>
<SecureLink
to="/admin/users"
label="Manage Users"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN]}
id="menu_admin_users"
/>
<SecureLink
to="/admin/search"
label="Map"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_search"
/>
<SecureLink
to="/admin/resources"
label="Resources"
validRoles={[SYSTEM_ROLE.SYSTEM_ADMIN, SYSTEM_ROLE.PROJECT_ADMIN]}
id="menu_resources"
/>
</Toolbar>
</Box>
</AppBar>

<Dialog open={open}>
<DialogTitle>Need Help?</DialogTitle>
<DialogContent>
<Typography variant="body1" gutterBottom>
For technical support or questions about this application, please contact:{' '}
<OtherLink
href="mailto:[email protected]?subject=BioHub - Secure Document Access Request"
underline="always"
onClick={preventDefault}>
[email protected]
</OtherLink>
.<Box></Box>
</Typography>
<Typography variant="body1">A support representative will respond to your request shortly.</Typography>
</DialogContent>
<DialogActions>
<Button variant="contained" color="primary" onClick={hideSupportDialog}>
OK
</Button>
</DialogActions>
</Dialog>
</>
);
};

Expand Down
8 changes: 8 additions & 0 deletions app/src/features/resources/ResourcesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ const ResourcesPage: React.FC = () => {
type: mdiFileExcelOutline,
lastModified: 'Today',
fileSize: '36 KB'
},
{
id: '3',
name: 'Moose Summary Statistics',
url: 'https://nrs.objectstore.gov.bc.ca/gblhvt/templates/Moose_Summary_Statistics.xlsx',
type: mdiFileExcelOutline,
lastModified: 'Today',
fileSize: '10 KB'
}
];

Expand Down
2 changes: 1 addition & 1 deletion app/src/features/search/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const SearchPage: React.FC = () => {
dialogErrorDetails: apiError?.errors
});
}
}, [biohubApi.search, showFilterErrorDialog]);
}, [biohubApi.search, biohubApi.public.search, showFilterErrorDialog, keycloakWrapper]);

useEffect(() => {
if (performSearch) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/features/surveys/view/SurveySummaryResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const SurveySummaryResults = () => {
} catch (error) {
return error;
}
}, [biohubApi.project, biohubApi.survey, surveyId, projectId, hasErrorMessages]);
}, [biohubApi.survey, surveyId, projectId]);

useEffect(() => {
if (isLoading) {
Expand Down
Loading

0 comments on commit 00a88d3

Please sign in to comment.