Repository navigation
nav 链接编辑支持修改所属分类(下拉 + categoryId,沿 #17 搬家口径) - #35
Merged
todosdev[bot] merged 3 commits intoNov 6, 2026
Merged
Conversation
todosdev Bot
added a commit
that referenced
this pull request
Nov 8, 2026
…a-a3ea749fe9f6 classic 居中模型更正:整块居中 + 末行左对齐(#35 口径更正)
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Select组件),改分类保存即把链接搬到目标分类末尾、原分类中消失;「所有」筛选视图下同样可用,并预选该链接实际所属的分类。PUT /api/admin/links/:id:categoryId变更且未传sortOrder时把sort_order置为全表MAX+1(沿 ONE-448: 主题切换生效(settings.theme 三档 + system 跟随) #17 分类跨场景搬家的口径),链接sort_order的全局语义不变;分类未变不扰动顺序。/links/reorder并作废本地排序簿记,避免旧顺序回写把新位置覆盖回旧槽位。Changes
web/src/components/admin/crud-panels.tsx— LinkPanel 弹窗新增「所属分类」字段(只列当前场景的分类),新建与编辑都写入并提交categoryId;编辑时预选链接实际分类(「所有」视图同样);改分类时提示「链接已移到「分类名」末尾」,并在保存前await settleLinkOrder(),保证这次 PUT 是链接顺序相关的最后一次写。web/src/lib/nav-store.ts— 排序簿记新增inFlight(在飞发送循环的 Promise)与settleLinkOrder():先等链接排序请求(含pendingIds那一轮)落库,再清localIds/pendingIds/beforeIds;resetAdminOrderState一并清inFlight;排序自身失败不阻塞保存。worker/src/db/queries/content.ts、worker/src/routes/admin.ts— 新增nextLinkSortOrder(全表COALESCE(MAX(sort_order), -1) + 1),PUT 仅在categoryId变化且未传sortOrder时使用;显式sortOrder优先;未知categoryId仍返回 400。无新增端点、无 schema 变更。web/src/lib/mockDb.ts— 开发联调 mock 的updateLink对齐上述后端口径,pnpm dev下行为与真实后端一致。docs/api-contract.md— 补记链接 PUT 的换分类语义:末尾追加、显式sortOrder优先、分类未变不动顺序。worker/test/api-contract.test.ts(4 例:末尾 MAX+1、顺序不扰动、显式 sortOrder、未知分类 400 且不落库)、web/test/crud-panels.test.tsx(6 例,含 deferred 排序交错与「目标分类末尾 / 原分类消失」)、web/test/nav-store-reorder.test.ts(3 例:settle 投影、等在飞落库、失败不阻塞)。Testing
pnpm test:worker 13 文件 / 197 通过;web 19 文件 / 224 通过(合并最新main后复跑,新增用例 4 + 6 + 3)。pnpm typecheck、pnpm lint(exit 0,仅既有 30 条web/src/components/ui/*告警,改动文件零告警)、pnpm format:check、pnpm build均通过。await settleLinkOrder()或settleLinkOrder内的await track.inFlight,对应交错用例即失败。sortOrder=4(全局 MAX+1);390×844 下弹窗 358×577 完整在视口内、下拉占满整行、分类未改保存时sortOrder不变。POST /links/reorder响应 t=1.508 →PUT /links/{id}请求 t=1.512(确认只在排序落库后才发),最终sort_order为全局 MAX+1。bcc3502,合并基线前的末次提交)conclusion success。web/dist未入库,无需随本次改动重建;pnpm build:web会顺带重排web/public/icon-index.json,该改动已还原,diff 中不含此文件。