From 1234ac55869d12666e2b728d6f355ec01d897a2e Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Wed, 3 Apr 2024 14:41:42 +0200 Subject: [PATCH] feat(leftmenu): add version info --- .gitlab-ci.yml | 4 ++++ src/components/Routes/LeftSideBar/LeftSideBar.tsx | 11 ++++++++++- src/components/Routes/LeftSideBar/styles.ts | 11 +++++++++++ src/data/version.json | 4 ++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/data/version.json diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c74c1d5f3..711573f0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: diff --git a/src/components/Routes/LeftSideBar/LeftSideBar.tsx b/src/components/Routes/LeftSideBar/LeftSideBar.tsx index 8bfe541f5..2a31dd73e 100644 --- a/src/components/Routes/LeftSideBar/LeftSideBar.tsx +++ b/src/components/Routes/LeftSideBar/LeftSideBar.tsx @@ -15,7 +15,8 @@ import { ListItemIcon, Typography, Tooltip, - Zoom + Zoom, + Box } from '@mui/material' import AddIcon from '@mui/icons-material/Add' @@ -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 @@ -415,6 +417,13 @@ const LeftSideBar: React.FC<{ open?: boolean }> = (props) => { + {open && versionInfo.version && ( + + + {`${versionInfo.version} (${versionInfo.commit})`} + + )} + {ODD_CONTACT && (open ? (