feat(platform): show release in topbar
This commit is contained in:
@@ -36,6 +36,7 @@ export default function App() {
|
|||||||
initialRoute.page === 'quality' ? qualityFiltersFromRoute(initialRoute) : {}
|
initialRoute.page === 'quality' ? qualityFiltersFromRoute(initialRoute) : {}
|
||||||
);
|
);
|
||||||
const [linkIssueCount, setLinkIssueCount] = useState<number | null>(null);
|
const [linkIssueCount, setLinkIssueCount] = useState<number | null>(null);
|
||||||
|
const [platformRelease, setPlatformRelease] = useState('');
|
||||||
const [currentVehicleStatus, setCurrentVehicleStatus] = useState<VehicleServiceStatus | undefined>();
|
const [currentVehicleStatus, setCurrentVehicleStatus] = useState<VehicleServiceStatus | undefined>();
|
||||||
const [currentVehicleLabel, setCurrentVehicleLabel] = useState('');
|
const [currentVehicleLabel, setCurrentVehicleLabel] = useState('');
|
||||||
const [currentVehicleConsistency, setCurrentVehicleConsistency] = useState<VehicleSourceConsistency | undefined>();
|
const [currentVehicleConsistency, setCurrentVehicleConsistency] = useState<VehicleSourceConsistency | undefined>();
|
||||||
@@ -63,6 +64,7 @@ export default function App() {
|
|||||||
return api.opsHealth()
|
return api.opsHealth()
|
||||||
.then((health) => {
|
.then((health) => {
|
||||||
setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length);
|
setLinkIssueCount(health.linkHealth.filter((item) => item.status !== 'ok').length);
|
||||||
|
setPlatformRelease(health.runtime?.platformRelease ?? '');
|
||||||
return health;
|
return health;
|
||||||
})
|
})
|
||||||
.catch((error: Error) => {
|
.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} />,
|
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} />,
|
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} />,
|
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 (
|
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]}
|
{pages[activePage]}
|
||||||
</AppShell>
|
</AppShell>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ function linkHealthClassName(count: number | null) {
|
|||||||
export function AppShell({
|
export function AppShell({
|
||||||
activePage,
|
activePage,
|
||||||
linkIssueCount,
|
linkIssueCount,
|
||||||
|
platformRelease,
|
||||||
currentVehicleStatus,
|
currentVehicleStatus,
|
||||||
currentVehicleLabel,
|
currentVehicleLabel,
|
||||||
currentVehicleConsistency,
|
currentVehicleConsistency,
|
||||||
@@ -45,6 +46,7 @@ export function AppShell({
|
|||||||
}: {
|
}: {
|
||||||
activePage: PageKey;
|
activePage: PageKey;
|
||||||
linkIssueCount: number | null;
|
linkIssueCount: number | null;
|
||||||
|
platformRelease?: string;
|
||||||
currentVehicleStatus?: VehicleServiceStatus;
|
currentVehicleStatus?: VehicleServiceStatus;
|
||||||
currentVehicleLabel?: string;
|
currentVehicleLabel?: string;
|
||||||
currentVehicleConsistency?: VehicleSourceConsistency;
|
currentVehicleConsistency?: VehicleSourceConsistency;
|
||||||
@@ -107,6 +109,7 @@ export function AppShell({
|
|||||||
</Tag>
|
</Tag>
|
||||||
) : null}
|
) : null}
|
||||||
<Tag color="blue">生产环境</Tag>
|
<Tag color="blue">生产环境</Tag>
|
||||||
|
{platformRelease ? <Tag color="blue">版本 {platformRelease}</Tag> : null}
|
||||||
<Tag color="grey">多源接入 / 一个车辆服务</Tag>
|
<Tag color="grey">多源接入 / 一个车辆服务</Tag>
|
||||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图就绪' : '地图待配置'}</Tag>
|
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图就绪' : '地图待配置'}</Tag>
|
||||||
<Button size="small" aria-label="顶部实时监控" onClick={() => onChange('realtime')}>实时监控</Button>
|
<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 {
|
return {
|
||||||
ok: true,
|
ok: true,
|
||||||
json: async () => ({
|
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',
|
traceId: 'trace-test',
|
||||||
timestamp: 1783094400000
|
timestamp: 1783094400000
|
||||||
})
|
})
|
||||||
@@ -72,6 +79,7 @@ test('exposes AMap operations shortcuts when map key is configured', async () =>
|
|||||||
render(<App />);
|
render(<App />);
|
||||||
|
|
||||||
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
|
expect(await screen.findByText('地图就绪')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('版本 platform-20260704153357')).toBeInTheDocument();
|
||||||
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
|
fireEvent.click(screen.getByRole('button', { name: '顶部实时监控' }));
|
||||||
expect(window.location.hash).toBe('#/realtime');
|
expect(window.location.hash).toBe('#/realtime');
|
||||||
fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' }));
|
fireEvent.click(screen.getByRole('button', { name: '顶部轨迹回放' }));
|
||||||
|
|||||||
Reference in New Issue
Block a user