feat: add version display
This commit is contained in:
parent
d03f60f6a1
commit
ac7f4011cd
@ -6,6 +6,7 @@ import { Button, Dropdown } from 'antd';
|
|||||||
import { useUserStore } from '../store/user';
|
import { useUserStore } from '../store/user';
|
||||||
import { useLogout } from '../api/model/user';
|
import { useLogout } from '../api/model/user';
|
||||||
import { ColorSchemeSwitcher } from '../components/ColorSchemeSwitcher';
|
import { ColorSchemeSwitcher } from '../components/ColorSchemeSwitcher';
|
||||||
|
import { version } from '../../shared';
|
||||||
|
|
||||||
export const Layout: React.FC = React.memo(() => {
|
export const Layout: React.FC = React.memo(() => {
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
@ -66,6 +67,14 @@ export const Layout: React.FC = React.memo(() => {
|
|||||||
logout();
|
logout();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'divider',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'version',
|
||||||
|
label: `v${version}`,
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -26,6 +26,7 @@ import { serverStatusRouter } from './router/serverStatus';
|
|||||||
import { initCronjob } from './cronjob';
|
import { initCronjob } from './cronjob';
|
||||||
import { logger } from './utils/logger';
|
import { logger } from './utils/logger';
|
||||||
import { monitorRouter } from './router/monitor';
|
import { monitorRouter } from './router/monitor';
|
||||||
|
import { healthRouter } from './router/health';
|
||||||
|
|
||||||
const port = settings.port;
|
const port = settings.port;
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ app.use(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
app.use('/health', healthRouter);
|
||||||
app.use('/api/website', websiteRouter);
|
app.use('/api/website', websiteRouter);
|
||||||
app.use('/api/workspace', workspaceRouter);
|
app.use('/api/workspace', workspaceRouter);
|
||||||
app.use('/monitor', monitorRouter);
|
app.use('/monitor', monitorRouter);
|
||||||
|
10
src/server/router/health.ts
Normal file
10
src/server/router/health.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { version } from '../../shared';
|
||||||
|
|
||||||
|
export const healthRouter = Router();
|
||||||
|
|
||||||
|
healthRouter.get('/', async (req, res) => {
|
||||||
|
res.json({
|
||||||
|
version,
|
||||||
|
});
|
||||||
|
});
|
3
src/shared/config.ts
Normal file
3
src/shared/config.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import packageJson from '../../package.json';
|
||||||
|
|
||||||
|
export const version = packageJson.version;
|
@ -1,3 +1,4 @@
|
|||||||
|
export * from './config';
|
||||||
export * from './date';
|
export * from './date';
|
||||||
export * from './server';
|
export * from './server';
|
||||||
export * from './regex';
|
export * from './regex';
|
||||||
|
Loading…
Reference in New Issue
Block a user