Skip to content

Commit

Permalink
Merge branch 'develop' into hm-duos-2668-usg-omb-text
Browse files Browse the repository at this point in the history
  • Loading branch information
hams7504 authored Sep 20, 2023
2 parents 259d828 + 57bd68d commit 0b60044
Show file tree
Hide file tree
Showing 11 changed files with 2,627 additions and 104 deletions.
2 changes: 1 addition & 1 deletion scripts/compile-jsonschema.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ download_and_compile_schema() {
curl -s -S -X 'GET' "$1/schemas/dataset-registration/v1" -H 'accept: application/json' -o ./src/assets/schemas/DataRegistrationV1.json

# Generate the data submission schema validation code
ajv compile -s ./src/assets/schemas/DataRegistrationV1.json -o ./src/assets/schemas/DataRegistrationV1Validation.js --spec draft2019 -c ajv-formats --strict false --all-errors
ajv compile --code-lines -s ./src/assets/schemas/DataRegistrationV1.json -o ./src/assets/schemas/DataRegistrationV1Validation.js --spec draft2019 -c ajv-formats --strict false --all-errors

# Prevent linting errors (minified file)
prepend_text "/* eslint-disable */" ./src/assets/schemas/DataRegistrationV1Validation.js
Expand Down
4 changes: 3 additions & 1 deletion src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Home from './pages/Home';
import NotFound from './pages/NotFound';
import NIHICWebform from './pages/NIHicWebform';
import PrivacyPolicy from './pages/PrivacyPolicy';
import ResearcherConsole from './pages/ResearcherConsole';
import ResearcherConsole from './pages/researcher_console/ResearcherConsole';
import UserProfile from './pages/user_profile/UserProfile';
import RequestRole from './pages/user_profile/RequestRole';
import SigningOfficialResearchers from './pages/signing_official_console/SigningOfficialResearchers';
Expand All @@ -33,6 +33,7 @@ import AdminManageDarCollections from './pages/AdminManageDarCollections';
import {AdminEditUser} from './pages/AdminEditUser';
import ChairConsole from './pages/ChairConsole';
import MemberConsole from './pages/MemberConsole';
import DatasetSubmissions from './pages/researcher_console/DatasetSubmissions';
import TermsOfService from './pages/TermsOfService';
import TermsOfServiceAcceptance from './pages/TermsOfServiceAcceptance';
import {HealthCheck} from './pages/HealthCheck';
Expand Down Expand Up @@ -87,6 +88,7 @@ const Routes = (props) => (
<AuthenticatedRoute path="/signing_official_console/researchers" component={ensureSoHasDaaAcknowledgement(SigningOfficialResearchers, true)} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.signingOfficial]} />
<AuthenticatedRoute path="/signing_official_console/dar_requests" component={ensureSoHasDaaAcknowledgement(SigningOfficialDarRequests)} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.signingOfficial]} />
{checkEnv(envGroups.NON_STAGING) && <AuthenticatedRoute path="/signing_official_console/data_submitters" component={ensureSoHasDaaAcknowledgement(SigningOfficialDataSubmitters, false, true)} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.signingOfficial]} />}
<AuthenticatedRoute path="/dataset_submissions" component={DatasetSubmissions} props={props} rolesAllowed={[USER_ROLES.dataSubmitter]}/>
<AuthenticatedRoute path="/dataset_registration/:datasetId" component={DatasetRegistration} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.chairperson]} />
<AuthenticatedRoute path="/dataset_update/:datasetId" component={DatasetUpdateForm} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.chairperson]} />
<AuthenticatedRoute path="/dataset_registration" component={DatasetRegistration} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.chairperson]} />
Expand Down
2,177 changes: 2,176 additions & 1 deletion src/assets/schemas/DataRegistrationV1Validation.js

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions src/components/DuosHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,14 @@ export const headerTabsConfig = [
],
isRendered: (user) => user.isMember
},
{
label: 'DS Console',
link: '/data_submission_form',
search: 'data_submission_form',
children: [
{ label: 'Datasets', link: '/data_submission_form' }
],
isRendered: (user) => user.isDataSubmitter
},
{
label: 'Researcher Console',
link: '/dataset_catalog',
search: 'dataset_catalog',
children: [
{ label: 'Data Catalog', link: '/dataset_catalog' },
{ label: 'DAR Requests', link: '/researcher_console' }
{ label: 'DAR Requests', link: '/researcher_console' },
{ label: 'Submitted Datasets', link: '/dataset_submissions', isRenderedForUser: (user) => user?.isDataSubmitter }
],
isRendered: (user) => user.isResearcher && !isOnlySigningOfficial(user)
}
Expand Down Expand Up @@ -321,7 +313,10 @@ const NavigationTabsComponent = (props) => {
const isRendered = (!isFunction(tab.isRendered) || isNil(tab.isRendered())) ?
true :
tab.isRendered();
return isRendered ? h(Tab, {
const isRenderedForUser = (!isFunction(tab.isRenderedForUser) || isNil(tab.isRenderedForUser(currentUser))) ?
true :
tab.isRenderedForUser(currentUser);
return (isRendered && isRenderedForUser) ? h(Tab, {
key: `${tab.link}_${tabIndex}`,
label: tab.label,
style: selectedSubTab === tabIndex ? styles.subTabActive : styles.subTab,
Expand Down
20 changes: 11 additions & 9 deletions src/components/sortable_table/SortableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Step 3: Pass both arrays into the headCells and rows props
*/

import React from 'react';
import React, {useState, useMemo} from 'react';
import Box from '@mui/material/Box';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
Expand Down Expand Up @@ -84,14 +84,16 @@ export default function SortableTable(props) {

const {
rows,
headCells
headCells,
defaultSort = 'darCode',
cellAlignment = 'center'
} = props;

const [order, setOrder] = React.useState('asc');
const [orderBy, setOrderBy] = React.useState('darCode');
const [selected, setSelected] = React.useState([]);
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const [order, setOrder] = useState('asc');
const [orderBy, setOrderBy] = useState(defaultSort);
const [selected, setSelected] = useState([]);
const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(10);

const handleRequestSort = (event, property) => {
const isAsc = orderBy === property && order === 'asc';
Expand Down Expand Up @@ -135,7 +137,7 @@ export default function SortableTable(props) {
const emptyRows =
page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0;

const visibleRows = React.useMemo(
const visibleRows = useMemo(
() =>
stableSort(rows, getComparator(order, orderBy)).slice(
page * rowsPerPage,
Expand Down Expand Up @@ -187,7 +189,7 @@ export default function SortableTable(props) {
id={labelId}
scope='row'
padding='none'
align='center'>
align={cellAlignment}>
{row[category]}
</TableCell>
))}
Expand Down
Loading

0 comments on commit 0b60044

Please sign in to comment.