Skip to content

Commit

Permalink
Merge pull request #613 from chicagopcdc/pcdc_dev
Browse files Browse the repository at this point in the history
PR from pcdc_dev to master
  • Loading branch information
grugna authored Dec 23, 2024
2 parents 8122b35 + 9038fb3 commit 87aaf62
Show file tree
Hide file tree
Showing 14 changed files with 3,519 additions and 3,126 deletions.
5,880 changes: 3,006 additions & 2,874 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pcdc/windmill",
"version": "1.33.0",
"version": "1.34.0",
"description": "PCDC Data Portal",
"dependencies": {
"@adobe/react-spectrum": "3.32.2",
Expand Down
49 changes: 28 additions & 21 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { fetchGraphvizLayout } from './redux/ddgraph/asyncThunks';
import {
fetchSurvivalConfig,
fetchFilterSets,
fetchFederationQuery,
} from './redux/explorer/asyncThunks';
import {
fetchProjects as fetchDataRequestProjects,
Expand All @@ -47,6 +48,7 @@ import {
import { toggleAdminActive } from './redux/dataRequest/slice';
import { useAppDispatch } from './redux/hooks';
import useGoogleAnalytics from './hooks/useGoogleAnalytics';
import { isAdminUser } from './utils';

// lazy-loaded pages
const DataDictionary = lazy(() => import('./DataDictionary'));
Expand Down Expand Up @@ -224,6 +226,26 @@ function App() {
</ProtectedContent>
}
/>
<Route
path='links/ccdifederation/:token'
element={
<ProtectedContent
preload={({ location }) => {
const {
params: { token },
} = matchPath('links/ccdifederation/:token', location.pathname);
console.log(token);
return Promise.all([
dispatch(fetchFederationQuery(token)),
dispatch(fetchDictionary()),
dispatch(fetchSurvivalConfig()),
]);
}}
>
<Explorer />
</ProtectedContent>
}
/>
{enableResourceBrowser && (
<Route
path='resource-browser'
Expand All @@ -241,17 +263,10 @@ function App() {
<ProtectedContent
preload={({ state }) => {
if (searchParams.get('admin') === 'true') {
let {
is_admin,
authz: { '/services/amanuensis': serviceAccessMethods },
} = state.user;
let serviceAccessMethod = Array.isArray(
serviceAccessMethods,
)
? serviceAccessMethods[0]?.method
: undefined;
let isAdmin = is_admin || !!serviceAccessMethod;
if (isAdmin && !state.dataRequest.isAdminActive) {
if (
isAdminUser(state.user.authz) &&
!state.dataRequest.isAdminActive
) {
dispatch(toggleAdminActive());
}
return Promise.all([
Expand All @@ -276,17 +291,9 @@ function App() {
element={
<ProtectedContent
preload={({ state }) => {
let {
is_admin,
authz: { '/services/amanuensis': serviceAccessMethods },
} = state.user;
let serviceAccessMethod = Array.isArray(serviceAccessMethods)
? serviceAccessMethods[0]?.method
: undefined;
let isAdmin = is_admin || !!serviceAccessMethod;
/** @type {Promise[]} */
let requests = [dispatch(fetchFilterSets())];
if (isAdmin) {
const requests = [dispatch(fetchFilterSets())];
if (isAdminUser(state.user.authz)) {
requests.push(dispatch(adminFetchUsers()));
}
return Promise.all(requests);
Expand Down
8 changes: 4 additions & 4 deletions src/DataDictionary/highlightHelper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,17 @@ export const getPropertyTypeFragment = (
return (
<li key={i}>
{addHighlightingSpans(t, matchedTypeItem.indices, spanClassName)}
{property?.enumDef && property?.enumDef.filter((obj) => { return obj?.["enumeration"] === t && obj?.["termDef"]?.["term_url"] && obj?.["termDef"]?.["cde_id"]})
.map((x) => { return (<a href={x["termDef"]["term_url"]} target="_blank"> ({x["termDef"]["cde_id"]}) </a>);})
{property?.enumDef && property?.enumDef.filter((obj) => { return obj?.["enumeration"] === t && obj?.["termDef"]?.["term_url"] && obj?.["termDef"]?.["code"]})
.map((x) => { return (<a href={x["termDef"]["term_url"]} target="_blank"> ({x["termDef"]["code"]}) </a>);})
}
</li>
);
}
return (
<li key={i}>
{addHighlightingSpans(t, [], spanClassName)}
{property?.enumDef && property?.enumDef.filter((obj) => { return obj?.["enumeration"] === t && obj?.["termDef"]?.["term_url"] && obj?.["termDef"]?.["cde_id"]})
.map((x) => { return (<a href={x["termDef"]["term_url"]} target="_blank"> ({x["termDef"]["cde_id"]}) </a>);})
{property?.enumDef && property?.enumDef.filter((obj) => { return obj?.["enumeration"] === t && obj?.["termDef"]?.["term_url"] && obj?.["termDef"]?.["code"]})
.map((x) => { return (<a href={x["termDef"]["term_url"]} target="_blank"> ({x["termDef"]["code"]}) </a>);})
}
</li>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ function DataDictionaryPropertyTable({
</td>
<td className='data-dictionary-property-table__data'>
{Array.isArray(property.term) ? (
property.term.filter((obj) => { return obj["termDef"]?.["term_url"] && obj["termDef"]?.["cde_id"]})
.map((x,i) => { return (<li key={i}><a href={x["termDef"]["term_url"]} target="_blank"> {x["termDef"]["cde_id"]} </a></li>);})
property.term.filter((obj) => { return obj["termDef"]?.["term_url"] && obj["termDef"]?.["code"]})
.map((x,i) => { return (<li key={i}><a href={x["termDef"]["term_url"]} target="_blank"> {x["termDef"]["code"]} </a></li>);})
) : (
property.term?.["termDef"] && property.term["termDef"]["term_url"] && property.term["termDef"]["cde_id"] && <a href={property.term["termDef"]["term_url"]} target="_blank"> {property.term["termDef"]["cde_id"]} </a>
property.term?.["termDef"] && property.term["termDef"]["term_url"] && property.term["termDef"]["code"] && <a href={property.term["termDef"]["term_url"]} target="_blank"> {property.term["termDef"]["code"]} </a>
)
}
</td>
Expand Down
Loading

0 comments on commit 87aaf62

Please sign in to comment.