import { defineComponent, ref, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderList, ssrRenderClass, ssrRenderStyle } from 'vue/server-renderer'; import { u as useApi } from './useApi-BNSkSrat.mjs'; import { u as useToast } from './useToast-MBvLaNjH.mjs'; import { h as healthLastRunText, S as STATUS_META, R as REGION_LABEL, p as parseCats, C as CAT_LABEL, P as PROBE_META, a as healthReason } from './svchealth-8zW8U1Ef.mjs'; import { _ as _export_sfc } from './server.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "svcinspect", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); const rows = ref([]); const summary = ref({ total: 0, ok: 0, warn: 0, error: 0, skip: 0 }); const lastRun = ref(0); const busy = ref(false); const filterStatus = ref(""); const keyword = ref(""); const lastRunText = computed(() => healthLastRunText(lastRun.value)); const summaryCards = computed(() => [ { key: "error", label: "不可用", value: summary.value.error, ico: "🚨", color: "#be123c", bg: "#ffe4e6" }, { key: "warn", label: "有隐患", value: summary.value.warn, ico: "⚠️", color: "#b45309", bg: "#fef3c7" }, { key: "ok", label: "正常", value: summary.value.ok, ico: "✅", color: "#047857", bg: "#d1fae5" }, { key: "skip", label: "已停用", value: summary.value.skip, ico: "⏸️", color: "#64748b", bg: "#f1f5f9" }, { key: "", label: "巡检配置总数", value: summary.value.total, ico: "📋", color: "#334155", bg: "#e2e8f0" } ]); const filtered = computed(() => { const kw = keyword.value.trim().toLowerCase(); return rows.value.filter((h) => { if (filterStatus.value && h.status !== filterStatus.value) return false; if (!kw) return true; return `${h.name} ${h.svc_id} ${h.provider} ${h.app_name}`.toLowerCase().includes(kw); }); }); function meta(s) { return STATUS_META[s] || STATUS_META.skip; } function probeMeta(k) { return PROBE_META[k] || PROBE_META.none; } function regionLabel(r) { return REGION_LABEL[r] || `区域 ${r}`; } function catLabel(c) { return CAT_LABEL[c] || `类别 ${c}`; } function cats(s) { return parseCats(s); } function reason(h) { return healthReason(h); } function timeText(ms) { return healthLastRunText(ms); } function issuesOf(h) { const all = (h.config_issues || []).map((s) => s.replace("[致命] ", "")); const shown = reason(h); return all.filter((s) => s !== shown && !shown.includes(s)); } return (_ctx, _push, _parent, _attrs) => { _push(`
| 状态 | 服务 | 作用域 / 区域 | 类别 | 探测方式 | 巡检结论 | 耗时 | 检查时间 | |
|---|---|---|---|---|---|---|---|---|
| ${ssrInterpolate(meta(h.status).label)}`);
if (h.fail_streak > 1) {
_push(` 连续 ${ssrInterpolate(h.fail_streak)} 次 `);
} else {
_push(``);
}
_push(` | ${ssrInterpolate(h.name || h.svc_id)} ${ssrInterpolate(h.svc_id)}`);
if (h.provider) {
_push(` · ${ssrInterpolate(h.provider)}`);
} else {
_push(``);
}
_push(` | ${ssrInterpolate(h.app_name || "全局默认")}`); if (h.region) { _push(`${ssrInterpolate(regionLabel(h.region))}`); } else { _push(`默认配置`); } _push(` | `); ssrRenderList(cats(h.categories), (c) => { _push(`${ssrInterpolate(catLabel(c))}`); }); _push(``); if (!cats(h.categories).length) { _push(`—`); } else { _push(``); } _push(` | ${ssrInterpolate(probeMeta(h.probe_kind).label)} | ${ssrInterpolate(reason(h) || "—")} `);
if (issuesOf(h).length) {
_push(``);
ssrRenderList(issuesOf(h), (i, idx) => {
_push(` `);
} else {
_push(``);
}
_push(`· ${ssrInterpolate(i)} `);
});
_push(` | ${ssrInterpolate(h.probe_kind === "none" ? "—" : h.latency_ms + " ms")} | ${ssrInterpolate(timeText(h.checked_at))} | |
| ${ssrInterpolate(rows.value.length ? "当前筛选下没有匹配的记录" : "暂无巡检记录,点击右上角「立即巡检」执行一次")} | ||||||||