feat: 展示 Gitea webhook relay 诊断
- types/api: 接入后端 webhook 诊断响应并安全降级 - store: 将 webhook 状态并入项目 Gitea 集成状态 - ProjectsView: 展示 relay 目标、hook 数量和匹配明细
This commit is contained in:
@@ -60,6 +60,26 @@ function branchTagText(project: ProjectConfig): string {
|
||||
|
||||
return `${branchCount} branches · ${tagCount} tags`
|
||||
}
|
||||
|
||||
function webhookCountText(project: ProjectConfig): string {
|
||||
if (
|
||||
project.giteaWebhookHookCount === undefined &&
|
||||
project.giteaWebhookActivePushHookCount === undefined
|
||||
) {
|
||||
return '尚未诊断'
|
||||
}
|
||||
|
||||
return `${project.giteaWebhookActivePushHookCount ?? 0}/${project.giteaWebhookHookCount ?? 0} 个 active push hook`
|
||||
}
|
||||
|
||||
function webhookHookText(hook: ProjectConfig['giteaWebhookHooks'][number]): string {
|
||||
const events = hook.events.length > 0 ? hook.events.join(', ') : '无事件'
|
||||
const branch = hook.branchFilter ? ` · ${hook.branchFilter}` : ''
|
||||
const matched = hook.matchesExpectedRelay ? ' · relay 匹配' : ''
|
||||
const active = hook.active ? '启用' : '停用'
|
||||
|
||||
return `#${hook.id} ${hook.type} · ${active} · ${events}${branch}${matched}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -118,6 +138,29 @@ function branchTagText(project: ProjectConfig): string {
|
||||
<dd>{{ branchTagText(row) }}</dd>
|
||||
<dt>默认分支 commit</dt>
|
||||
<dd class="mono">{{ commitText(row) }}</dd>
|
||||
<dt>Webhook / Relay</dt>
|
||||
<dd>
|
||||
<StatusPill :state="row.giteaWebhookStatus" />
|
||||
<span class="diagnostic-message">{{ row.giteaWebhookMessage }}</span>
|
||||
</dd>
|
||||
<dt>Relay 目标</dt>
|
||||
<dd class="mono">{{ row.giteaWebhookExpectedRelayTarget || '-' }}</dd>
|
||||
<dt>Hook 数量</dt>
|
||||
<dd>{{ webhookCountText(row) }}</dd>
|
||||
<dt>Hook 明细</dt>
|
||||
<dd>
|
||||
<div v-if="row.giteaWebhookHooks.length > 0" class="webhook-hook-list">
|
||||
<div
|
||||
v-for="hook in row.giteaWebhookHooks"
|
||||
:key="hook.id"
|
||||
class="webhook-hook-item"
|
||||
>
|
||||
<span>{{ webhookHookText(hook) }}</span>
|
||||
<small class="mono">{{ hook.target || '-' }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div v-for="env in row.environments" :key="env.name" class="env-config-card">
|
||||
@@ -274,6 +317,20 @@ dd {
|
||||
color: #7b8798;
|
||||
}
|
||||
|
||||
.webhook-hook-list {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.webhook-hook-item {
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.webhook-hook-item small {
|
||||
color: #7b8798;
|
||||
}
|
||||
|
||||
.run-link {
|
||||
color: #2563eb;
|
||||
text-decoration: none;
|
||||
|
||||
Reference in New Issue
Block a user