feat(client): show digital sync credential gaps

This commit is contained in:
baiyanyun
2026-06-07 02:05:12 +08:00
parent 6b033da313
commit bdcb5c6c14
6 changed files with 26 additions and 4 deletions

View File

@@ -57,6 +57,7 @@ interface QimingclawSyncStatus {
syncing: boolean;
enabled: boolean;
endpoint: string | null;
missingCredentials?: string[];
pending: number;
failed: number;
lastSyncAt: string | null;

View File

@@ -57,6 +57,7 @@ interface ManagementSyncStatus {
syncing: boolean;
enabled: boolean;
endpoint: string | null;
missingCredentials?: string[];
pending: number;
failed: number;
lastSyncAt: string | null;
@@ -448,6 +449,7 @@ function summarizeSyncError(value?: string | null): string {
function syncStatusTone(status: ManagementSyncStatus | null): 'info' | 'success' | 'warning' | 'danger' {
if (!status) return 'info';
if (!status.enabled || !status.endpoint) return 'warning';
if ((status.missingCredentials?.length ?? 0) > 0) return 'warning';
if (status.failed > 0 || status.lastSyncError) return 'danger';
if (status.syncing || status.pending > 0) return 'warning';
return status.lastSyncAt ? 'success' : 'info';
@@ -457,6 +459,7 @@ function syncStatusLabel(status: ManagementSyncStatus | null): string {
if (!status) return '未连接';
if (!status.enabled) return '已停用';
if (!status.endpoint) return '未配置';
if ((status.missingCredentials?.length ?? 0) > 0) return '缺少凭据';
if (status.syncing) return '同步中';
if (status.failed > 0 || status.lastSyncError) return '同步异常';
if (status.pending > 0) return '待同步';
@@ -467,6 +470,9 @@ function syncStatusSummary(status: ManagementSyncStatus | null): string {
if (!status) return '当前环境未连接 qimingclaw 同步桥。';
if (!status.enabled) return '管理端同步已停用。';
if (!status.endpoint) return '管理端同步地址未配置。';
if ((status.missingCredentials?.length ?? 0) > 0) {
return `管理端同步凭据未完整:${status.missingCredentials?.join('、')}`;
}
const error = summarizeSyncError(status.lastSyncError);
if (status.failed > 0 || error) {
const retrySummary = status.failureSummary