fix: 修复集群不可达时误报100分的严重bug
- 新增 check_connectivity() 连通性预检: kubectl存在性/kubeconfig/API Server连接 - 连不上集群直接返回0分+明确错误信息+排查建议(不再静默跳过) - 每个检查项kubectl失败时必须报critical问题(不再忽略error) - 前端: 连接失败时显示红色错误页+错误详情+排查建议+重新诊断按钮 - 智能识别常见错误: connection refused/证书过期/超时/DNS解析失败等
This commit is contained in:
+34
-2
@@ -58,8 +58,31 @@
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 集群连接失败 -->
|
||||
<div v-if="diagnosis && !diagnosing && diagnosis.connected === false" class="conn-error-box">
|
||||
<el-card shadow="never" class="conn-error-card">
|
||||
<div class="conn-error-icon">
|
||||
<el-icon :size="64" color="#f56c6c"><CircleCloseFilled /></el-icon>
|
||||
</div>
|
||||
<h2>无法连接到 Kubernetes 集群</h2>
|
||||
<div class="conn-error-detail">
|
||||
<el-alert type="error" :closable="false" show-icon>
|
||||
<template #title>错误信息</template>
|
||||
<pre class="conn-error-pre">{{ diagnosis.connectivity_error }}</pre>
|
||||
</el-alert>
|
||||
<el-alert v-if="diagnosis.connectivity_suggestion" type="warning" :closable="false" show-icon style="margin-top: 12px">
|
||||
<template #title>排查建议</template>
|
||||
<div>{{ diagnosis.connectivity_suggestion }}</div>
|
||||
</el-alert>
|
||||
</div>
|
||||
<div class="conn-error-actions">
|
||||
<el-button type="primary" @click="runDiagnosis" :icon="Refresh">重新诊断</el-button>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<!-- 诊断结果 -->
|
||||
<template v-if="diagnosis && !diagnosing">
|
||||
<template v-if="diagnosis && !diagnosing && diagnosis.connected !== false">
|
||||
<!-- 概览卡片 -->
|
||||
<el-row :gutter="16" class="summary-row">
|
||||
<el-col :span="4">
|
||||
@@ -219,7 +242,7 @@
|
||||
<script setup>
|
||||
import { ref, computed, nextTick } from 'vue'
|
||||
import { marked } from 'marked'
|
||||
import { Refresh, MagicStick, Loading, WarningFilled, Warning, Promotion, Monitor, CircleCheckFilled, CircleClose } from '@element-plus/icons-vue'
|
||||
import { Refresh, MagicStick, Loading, WarningFilled, Warning, Promotion, Monitor, CircleCheckFilled, CircleClose, CircleCloseFilled } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const API = '/api'
|
||||
@@ -405,6 +428,15 @@ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC'
|
||||
/* 诊断进度 */
|
||||
.progress-box { display: flex; justify-content: center; padding-top: 40px; }
|
||||
.progress-card { width: 600px; }
|
||||
|
||||
/* 连接失败 */
|
||||
.conn-error-box { display: flex; justify-content: center; padding-top: 40px; }
|
||||
.conn-error-card { width: 700px; text-align: center; padding: 20px 0; }
|
||||
.conn-error-icon { margin-bottom: 16px; }
|
||||
.conn-error-card h2 { font-size: 22px; color: #303133; margin-bottom: 20px; }
|
||||
.conn-error-detail { text-align: left; margin: 0 20px; }
|
||||
.conn-error-pre { white-space: pre-wrap; word-break: break-all; font-size: 13px; margin: 8px 0 0; color: #f56c6c; }
|
||||
.conn-error-actions { margin-top: 24px; }
|
||||
.progress-steps { display: flex; flex-direction: column; gap: 4px; }
|
||||
.progress-item {
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
|
||||
Reference in New Issue
Block a user