nx-kv 0.66.2 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/assets/nx-kv/references/A02-/346/217/220/344/272/244/344/273/273/345/212/241.md +6 -7
- package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +1 -1
- package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +2 -2
- package/package.json +1 -1
- package/src/core/attachmentdb/ids.ts +14 -1
- package/src/core/attachmentdb/query.ts +0 -38
- package/src/core/attachmentdb/repo.ts +98 -0
- package/src/core/attachmentdb.ts +5 -1
- package/src/core/db/import-json/tasks.ts +10 -9
- package/src/core/db/import-json.ts +16 -6
- package/src/core/db/index.ts +1 -1
- package/src/core/db/migrations/index.ts +2 -0
- package/src/core/db/migrations/v15.sql +88 -0
- package/src/core/db/verify.ts +7 -3
- package/src/core/db/version.ts +4 -1
- package/src/core/topic-key.ts +5 -8
- package/src/core/workflow/readiness.ts +1 -1
- package/src/core/workflow/types.ts +1 -1
- package/src/modules/claim/assemble.ts +0 -5
- package/src/modules/claim/host.ts +2 -4
- package/src/modules/claim/preview.ts +0 -1
- package/src/modules/claim/wait.ts +9 -49
- package/src/modules/docs/actions/docs-detach.ts +1 -2
- package/src/modules/docs/attach.ts +3 -17
- package/src/modules/docs/render.ts +4 -13
- package/src/modules/localtask/actions/localtask-add.ts +1 -3
- package/src/modules/localtask/actions/localtask-attach.ts +4 -2
- package/src/modules/localtask/actions/localtask-boardtasks.ts +0 -1
- package/src/modules/localtask/actions/localtask-clone.ts +1 -1
- package/src/modules/localtask/actions/localtask-config.ts +2 -11
- package/src/modules/localtask/actions/localtask-detach.ts +1 -3
- package/src/modules/localtask/infra/events.ts +5 -5
- package/src/modules/localtask/infra/repo/rows.ts +0 -1
- package/src/modules/localtask/infra/repo/settings.ts +1 -9
- package/src/modules/localtask/infra/repo/topics.ts +0 -4
- package/src/modules/localtask/lifecycle/add.ts +2 -9
- package/src/modules/localtask/lifecycle/deletion.ts +7 -15
- package/src/modules/localtask/lifecycle/task-lifecycle.ts +2 -2
- package/src/modules/localtask/lifecycle/task-ops.ts +14 -56
- package/src/modules/localtask/lifecycle/task-templates.ts +0 -13
- package/src/modules/localtask/lifecycle/task-view.ts +2 -3
- package/src/modules/localtask/lifecycle/topics.ts +3 -8
- package/src/modules/localtask/ops/attach-resource.ts +46 -4
- package/src/modules/localtask/ops/attach-template.ts +73 -3
- package/src/modules/localtask/ops/attach.ts +45 -18
- package/src/modules/localtask/paths.ts +7 -17
- package/src/modules/localtask/service.ts +3 -7
- package/src/modules/localtask/ui/action-flags.ts +2 -2
- package/src/modules/localtask/ui/action-render.ts +7 -19
- package/src/modules/localtask/waiting.ts +1 -8
- package/src/modules/promptplug/compose.ts +1 -3
- package/src/modules/promptplug/plugins/attachment.ts +56 -6
- package/src/modules/promptplug/plugins/context.ts +11 -2
- package/src/modules/promptplug/template-store.ts +25 -3
- package/src/modules/templates/scope.ts +1 -1
- package/src/shared/prompt-blocks.ts +2 -23
- package/src/web/frontend/App.tsx +4 -9
- package/src/web/frontend/api/cli-tree.json +6 -6
- package/src/web/frontend/api/client.generated.ts +11 -11
- package/src/web/frontend/api/tasks.ts +117 -0
- package/src/web/frontend/components/Introduction/index.tsx +50 -3
- package/src/web/frontend/components/Introduction/style.css +6 -0
- package/src/web/frontend/components/Introduction/use-intro.ts +25 -0
- package/src/web/frontend/components/md/attachments/attach-area.tsx +9 -11
- package/src/web/frontend/components/md/attachments/attach-common.ts +12 -5
- package/src/web/frontend/components/md/attachments/attach-modal.tsx +54 -9
- package/src/web/frontend/components/md/attachments/attach-repo-pick.tsx +48 -0
- package/src/web/frontend/components/sidebar/index.tsx +52 -48
- package/src/web/frontend/components/sidebar/model.ts +16 -32
- package/src/web/frontend/components/sidebar/queue-nav.ts +3 -4
- package/src/web/frontend/components/sidebar/row-menu.tsx +1 -1
- package/src/web/frontend/components/sidebar/task-children.tsx +53 -32
- package/src/web/frontend/{page/dir → components/task-panel}/dag-editor.tsx +1 -1
- package/src/web/frontend/components/task-panel/task-ops.ts +299 -0
- package/src/web/frontend/components/task-panel/task-page.tsx +495 -0
- package/src/web/frontend/components/tool-acts/modules.ts +3 -0
- package/src/web/frontend/modules/board/board-view.ts +2 -56
- package/src/web/frontend/modules/md/doc-store.ts +2 -3
- package/src/web/frontend/page/dag/head-bar.tsx +0 -1
- package/src/web/frontend/page/dag/index.tsx +1 -4
- package/src/web/frontend/page/dag/model.ts +0 -1
- package/src/web/frontend/page/dir/api.ts +4 -108
- package/src/web/frontend/page/dir/index.tsx +161 -348
- package/src/web/frontend/page/dir/task-actions.ts +20 -32
- package/src/web/frontend/page/dir/task-board-section.tsx +3 -0
- package/src/web/frontend/page/dir/task-chain.ts +6 -10
- package/src/web/frontend/page/dir/task-dock-panel.tsx +3 -6
- package/src/web/frontend/page/dir/task-feedback.ts +9 -17
- package/src/web/frontend/page/dir/task-not-found.tsx +2 -3
- package/src/web/frontend/page/dir/task-utils.ts +0 -1
- package/src/web/frontend/page/dir/task.tsx +14 -18
- package/src/web/frontend/page/doc/doc-dock.tsx +1 -1
- package/src/web/frontend/page/group/api.ts +3 -21
- package/src/web/frontend/page/group/group-project-memo.ts +41 -0
- package/src/web/frontend/page/group/index.tsx +289 -429
- package/src/web/frontend/page/progress/index.tsx +7 -12
- package/src/web/frontend/page/settings/api.ts +1 -2
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +12 -44
- package/src/web/frontend/panels.tsx +1 -1
- package/src/web/frontend/registry.ts +1 -2
- package/src/web/frontend/route-map.ts +0 -1
- package/src/web/frontend/routes/dir.ts +1 -4
- package/src/web/frontend/routes/keys.ts +5 -3
- package/src/web/frontend/svghub/catalog-nav.ts +8 -11
- package/src/web/public/assets/app-context-CngKv8Tc.js +1 -0
- package/src/web/public/assets/{bar-Dy_QDX2h.js → bar-C0Q_Qe4z.js} +1 -1
- package/src/web/public/assets/board-view-C8OQhkyi.js +1 -0
- package/src/web/public/assets/{button-3JlUeln_.js → button-Cs6w2CDi.js} +1 -1
- package/src/web/public/assets/{composer-launch-B7DH53Yf.js → composer-launch-BF3_hyn5.js} +1 -1
- package/src/web/public/assets/{composer-panel-Cj1J16r-.js → composer-panel-D6vBrzCs.js} +1 -1
- package/src/web/public/assets/{dag-DXRPHVl8.js → dag-CZF6sV2_.js} +1 -1
- package/src/web/public/assets/dir-6RhnWw1E.js +1 -0
- package/src/web/public/assets/doc-CVIVBV6n.js +6 -0
- package/src/web/public/assets/doc-DgYKv2wo.css +1 -0
- package/src/web/public/assets/group-AF62Z-_G.js +1 -0
- package/src/web/public/assets/group-project-memo-G-O6sPRw.js +1 -0
- package/src/web/public/assets/index-Bposj22Z.js +3 -0
- package/src/web/public/assets/{list-filter-CWxiOSg_.js → list-search-DFvFY408.js} +1 -1
- package/src/web/public/assets/md-history-COQu16vy.js +47 -0
- package/src/web/public/assets/{member-picker-BZgE3HGb.js → member-picker-CHX0nS0O.js} +1 -1
- package/src/web/public/assets/popup-dBtYqEM1.js +1 -0
- package/src/web/public/assets/progress-CDh6DY7g.js +3 -0
- package/src/web/public/assets/refs-t79ynSY8.js +2 -0
- package/src/web/public/assets/reopen-text-B2d9SZi0.js +13 -0
- package/src/web/public/assets/{repo-form-modal-CNLYR12c.js → repo-form-modal-dZqpHyUj.js} +1 -1
- package/src/web/public/assets/{repos-BGx-yAXd.js → repos-DdhOQJqF.js} +9 -9
- package/src/web/public/assets/{route-crumb-DX9C4jmQ.js → route-crumb-BKq2jry0.js} +1 -1
- package/src/web/public/assets/settings-Bk3clN2f.js +1 -0
- package/src/web/public/assets/task-C8nax2rT.js +13 -0
- package/src/web/public/assets/task-ops-D6E_TgEC.js +2 -0
- package/src/web/public/assets/task-utils-Dh33OFKe.js +1 -0
- package/src/web/public/assets/{templates-Co1Qb1aA.js → templates-Dusbff7Z.js} +3 -3
- package/src/web/public/assets/{tool-bar-D5wLBLRl.js → tool-bar-DPXnjdQF.js} +2 -2
- package/src/web/public/assets/use-rail-drag-B6J0iqFK.js +1 -0
- package/src/web/public/index.html +13 -13
- package/src/web/frontend/page/dir/landing.tsx +0 -553
- package/src/web/public/assets/app-context-BqCBcDsx.js +0 -1
- package/src/web/public/assets/board-view-Cm8189wG.js +0 -1
- package/src/web/public/assets/dir-_M1ciSxM.js +0 -3
- package/src/web/public/assets/doc-Iuxssa-b.css +0 -1
- package/src/web/public/assets/doc-_iteSM2X.js +0 -6
- package/src/web/public/assets/get-loop-modal-DlAfqJMz.js +0 -2
- package/src/web/public/assets/group-CH8qe-eg.js +0 -1
- package/src/web/public/assets/index-Cui4IuGj.js +0 -3
- package/src/web/public/assets/md-history-Bj790fdn.js +0 -46
- package/src/web/public/assets/popup-DZ2Khv2c.js +0 -1
- package/src/web/public/assets/progress-MPse2JLQ.js +0 -3
- package/src/web/public/assets/refs-DiIPoqnJ.js +0 -2
- package/src/web/public/assets/settings-Pt4YgGdY.js +0 -1
- package/src/web/public/assets/task-DOIIpQ4X.js +0 -13
- package/src/web/public/assets/task-utils-CJfMODCP.js +0 -13
- package/src/web/public/assets/use-rail-drag-CNOHXWng.js +0 -1
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
// 任务页模板(#251):目录任务页(page/dir)与项目组页(page/group)共用的**整页交互**。
|
|
2
|
+
//
|
|
3
|
+
// 基线是目录页:用户口径「先读 dir 的所有样式 / 交互 / 按钮,再抽成模板,两页复用」。
|
|
4
|
+
// 抽离前两页各写一遍容器与交互——组页缺多选 / 批量条 / 行尾菜单 / 导入 / 草稿态,
|
|
5
|
+
// 目录页缺组页的项目 tag 语义,改一处另一处就漂。现在两页只交数据与动作:
|
|
6
|
+
//
|
|
7
|
+
// rp-page
|
|
8
|
+
// ├ rp-group-head 标题 + 计数 chips + 工具区(ToolActsBar:新建 / 导入 / 进程 / 编排 /
|
|
9
|
+
// │ 草稿态 / 更多;两页同一套按钮与文案,差别只在 kind 的模块表)
|
|
10
|
+
// ├ intro 简介槽(目录 = 项目介绍,组 = 组介绍)
|
|
11
|
+
// ├ batch 批量条(选中后出现:标为完成 / 取消 / 删除 / 清空)
|
|
12
|
+
// ├ list TaskPanel:搜索框 + 全选本页 + 任务行(多选 / 拖把 / 行尾 ⋯)
|
|
13
|
+
// └ footer 翻页条
|
|
14
|
+
//
|
|
15
|
+
// 模板自己持有:搜索串、当前页、多选集合、拖拽视觉态、模板下拉菜单。
|
|
16
|
+
// 调用方持有:行数据(已排好显示序)、每行的 scope 语义、以及所有落盘动作。
|
|
17
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
18
|
+
import type { DragEvent as ReactDragEvent, MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
19
|
+
import { Icon } from '../icons.jsx';
|
|
20
|
+
import Pager, { usePager } from '../pager.jsx';
|
|
21
|
+
import { PopMenu, RowMenu } from '../popup/index.jsx';
|
|
22
|
+
import type { PopMenuItem, RowMenuItem } from '../popup/index.jsx';
|
|
23
|
+
import ToolActsBar from '../tool-acts/bar.jsx';
|
|
24
|
+
import { useToast } from '../toast/index.jsx';
|
|
25
|
+
import TaskPanel from './index.jsx';
|
|
26
|
+
import TaskPanelLayout from './layout.jsx';
|
|
27
|
+
import TaskRow from './task-row.jsx';
|
|
28
|
+
import { contextOf, hitTaskQuery } from '../../modules/board/task-search.js';
|
|
29
|
+
import type { LocalTask } from '../../types.js';
|
|
30
|
+
|
|
31
|
+
/** 列表每页条数(两页同值:20)。 */
|
|
32
|
+
const PAGE_SIZE = 20;
|
|
33
|
+
|
|
34
|
+
/** 一行任务:任务本体 + 这一页给它加的行级语义。 */
|
|
35
|
+
export interface TaskPageRow {
|
|
36
|
+
/** 行 key(组页同号任务会跨成员队列,key 必须带队列维度) */
|
|
37
|
+
key: string;
|
|
38
|
+
task: LocalTask;
|
|
39
|
+
/** 归属项目 tag(组页用;目录页不传) */
|
|
40
|
+
projectTag?: string;
|
|
41
|
+
/** 项目 tag 悬浮说明 */
|
|
42
|
+
projectTitle?: string;
|
|
43
|
+
/** 闸门挡住的下游任务 id */
|
|
44
|
+
downs?: Array<number | string>;
|
|
45
|
+
/** 行内显示 创建→领取 时间(目录页基线:传 true) */
|
|
46
|
+
showTimes?: boolean;
|
|
47
|
+
/** 可拖动排序(= 队列里的待领取任务;同时决定行尾的编排 / 闸门入口) */
|
|
48
|
+
movable?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 工具区透传面(kind 决定模块表;new / import / plan 由模板接管)。 */
|
|
52
|
+
export interface TaskPageToolActs {
|
|
53
|
+
labels?: Record<string, string | undefined>;
|
|
54
|
+
titles?: Record<string, string | undefined>;
|
|
55
|
+
disabled?: Record<string, boolean | undefined>;
|
|
56
|
+
renderers?: Record<string, ((ctx: { open: boolean }) => ReactNode) | undefined>;
|
|
57
|
+
actions?: Record<string, ((e?: ReactMouseEvent<HTMLButtonElement>) => void) | undefined>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface TaskPageProps {
|
|
61
|
+
/** 工具区模块表种类(dir / group) */
|
|
62
|
+
kind: 'dir' | 'group';
|
|
63
|
+
/** 页头主体名(目录名 / 组名) */
|
|
64
|
+
name: string;
|
|
65
|
+
/** 任务面板标题(「任务」/「本组任务」) */
|
|
66
|
+
title: string;
|
|
67
|
+
/** 全量行(已按显示序排好;搜索 / 分页由模板做) */
|
|
68
|
+
rows: TaskPageRow[];
|
|
69
|
+
/** 无搜索时的空态文案(搜索零命中的文案由模板拼) */
|
|
70
|
+
emptyText: string;
|
|
71
|
+
/** 简介槽 */
|
|
72
|
+
intro?: ReactNode;
|
|
73
|
+
/** 头部计数 chips 的**额外**项(对齐口径:任务数 / 待领取由模板出,页面只加自己的) */
|
|
74
|
+
extraCounts?: string[];
|
|
75
|
+
/** 工具区额外节点(如持续 get 的成员子菜单与配置弹窗) */
|
|
76
|
+
actionExtra?: ReactNode;
|
|
77
|
+
toolActs?: TaskPageToolActs;
|
|
78
|
+
/** 「+ 新建页」主区点击 */
|
|
79
|
+
onNew: () => void;
|
|
80
|
+
/** 新建按钮禁用(组页没有成员时不可建任务) */
|
|
81
|
+
newDisabled?: boolean;
|
|
82
|
+
/** 「+ 新建页」▾ 的模板菜单 */
|
|
83
|
+
tplMenuItems: Array<PopMenuItem | string>;
|
|
84
|
+
/** 点行 / 回车打开任务 */
|
|
85
|
+
onOpenRow: (row: TaskPageRow) => void;
|
|
86
|
+
/** 拖动排序落盘(落点只有 before / after) */
|
|
87
|
+
onMoveRow?: (src: TaskPageRow, dst: TaskPageRow, zone: 'before' | 'after') => void;
|
|
88
|
+
/** 「导入」选中 .md 后的落地 */
|
|
89
|
+
onImportFile?: (file: File) => void;
|
|
90
|
+
/** 草稿态切换(行尾单条 / 批量条都会走这里) */
|
|
91
|
+
onTogglePlan?: (rows: TaskPageRow[], to: 'plan' | 'pending') => void;
|
|
92
|
+
/** 行尾「编排依赖…」 */
|
|
93
|
+
onOpenDag?: (row: TaskPageRow) => void;
|
|
94
|
+
/** 行尾闸门开关 */
|
|
95
|
+
onToggleGate?: (row: TaskPageRow) => void;
|
|
96
|
+
/** 行尾反馈 */
|
|
97
|
+
onFeedback?: (row: TaskPageRow) => void;
|
|
98
|
+
/** 行尾单条删除 */
|
|
99
|
+
onDeleteRow?: (row: TaskPageRow) => void;
|
|
100
|
+
/** 批量:删除 / 取消 / 标为完成(返回真值则清空选择) */
|
|
101
|
+
onDeleteRows?: (rows: TaskPageRow[]) => Promise<unknown>;
|
|
102
|
+
onCancelRows?: (rows: TaskPageRow[]) => Promise<unknown>;
|
|
103
|
+
onCompleteRows?: (rows: TaskPageRow[]) => Promise<unknown>;
|
|
104
|
+
/** 页面级弹层(编排编辑器、成员选择器等) */
|
|
105
|
+
extra?: ReactNode;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** 拖动落点:行上半 = 之前,下半 = 之后。 */
|
|
109
|
+
type DropZone = 'before' | 'after';
|
|
110
|
+
|
|
111
|
+
export default function TaskPage({
|
|
112
|
+
kind,
|
|
113
|
+
name,
|
|
114
|
+
title,
|
|
115
|
+
rows,
|
|
116
|
+
emptyText,
|
|
117
|
+
intro = null,
|
|
118
|
+
extraCounts = [],
|
|
119
|
+
actionExtra = null,
|
|
120
|
+
toolActs = {},
|
|
121
|
+
onNew,
|
|
122
|
+
newDisabled = false,
|
|
123
|
+
tplMenuItems,
|
|
124
|
+
onOpenRow,
|
|
125
|
+
onMoveRow,
|
|
126
|
+
onImportFile,
|
|
127
|
+
onTogglePlan,
|
|
128
|
+
onOpenDag,
|
|
129
|
+
onToggleGate,
|
|
130
|
+
onFeedback,
|
|
131
|
+
onDeleteRow,
|
|
132
|
+
onDeleteRows,
|
|
133
|
+
onCancelRows,
|
|
134
|
+
onCompleteRows,
|
|
135
|
+
extra = null,
|
|
136
|
+
}: TaskPageProps) {
|
|
137
|
+
const toast = useToast();
|
|
138
|
+
const fileRef = useRef<HTMLInputElement | null>(null);
|
|
139
|
+
const [tplMenu, setTplMenu] = useState<{ x?: number; y?: number } | null>(null);
|
|
140
|
+
|
|
141
|
+
// ─── 搜索 + 分页(两页同一口径:标题与正文都搜,见 modules/board/task-search) ───
|
|
142
|
+
const [q, setQ] = useState('');
|
|
143
|
+
const searching = !!String(q).trim();
|
|
144
|
+
const shown = useMemo(
|
|
145
|
+
() => (searching ? rows.filter((r) => hitTaskQuery({ id: r.task.id, text: r.task.text }, q)) : rows),
|
|
146
|
+
[rows, q, searching],
|
|
147
|
+
);
|
|
148
|
+
// 待领取计数跟着**筛后**集合走:搜索时头部数字要与屏幕上的行对得上
|
|
149
|
+
const pendingCount = useMemo(
|
|
150
|
+
() => shown.filter((r) => r.task.status === 'pending' && !r.task.migratedTo).length,
|
|
151
|
+
[shown],
|
|
152
|
+
);
|
|
153
|
+
const pager = usePager(shown, PAGE_SIZE);
|
|
154
|
+
// 改查询串回第一页(否则停在「上一结果的第 3 页」,看起来像没命中)
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
pager.setPage(0);
|
|
157
|
+
}, [q]);
|
|
158
|
+
|
|
159
|
+
// ─── 多选 + 批量条 ─────────────────────────────────────────────
|
|
160
|
+
const [picked, setPicked] = useState<Set<string>>(() => new Set());
|
|
161
|
+
const pageRows = pager.items;
|
|
162
|
+
const pageKeys = pageRows.map((r) => r.key);
|
|
163
|
+
const allPicked = pageKeys.length > 0 && pageKeys.every((k) => picked.has(k));
|
|
164
|
+
// 翻页后清空选择,避免批量操作跨页误伤看不到的行
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
setPicked(new Set());
|
|
167
|
+
}, [pager.page]);
|
|
168
|
+
const pickedRows = rows.filter((r) => picked.has(r.key));
|
|
169
|
+
// #184:标为完成对「未结束」任务开放(待领取 + 已领取);取消只给待领取
|
|
170
|
+
const doneTargets = pickedRows.filter(
|
|
171
|
+
(r) =>
|
|
172
|
+
(r.task.status === 'pending' || r.task.status === 'claimed') && !r.task.migratedTo && !r.task.deletedAt,
|
|
173
|
+
);
|
|
174
|
+
const cancelTargets = pickedRows.filter(
|
|
175
|
+
(r) => r.task.status === 'pending' && !r.task.migratedTo && !r.task.deletedAt,
|
|
176
|
+
);
|
|
177
|
+
const claimedPicked = doneTargets.filter((r) => r.task.status === 'claimed').length;
|
|
178
|
+
const togglePick = (key: string) => {
|
|
179
|
+
setPicked((prev) => {
|
|
180
|
+
const next = new Set(prev);
|
|
181
|
+
if (next.has(key)) next.delete(key);
|
|
182
|
+
else next.add(key);
|
|
183
|
+
return next;
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
const togglePickAll = () => {
|
|
187
|
+
setPicked((prev) => {
|
|
188
|
+
const next = new Set(prev);
|
|
189
|
+
if (allPicked) pageKeys.forEach((k) => next.delete(k));
|
|
190
|
+
else pageKeys.forEach((k) => next.add(k));
|
|
191
|
+
return next;
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
const runBatch = async (fn?: (rs: TaskPageRow[]) => Promise<unknown>) => {
|
|
195
|
+
if (!pickedRows.length || !fn) return;
|
|
196
|
+
const ok = await fn(pickedRows);
|
|
197
|
+
if (ok) setPicked(new Set());
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// ─── 草稿态(pending ↔ plan):批量条不设按钮,走工具区「草稿态」+ 行尾菜单 ───
|
|
201
|
+
const toPlan = pickedRows.filter((r) => r.task.status === 'pending');
|
|
202
|
+
const toPending = pickedRows.filter((r) => r.task.status === 'plan');
|
|
203
|
+
const planTargets = toPlan.length ? toPlan : toPending;
|
|
204
|
+
const planTo: 'plan' | 'pending' = toPlan.length ? 'plan' : 'pending';
|
|
205
|
+
const planLabel = pickedRows.length
|
|
206
|
+
? planTo === 'plan'
|
|
207
|
+
? `转草稿 (${toPlan.length})`
|
|
208
|
+
: `转回待领取 (${toPending.length})`
|
|
209
|
+
: '草稿态';
|
|
210
|
+
|
|
211
|
+
// ─── 拖动排序(HTML5 DnD,只在可移动行之间换位)────────────────────
|
|
212
|
+
// 拖拽态走 **ref**:dragstart / dragover 间隔只有几毫秒,state 那一拍会读到旧值
|
|
213
|
+
const dragRef = useRef<string | null>(null);
|
|
214
|
+
const [dragKey, setDragKey] = useState<string | null>(null);
|
|
215
|
+
const [dropAt, setDropAt] = useState<{ key: string; zone: DropZone } | null>(null);
|
|
216
|
+
const zoneOf = (e: ReactDragEvent<HTMLElement>, el: HTMLElement): DropZone => {
|
|
217
|
+
const r = el.getBoundingClientRect();
|
|
218
|
+
return e.clientY < r.top + r.height / 2 ? 'before' : 'after';
|
|
219
|
+
};
|
|
220
|
+
const onDragStart = (e: ReactDragEvent<HTMLElement>, r: TaskPageRow) => {
|
|
221
|
+
dragRef.current = r.key;
|
|
222
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
223
|
+
e.dataTransfer.setData('text/plain', 'task:' + r.task.id);
|
|
224
|
+
setDragKey(r.key);
|
|
225
|
+
};
|
|
226
|
+
const onDragOver = (e: ReactDragEvent<HTMLElement>, r: TaskPageRow) => {
|
|
227
|
+
if (!dragRef.current || !r.movable || r.key === dragRef.current) return;
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
e.dataTransfer.dropEffect = 'move';
|
|
230
|
+
setDropAt({ key: r.key, zone: zoneOf(e, e.currentTarget) });
|
|
231
|
+
};
|
|
232
|
+
const onDragLeave = (e: ReactDragEvent<HTMLElement>) => {
|
|
233
|
+
// 行内子元素之间移动也会触发 dragleave:真离开整行才清指示
|
|
234
|
+
if (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)) return;
|
|
235
|
+
setDropAt(null);
|
|
236
|
+
};
|
|
237
|
+
const onDrop = (e: ReactDragEvent<HTMLElement>, r: TaskPageRow) => {
|
|
238
|
+
e.preventDefault();
|
|
239
|
+
const zone = zoneOf(e, e.currentTarget);
|
|
240
|
+
const fromKey = dragRef.current;
|
|
241
|
+
dragRef.current = null;
|
|
242
|
+
setDragKey(null);
|
|
243
|
+
setDropAt(null);
|
|
244
|
+
if (!fromKey || !r.movable || r.key === fromKey) return;
|
|
245
|
+
const src = rows.find((x) => x.key === fromKey);
|
|
246
|
+
if (src && onMoveRow) onMoveRow(src, r, zone);
|
|
247
|
+
};
|
|
248
|
+
const onDragEnd = () => {
|
|
249
|
+
dragRef.current = null;
|
|
250
|
+
setDragKey(null);
|
|
251
|
+
setDropAt(null);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// ─── 行尾 ⋯ 菜单(两页同一套条目与文案;动作由调用方给)───────────────
|
|
255
|
+
const menuOf = (r: TaskPageRow): Array<RowMenuItem | null | false> => {
|
|
256
|
+
const t = r.task;
|
|
257
|
+
return [
|
|
258
|
+
(t.status === 'pending' || t.status === 'plan') && onTogglePlan
|
|
259
|
+
? {
|
|
260
|
+
label: t.status === 'pending' ? '转为草稿(不进队列)' : '转回待领取',
|
|
261
|
+
onPick: () => onTogglePlan([r], t.status === 'pending' ? 'plan' : 'pending'),
|
|
262
|
+
}
|
|
263
|
+
: null,
|
|
264
|
+
r.movable && onOpenDag ? { label: '编排依赖…', onPick: () => onOpenDag(r) } : null,
|
|
265
|
+
r.movable && onToggleGate
|
|
266
|
+
? {
|
|
267
|
+
label: t.blocksFollowing ? '取消闸门(不再挡后续)' : '设为闸门(挡住后续)',
|
|
268
|
+
onPick: () => onToggleGate(r),
|
|
269
|
+
}
|
|
270
|
+
: null,
|
|
271
|
+
// #144 反馈只在链尖:已有派生子任务的旧轮次不再给入口(否则把链分叉)
|
|
272
|
+
onFeedback && t.status !== 'cancelled' && !t.childCount && (t.status === 'claimed' || t.status === 'done' || t.completedAt)
|
|
273
|
+
? {
|
|
274
|
+
label: t.completedAt ? '反馈:新开一条任务(原任务不动)' : '反馈修改:回写本任务并记入任务链',
|
|
275
|
+
onPick: () => onFeedback(r),
|
|
276
|
+
}
|
|
277
|
+
: null,
|
|
278
|
+
onDeleteRow ? { label: '删除此任务(软删除,CLI 可恢复)', danger: true, onPick: () => onDeleteRow(r) } : null,
|
|
279
|
+
];
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// ─── 批量条(选中后出现;块序与样式与目录页原实现一致)───────────────
|
|
283
|
+
const batchBar = pickedRows.length > 0 ? (
|
|
284
|
+
<div className="mdw-land-batch">
|
|
285
|
+
<span className="mdw-land-batch-count">已选 {pickedRows.length} 条</span>
|
|
286
|
+
{onCompleteRows && (
|
|
287
|
+
<button
|
|
288
|
+
type="button"
|
|
289
|
+
className="btn ghost sm"
|
|
290
|
+
disabled={!doneTargets.length}
|
|
291
|
+
title={
|
|
292
|
+
doneTargets.length
|
|
293
|
+
? `把选中的未结束任务标为已完成(补一条完成记录,原文留档)${claimedPicked ? `;其中 ${claimedPicked} 条已被领取,会直接收口,agent 侧回执忽略` : ''}`
|
|
294
|
+
: '选中的任务都已结束,没有可标为完成的'
|
|
295
|
+
}
|
|
296
|
+
onClick={() => void runBatch(onCompleteRows)}
|
|
297
|
+
>
|
|
298
|
+
标为完成选中{doneTargets.length ? ` (${doneTargets.length})` : ''}
|
|
299
|
+
</button>
|
|
300
|
+
)}
|
|
301
|
+
{onCancelRows && (
|
|
302
|
+
<button
|
|
303
|
+
type="button"
|
|
304
|
+
className="btn ghost sm"
|
|
305
|
+
disabled={!cancelTargets.length}
|
|
306
|
+
title={
|
|
307
|
+
cancelTargets.length
|
|
308
|
+
? '把选中的待领取任务标为已取消(终态,原文留档)'
|
|
309
|
+
: '只有待领取任务可以取消(已领取的交给 agent 回执)'
|
|
310
|
+
}
|
|
311
|
+
onClick={() => void runBatch(onCancelRows)}
|
|
312
|
+
>
|
|
313
|
+
取消选中{cancelTargets.length ? ` (${cancelTargets.length})` : ''}
|
|
314
|
+
</button>
|
|
315
|
+
)}
|
|
316
|
+
{onDeleteRows && (
|
|
317
|
+
<button type="button" className="btn ghost sm danger" onClick={() => void runBatch(onDeleteRows)}>
|
|
318
|
+
删除选中 ({pickedRows.length})
|
|
319
|
+
</button>
|
|
320
|
+
)}
|
|
321
|
+
<button type="button" className="btn ghost sm" onClick={() => setPicked(new Set())}>
|
|
322
|
+
清空
|
|
323
|
+
</button>
|
|
324
|
+
</div>
|
|
325
|
+
) : null;
|
|
326
|
+
|
|
327
|
+
// ─── 列表 ───────────────────────────────────────────────────────
|
|
328
|
+
const listPanel = (
|
|
329
|
+
<TaskPanel
|
|
330
|
+
title={title}
|
|
331
|
+
pendingCount={pendingCount}
|
|
332
|
+
headerExtra={
|
|
333
|
+
<span className="rp-tasks-tools">
|
|
334
|
+
<input
|
|
335
|
+
className="rp-task-search"
|
|
336
|
+
type="search"
|
|
337
|
+
value={q}
|
|
338
|
+
placeholder="搜索标题 / 内容"
|
|
339
|
+
aria-label="搜索任务"
|
|
340
|
+
onChange={(e) => setQ(e.target.value)}
|
|
341
|
+
/>
|
|
342
|
+
{pageRows.length ? (
|
|
343
|
+
<label className="rp-proj-pickall" title="全选/取消全选当前页">
|
|
344
|
+
<input type="checkbox" checked={allPicked} onChange={togglePickAll} aria-label="全选当前页任务" />
|
|
345
|
+
全选本页
|
|
346
|
+
</label>
|
|
347
|
+
) : null}
|
|
348
|
+
</span>
|
|
349
|
+
}
|
|
350
|
+
emptyText={
|
|
351
|
+
searching
|
|
352
|
+
? `没有匹配「${q.trim()}」的任务(标题与正文都搜过了)`
|
|
353
|
+
: emptyText
|
|
354
|
+
}
|
|
355
|
+
>
|
|
356
|
+
{pageRows.map((r) => {
|
|
357
|
+
const handlers = r.movable
|
|
358
|
+
? {
|
|
359
|
+
onDragStart: (e: ReactDragEvent<HTMLElement>) => onDragStart(e, r),
|
|
360
|
+
onDragOver: (e: ReactDragEvent<HTMLElement>) => onDragOver(e, r),
|
|
361
|
+
onDragLeave: onDragLeave,
|
|
362
|
+
onDrop: (e: ReactDragEvent<HTMLElement>) => onDrop(e, r),
|
|
363
|
+
onDragEnd: onDragEnd,
|
|
364
|
+
}
|
|
365
|
+
: null;
|
|
366
|
+
return (
|
|
367
|
+
<TaskRow
|
|
368
|
+
key={r.key}
|
|
369
|
+
t={r.task}
|
|
370
|
+
projectTag={r.projectTag}
|
|
371
|
+
projectTitle={r.projectTitle}
|
|
372
|
+
searchCtx={searching ? contextOf(r.task, q) : null}
|
|
373
|
+
selectable
|
|
374
|
+
picked={picked.has(r.key)}
|
|
375
|
+
onTogglePick={() => togglePick(r.key)}
|
|
376
|
+
draggable={!!r.movable}
|
|
377
|
+
dragHandlers={handlers}
|
|
378
|
+
dragVisual={{ dragging: dragKey === r.key, drop: dropAt && dropAt.key === r.key ? dropAt.zone : null }}
|
|
379
|
+
showTimes={r.showTimes}
|
|
380
|
+
downs={r.downs}
|
|
381
|
+
onOpen={() => onOpenRow(r)}
|
|
382
|
+
ops={<RowMenu items={menuOf(r)} />}
|
|
383
|
+
/>
|
|
384
|
+
);
|
|
385
|
+
})}
|
|
386
|
+
</TaskPanel>
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
const footerBar = pager.total > 0 ? (
|
|
390
|
+
<div className="mdw-land-pager">
|
|
391
|
+
<Pager page={pager.page} pageCount={pager.pageCount} total={pager.total} onPage={pager.setPage} unit="个任务" />
|
|
392
|
+
</div>
|
|
393
|
+
) : null;
|
|
394
|
+
|
|
395
|
+
// ─── 工具区:new / import / plan 由模板接管,其余(进程 / 编排 / 更多…)由页面给 ───
|
|
396
|
+
const openTplMenu = (e: { type: string; clientX?: number; clientY?: number }) => {
|
|
397
|
+
setTplMenu({ x: e.clientX, y: e.clientY });
|
|
398
|
+
};
|
|
399
|
+
const newButton = () => (
|
|
400
|
+
<span className="rp-newtask">
|
|
401
|
+
<button
|
|
402
|
+
type="button"
|
|
403
|
+
className="btn small primary"
|
|
404
|
+
title="按默认模板新建一页(▾ 选模板)"
|
|
405
|
+
disabled={newDisabled}
|
|
406
|
+
onClick={() => onNew()}
|
|
407
|
+
>
|
|
408
|
+
+ 新建页
|
|
409
|
+
<span
|
|
410
|
+
role="button"
|
|
411
|
+
tabIndex={newDisabled ? undefined : 0}
|
|
412
|
+
aria-label="选择模板新建一页"
|
|
413
|
+
aria-haspopup="menu"
|
|
414
|
+
className="rp-newtask-caret"
|
|
415
|
+
title="选择模板新建一页"
|
|
416
|
+
onClick={(e) => {
|
|
417
|
+
e.stopPropagation();
|
|
418
|
+
openTplMenu(e);
|
|
419
|
+
}}
|
|
420
|
+
onKeyDown={(e) => {
|
|
421
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
422
|
+
e.preventDefault();
|
|
423
|
+
e.stopPropagation();
|
|
424
|
+
openTplMenu(e);
|
|
425
|
+
}
|
|
426
|
+
}}
|
|
427
|
+
>
|
|
428
|
+
<Icon name="chevron" size={11} title={undefined} />
|
|
429
|
+
</span>
|
|
430
|
+
</button>
|
|
431
|
+
</span>
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
return (
|
|
435
|
+
<>
|
|
436
|
+
<TaskPanelLayout
|
|
437
|
+
name={name}
|
|
438
|
+
counts={[
|
|
439
|
+
`${searching ? '命中 ' : ''}${pager.total} 个任务`,
|
|
440
|
+
...(pendingCount > 0 ? [`待领取 ${pendingCount}`] : []),
|
|
441
|
+
...extraCounts,
|
|
442
|
+
]}
|
|
443
|
+
intro={intro}
|
|
444
|
+
batch={batchBar}
|
|
445
|
+
list={listPanel}
|
|
446
|
+
footer={footerBar}
|
|
447
|
+
actions={
|
|
448
|
+
<>
|
|
449
|
+
<ToolActsBar
|
|
450
|
+
kind={kind}
|
|
451
|
+
labels={{ more: '更多', ...toolActs.labels, plan: planLabel }}
|
|
452
|
+
titles={{
|
|
453
|
+
new: '按默认模板新建一页(▾ 选模板)',
|
|
454
|
+
import: '把一个 .md 文件导入成任务',
|
|
455
|
+
plan: '选中任务后:待领取 ↔ 草稿(草稿不进 get/wait 队列;行尾 ⋯ 菜单也能单条切换)',
|
|
456
|
+
...toolActs.titles,
|
|
457
|
+
}}
|
|
458
|
+
disabled={toolActs.disabled}
|
|
459
|
+
renderers={{ new: newButton, ...toolActs.renderers }}
|
|
460
|
+
actions={{
|
|
461
|
+
...toolActs.actions,
|
|
462
|
+
new: () => onNew(),
|
|
463
|
+
import: () => fileRef.current?.click(),
|
|
464
|
+
plan: () => {
|
|
465
|
+
if (!planTargets.length) {
|
|
466
|
+
toast('先勾选任务:待领取可转草稿,草稿可转回待领取(行尾 ⋯ 菜单也能单条切换)');
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
onTogglePlan?.(planTargets, planTo);
|
|
470
|
+
},
|
|
471
|
+
}}
|
|
472
|
+
/>
|
|
473
|
+
{actionExtra}
|
|
474
|
+
</>
|
|
475
|
+
}
|
|
476
|
+
/>
|
|
477
|
+
|
|
478
|
+
{tplMenu && <PopMenu x={tplMenu.x} y={tplMenu.y} items={tplMenuItems} onClose={() => setTplMenu(null)} />}
|
|
479
|
+
|
|
480
|
+
<input
|
|
481
|
+
ref={fileRef}
|
|
482
|
+
type="file"
|
|
483
|
+
accept=".md,text/markdown,text/plain"
|
|
484
|
+
hidden
|
|
485
|
+
onChange={(e) => {
|
|
486
|
+
const f = e.target.files?.[0];
|
|
487
|
+
e.target.value = '';
|
|
488
|
+
if (f && onImportFile) onImportFile(f);
|
|
489
|
+
}}
|
|
490
|
+
/>
|
|
491
|
+
|
|
492
|
+
{extra}
|
|
493
|
+
</>
|
|
494
|
+
);
|
|
495
|
+
}
|
|
@@ -44,9 +44,12 @@ export const DIR_MODULES: ToolModule[] = [
|
|
|
44
44
|
|
|
45
45
|
export const GROUP_MODULES: ToolModule[] = [
|
|
46
46
|
{ id: 'new', label: '新增任务', icon: 'plus', section: 'primary', noHide: true },
|
|
47
|
+
// #251:与 dir 页对齐——导入 / 草稿态两条都补上(任务页模板统一接管 new/import/plan)
|
|
48
|
+
{ id: 'import', label: '导入', icon: 'import', section: 'bar' },
|
|
47
49
|
{ id: 'progress', label: '进程', icon: 'progress', section: 'bar' },
|
|
48
50
|
{ id: 'addMember', label: '添加成员', icon: 'users', section: 'bar' },
|
|
49
51
|
{ id: 'orch', label: '编排', icon: 'flow', section: 'bar' },
|
|
52
|
+
{ id: 'plan', label: '草稿态', icon: 'pin', section: 'bar' },
|
|
50
53
|
{ id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
|
|
51
54
|
{ id: 'refs', label: '查看列表', icon: 'list', section: 'more' },
|
|
52
55
|
// #250:与 dir 页对齐——持续 get 进组页「更多」。组横跨多个成员仓库,
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
// 组合 localtask 主题与独立 timegoal 的显示模型。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// 永远最前);只有 timegoal 的目录按 goal 的接口顺序追加,且同一 key 只出现一次。
|
|
3
|
+
// 只为视图准备一行一个目录;存储仍各自独立,顺序沿用 localtask(#190 起没有全局池行)。
|
|
5
4
|
//
|
|
6
5
|
// 本文件是**纯前端视图模型**,没有任何后端消费方——原先长在 modules/localtask/ 下,
|
|
7
6
|
// 被迫在前端目录之外维护,还得靠注释解释「别 import service.js」。现在归位到前端。
|
|
8
|
-
// 与后端的共同约定只有 `__GLOBAL__` 这一个字符串(见 localtask service 的 GLOBAL_KEY),
|
|
9
|
-
// 由 tests/unit/registry.test.mjs 的边界断言与 shared/ 层共同守住。
|
|
10
7
|
|
|
11
8
|
// 任务状态词表与谓词:前后端共用同一份实现(src/shared/task-status.js)。
|
|
12
9
|
// 以前这里抄了一份「排除法」的 isPendingRow,与后端各写一遍迟早分叉。
|
|
13
10
|
import { isPending } from '../../../../shared/task-status.js';
|
|
14
11
|
import type { BoardRow, LocalTask, LocalTopic } from '../../types.js';
|
|
15
12
|
|
|
16
|
-
// 全局任务池(共享池)的固定标识 —— 与 localtask service 的 GLOBAL_KEY 一致。
|
|
17
|
-
export const GLOBAL_KEY = '__GLOBAL__';
|
|
18
|
-
export const GLOBAL_NAME = '全局任务';
|
|
19
13
|
|
|
20
14
|
/** 时间目标(/api/timegoals 的行;合并目录行时只读 key/cwd/name)。 */
|
|
21
15
|
export interface DirectoryGoal {
|
|
@@ -32,7 +26,6 @@ export interface DirectoryRow {
|
|
|
32
26
|
name: string;
|
|
33
27
|
topic: LocalTopic | null;
|
|
34
28
|
goal: DirectoryGoal | null;
|
|
35
|
-
isGlobal: boolean;
|
|
36
29
|
placeholder?: boolean;
|
|
37
30
|
[k: string]: any;
|
|
38
31
|
}
|
|
@@ -54,48 +47,6 @@ export interface GroupTaskHit {
|
|
|
54
47
|
taskRow: LocalTask | null;
|
|
55
48
|
}
|
|
56
49
|
|
|
57
|
-
// 全局池占位主题:全局池空着的时候,store 里**没有**这个主题(它只在真的投过
|
|
58
|
-
// 任务之后才存在),于是看板上就没有"全局任务"这一行 —— 用户想往全局池里加
|
|
59
|
-
// **第一条**任务时找不到入口("全局任务队列里没有任务,全局任务就无法添加"就是这个坑)。
|
|
60
|
-
// 这个壳只在视图层造,不写 store:真投了第一条,store 里自然会有真的全局主题。
|
|
61
|
-
export function globalPlaceholderTopic(): LocalTopic {
|
|
62
|
-
return {
|
|
63
|
-
key: GLOBAL_KEY,
|
|
64
|
-
cwd: '',
|
|
65
|
-
name: GLOBAL_NAME,
|
|
66
|
-
summary: '',
|
|
67
|
-
waiting: false,
|
|
68
|
-
staleWaiting: false,
|
|
69
|
-
waitingUntil: '',
|
|
70
|
-
waitingUntilMs: 0,
|
|
71
|
-
waitingSince: '',
|
|
72
|
-
cancelRequested: false,
|
|
73
|
-
isGlobal: true,
|
|
74
|
-
manual: false,
|
|
75
|
-
createdAt: '',
|
|
76
|
-
updatedAt: '',
|
|
77
|
-
pending: 0,
|
|
78
|
-
total: 0,
|
|
79
|
-
tasks: [],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// 看板上补一行全局池:真主题已在则原样返回(不重复),否则补一个占位行。
|
|
84
|
-
export function withGlobalRow(rows: DirectoryRow[]): DirectoryRow[] {
|
|
85
|
-
if (rows.some((r) => r.isGlobal)) return rows;
|
|
86
|
-
return [
|
|
87
|
-
{
|
|
88
|
-
key: GLOBAL_KEY,
|
|
89
|
-
cwd: '',
|
|
90
|
-
name: GLOBAL_NAME,
|
|
91
|
-
topic: null,
|
|
92
|
-
goal: null,
|
|
93
|
-
isGlobal: true,
|
|
94
|
-
placeholder: true,
|
|
95
|
-
},
|
|
96
|
-
...rows,
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
50
|
|
|
100
51
|
/**
|
|
101
52
|
* 把一个主题的任务拆成三段:待领取 / 已领取 / 已删除。
|
|
@@ -242,7 +193,7 @@ export function findGroupTask(
|
|
|
242
193
|
};
|
|
243
194
|
const ids = boardMatchIds(board);
|
|
244
195
|
for (const r of rows || []) {
|
|
245
|
-
if (!r
|
|
196
|
+
if (!r) continue;
|
|
246
197
|
if (memberKeys.size && !rowKeyOf(r).some((k) => memberKeys.has(k))) continue;
|
|
247
198
|
const hit = (r.tasks || []).find((t) => t && !t.deletedAt && String(t.id) === String(taskId));
|
|
248
199
|
if (!hit) continue;
|
|
@@ -271,7 +222,6 @@ export function mergeDirectoryRows(topics: LocalTopic[] = [], goals: DirectoryGo
|
|
|
271
222
|
name: topic.name || goal?.name || topic.cwd || goal?.cwd || '(未命名)',
|
|
272
223
|
topic,
|
|
273
224
|
goal,
|
|
274
|
-
isGlobal: !!topic.isGlobal,
|
|
275
225
|
};
|
|
276
226
|
rows.push(row);
|
|
277
227
|
byKey.set(row.key, row);
|
|
@@ -289,14 +239,10 @@ export function mergeDirectoryRows(topics: LocalTopic[] = [], goals: DirectoryGo
|
|
|
289
239
|
name: goal.name || goal.cwd || '(未命名)',
|
|
290
240
|
topic: null,
|
|
291
241
|
goal,
|
|
292
|
-
isGlobal: false,
|
|
293
242
|
};
|
|
294
243
|
rows.push(row);
|
|
295
244
|
byKey.set(row.key, row);
|
|
296
245
|
}
|
|
297
246
|
|
|
298
|
-
// 注册表的 topics 顺序本来就把全局主题置顶;保留该约定,同时为直接调用的
|
|
299
|
-
// 使用方兜底(例如单测或以后复用 board selector 的其它视图)。
|
|
300
|
-
rows.sort((a, b) => Number(b.isGlobal) - Number(a.isGlobal));
|
|
301
247
|
return rows;
|
|
302
248
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// 这里只管「文档内容」——标题 / 正文 / 附件 / 视图模式。
|
|
5
5
|
// 面板关掉再打开,内容还在(会话内);刷新即空(草稿本就只在会话有效)。
|
|
6
6
|
import { useSyncExternalStore } from 'react';
|
|
7
|
-
import { GLOBAL_KEY } from '../board/board-view.js';
|
|
8
7
|
import type { Attachment } from '../../components/md/attachments/attach-common.js';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -40,8 +39,8 @@ const subscribe = (l: () => void) => { listeners.add(l); return () => { listener
|
|
|
40
39
|
export const docsSnapshot = (): Record<string, DocRecord> => s.docs;
|
|
41
40
|
const snapshot = docsSnapshot;
|
|
42
41
|
|
|
43
|
-
/**
|
|
44
|
-
export const scopeOf = (dirKey?: string | null): string => (dirKey ||
|
|
42
|
+
/** 目录作用域(#190:全局池已删除,无 key 时用固定 'local' 兜底草稿归属) */
|
|
43
|
+
export const scopeOf = (dirKey?: string | null): string => (dirKey || 'local');
|
|
45
44
|
|
|
46
45
|
/** 文档身份:作用域 + 任务号(草稿号也算) */
|
|
47
46
|
export const docIdOf = (scope: string, task: string | number): string => `${scope}::${task}`;
|
|
@@ -74,7 +74,6 @@ export default function DagPanel({ dirKey, groupId }: DagPanelProps) {
|
|
|
74
74
|
key: t.key,
|
|
75
75
|
name: m.name || m.key,
|
|
76
76
|
cwd: t.cwd,
|
|
77
|
-
isGlobal: !!t.isGlobal,
|
|
78
77
|
count: pendingTasks.length,
|
|
79
78
|
total: pendingTasks.length,
|
|
80
79
|
});
|
|
@@ -110,7 +109,6 @@ export default function DagPanel({ dirKey, groupId }: DagPanelProps) {
|
|
|
110
109
|
...task,
|
|
111
110
|
topicKey: t.key,
|
|
112
111
|
topicCwd: t.cwd,
|
|
113
|
-
topicIsGlobal: !!t.isGlobal,
|
|
114
112
|
projectName: m.name || m.key,
|
|
115
113
|
nodeKey: nodeKeyOf(t.key, task.id),
|
|
116
114
|
});
|
|
@@ -124,7 +122,6 @@ export default function DagPanel({ dirKey, groupId }: DagPanelProps) {
|
|
|
124
122
|
...task,
|
|
125
123
|
topicKey: dirTopic.key,
|
|
126
124
|
topicCwd: dirTopic.cwd,
|
|
127
|
-
topicIsGlobal: !!dirTopic.isGlobal,
|
|
128
125
|
projectName: dirTopic.name || dirTopic.key,
|
|
129
126
|
nodeKey: nodeKeyOf(dirTopic.key, task.id),
|
|
130
127
|
}));
|
|
@@ -203,7 +200,7 @@ export default function DagPanel({ dirKey, groupId }: DagPanelProps) {
|
|
|
203
200
|
try {
|
|
204
201
|
const payload: { blockBy?: DepToken[] | string; gate?: boolean; duration?: string; clearGoal?: boolean } = { ...body };
|
|
205
202
|
if (Array.isArray(payload.blockBy)) payload.blockBy = payload.blockBy.join(',');
|
|
206
|
-
const scope =
|
|
203
|
+
const scope = { cwd: node.topicCwd };
|
|
207
204
|
await patchTaskItem({ ...scope, id: Number(node.id), ...payload });
|
|
208
205
|
if (okMsg) toast(okMsg);
|
|
209
206
|
if (refreshLocal) await refreshLocal();
|