Skip to content

Commit

Permalink
UI customisation: Show Git repo, ref, hash & deploy time in status p…
Browse files Browse the repository at this point in the history
…anel #5
  • Loading branch information
jonnyry committed Dec 10, 2023
1 parent 6a1dbb0 commit 643e956
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
11 changes: 10 additions & 1 deletion devops/scripts/build_deploy_ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ ui_version=$(jq -r '.version' package.json)

activeDirectoryUri="$(az cloud show --query endpoints.activeDirectory --output tsv)"

gitRef="$(git branch --show-current)"
gitHash="$(git rev-parse --short HEAD)"
gitRepo="$(git config --get remote.origin.url | sed 's/.*\/\([^ ]*\/[^.]*\).*/\1/')"
deployTime="$(printf '%(%d-%b-%Y %H:%M)T')"

# replace the values in the config file
jq --arg rootClientId "${SWAGGER_UI_CLIENT_ID}" \
--arg rootTenantId "${AAD_TENANT_ID}" \
Expand All @@ -20,7 +25,11 @@ jq --arg rootClientId "${SWAGGER_UI_CLIENT_ID}" \
--arg treId "${TRE_ID}" \
--arg version "${ui_version}" \
--arg activeDirectoryUri "${activeDirectoryUri}" \
'.rootClientId = $rootClientId | .rootTenantId = $rootTenantId | .treApplicationId = $treApplicationId | .treUrl = $treUrl | .treId = $treId | .version = $version | .activeDirectoryUri = $activeDirectoryUri' ./src/config.source.json > ./src/config.json
--arg gitRef "${gitRef}" \
--arg gitHash "${gitHash}" \
--arg gitRepo "${gitRepo}" \
--arg deployTime "${deployTime}" \
'.rootClientId = $rootClientId | .rootTenantId = $rootTenantId | .treApplicationId = $treApplicationId | .treUrl = $treUrl | .treId = $treId | .version = $version | .activeDirectoryUri = $activeDirectoryUri | .gitRef = $gitRef | .gitHash = $gitHash | .gitRepo = $gitRepo | .deployTime = $deployTime' ./src/config.source.json > ./src/config.json

# build and deploy the app
yarn install
Expand Down
28 changes: 27 additions & 1 deletion ui/app/src/components/shared/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,32 @@ export const Footer: React.FunctionComponent = () => {
Azure TRE
</Text>
<Stack tokens={{childrenGap: 5}}>
{
uiConfig.gitRepo && <Stack horizontal horizontalAlign='space-between'>
<Stack.Item>Git Repo:</Stack.Item>
<Stack.Item>{uiConfig.gitRepo}</Stack.Item>
</Stack>
}
{
uiConfig.gitRef && <Stack horizontal horizontalAlign='space-between'>
<Stack.Item>Git Ref:</Stack.Item>
<Stack.Item>{uiConfig.gitRef}</Stack.Item>
</Stack>
}
{
uiConfig.gitHash && <Stack horizontal horizontalAlign='space-between'>
<Stack.Item>Git Hash:</Stack.Item>
<Stack.Item>{uiConfig.gitHash}</Stack.Item>
</Stack>
}
{
uiConfig.deployTime && <Stack horizontal horizontalAlign='space-between'>
<Stack.Item>Deploy Time:</Stack.Item>
<Stack.Item>{uiConfig.deployTime}</Stack.Item>
</Stack>
}
</Stack>
<Stack tokens={{childrenGap: 5}} style={{marginTop: 10, paddingTop: 8, borderTop: '1px solid #e8e8e8'}}>
{
uiConfig.version && <Stack horizontal horizontalAlign='space-between'>
<Stack.Item>UI Version:</Stack.Item>
Expand Down Expand Up @@ -109,7 +135,7 @@ const iconButtonStyles: Partial<IButtonStyles> = {

const styles = mergeStyleSets({
callout: {
width: 250,
width: 300,
padding: '20px 24px',
},
title: {
Expand Down
6 changes: 5 additions & 1 deletion ui/app/src/config.source.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"treId": "my-tre",
"debug": false,
"version": "0.0.0",
"activeDirectoryUri": ""
"activeDirectoryUri": "",
"gitRef": "",
"gitHash": "",
"gitRepo": "",
"deployTime": ""
}

0 comments on commit 643e956

Please sign in to comment.