feat: Spec product version, build bake, Admin UI label.
Resolve VERSION from EventHubSpec; VITE_APP_BUILD from run_number; show Admin UI / API as version.build (sha). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ export type AdminHealthInfo = {
|
||||
status: string;
|
||||
service?: string;
|
||||
version?: string;
|
||||
build?: number;
|
||||
git_sha?: string;
|
||||
built_at?: string;
|
||||
};
|
||||
|
||||
@@ -57,9 +57,13 @@ import { useCommandPaletteHotkey } from '@/hooks/useCommandPaletteHotkey';
|
||||
import { HeaderNodeMetrics } from '@/components/HeaderNodeMetrics';
|
||||
import { healthApi } from '@/api/healthApi';
|
||||
|
||||
function formatBuildLabel(version: string, sha: string): string {
|
||||
function formatBuildLabel(version: string, build: number | string | undefined, sha: string): string {
|
||||
const shortSha = sha && sha !== 'unknown' && sha !== 'dev' ? sha.slice(0, 12) : sha;
|
||||
return `${version} (${shortSha})`;
|
||||
const buildPart =
|
||||
build === undefined || build === null || build === '' || Number(build) === 0
|
||||
? version
|
||||
: `${version}.${build}`;
|
||||
return `${buildPart} (${shortSha})`;
|
||||
}
|
||||
|
||||
const navIconByKey: Record<string, React.ComponentType<{ className?: string }>> = {
|
||||
@@ -125,6 +129,7 @@ const ControlCenterLayout: React.FC = () => {
|
||||
|
||||
const adminVersionLabel = formatBuildLabel(
|
||||
import.meta.env.VITE_APP_VERSION || '0.0',
|
||||
import.meta.env.VITE_APP_BUILD || '0',
|
||||
import.meta.env.VITE_GIT_SHA || 'dev'
|
||||
);
|
||||
|
||||
@@ -135,7 +140,11 @@ const ControlCenterLayout: React.FC = () => {
|
||||
.then((info) => {
|
||||
if (cancelled) return;
|
||||
setApiVersionLabel(
|
||||
formatBuildLabel(info.version || '0.0', info.git_sha || 'unknown')
|
||||
formatBuildLabel(
|
||||
info.version || '0.0',
|
||||
info.build,
|
||||
info.git_sha || 'unknown'
|
||||
)
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
|
||||
@@ -32,6 +32,7 @@ function buildContext(extra?: Record<string, unknown>): Record<string, unknown>
|
||||
route: typeof window !== 'undefined' ? window.location.pathname : undefined,
|
||||
user_agent: typeof navigator !== 'undefined' ? navigator.userAgent : undefined,
|
||||
build: import.meta.env.VITE_APP_VERSION || '0.0',
|
||||
build_number: import.meta.env.VITE_APP_BUILD || '0',
|
||||
git_sha: import.meta.env.VITE_GIT_SHA || 'dev',
|
||||
...extra,
|
||||
};
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@
|
||||
"nodeMemory": "Memory: {{used}} / {{total}} MB ({{percent}}%)",
|
||||
"nodeWas": "was {{value}}%",
|
||||
"nodeAria": "{{node}}: CPU {{cpu}}%, memory {{memory}}%",
|
||||
"adminVersion": "Admin {{version}}",
|
||||
"adminVersion": "Admin UI {{version}}",
|
||||
"apiVersion": "API {{version}}",
|
||||
"apiVersionUnavailable": "API — unavailable"
|
||||
},
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@
|
||||
"nodeMemory": "Память: {{used}} / {{total}} МБ ({{percent}}%)",
|
||||
"nodeWas": "было {{value}}%",
|
||||
"nodeAria": "{{node}}: CPU {{cpu}}%, память {{memory}}%",
|
||||
"adminVersion": "Admin {{version}}",
|
||||
"adminVersion": "Admin UI {{version}}",
|
||||
"apiVersion": "API {{version}}",
|
||||
"apiVersionUnavailable": "API — нет данных"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user