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

Feat: enable old and new data dictionary for VA #1613

Merged
merged 3 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion docs/portal_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ Below is an example, with inline comments describing what each JSON block config
"title": "My app title", // App title/name, also displayed on the App card in the /analysis page
"description": "My app description", // App title/name, also displayed on the App card in the /analysis page
"image": "/src/img/analysis-icons/myapp-image.svg", // App logo/image to be displayed on the App card in the /analysis page
"needsTeamProject": true // Optional. Whether the app needs a "team project" selection to be made by the user first. If true, it will force the user to select a "team project" first. See also https://github.com/uc-cdis/data-portal/pull/1445
"needsTeamProject": true, // Optional. Whether the app needs a "team project" selection to be made by the user first. If true, it will force the user to select a "team project" first. See also https://github.com/uc-cdis/data-portal/pull/1445
"dataDictionaryVersion": "new", // Optional, for custom AtlasDataDictionary. Set to "new" to ensure the new version of the /analysis/AtlasDataDictionary data dictionary when the user navigates to /analysis/AtlasDataDictionary.
},
{
"title": "My other app",
Expand Down
4 changes: 3 additions & 1 deletion src/Analysis/AnalysisApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ class AnalysisApp extends React.Component {
case 'AtlasDataDictionary': {
return (
<div className='analysis-app_flex_row'>
<AtlasDataDictionaryContainer />
<AtlasDataDictionaryContainer
dataDictionaryVersion={analysisApps[app].dataDictionaryVersion}
/>
</div>
);
}
Expand Down
28 changes: 20 additions & 8 deletions src/Analysis/AtlasDataDictionary/AtlasDataDictionaryContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useLocation, useHistory, useRouteMatch } from 'react-router-dom';
import ProtectedContent from '../../Login/ProtectedContent';
import AtlasDataDictionaryLoading from './AtlasDataDictionaryTable/AtlasDataDictionaryLoading';
import AtlasDataDictionaryButton from './AtlasDataDictionaryButton/AtlasDataDictionaryButton';
import './AtlasDataDictionary.css';

const AtlasDataDictionaryContainer = () => {
const AtlasDataDictionaryContainer = ({ dataDictionaryVersion }) => {
const location = useLocation();
const history = useHistory();
const match = useRouteMatch();

if (!dataDictionaryVersion || !dataDictionaryVersion.includes('new')) {
// Default legacy component: render a div with AtlasDataDictionaryButton when
// no dataDictionaryVersion is set or it does not include 'new':
return (
<div style={{ width: '100%' }}><AtlasDataDictionaryButton /></div>
);
}
return (
<div className='atlas-data-dictionary-container'>
<ProtectedContent
public
location={location}
history={history}
match={match}
component={() => <AtlasDataDictionaryLoading />}
/>
<AtlasDataDictionaryLoading />
</div>
);
};

AtlasDataDictionaryContainer.propTypes = {
dataDictionaryVersion: PropTypes.string,
};

AtlasDataDictionaryContainer.defaultProps = {
dataDictionaryVersion: null,
};

export default AtlasDataDictionaryContainer;
Loading