refactor(desktop): show authorized AI platforms count on shell

The shell badge and the AI Platforms overview now report platforms
whose binding is locally authorized (authState=active) instead of the
total bound platforms, so the number reflects how many monitoring
sources are actually usable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-06 12:56:54 +08:00
parent 13464c7788
commit 68089d065f
2 changed files with 17 additions and 15 deletions
@@ -29,13 +29,6 @@ const aiAccounts = computed(() =>
),
)
const overview = computed(() => ({
configuredPlatforms: desktopMonitoringMediaCatalog.length,
bound: aiAccounts.value.length,
live: aiAccounts.value.filter((item) => item.health === 'live').length,
onlineClients: snapshot.value?.summary.onlineClients ?? 0,
}))
const platformCards = computed(() =>
desktopMonitoringMediaCatalog.map((platform) => {
const matched = aiAccounts.value.filter((account) => account.platform === platform.id)
@@ -47,6 +40,17 @@ const platformCards = computed(() =>
}),
)
function isLocallyAuthorized(account: AccountRow | null): boolean {
return account?.authState === 'active'
}
const overview = computed(() => ({
configuredPlatforms: desktopMonitoringMediaCatalog.length,
authorized: platformCards.value.filter((platform) => isLocallyAuthorized(platform.account))
.length,
onlineClients: snapshot.value?.summary.onlineClients ?? 0,
}))
function authLabel(account: AccountRow | null) {
if (!account) {
return '未绑定'
@@ -258,13 +262,9 @@ async function unbindPlatform(account: AccountRow) {
<div class="stat-label">支持平台</div>
<div class="stat-value">{{ overview.configuredPlatforms }}</div>
</div>
<div class="stat-card">
<div class="stat-label">已绑定</div>
<div class="stat-value">{{ overview.bound }}</div>
</div>
<div class="stat-card">
<div class="stat-label">授权正常</div>
<div class="stat-value">{{ overview.live }}</div>
<div class="stat-value">{{ overview.authorized }}</div>
</div>
<div class="stat-card">
<div class="stat-label">在线客户端</div>