docs: annotate Foundry source and deployment lifecycle in Chinese [skip ci]
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// 显式 legacy frameId 成员迁移为独立子画布的纯算法;不读写数据库,不按几何重叠推断成员。
|
||||
package platform
|
||||
|
||||
import (
|
||||
@@ -10,12 +11,15 @@ import (
|
||||
|
||||
// A plan contains only explicit legacy memberships. Coordinates are local to
|
||||
// the containing canvas; the viewport is never part of this transformation.
|
||||
// legacyFramePlan 按框列出成员节点、内部边和边界边,供 dry-run 解释实际迁移范围。
|
||||
type legacyFramePlan struct {
|
||||
FrameID string `json:"frame_id"`
|
||||
NodeIDs []string `json:"node_ids"`
|
||||
InternalEdges []string `json:"internal_edges"`
|
||||
BoundaryEdges []string `json:"boundary_edges"`
|
||||
}
|
||||
|
||||
// legacyMigrationPlan 将计划绑定项目/工作区/父 ID、版本和源文档摘要,防止按陈旧预览执行。
|
||||
type legacyMigrationPlan struct {
|
||||
PlanID string `json:"plan_id"`
|
||||
ParentVersion int64 `json:"parent_version"`
|
||||
@@ -25,6 +29,7 @@ type legacyMigrationPlan struct {
|
||||
Issues []string `json:"issues"`
|
||||
}
|
||||
|
||||
// legacyPlan 从已校验快照提取尚未拥有 subgraph 的框,排序框/成员以稳定展示和计划身份。
|
||||
func legacyPlan(project, workspace string, parent canvasSnapshot) legacyMigrationPlan {
|
||||
var doc map[string]any
|
||||
_ = json.Unmarshal(parent.Document, &doc)
|
||||
@@ -76,6 +81,7 @@ func legacyPlan(project, workspace string, parent canvasSnapshot) legacyMigratio
|
||||
|
||||
// migrateLegacyDocument mutates only a freshly decoded snapshot. Boundary edges
|
||||
// stay in the parent and are redirected through stable, deduplicated ports.
|
||||
// migrateLegacyDocument 解码复制后按 frame→child ID 映射拆分文档;每个输出都经过 normalizeCanvas。
|
||||
func migrateLegacyDocument(raw json.RawMessage, children map[string]string) (json.RawMessage, map[string]json.RawMessage, error) {
|
||||
var doc map[string]any
|
||||
if err := json.Unmarshal(raw, &doc); err != nil {
|
||||
@@ -94,6 +100,7 @@ func migrateLegacyDocument(raw json.RawMessage, children map[string]string) (jso
|
||||
childDocs[id] = map[string]any{"schema_version": 2, "nodes": []any{}, "edges": []any{}, "viewport": map[string]any{"x": 0, "y": 0, "zoom": 1}}
|
||||
}
|
||||
}
|
||||
// 子节点坐标减去框原点及内容内边距 (24,36),同时去掉旧 frameId,父文档保留框。
|
||||
parentNodes := []any{}
|
||||
for _, v := range nodes {
|
||||
n := v.(map[string]any)
|
||||
@@ -117,6 +124,7 @@ func migrateLegacyDocument(raw json.RawMessage, children map[string]string) (jso
|
||||
d["ports"] = []any{}
|
||||
d["presentation"] = map[string]any{"collapsed": false, "contentScale": 1, "expandedSize": map[string]any{"width": f["width"], "height": f["height"]}, "collapsedSize": map[string]any{"width": 240, "height": 140}}
|
||||
}
|
||||
// 同一孩子内的边随节点移动;跨边界边留在父画布,通过按逻辑端点派生的稳定端口连接。
|
||||
parentEdges := []any{}
|
||||
for _, v := range edges {
|
||||
e := v.(map[string]any)
|
||||
@@ -134,6 +142,7 @@ func migrateLegacyDocument(raw json.RawMessage, children map[string]string) (jso
|
||||
if frame == "" {
|
||||
continue
|
||||
}
|
||||
// 旧边缺 handle 时按源右/目标左补缺省,再由方向、节点与 handle 去重端口。
|
||||
handle, _ := e[end+"Handle"].(string)
|
||||
if handle == "" {
|
||||
if end == "source" {
|
||||
@@ -183,6 +192,8 @@ func migrateLegacyDocument(raw json.RawMessage, children map[string]string) (jso
|
||||
}
|
||||
return parent, result, nil
|
||||
}
|
||||
|
||||
// translateEdgeKnots 仅平移绝对 knot 位置,端点控制与 knot in/out 是相对向量,不受纯平移影响。
|
||||
func translateEdgeKnots(e map[string]any, x, y float64) {
|
||||
data, _ := e["data"].(map[string]any)
|
||||
path, _ := data["path"].(map[string]any)
|
||||
|
||||
Reference in New Issue
Block a user