fix: 报错修复
This commit is contained in:
@@ -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>;
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -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}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user