4578b65965
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m30s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m37s
CI/CD Pipeline / Frontend Lint (push) Successful in 3m3s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 3m18s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 3m18s
CI/CD Pipeline / Frontend Unit Tests (push) Failing after 3m17s
CI/CD Pipeline / Validate - Code Quality (push) Failing after 3m33s
CI/CD Pipeline / Integration Tests (push) Successful in 2m22s
CI/CD Pipeline / Build Staging API Image (push) Successful in 6m19s
CI/CD Pipeline / Unit Tests (push) Failing after 6m57s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m31s
CI/CD Pipeline / ACR Image Cleanup (push) Failing after 16s
CI/CD Pipeline / Staging E2E Tests (push) Successful in 1m46s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m59s
CI/CD Pipeline / Canary Release to Production (push) Failing after 1214h13m18s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1214h25m0s
CI/CD Pipeline / Deploy Production (push) Failing after 1214h25m2s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 1214h25m4s
CI/CD Pipeline / Build Production API Image (push) Failing after 1214h25m8s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 1214h25m10s
CI/CD Pipeline / PR Build API Image (push) Failing after 1214h25m11s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 1214h25m12s
CI/CD Pipeline / CI Gate (push) Failing after 1214h51m3s
CI/CD Pipeline / Build Production Web Image (push) Failing after 1214h57m59s
CI/CD Pipeline / PR Build Web Image (push) Failing after 1214h58m3s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
/** 格式化文件大小 */
|
|
export const formatSize = (bytes?: number): string => {
|
|
if (!bytes) return ""
|
|
if (bytes < 1024) return `${bytes}B`
|
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`
|
|
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`
|
|
}
|
|
|
|
/** 格式化时长 */
|
|
export const formatDuration = (seconds?: number): string => {
|
|
if (!seconds) return ""
|
|
const m = Math.floor(seconds / 60)
|
|
const s = Math.floor(seconds % 60)
|
|
return m > 0 ? `${m}:${s.toString().padStart(2, "0")}` : `${s}s`
|
|
}
|
|
|
|
/** 获取质量分等级 */
|
|
export const getQualityLevel = (score?: number): string => {
|
|
if (score == null) return "none"
|
|
if (score >= 90) return "excellent"
|
|
if (score >= 70) return "good"
|
|
if (score >= 50) return "fair"
|
|
return "poor"
|
|
}
|
|
|
|
/** 质量分颜色 */
|
|
export const getQualityColor = (score?: number): string => {
|
|
if (score == null) return "var(--text-secondary)"
|
|
if (score >= 90) return "var(--success-color, #10b981)"
|
|
if (score >= 70) return "var(--primary-color, #6366f1)"
|
|
if (score >= 50) return "var(--warning-color, #f59e0b)"
|
|
return "var(--error-color, #ef4444)"
|
|
}
|