Skip to content

Commit

Permalink
feat(leftmenu): add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored Apr 3, 2024
1 parent b61de5a commit 1234ac5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ stages: # List of stages for jobs in their order of execution
- dependency-check
- deploy


build-job:
image: harbor.eds.aphp.fr/cohort360/node:16.13.2
stage: build
script:
- export VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/"version"://g' | sed 's/[",]//g' | tr -d '[[:space:]]')
- |
echo "{\"commit\": \"$CI_COMMIT_SHORT_SHA\", \"version\": \"$VERSION\"}" > src/data/version.json
- npm install
- npm run build
artifacts:
Expand Down
11 changes: 10 additions & 1 deletion src/components/Routes/LeftSideBar/LeftSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
ListItemIcon,
Typography,
Tooltip,
Zoom
Zoom,
Box
} from '@mui/material'

import AddIcon from '@mui/icons-material/Add'
Expand All @@ -39,6 +40,7 @@ import { resetCohortCreation } from 'state/cohortCreation'

import { ODD_CONTACT } from '../../../constants'
import useStyles from './styles'
import versionInfo from 'data/version.json'

const smallDrawerWidth = 52
const largeDrawerWidth = 260
Expand Down Expand Up @@ -415,6 +417,13 @@ const LeftSideBar: React.FC<{ open?: boolean }> = (props) => {
</Collapse>
</List>

{open && versionInfo.version && (
<Box className={classes.footer}>
<Divider />
<Typography variant="caption">{`${versionInfo.version} (${versionInfo.commit})`}</Typography>
</Box>
)}

{ODD_CONTACT &&
(open ? (
<Button
Expand Down
11 changes: 11 additions & 0 deletions src/components/Routes/LeftSideBar/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,17 @@ const useStyles = makeStyles()((theme: Theme) => ({
'&:hover': {
color: '#499cbf'
}
},
footer: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
position: 'fixed',
bottom: 0,
width: 'inherit',
height: 50,
backgroundColor: '#232E6A',
color: '#FFF'
}
}))

Expand Down
4 changes: 4 additions & 0 deletions src/data/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": null,
"commit": null
}

0 comments on commit 1234ac5

Please sign in to comment.