fix: 报错修复

This commit is contained in:
2026-01-03 23:18:33 +08:00
parent d22fdc9618
commit a067d167e9
4 changed files with 4 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ export const createDeploymentSchema = z.object({
branch: z.string().min(1, { message: '分支不能为空' }), branch: z.string().min(1, { message: '分支不能为空' }),
commitHash: z.string().min(1, { message: '提交哈希不能为空' }), commitHash: z.string().min(1, { message: '提交哈希不能为空' }),
commitMessage: z.string().min(1, { message: '提交信息不能为空' }), commitMessage: z.string().min(1, { message: '提交信息不能为空' }),
envVars: z.record(z.string()).optional(), // 环境变量 key-value 对象 envVars: z.record(z.string(), z.string()).optional(), // 环境变量 key-value 对象
}); });
export type ListDeploymentsQuery = z.infer<typeof listDeploymentsQuerySchema>; export type ListDeploymentsQuery = z.infer<typeof listDeploymentsQuerySchema>;

View File

@@ -25,17 +25,6 @@ function DeployRecordItem({
return <Tag color={config.color}>{config.text}</Tag>; return <Tag color={config.color}>{config.text}</Tag>;
}; };
// 环境标签渲染函数
const getEnvTag = (env: string) => {
const envMap: Record<string, { color: string; text: string }> = {
production: { color: 'red', text: '生产环境' },
staging: { color: 'orange', text: '预发布环境' },
development: { color: 'blue', text: '开发环境' },
};
const config = envMap[env] || { color: 'gray', text: env };
return <Tag color={config.color}>{config.text}</Tag>;
};
return ( return (
<List.Item <List.Item
key={item.id} key={item.id}
@@ -68,9 +57,6 @@ function DeployRecordItem({
:{' '} :{' '}
<span className="font-medium text-gray-700">{item.branch}</span> <span className="font-medium text-gray-700">{item.branch}</span>
</span> </span>
<span className="text-sm text-gray-500">
: {getEnvTag(item.env || 'unknown')}
</span>
<span className="text-sm text-gray-500"> <span className="text-sm text-gray-500">
: {getStatusTag(item.status)} : {getStatusTag(item.status)}
</span> </span>

View File

@@ -813,7 +813,7 @@ function ProjectDetailPage() {
/> />
{workspaceStatus.error && ( {workspaceStatus.error && (
<div className="mt-4 p-3 bg-red-50 border border-red-200 rounded"> <div className="mt-4 p-3 bg-red-50 border border-red-200 rounded">
<Typography.Text type="danger"> <Typography.Text type="error">
{workspaceStatus.error} {workspaceStatus.error}
</Typography.Text> </Typography.Text>
</div> </div>
@@ -888,7 +888,7 @@ function ProjectDetailPage() {
</Typography.Title> </Typography.Title>
{selectedRecord && ( {selectedRecord && (
<Typography.Text type="secondary" className="text-sm"> <Typography.Text type="secondary" className="text-sm">
{selectedRecord.branch} · {selectedRecord.env} ·{' '} {selectedRecord.branch}
{formatDateTime(selectedRecord.createdAt)} {formatDateTime(selectedRecord.createdAt)}
</Typography.Text> </Typography.Text>
)} )}

View File

@@ -214,7 +214,7 @@ class DetailService {
// 更新项目 // 更新项目
async updateProject( async updateProject(
id: number, id: number,
project: Partial<{ name: string; description: string; repository: string }>, project: Partial<Project>,
) { ) {
const { data } = await net.request<APIResponse<Project>>({ const { data } = await net.request<APIResponse<Project>>({
url: `/api/projects/${id}`, url: `/api/projects/${id}`,