fix(GOV-009): 完成最终复审整改
This commit is contained in:
@@ -3,8 +3,10 @@ import type { components } from '../generated/schema';
|
||||
type HealthResponseDto = components['schemas']['HealthResponseDto'];
|
||||
type DependencyHealthDto = components['schemas']['DependencyHealthDto'];
|
||||
|
||||
/** 页面级健康状态把后端 disabled 映射为 degraded,避免与真实故障混为一谈。 */
|
||||
export type HealthViewState = 'healthy' | 'degraded' | 'unavailable';
|
||||
|
||||
/** 单项依赖的展示模型隐藏后端 DTO 结构,只保留名称、可用性和安全说明。 */
|
||||
export interface HealthServiceViewModel {
|
||||
key: 'redis' | 'mysql' | 'rocketMq';
|
||||
name: 'Redis' | 'MySQL' | 'RocketMQ';
|
||||
@@ -12,6 +14,7 @@ export interface HealthServiceViewModel {
|
||||
note: string;
|
||||
}
|
||||
|
||||
/** 健康页稳定展示契约;Vue 组件不直接依赖 OpenAPI 生成类型。 */
|
||||
export interface HealthViewModel {
|
||||
state: HealthViewState;
|
||||
stateLabel: '运行正常' | '部分能力停用' | '服务异常';
|
||||
@@ -39,6 +42,7 @@ function toServiceViewModel(
|
||||
};
|
||||
}
|
||||
|
||||
/** 将版本化 HTTP DTO 转为页面展示模型,并拒绝未知的服务端状态枚举。 */
|
||||
export function toHealthViewModel(dto: HealthResponseDto): HealthViewModel {
|
||||
const dependencies = Object.values(dto.dependencies);
|
||||
for (const dependency of dependencies) assertDependencyStatus(dependency.status);
|
||||
|
||||
Reference in New Issue
Block a user