Skip to content

Commit f59b9a2

Browse files
committed
Add version build time to sidebar.
1 parent 7cba8f1 commit f59b9a2

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

web-server/pages/api/internal/version.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type CheckNewVersionResponse = {
2323
current_github_commit: string;
2424
is_update_available: boolean;
2525
latest_docker_image_build_date: Date;
26+
current_docker_image_build_date: Date;
2627
};
2728

2829
type DockerHubAPIResponse = {
@@ -142,7 +143,8 @@ async function checkNewImageRelease(): Promise<CheckNewVersionResponse> {
142143
dockerLatestRemoteTag: latestTag,
143144
localVersionInfo: versionInfo
144145
}),
145-
latest_docker_image_build_date: latestRemoteDate
146+
latest_docker_image_build_date: latestRemoteDate,
147+
current_docker_image_build_date: new Date(versionInfo.current_build_date)
146148
};
147149
}
148150

web-server/src/layouts/ExtendedSidebarLayout/Sidebar/index.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import {
77
useTheme,
88
lighten
99
} from '@mui/material';
10+
import { format } from 'date-fns';
1011
import { useContext, useMemo } from 'react';
1112

13+
import { FlexBox } from '@/components/FlexBox';
1214
import Scrollbar from '@/components/Scrollbar';
15+
import { Line } from '@/components/Text';
1316
import { SidebarContext } from '@/contexts/SidebarContext';
17+
import { useSelector } from '@/store';
1418

1519
import SidebarMenu from './SidebarMenu';
1620
import SidebarTopSection from './SidebarTopSection';
@@ -61,6 +65,13 @@ function Sidebar() {
6165
const SidebarContent = () => {
6266
const theme = useTheme();
6367

68+
const imageStatus = useSelector((s) => s.app.latestImageStatus);
69+
70+
const formattedDate = format(
71+
new Date(imageStatus.current_docker_image_build_date),
72+
'dd MMM yyyy HH:mm:ss'
73+
);
74+
6475
return (
6576
<>
6677
<Scrollbar>
@@ -75,6 +86,11 @@ const SidebarContent = () => {
7586
<SidebarMenu />
7687
</Scrollbar>
7788
<Divider sx={{ background: theme.colors.alpha.trueWhite[10] }} />
89+
<FlexBox justifyCenter alignCenter height="60px">
90+
<Line small medium secondary>
91+
Build: {formattedDate}
92+
</Line>
93+
</FlexBox>
7894
</>
7995
);
8096
};

web-server/src/types/resources.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ export type IntegrationsLinkedAtMap = Record<keyof IntegrationsMap, DateString>;
10201020
export type ImageStatusApiResponse = {
10211021
latest_docker_image: string;
10221022
is_update_available: boolean;
1023+
current_docker_image_build_date: DateString;
10231024
};
10241025

10251026
export type DB_OrgRepo = {

0 commit comments

Comments
 (0)