|
|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
|
import { ProjectDTO, fetchProjects, createProject, updateProject, confirmDeleteProject, deleteProject, getProjectDetail } from '../api/project';
|
|
|
|
|
import { ProjectStatusEnum } from '../types';
|
|
|
|
|
import { ProjectStatusEnum, BusinessError } from '../types';
|
|
|
|
|
import { Button, Modal, Input, message } from '../components/UI';
|
|
|
|
|
import { Plus, PlayCircle, Sparkles, AlertTriangle, LayoutDashboard, Loader2 } from 'lucide-react';
|
|
|
|
|
import { ProjectWizard } from '../components/ProjectWizard';
|
|
|
|
|
@ -90,10 +90,18 @@ export const Dashboard: React.FC<DashboardProps> = ({ onProjectSelect }) => {
|
|
|
|
|
message.error('请输入项目名称');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (newProjectName.trim().length > 50) {
|
|
|
|
|
message.error('项目名称不能超过50个字符');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!newProjectDesc.trim()) {
|
|
|
|
|
message.error('请输入业务场景描述');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (newProjectDesc.trim().length > 1000) {
|
|
|
|
|
message.error('业务场景描述不能超过1000个字符');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isCreating) return;
|
|
|
|
|
|
|
|
|
|
setIsCreating(true);
|
|
|
|
|
@ -111,7 +119,10 @@ export const Dashboard: React.FC<DashboardProps> = ({ onProjectSelect }) => {
|
|
|
|
|
setIsDeploying(false);
|
|
|
|
|
setIsCreating(false);
|
|
|
|
|
setCurrentProjectId(null);
|
|
|
|
|
message.error("创建失败,请检查网络或重试");
|
|
|
|
|
// 如果是业务错误(如配额超出),已由全局错误处理器显示,不再重复提示
|
|
|
|
|
if (!(e instanceof BusinessError)) {
|
|
|
|
|
message.error("创建失败,请检查网络或重试");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -299,7 +310,10 @@ export const Dashboard: React.FC<DashboardProps> = ({ onProjectSelect }) => {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<Input label="项目名称" placeholder="例如:企业级 CRM 客户管理系统" value={newProjectName} onChange={(e) => setNewProjectName(e.target.value)} required />
|
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<Input label="项目名称" placeholder="例如:企业级 CRM 客户管理系统" value={newProjectName} onChange={(e) => setNewProjectName(e.target.value)} maxLength={50} required />
|
|
|
|
|
<span className="text-xs text-gray-400 text-right">{newProjectName.length}/50</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<label className="text-sm font-medium text-gray-700">数据库类型<span className="text-red-500 ml-1">*</span></label>
|
|
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4">
|
|
|
|
|
@ -322,7 +336,8 @@ export const Dashboard: React.FC<DashboardProps> = ({ onProjectSelect }) => {
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex flex-col gap-2">
|
|
|
|
|
<label className="text-sm font-medium text-gray-700">业务场景描述<span className="text-red-500 ml-1">*</span></label>
|
|
|
|
|
<textarea className="px-4 py-3 bg-white border border-gray-300 rounded-lg text-sm focus:border-primary focus:ring-2 focus:ring-blue-100 transition-all h-32 resize-none leading-relaxed" placeholder="请详细描述实体及关系..." value={newProjectDesc} onChange={(e) => setNewProjectDesc(e.target.value)}></textarea>
|
|
|
|
|
<textarea className="px-4 py-3 bg-white border border-gray-300 rounded-lg text-sm focus:border-primary focus:ring-2 focus:ring-blue-100 transition-all h-32 resize-none leading-relaxed" placeholder="请详细描述实体及关系..." value={newProjectDesc} onChange={(e) => setNewProjectDesc(e.target.value)} maxLength={1000}></textarea>
|
|
|
|
|
<span className="text-xs text-gray-400 text-right">{newProjectDesc.length}/1000</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|