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:
@@ -30,7 +30,9 @@ const navItems = computed(() => {
|
||||
const data = snapshot.value
|
||||
const accounts = data?.accounts ?? []
|
||||
const publishIDs = new Set(desktopPublishMediaCatalog.map((item) => item.id))
|
||||
const monitoringIDs = new Set(desktopMonitoringMediaCatalog.map((item) => item.id))
|
||||
const authorizedMonitoringCount = desktopMonitoringMediaCatalog.filter((platform) =>
|
||||
accounts.find((account) => account.platform === platform.id)?.authState === 'active',
|
||||
).length
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -57,8 +59,8 @@ const navItems = computed(() => {
|
||||
{
|
||||
to: '/ai-platforms',
|
||||
title: 'AI 平台',
|
||||
description: 'AI 平台一平台一绑定,按卡片查看状态与归属',
|
||||
count: accounts.filter((item) => monitoringIDs.has(item.platform)).length,
|
||||
description: 'AI 平台一平台一授权,按卡片查看状态与归属',
|
||||
count: authorizedMonitoringCount,
|
||||
icon: RobotOutlined,
|
||||
},
|
||||
]
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user