Skip to content

Commit

Permalink
feat: enable old and new data dictionary for VA
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlukasse committed Oct 25, 2024
1 parent 7d03acf commit 0b28e93
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
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
title={analysisApps[app].title}
/>
</div>
);
}
Expand Down
37 changes: 25 additions & 12 deletions src/Analysis/AtlasDataDictionary/AtlasDataDictionaryContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
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 = ({ title }) => {
const location = useLocation();
const history = useHistory();
const match = useRouteMatch();
return (
<div className='atlas-data-dictionary-container'>
<ProtectedContent
public
location={location}
history={history}
match={match}
component={() => <AtlasDataDictionaryLoading />}
/>
</div>
);

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

AtlasDataDictionaryContainer.propTypes = {
title: PropTypes.string,
};
export default AtlasDataDictionaryContainer;

0 comments on commit 0b28e93

Please sign in to comment.