mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-06 17:53:19 +08:00
typescript
This commit is contained in:
@@ -99,10 +99,14 @@ export default defineEventHandler(async (event) => {
|
||||
const panY = body.layout.pan.y
|
||||
const parsedX = typeof panX === 'number' ? panX : Number(panX)
|
||||
const parsedY = typeof panY === 'number' ? panY : Number(panY)
|
||||
if (Number.isFinite(parsedX)) layout.pan = layout.pan || { x: 0, y: 0 }
|
||||
if (Number.isFinite(parsedX)) layout.pan.x = parsedX
|
||||
if (Number.isFinite(parsedY)) layout.pan = layout.pan || { x: 0, y: 0 }
|
||||
if (Number.isFinite(parsedY)) layout.pan.y = parsedY
|
||||
if (Number.isFinite(parsedX)) {
|
||||
layout.pan = layout.pan || { x: 0, y: 0 }
|
||||
layout.pan.x = parsedX
|
||||
}
|
||||
if (Number.isFinite(parsedY)) {
|
||||
layout.pan = layout.pan || { x: 0, y: 0 }
|
||||
layout.pan.y = parsedY
|
||||
}
|
||||
}
|
||||
if (Array.isArray(body.layout.groups)) {
|
||||
layout.groups = body.layout.groups
|
||||
@@ -125,7 +129,7 @@ export default defineEventHandler(async (event) => {
|
||||
bounds,
|
||||
}
|
||||
})
|
||||
.filter((group): group is NonNullable<typeof group> => Boolean(group))
|
||||
.filter((group: any): group is NonNullable<typeof group> => Boolean(group))
|
||||
}
|
||||
flow.layout = layout
|
||||
flow.markModified('layout')
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { serializeNodeDocument } from '../../../../../../services/decisionFlowService'
|
||||
import type {
|
||||
DecisionNodeCondition,
|
||||
DecisionNodeRole,
|
||||
DecisionNodeTrigger,
|
||||
DecisionNodeTransition,
|
||||
} from '~~/shared/types/decision'
|
||||
@@ -58,7 +59,7 @@ export default defineEventHandler(async (event) => {
|
||||
if (!ROLE_SET.has(role)) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'role must be pilot, atc or system' })
|
||||
}
|
||||
node.role = role
|
||||
node.role = role as DecisionNodeRole
|
||||
}
|
||||
|
||||
if (typeof body.phase === 'string' && body.phase.trim()) {
|
||||
@@ -84,7 +85,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
if (typeof body.autoBehavior === 'string') {
|
||||
node.autoBehavior = body.autoBehavior.trim() || undefined
|
||||
node.autoBehavior = (body.autoBehavior.trim() || undefined) as typeof node.autoBehavior
|
||||
}
|
||||
|
||||
if (Array.isArray(body.actions)) {
|
||||
|
||||
Reference in New Issue
Block a user