feat(platform): show release in topbar
This commit is contained in:
@@ -36,6 +36,7 @@ export default function App() {
|
||||
initialRoute.page === 'quality' ? qualityFiltersFromRoute(initialRoute) : {}
|
||||
);
|
||||
const [linkIssueCount, setLinkIssueCount] = useState<number | null>(null);
|
||||
const [platformRelease, setPlatformRelease] = useState('');
|
||||
const [currentVehicleStatus, setCurrentVehicleStatus] = useState<VehicleServiceStatus | undefined>();
|
||||
const [currentVehicleLabel, setCurrentVehicleLabel] = useState('');
|
||||
const [currentVehicleConsistency, setCurrentVehicleConsistency] = useState<VehicleSourceConsistency | undefined>();
|
||||
@@ -63,6 +64,7 @@ export default function App() {
|
||||
return api.opsHealth()
|
||||
.then((health) => {
|
||||
setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length);
|
||||
setPlatformRelease(health.runtime?.platformRelease ?? '');
|
||||
return health;
|
||||
})
|
||||
.catch((error: Error) => {
|
||||
@@ -404,11 +406,14 @@ export default function App() {
|
||||
detail: <VehicleDetail vin={activeVin} protocol={activeProtocol} onOpenRealtime={openRealtimeForVehicle} onOpenHistory={openHistoryForVehicle} onOpenRaw={openRawForVehicle} onOpenMileage={openMileageForVehicle} onOpenVehicles={openVehicles} onOpenQuality={openQuality} onOpenHistoryEvidence={openHistoryWithFilters} onOpenRawEvidence={openRawWithFilters} onQueryChange={updateVehicleDetailQuery} />,
|
||||
history: <History initialVin={analysisVin} initialProtocol={activeProtocol} initialTab={historyTab} initialFilters={historyFilters} onFiltersChange={updateHistoryFilters} onOpenVehicle={openVehicle} onOpenMileage={openMileageWithFilters} onOpenRaw={openRawWithFilters} />,
|
||||
mileage: <Mileage initialVin={analysisVin} initialProtocol={activeProtocol} initialFilters={mileageFilters} onFiltersChange={updateMileageFilters} onOpenVehicle={openVehicle} onOpenHistory={openHistoryWithFilters} onOpenRaw={openRawWithFilters} />,
|
||||
quality: <Quality onOpenVehicle={openVehicle} onOpenRealtime={openRealtime} onOpenHistory={openHistoryWithFilters} onOpenRaw={openRawWithFilters} onOpenMileage={openMileageWithFilters} onHealthLoaded={(health) => setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length)} onFiltersChange={updateQualityFilters} initialFilters={qualityFilters} />
|
||||
quality: <Quality onOpenVehicle={openVehicle} onOpenRealtime={openRealtime} onOpenHistory={openHistoryWithFilters} onOpenRaw={openRawWithFilters} onOpenMileage={openMileageWithFilters} onHealthLoaded={(health) => {
|
||||
setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length);
|
||||
setPlatformRelease(health.runtime?.platformRelease ?? '');
|
||||
}} onFiltersChange={updateQualityFilters} initialFilters={qualityFilters} />
|
||||
};
|
||||
|
||||
return (
|
||||
<AppShell activePage={activePage} linkIssueCount={linkIssueCount} currentVehicleStatus={currentVehicleStatus} currentVehicleLabel={currentVehicleLabel} currentVehicleConsistency={currentVehicleConsistency} onChange={navigatePage} onVehicleSearch={openVehicle}>
|
||||
<AppShell activePage={activePage} linkIssueCount={linkIssueCount} platformRelease={platformRelease} currentVehicleStatus={currentVehicleStatus} currentVehicleLabel={currentVehicleLabel} currentVehicleConsistency={currentVehicleConsistency} onChange={navigatePage} onVehicleSearch={openVehicle}>
|
||||
{pages[activePage]}
|
||||
</AppShell>
|
||||
);
|
||||
|
||||
@@ -36,6 +36,7 @@ function linkHealthClassName(count: number | null) {
|
||||
export function AppShell({
|
||||
activePage,
|
||||
linkIssueCount,
|
||||
platformRelease,
|
||||
currentVehicleStatus,
|
||||
currentVehicleLabel,
|
||||
currentVehicleConsistency,
|
||||
@@ -45,6 +46,7 @@ export function AppShell({
|
||||
}: {
|
||||
activePage: PageKey;
|
||||
linkIssueCount: number | null;
|
||||
platformRelease?: string;
|
||||
currentVehicleStatus?: VehicleServiceStatus;
|
||||
currentVehicleLabel?: string;
|
||||
currentVehicleConsistency?: VehicleSourceConsistency;
|
||||
@@ -107,6 +109,7 @@ export function AppShell({
|
||||
</Tag>
|
||||
) : null}
|
||||
<Tag color="blue">生产环境</Tag>
|
||||
{platformRelease ? <Tag color="blue">版本 {platformRelease}</Tag> : null}
|
||||
<Tag color="grey">多源接入 / 一个车辆服务</Tag>
|
||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图就绪' : '地图待配置'}</Tag>
|
||||
<Button size="small" aria-label="顶部实时监控" onClick={() => onChange('realtime')}>实时监控</Button>
|
||||
|
||||
@@ -23,7 +23,14 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
data: { linkHealth: [], kafkaLag: 0, redisOnlineKeys: 0, tdengineWritable: true, mysqlWritable: true, runtime: { requestTimeoutMs: 5000 } },
|
||||
data: {
|
||||
linkHealth: [],
|
||||
kafkaLag: 0,
|
||||
redisOnlineKeys: 0,
|
||||
tdengineWritable: true,
|
||||
mysqlWritable: true,
|
||||
runtime: { requestTimeoutMs: 5000, platformRelease: 'platform-20260704153357' }
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
})
|
||||
@@ -72,6 +79,7 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
||||
render(<App />);
|
||||
|
||||
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
|
||||
expect(screen.getByText('版本 platform-20260704153357')).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
|
||||
expect(window.location.hash).toBe('#/realtime');
|
||||
fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' }));
|
||||
|
||||
Reference in New Issue
Block a user