主要变更: - RDP 远程桌面:新增 backend/pkg/rdp(RDP 引擎 + credssp/display/rle/trace)、 backend/controller/rdp*(连接/凭证/文件/会话/实时)、frontend RDP 组件与 API - Windows SMB 文件传输:backend/pkg/winsmb - 云账单同步:backend/pkg/billingsync + billing_sync/aliyun_billing,前端账单详情 - Agent CLI Kubernetes 工具:kubernetes_action/get、pod_execute/logs - 服务器导入助手:server_import_helpers、ImportCredentialSettings - 国际化与组件重构(cloud/deploy/monitor/server/system 等多模块) - 清理编译产物二进制:移除 backend/server、backend/agent/bin/aiops-agent-* - .gitignore:新增 backend/agent/ 与 .cache/(避免 334MB go-build 缓存误入库) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
2.8 KiB
TypeScript
61 lines
2.8 KiB
TypeScript
// 发布管理(审批流)共享工具函数与常量 // Logan.Li
|
|
// 注意:本文件专用于 ReleaseManager(含审批流,状态标签与 AppRelease 的 releaseHelpers 不同)
|
|
import type { TFunction } from 'i18next';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import {
|
|
type LucideIcon,
|
|
Clock,
|
|
Check,
|
|
XCircle,
|
|
Loader2,
|
|
CheckCircle,
|
|
RotateCcw,
|
|
} from 'lucide-react';
|
|
|
|
// 环境配置(值与后端 oneof=dev test staging prod 一致) // Logan.Li
|
|
export const ENVIRONMENTS: Record<string, { label: string; color: string }> = {
|
|
dev: { label: '开发环境', color: 'border-blue-500/30 dg-text-blue bg-blue-500/10' },
|
|
test: { label: '测试环境', color: 'border-cyan-500/30 dg-text-cyan bg-cyan-500/10' },
|
|
staging: { label: '预发环境', color: 'border-amber-500/30 dg-text-yellow bg-amber-500/10' },
|
|
prod: { label: '生产环境', color: 'border-red-500/30 dg-text-red bg-red-500/10' },
|
|
};
|
|
|
|
const ENV_LABEL_KEY: Record<string, string> = {
|
|
dev: 'deploy.env.devEnv',
|
|
test: 'deploy.env.testEnv',
|
|
staging: 'deploy.env.stagingEnv',
|
|
prod: 'deploy.env.prodEnv',
|
|
};
|
|
|
|
// 发布状态徽章(审批流:待审批/已审批/已驳回/发布中/发布成功/发布失败/已回滚) // Logan.Li
|
|
export function getStatusBadge(status: string, t: TFunction) {
|
|
const map: Record<string, { icon: LucideIcon; labelKey: string; cls: string }> = {
|
|
pending: { icon: Clock, labelKey: 'deploy.status.pendingApproval', cls: 'border-amber-500/30 dg-text-yellow bg-amber-500/10' },
|
|
approved: { icon: Check, labelKey: 'deploy.status.approved', cls: 'border-purple-500/30 dg-text-purple bg-purple-500/10' },
|
|
rejected: { icon: XCircle, labelKey: 'deploy.status.rejected', cls: 'border-[var(--dg-border)] dg-text-secondary bg-[var(--dg-bg-active)]/10' },
|
|
deploying: { icon: Loader2, labelKey: 'deploy.status.deploying', cls: 'border-blue-500/30 dg-text-blue bg-blue-500/10 animate-pulse' },
|
|
success: { icon: CheckCircle, labelKey: 'deploy.status.succeeded', cls: 'border-emerald-500/30 dg-text-green bg-emerald-500/10' },
|
|
failed: { icon: XCircle, labelKey: 'deploy.status.failed_deploy', cls: 'border-red-500/30 dg-text-red bg-red-500/10' },
|
|
rolled_back: { icon: RotateCcw, labelKey: 'deploy.status.rolledBack', cls: 'border-[var(--dg-border)] dg-text-secondary bg-[var(--dg-bg-active)]/10' },
|
|
};
|
|
const cfg = map[status];
|
|
if (!cfg) return null;
|
|
const Icon = cfg.icon;
|
|
return (
|
|
<Badge variant="outline" className={cfg.cls}>
|
|
<Icon className="h-3 w-3 mr-1" />
|
|
{t(cfg.labelKey)}
|
|
</Badge>
|
|
);
|
|
}
|
|
|
|
// 环境徽章 // Logan.Li
|
|
export function getEnvironmentBadge(env: string, t: TFunction) {
|
|
const cfg = ENVIRONMENTS[env];
|
|
return (
|
|
<Badge variant="outline" className={cfg?.color || 'border-[var(--dg-border)] dg-text-secondary'}>
|
|
{ENV_LABEL_KEY[env] ? t(ENV_LABEL_KEY[env]) : env}
|
|
</Badge>
|
|
);
|
|
}
|