Files
model-platform/frontend
tao.chen 02c25fcc8e feat(scripts): listScripts parent_path filter + lazy load by directory
Backend — backend/src/backend/scripts.py
- list_scripts accepts optional parent_path Query (default "").
- Extracts _build_list_scripts_descendant_prefix helper for the
  "direct children of parent_path" prefix.
- WHERE clause now adds:
    StorageObjects.relative_path LIKE '<prefix>/%'
    AND NOT LIKE '<prefix>/%/%'
  so deeper descendants and prefix-siblings (foo/bar vs foo/bar2)
  are excluded. Empty parent_path filters to root-level only —
  this is the symmetric, intent-aligned behavior the lazy-load
  frontend relies on.
- EXPLAIN confirms idx_scripts_workspace drives the scripts table;
  storage_objects PK lookup applies the LIKE filter per row.

Frontend — frontend/app/services/api.ts + scriptWorkspaceStore.ts
- listScripts accepts optional parentPath; built URL preserves
  the new filter param.
- Store gains loadedScriptPaths / loadingScriptPaths Sets and a
  loadScripts(parentPath) action: idempotent, in-flight dedupe,
  dedup-by-id when merging into the flat scripts array so existing
  find() callers keep working.
- load() now uses listScripts("") instead of bulk fetch — root
  only on first paint.
- toggleExpanded() triggers loadScripts(parentPath) in parallel
  with loadChildren(parentPath) so folder expansion loads both
  sub-directories and direct-child scripts.

Tests — backend/tests/test_list_scripts_parent_path.py
- 7 unit tests: prefix construction, normalization, traversal
  rejection, and SQL compilation contract (LIKE prefix + NOT LIKE
  prefix + scripts.status filter).

Verified:
- pytest backend/tests: 50 passed (43 existing + 7 new)
- pnpm typecheck: clean
- alembic: no schema changes (migration-less feature)
- EXPLAIN with real workspace: idx_scripts_workspace → PK lookup
2026-08-21 10:27:40 +08:00
..
2026-07-31 09:35:53 +08:00
2026-08-20 20:11:06 +08:00
2026-08-20 20:11:06 +08:00
2026-07-31 09:43:33 +08:00
2026-08-11 16:19:34 +08:00
2026-08-20 19:23:42 +08:00
2026-08-11 21:26:55 +08:00

Frontend

React Router SPA,已将原前端按功能拆分到 app/

app/components/          通用图标组件
app/features/platform/   主框架、脚本工作区和 Jupyter 编辑
app/features/schedules/  DAG 调度页面
app/features/admin/      工作台与系统管理
app/routes/              React Router 路由入口
app/services/            API 请求、DTO 和演示上下文
app/styles/              分功能样式

本地开发:

pnpm install
pnpm dev

生产构建由根目录 nginx/Dockerfile 完成,构建结果复制到 Nginx 静态目录。