fix: 修复3个前端报错 — 实例分组编辑500/定时任务404/工作流null
1. instance_group.go: UpdateInstanceGroup 改用结构体输入,过滤系统字段,防止GORM更新主键导致500 2. scheduled_task.go: 新增 ListScheduledTasks + CancelScheduledTask handler 3. router.go: 注册 /tickets/scheduled/list 和 /tickets/:id/cancel-schedule 路由 4. WorkflowPage.tsx: 4处 wf.steps 添加 || [] 空值保护
This commit is contained in:
1 parent
88e5f4e7ee
commit
2957075345
4 files changed
+146
-6
No files matched your search
@@ -625,7 +625,7 @@ export default function WorkflowPage() {
|
||||
{wf.is_active ? '已启用' : '已禁用'}
|
||||
</span>
|
||||
<span className="px-2 py-0.5 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)] text-xs rounded">
|
||||
{wf.steps.length} 个阶段
|
||||
{(wf.steps || []).length} 个阶段
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -633,9 +633,10 @@ export default function WorkflowPage() {
|
||||
|
||||
{/* Flow visualization */}
|
||||
<div className="flex items-center gap-1 mt-4 p-4 bg-[var(--dg-bg-tertiary)] rounded-lg overflow-x-auto">
|
||||
{wf.steps.map((step, i) => {
|
||||
{(wf.steps || []).map((step, i) => {
|
||||
const StepIcon = STEP_TYPE_ICONS[step.step_type] || Shield;
|
||||
const uids: number[] = step.approver_ids ? JSON.parse(step.approver_ids) : [];
|
||||
const stepsArr = wf.steps || [];
|
||||
return (
|
||||
<div key={step.id || i} className="flex items-center gap-1 flex-shrink-0">
|
||||
<div className={`px-3 py-2 rounded-lg border ${STEP_TYPE_COLORS[step.step_type] || STEP_TYPE_COLORS.serial} flex items-center gap-2`}>
|
||||
@@ -649,7 +650,7 @@ export default function WorkflowPage() {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{i < wf.steps.length - 1 && <ArrowRight className="w-4 h-4 text-[var(--dg-text-muted)] flex-shrink-0" />}
|
||||
{i < stepsArr.length - 1 && <ArrowRight className="w-4 h-4 text-[var(--dg-text-muted)] flex-shrink-0" />}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
@@ -662,7 +663,7 @@ export default function WorkflowPage() {
|
||||
<GitBranch className="w-4 h-4 text-[var(--dg-text-muted)]" />
|
||||
流程步骤详情
|
||||
</h4>
|
||||
{wf.steps.map((step, si) => {
|
||||
{(wf.steps || []).map((step, si) => {
|
||||
const StepIcon = STEP_TYPE_ICONS[step.step_type] || Shield;
|
||||
const colorClass = STEP_TYPE_COLORS[step.step_type] || STEP_TYPE_COLORS.serial;
|
||||
const uids: number[] = step.approver_ids ? JSON.parse(step.approver_ids) : [];
|
||||
|
||||
Reference in new issue
Block a user