diff --git a/src/dashboard/web/groups.ts b/src/dashboard/web/groups.ts index 52035b1f..d504bc1a 100644 --- a/src/dashboard/web/groups.ts +++ b/src/dashboard/web/groups.ts @@ -26,6 +26,11 @@ type SaveProfileEntry = { content: string; status: SaveProfileEntryStatus; }; +type GroupAddBotResult = { + id?: unknown; + ok?: unknown; + error?: unknown; +}; function isValidProfileId(profileId: string): boolean { return PROFILE_ID_RE.test(profileId) && profileId !== '.' && profileId !== '..'; @@ -187,6 +192,26 @@ export function renderRoleProfileBootstrapSummary( return `
${escapeHtml(t('groups.roleProfileBootstrapDone', { name: cleanProfileId }))}
`; } +export function renderAddBotsResultSummary(result: GroupAddBotResult[]): string { + const rows = Array.isArray(result) ? result : []; + if (!rows.length) { + return `没有返回添加结果。
`; + } + const okCount = rows.filter(x => !!x?.ok).length; + const failed = rows.length - okCount; + const cls = failed ? 'hint-warn' : 'hint-ok'; + const items = rows.map(x => { + const id = String(x?.id ?? '?'); + return x?.ok + ? `${escapeHtml(id)}: OK${escapeHtml(id)}: failed (${escapeHtml(String(x?.error ?? 'unknown'))})${escapeHtml(title)}
${escapeHtml(String(reason ?? 'unknown'))}
${t('groups.createHelp')}