feat(web): show awooop security coverage

This commit is contained in:
Your Name
2026-05-21 15:15:38 +08:00
parent 5af90d1367
commit fdf3095e1b
8 changed files with 421 additions and 3 deletions

View File

@@ -114,6 +114,15 @@ type SurfaceConnectionStatus = {
tone: 'steady' | 'warn' | 'locked'
}
type AwoooPCoverageStatus = {
key: string
href: string
route: string
stage: string
icon: typeof ShieldCheck
tone: 'steady' | 'warn' | 'locked'
}
type CoverageGroup = {
key: string
count: string
@@ -483,6 +492,32 @@ const surfaceConnectionStatuses: SurfaceConnectionStatus[] = [
{ key: 'codeReview', href: '/code-review', state: 'directBridge', icon: SearchCheck, tone: 'warn' },
]
const awooopCoverageStatuses: AwoooPCoverageStatus[] = [
{ key: 'home', href: '/awooop', route: '/awooop', stage: 'S2.72', icon: ShieldCheck, tone: 'steady' },
{ key: 'workItems', href: '/awooop/work-items', route: '/awooop/work-items', stage: 'S2.73', icon: ListChecks, tone: 'steady' },
{ key: 'contracts', href: '/awooop/contracts', route: '/awooop/contracts', stage: 'S2.74', icon: FileText, tone: 'steady' },
{ key: 'approvals', href: '/awooop/approvals', route: '/awooop/approvals', stage: 'S2.75', icon: ClipboardCheck, tone: 'locked' },
{ key: 'tenants', href: '/awooop/tenants', route: '/awooop/tenants', stage: 'S2.76', icon: Radar, tone: 'steady' },
{ key: 'runs', href: '/awooop/runs', route: '/awooop/runs', stage: 'S2.77', icon: Activity, tone: 'steady' },
{ key: 'runDetail', href: '/awooop/runs', route: '/awooop/runs/[run_id]', stage: 'S2.78', icon: SearchCheck, tone: 'warn' },
{ key: 'approvalDecision', href: '/awooop/approvals', route: '/awooop/approvals/[run_id]', stage: 'S2.79', icon: Lock, tone: 'locked' },
]
const awooopCoverageBoundaries = [
'awooop_route_coverage_count=8',
'awooop_route_coverage_visible_count=8',
'runtime_execution_authorized=false',
'active_runtime_gate_count=0',
'action_buttons_allowed=false',
'not_authorization=true',
'repo_creation_authorized=false',
'refs_sync_authorized=false',
'workflow_modification_authorized=false',
'secret_value_collection_allowed=false',
'github_primary_switch_authorized=false',
'gitea_disablement_authorized=false',
]
const coverageGroups: CoverageGroup[] = [
{
key: 'signals',
@@ -1340,6 +1375,135 @@ function SurfaceConnectionCard({ item, locale }: { item: SurfaceConnectionStatus
)
}
function AwoooPCoverageStatusCard({ item, locale }: { item: AwoooPCoverageStatus; locale: string }) {
const t = useTranslations('iwooos.awooopCoverage')
const Icon = item.icon
const textWrap = { overflowWrap: 'anywhere' as const, wordBreak: 'break-word' as const }
return (
<Link
href={`/${locale}${item.href}`}
style={{
...band,
minHeight: 196,
minWidth: 0,
padding: 16,
color: 'inherit',
textDecoration: 'none',
display: 'grid',
gap: 10,
...textWrap,
}}
>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 10, minWidth: 0 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, minWidth: 0 }}>
<Icon size={17} color={toneColors[item.tone]} style={{ flex: '0 0 auto' }} />
<span style={{ fontSize: 12, fontWeight: 700, color: '#141413', minWidth: 0 }}>
{t(`items.${item.key}.title` as never)}
</span>
</div>
<span style={{ fontSize: 10, color: toneColors[item.tone], textAlign: 'right' }}>
{item.stage}
</span>
</div>
<div style={{ display: 'grid', gap: 4 }}>
<span style={{ fontSize: 11, color: '#87867f' }}>{t('routeLabel')}</span>
<span style={{ fontSize: 12, color: '#4f4c45', lineHeight: 1.45, ...textWrap }}>{item.route}</span>
</div>
<p style={{ fontSize: 12, color: '#6f6d66', lineHeight: 1.55, margin: 0, ...textWrap }}>
{t(`items.${item.key}.body` as never)}
</p>
<div style={{ display: 'grid', gap: 4, alignSelf: 'end' }}>
<span style={{ fontSize: 11, color: '#87867f' }}>{t('boundaryLabel')}</span>
<span style={{ fontSize: 11, color: toneColors[item.tone], lineHeight: 1.45, ...textWrap }}>
{t(`items.${item.key}.boundary` as never)}
</span>
</div>
</Link>
)
}
function AwoooPCoverageBoard({ locale }: { locale: string }) {
const t = useTranslations('iwooos.awooopCoverage')
const summaryItems = [
{ key: 'routes', value: '8', tone: 'steady' as const },
{ key: 'covered', value: '8', tone: 'steady' as const },
{ key: 'runtimeGates', value: '0', tone: 'locked' as const },
{ key: 'actions', value: '0', tone: 'locked' as const },
]
return (
<section style={{ marginBottom: 14 }} data-testid="iwooos-awooop-coverage-board">
<div style={{ marginBottom: 14 }}>
<h2 style={{ fontSize: 16, margin: 0 }}>{t('title')}</h2>
<p style={{ fontSize: 12, color: '#6f6d66', margin: '6px 0 0', lineHeight: 1.55 }}>
{t('subtitle')}
</p>
</div>
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
gap: 10,
marginBottom: 12,
}}
>
{summaryItems.map(item => (
<div key={item.key} style={{ ...band, padding: 14, minHeight: 94 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
<span style={{ fontSize: 11, color: '#87867f' }}>{t(`summary.${item.key}.label` as never)}</span>
<ToneDot tone={item.tone} />
</div>
<div style={{ fontSize: 28, fontWeight: 700, lineHeight: 1, marginTop: 8 }}>{item.value}</div>
<p style={{ fontSize: 11, color: '#6f6d66', lineHeight: 1.45, margin: '7px 0 0' }}>
{t(`summary.${item.key}.detail` as never)}
</p>
</div>
))}
</div>
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(230px, 1fr))',
gap: 12,
}}
>
{awooopCoverageStatuses.map(item => (
<AwoooPCoverageStatusCard key={item.key} item={item} locale={locale} />
))}
</div>
<div style={{ ...band, marginTop: 12, padding: 16 }}>
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 10 }}>
<Lock size={16} color={toneColors.locked} />
<h3 style={{ fontSize: 14, margin: 0 }}>{t('guardTitle')}</h3>
</div>
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(230px, 1fr))',
gap: 7,
}}
>
{awooopCoverageBoundaries.map(item => (
<span
key={item}
style={{
border: '0.5px solid #eee9dd',
borderRadius: 8,
padding: '7px 9px',
color: '#4f4c45',
fontSize: 11,
lineHeight: 1.4,
overflowWrap: 'anywhere',
}}
>
{item}
</span>
))}
</div>
</div>
</section>
)
}
function CoverageCard({ item }: { item: CoverageGroup }) {
const t = useTranslations('iwooos.coverage')
const Icon = item.icon
@@ -2469,6 +2633,8 @@ export default function IwoooSPage({ params }: { params: { locale: string } }) {
</div>
</section>
<AwoooPCoverageBoard locale={params.locale} />
<section style={{ marginBottom: 14 }}>
<div style={{ marginBottom: 14 }}>
<h2 style={{ fontSize: 16, margin: 0 }}>{t('awooopReadOnlyLandingReadiness.title')}</h2>