nx-kv 0.48.0 → 0.48.2
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 +43 -0
- package/package.json +1 -1
- package/src/modules/auth/actions/auth-login.ts +13 -6
- package/src/modules/auth/actions/auth-logout.ts +11 -6
- package/src/modules/auth/actions/auth-me.ts +11 -6
- package/src/modules/auth/actions/auth-status.ts +11 -6
- package/src/modules/bundled/actions/bundled-get.ts +14 -6
- package/src/modules/bundled/actions/bundled-groups.ts +11 -6
- package/src/modules/bundled/actions/bundled-install.ts +15 -6
- package/src/modules/bundled/actions/bundled-list.ts +11 -6
- package/src/modules/db/actions/db-backup.ts +12 -6
- package/src/modules/db/actions/db-migrate.ts +12 -6
- package/src/modules/db/actions/db-status.ts +11 -6
- package/src/modules/db/actions/db-verify.ts +11 -6
- package/src/modules/docs/actions/doc-add.ts +14 -6
- package/src/modules/docs/actions/doc-attach-note.ts +13 -6
- package/src/modules/docs/actions/doc-attach.ts +20 -6
- package/src/modules/docs/actions/doc-attachments.ts +11 -6
- package/src/modules/docs/actions/doc-detach.ts +13 -6
- package/src/modules/docs/actions/doc-get.ts +11 -6
- package/src/modules/docs/actions/doc-list.ts +11 -6
- package/src/modules/docs/actions/doc-remove.ts +11 -6
- package/src/modules/docs/actions/doc-update.ts +14 -6
- package/src/modules/docs/actions/docs-bind.ts +15 -6
- package/src/modules/docs/actions/docs-index.ts +11 -6
- package/src/modules/docs/actions/docs-link.ts +16 -6
- package/src/modules/docs/actions/docs-notebind.ts +15 -6
- package/src/modules/docs/actions/docs-seed.ts +11 -6
- package/src/modules/file/actions/file-content.ts +18 -10
- package/src/modules/file/actions/file-get.ts +12 -6
- package/src/modules/file/actions/file-list.ts +13 -6
- package/src/modules/file/actions/file-orphans.ts +11 -6
- package/src/modules/file/actions/file-prune.ts +12 -6
- package/src/modules/file/actions/file-remove.ts +12 -6
- package/src/modules/file/actions/file-sync.ts +15 -6
- package/src/modules/file/actions/file-upload.ts +17 -6
- package/src/modules/localtask/actions/localtask-add.ts +26 -6
- package/src/modules/localtask/actions/localtask-attach-note.ts +15 -6
- package/src/modules/localtask/actions/localtask-attach.ts +24 -6
- package/src/modules/localtask/actions/localtask-attachments.ts +13 -6
- package/src/modules/localtask/actions/localtask-cancel.ts +12 -6
- package/src/modules/localtask/actions/localtask-cancelMany.ts +13 -6
- package/src/modules/localtask/actions/localtask-chain.ts +13 -6
- package/src/modules/localtask/actions/localtask-claim.ts +14 -6
- package/src/modules/localtask/actions/localtask-clone.ts +13 -6
- package/src/modules/localtask/actions/localtask-closeMany.ts +15 -6
- package/src/modules/localtask/actions/localtask-config.ts +23 -8
- package/src/modules/localtask/actions/localtask-detach.ts +15 -6
- package/src/modules/localtask/actions/localtask-done.ts +14 -6
- package/src/modules/localtask/actions/localtask-events.ts +19 -9
- package/src/modules/localtask/actions/localtask-fork.ts +13 -6
- package/src/modules/localtask/actions/localtask-get.ts +13 -6
- package/src/modules/localtask/actions/localtask-importRemote.ts +20 -9
- package/src/modules/localtask/actions/localtask-list.ts +11 -6
- package/src/modules/localtask/actions/localtask-presence.ts +11 -6
- package/src/modules/localtask/actions/localtask-preview.ts +15 -6
- package/src/modules/localtask/actions/localtask-prune.ts +12 -6
- package/src/modules/localtask/actions/localtask-remove.ts +14 -6
- package/src/modules/localtask/actions/localtask-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-reopen.ts +22 -7
- package/src/modules/localtask/actions/localtask-reorder.ts +17 -6
- package/src/modules/localtask/actions/localtask-task-restore.ts +13 -6
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-add.ts +12 -6
- package/src/modules/localtask/actions/localtask-topic-remove.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-update.ts +24 -6
- package/src/modules/localtask/actions/localtask-wait.ts +15 -6
- package/src/modules/localtask/actions/task-move.ts +23 -6
- package/src/modules/repos/actions/board-add.ts +12 -6
- package/src/modules/repos/actions/board-assign.ts +14 -6
- package/src/modules/repos/actions/board-export.ts +11 -6
- package/src/modules/repos/actions/board-get.ts +11 -6
- package/src/modules/repos/actions/board-import.ts +17 -7
- package/src/modules/repos/actions/board-list.ts +11 -6
- package/src/modules/repos/actions/board-note.ts +13 -6
- package/src/modules/repos/actions/board-prefix.ts +12 -6
- package/src/modules/repos/actions/board-prune.ts +13 -6
- package/src/modules/repos/actions/board-rekey.ts +13 -6
- package/src/modules/repos/actions/board-remove.ts +11 -6
- package/src/modules/repos/actions/board-update.ts +13 -6
- package/src/modules/repos/actions/repo-add.ts +19 -6
- package/src/modules/repos/actions/repo-bind-topics.ts +12 -6
- package/src/modules/repos/actions/repo-bind.ts +14 -6
- package/src/modules/repos/actions/repo-clone.ts +16 -6
- package/src/modules/repos/actions/repo-detect.ts +11 -6
- package/src/modules/repos/actions/repo-doc-add.ts +17 -6
- package/src/modules/repos/actions/repo-doc-list.ts +11 -6
- package/src/modules/repos/actions/repo-doc-remove.ts +12 -6
- package/src/modules/repos/actions/repo-export.ts +14 -6
- package/src/modules/repos/actions/repo-get.ts +11 -6
- package/src/modules/repos/actions/repo-import-diff.ts +12 -6
- package/src/modules/repos/actions/repo-import.ts +16 -6
- package/src/modules/repos/actions/repo-key-migrate.ts +11 -6
- package/src/modules/repos/actions/repo-key-refresh.ts +13 -6
- package/src/modules/repos/actions/repo-key-set.ts +13 -6
- package/src/modules/repos/actions/repo-knowledge.ts +12 -6
- package/src/modules/repos/actions/repo-list.ts +11 -6
- package/src/modules/repos/actions/repo-open.ts +11 -6
- package/src/modules/repos/actions/repo-ref-add.ts +15 -6
- package/src/modules/repos/actions/repo-ref-backfill.ts +12 -6
- package/src/modules/repos/actions/repo-ref-check.ts +11 -6
- package/src/modules/repos/actions/repo-ref-clone.ts +18 -6
- package/src/modules/repos/actions/repo-ref-note.ts +14 -6
- package/src/modules/repos/actions/repo-ref-of.ts +11 -6
- package/src/modules/repos/actions/repo-ref-sync.ts +12 -6
- package/src/modules/repos/actions/repo-remote-check.ts +12 -6
- package/src/modules/repos/actions/repo-remote-list.ts +11 -6
- package/src/modules/repos/actions/repo-remote-pick.ts +12 -6
- package/src/modules/repos/actions/repo-remote.ts +13 -6
- package/src/modules/repos/actions/repo-remove.ts +11 -6
- package/src/modules/repos/actions/repo-scan.ts +13 -6
- package/src/modules/repos/actions/repo-update.ts +23 -6
- package/src/modules/setting/actions/setting-get.ts +11 -6
- package/src/modules/setting/actions/setting-set.ts +14 -6
- package/src/modules/system/actions/bootstrap.ts +9 -7
- package/src/modules/system/actions/health.ts +8 -6
- package/src/modules/system/actions/routes.ts +13 -6
- package/src/modules/system/routes.ts +1 -1
- package/src/modules/tasktool/actions/timegoal-check.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-clear.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-list.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-log.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-prune.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-set.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-show.ts +12 -6
- package/src/modules/tasktool/actions/timegoal-update.ts +13 -6
- package/src/modules/templates/actions/templates-add.ts +19 -6
- package/src/modules/templates/actions/templates-default.ts +15 -6
- package/src/modules/templates/actions/templates-list.ts +13 -6
- package/src/modules/templates/actions/templates-remove.ts +11 -6
- package/src/modules/templates/actions/templates-update.ts +17 -6
- package/src/modules/todo/actions/group-add.ts +12 -6
- package/src/modules/todo/actions/group-current.ts +11 -6
- package/src/modules/todo/actions/group-get.ts +11 -6
- package/src/modules/todo/actions/group-list.ts +11 -6
- package/src/modules/todo/actions/group-members.ts +11 -6
- package/src/modules/todo/actions/group-remove.ts +11 -6
- package/src/modules/todo/actions/group-update.ts +13 -6
- package/src/modules/todo/actions/group-use.ts +11 -6
- package/src/modules/todo/actions/prompt-get.ts +12 -6
- package/src/modules/todo/actions/prompt-remove.ts +12 -6
- package/src/modules/todo/actions/prompt-set.ts +13 -6
- package/src/modules/todo/actions/todo-add.ts +13 -6
- package/src/modules/todo/actions/todo-archive.ts +12 -6
- package/src/modules/todo/actions/todo-attach.ts +19 -6
- package/src/modules/todo/actions/todo-attachments.ts +14 -6
- package/src/modules/todo/actions/todo-done.ts +15 -6
- package/src/modules/todo/actions/todo-freeze.ts +14 -6
- package/src/modules/todo/actions/todo-get.ts +14 -6
- package/src/modules/todo/actions/todo-list.ts +13 -6
- package/src/modules/todo/actions/todo-remove.ts +14 -6
- package/src/modules/todo/actions/todo-unfreeze.ts +14 -6
- package/src/modules/todo/actions/todo-update.ts +17 -6
- package/src/modules/todo/actions/topic-add.ts +12 -6
- package/src/modules/todo/actions/topic-list.ts +11 -6
- package/src/modules/todo/actions/topic-remove.ts +12 -6
- package/src/runtime/action-base.ts +41 -1
- package/src/runtime/action-decorator.ts +28 -13
- package/src/runtime/codegen.ts +26 -41
- package/src/runtime/registry.ts +2 -2
- package/src/web/frontend/api/client.generated.ts +550 -698
- package/src/web/frontend/page/cloud/api.ts +99 -0
- package/src/web/frontend/page/cloud/index.tsx +13 -32
- package/src/web/frontend/page/dag/api.ts +20 -0
- package/src/web/frontend/page/dag/index.tsx +2 -5
- package/src/web/frontend/page/dir/api.ts +135 -0
- package/src/web/frontend/page/dir/index.tsx +37 -57
- package/src/web/frontend/page/dir/task-actions.ts +39 -59
- package/src/web/frontend/page/dir/task-chain.ts +2 -2
- package/src/web/frontend/page/dir/task-feedback.ts +19 -23
- package/src/web/frontend/page/dir/task-goal.ts +3 -3
- package/src/web/frontend/page/dir/task.tsx +3 -3
- package/src/web/frontend/page/doc/api.ts +82 -0
- package/src/web/frontend/page/doc/index.tsx +29 -32
- package/src/web/frontend/page/group/api.ts +24 -0
- package/src/web/frontend/page/group/index.tsx +7 -16
- package/src/web/frontend/page/overview/api.ts +16 -0
- package/src/web/frontend/page/overview/index.tsx +2 -2
- package/src/web/frontend/page/progress/api.ts +20 -0
- package/src/web/frontend/page/progress/index.tsx +3 -6
- package/src/web/frontend/page/refs/api.ts +14 -0
- package/src/web/frontend/page/refs/index.tsx +2 -4
- package/src/web/frontend/page/repos/api.ts +197 -0
- package/src/web/frontend/page/repos/bind-modals.tsx +4 -7
- package/src/web/frontend/page/repos/board-admin.tsx +6 -6
- package/src/web/frontend/page/repos/doc-search-modal.tsx +4 -4
- package/src/web/frontend/page/repos/index.tsx +10 -14
- package/src/web/frontend/page/repos/pending-section.tsx +7 -13
- package/src/web/frontend/page/repos/ref-panel.tsx +9 -14
- package/src/web/frontend/page/repos/remote-modal.tsx +4 -28
- package/src/web/frontend/page/repos/repo-form-modal.tsx +4 -4
- package/src/web/frontend/page/settings/api.ts +29 -0
- package/src/web/frontend/page/settings/index.tsx +3 -3
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +4 -4
- package/src/web/frontend/page/settings/sidebar-section.tsx +2 -2
- package/src/web/public/assets/Introduction-Du_dycft.js +6 -0
- package/src/web/public/assets/{bar-B9WWmCpt.js → bar-B52NTf_v.js} +1 -1
- package/src/web/public/assets/cloud-Droja_aT.js +3 -0
- package/src/web/public/assets/{composer-panel-ByezS8Xv.js → composer-panel-DpiU2h50.js} +1 -1
- package/src/web/public/assets/dag-Ca-wjIxQ.js +1 -0
- package/src/web/public/assets/{deleted-panel-BcbtctNF.js → deleted-panel-K9GgfR8t.js} +1 -1
- package/src/web/public/assets/dir-DacRpcBt.js +5 -0
- package/src/web/public/assets/group-TPuU-QVc.js +2 -0
- package/src/web/public/assets/{index-D8MvtVAm.js → index-BkLkooKe.js} +2 -2
- package/src/web/public/assets/{md-history-BqZvzWiD.js → md-history-0GBWw4qr.js} +1 -1
- package/src/web/public/assets/overview-B3kHI66i.js +1 -0
- package/src/web/public/assets/progress-CdhFz0Lz.js +3 -0
- package/src/web/public/assets/refs-BDxfuH6R.js +1 -0
- package/src/web/public/assets/repos-C8jRM7wS.js +15 -0
- package/src/web/public/assets/{route-crumb-CWVu80du.js → route-crumb-QvahotvN.js} +1 -1
- package/src/web/public/assets/settings-BBcdGLTc.js +1 -0
- package/src/web/public/assets/{status-tag-DRl9E2Os.js → status-tag-BheHByek.js} +1 -1
- package/src/web/public/assets/task-CUkQaLBZ.js +11 -0
- package/src/web/public/assets/task-utils-_JAWRAz6.js +12 -0
- package/src/web/public/assets/{templates-Df__0k-F.js → templates-CbRyW3PJ.js} +1 -1
- package/src/web/public/assets/{tool-bar-Cv7f6p4v.js → tool-bar-BAmT-BI-.js} +1 -1
- package/src/web/public/index.html +1 -1
- package/src/modules/auth/schemas.ts +0 -27
- package/src/modules/bundled/schemas.ts +0 -32
- package/src/modules/db/schemas.ts +0 -27
- package/src/modules/docs/schemas.ts +0 -107
- package/src/modules/file/schemas.ts +0 -61
- package/src/modules/localtask/schemas.ts +0 -310
- package/src/modules/repos/schemas.ts +0 -310
- package/src/modules/setting/schemas.ts +0 -18
- package/src/modules/system/schemas.ts +0 -29
- package/src/modules/tasktool/schemas.ts +0 -52
- package/src/modules/templates/schemas.ts +0 -50
- package/src/modules/todo/schemas.ts +0 -177
- package/src/web/public/assets/Introduction-aQCeCLrV.js +0 -6
- package/src/web/public/assets/cloud-C4b8SU7C.js +0 -3
- package/src/web/public/assets/dag-jvrjx4i7.js +0 -1
- package/src/web/public/assets/dir-B82XBb1J.js +0 -5
- package/src/web/public/assets/group-BPUOO_QM.js +0 -2
- package/src/web/public/assets/overview-DMihuyzh.js +0 -1
- package/src/web/public/assets/progress-D-rMgz3w.js +0 -3
- package/src/web/public/assets/refs-D21jmrn6.js +0 -1
- package/src/web/public/assets/repos-B94tMDGs.js +0 -15
- package/src/web/public/assets/settings-DgTt4JG5.js +0 -1
- package/src/web/public/assets/task-B2x5GoV3.js +0 -11
- package/src/web/public/assets/task-utils-By8gLpHY.js +0 -12
|
@@ -3,7 +3,14 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import type { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
4
|
import { Actions } from 'flexlayout-react';
|
|
5
5
|
import type { Model } from 'flexlayout-react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
addTask,
|
|
8
|
+
cloneTask,
|
|
9
|
+
closeManyTasks,
|
|
10
|
+
forkTask,
|
|
11
|
+
patchTaskItem,
|
|
12
|
+
removeTaskItem,
|
|
13
|
+
} from './api.js';
|
|
7
14
|
import { useToast } from '../../components/toast/index.jsx';
|
|
8
15
|
import { openPanel } from '../../workspace.js';
|
|
9
16
|
import { filesToAttachments, persistAtt } from '../../components/md/attachments.js';
|
|
@@ -143,15 +150,12 @@ export function useTaskActions({
|
|
|
143
150
|
return;
|
|
144
151
|
}
|
|
145
152
|
if (!isDraft) {
|
|
146
|
-
const res = await
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
text: b,
|
|
153
|
-
...gp,
|
|
154
|
-
},
|
|
153
|
+
const res = await patchTaskItem({
|
|
154
|
+
cwd: isGlobal ? (projTopic ? projTopic.cwd : undefined) : topic?.cwd,
|
|
155
|
+
key: isGlobal && !projTopic ? GLOBAL_KEY : undefined,
|
|
156
|
+
id: Number(task),
|
|
157
|
+
text: b,
|
|
158
|
+
...gp,
|
|
155
159
|
});
|
|
156
160
|
if (res?.moved) {
|
|
157
161
|
const landedKey = res.key || topicKey;
|
|
@@ -185,19 +189,16 @@ export function useTaskActions({
|
|
|
185
189
|
refreshLocal?.();
|
|
186
190
|
return;
|
|
187
191
|
}
|
|
188
|
-
const res = await
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
? { text: b,
|
|
193
|
-
:
|
|
194
|
-
? {
|
|
195
|
-
:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
...gp,
|
|
199
|
-
},
|
|
200
|
-
});
|
|
192
|
+
const res = await addTask({
|
|
193
|
+
...(groupSubmit
|
|
194
|
+
? { text: b, board: boardCtx.board.id, project: fm.project }
|
|
195
|
+
: fm.project
|
|
196
|
+
? { text: b, project: fm.project }
|
|
197
|
+
: isGlobal
|
|
198
|
+
? { global: true, text: b }
|
|
199
|
+
: { cwd: topic?.cwd, text: b }),
|
|
200
|
+
...gp,
|
|
201
|
+
});
|
|
201
202
|
const newId = res?.task?.id ?? res?.id;
|
|
202
203
|
if (newId != null) {
|
|
203
204
|
const landedKey = res?.key || topicKey;
|
|
@@ -229,14 +230,11 @@ export function useTaskActions({
|
|
|
229
230
|
const name = file.name.replace(/\.md$/i, '');
|
|
230
231
|
await guard(async () => {
|
|
231
232
|
const bodyText = text.startsWith('#') ? text : `# ${name}\n\n${text}`;
|
|
232
|
-
const res = await
|
|
233
|
-
|
|
234
|
-
body: isGlobal
|
|
233
|
+
const res = await addTask(
|
|
234
|
+
isGlobal
|
|
235
235
|
? { global: true, text: bodyText }
|
|
236
|
-
:
|
|
237
|
-
|
|
238
|
-
: { cwd: topic?.cwd, text: bodyText },
|
|
239
|
-
});
|
|
236
|
+
: { cwd: topic?.cwd, text: bodyText },
|
|
237
|
+
);
|
|
240
238
|
toast(`已导入:${file.name}`);
|
|
241
239
|
refreshLocal?.();
|
|
242
240
|
const newId = res?.task?.id ?? res?.id;
|
|
@@ -258,10 +256,7 @@ export function useTaskActions({
|
|
|
258
256
|
});
|
|
259
257
|
if (!ok) return;
|
|
260
258
|
guard(async () => {
|
|
261
|
-
await
|
|
262
|
-
method: 'DELETE',
|
|
263
|
-
body: isGlobal ? { key: GLOBAL_KEY, id: Number(task) } : { cwd: topic?.cwd, id: Number(task) },
|
|
264
|
-
});
|
|
259
|
+
await removeTaskItem(isGlobal ? { key: GLOBAL_KEY, id: Number(task) } : { cwd: topic?.cwd, id: Number(task) });
|
|
265
260
|
toast(`已删除「${title}」`);
|
|
266
261
|
if (model && tabId) model.doAction(Actions.deleteTab(tabId));
|
|
267
262
|
refreshLocal?.();
|
|
@@ -283,10 +278,7 @@ export function useTaskActions({
|
|
|
283
278
|
okText: '标为完成',
|
|
284
279
|
});
|
|
285
280
|
if (summary === null || summary === undefined) return;
|
|
286
|
-
await
|
|
287
|
-
method: 'POST',
|
|
288
|
-
body: { ...scope, ids: [Number(task)], status: 'done', summary: String(summary).trim() },
|
|
289
|
-
});
|
|
281
|
+
await closeManyTasks({ ...scope, ids: [Number(task)], status: 'done', summary: String(summary).trim() });
|
|
290
282
|
toast(`已标为完成 #${task}`);
|
|
291
283
|
} else {
|
|
292
284
|
const ok = await dialog({
|
|
@@ -296,10 +288,7 @@ export function useTaskActions({
|
|
|
296
288
|
okText: '取消任务',
|
|
297
289
|
});
|
|
298
290
|
if (!ok) return;
|
|
299
|
-
await
|
|
300
|
-
method: 'POST',
|
|
301
|
-
body: { ...scope, ids: [Number(task)], status: 'cancelled' },
|
|
302
|
-
});
|
|
291
|
+
await closeManyTasks({ ...scope, ids: [Number(task)], status: 'cancelled' });
|
|
303
292
|
toast(`已取消 #${task}`);
|
|
304
293
|
}
|
|
305
294
|
refreshLocal?.();
|
|
@@ -341,15 +330,12 @@ export function useTaskActions({
|
|
|
341
330
|
const synced = composeText(cur.title, patch.body || body);
|
|
342
331
|
saveDoc(id, { body: synced, title: titleFromMd(synced) });
|
|
343
332
|
try {
|
|
344
|
-
await
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
text: synced,
|
|
351
|
-
},
|
|
352
|
-
});
|
|
333
|
+
await patchTaskItem({
|
|
334
|
+
cwd: isGlobal ? undefined : topic?.cwd,
|
|
335
|
+
key: isGlobal ? GLOBAL_KEY : undefined,
|
|
336
|
+
id: Number(task),
|
|
337
|
+
text: synced,
|
|
338
|
+
});
|
|
353
339
|
setDirty(false);
|
|
354
340
|
refreshLocal?.();
|
|
355
341
|
toast(items.length ? `已添加附件并同步(${items.length})` : '已同步附件');
|
|
@@ -389,10 +375,7 @@ export function useTaskActions({
|
|
|
389
375
|
return;
|
|
390
376
|
}
|
|
391
377
|
guard(async () => {
|
|
392
|
-
const res = await
|
|
393
|
-
method: 'POST',
|
|
394
|
-
body: isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd },
|
|
395
|
-
});
|
|
378
|
+
const res = await cloneTask(isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd });
|
|
396
379
|
toast(`已克隆为新任务 #${res.task?.id ?? res.id}`);
|
|
397
380
|
refreshLocal?.();
|
|
398
381
|
const newId = res?.task?.id ?? res?.id;
|
|
@@ -410,10 +393,7 @@ export function useTaskActions({
|
|
|
410
393
|
return;
|
|
411
394
|
}
|
|
412
395
|
guard(async () => {
|
|
413
|
-
const res = await
|
|
414
|
-
method: 'POST',
|
|
415
|
-
body: isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd },
|
|
416
|
-
});
|
|
396
|
+
const res = await forkTask(isGlobal ? { id: Number(task) } : { id: Number(task), cwd: topic?.cwd });
|
|
417
397
|
toast(`已 Fork 为新任务 #${res.task?.id ?? res.id}(保留任务链)`);
|
|
418
398
|
refreshLocal?.();
|
|
419
399
|
const newId = res?.task?.id ?? res?.id;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 任务链(history / fork 派生)状态与导航。
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import type { Model } from 'flexlayout-react';
|
|
4
|
-
import {
|
|
4
|
+
import { getTaskChain } from './api.js';
|
|
5
5
|
import { GLOBAL_KEY } from '../../modules/board/board-view.js';
|
|
6
6
|
import { openBesideMain } from '../../workspace.js';
|
|
7
7
|
import type { LocalTask, LocalTopic } from '../../types.js';
|
|
@@ -36,7 +36,7 @@ export function useChain({
|
|
|
36
36
|
const q = isGlobal
|
|
37
37
|
? `key=${encodeURIComponent(GLOBAL_KEY)}&id=${Number(task)}`
|
|
38
38
|
: `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
|
|
39
|
-
|
|
39
|
+
getTaskChain(q)
|
|
40
40
|
.then((d) => {
|
|
41
41
|
if (!cancelled) setChainApi(d);
|
|
42
42
|
})
|
|
@@ -3,7 +3,7 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import type { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
4
|
import { Actions } from 'flexlayout-react';
|
|
5
5
|
import type { Model } from 'flexlayout-react';
|
|
6
|
-
import {
|
|
6
|
+
import { addTask, findTaskItem, postReopen } from './api.js';
|
|
7
7
|
import { useToast } from '../../components/toast/index.jsx';
|
|
8
8
|
import { openComposer } from '../../components/md/composer-launch.js';
|
|
9
9
|
import { persistAtt } from '../../components/md/attachments.js';
|
|
@@ -64,7 +64,7 @@ export function useFeedback({
|
|
|
64
64
|
const q = isGlobal
|
|
65
65
|
? `key=${encodeURIComponent(GLOBAL_KEY)}&id=${Number(task)}`
|
|
66
66
|
: `cwd=${encodeURIComponent(topic?.cwd || '')}&id=${Number(task)}`;
|
|
67
|
-
return
|
|
67
|
+
return findTaskItem(q).catch(() => null);
|
|
68
68
|
}, [isDraft, task, isGlobal, topic?.cwd]);
|
|
69
69
|
|
|
70
70
|
/** 反馈:开一块 **md 编辑面板** 写意见;提交后**新建一条任务**(forkOf 指回本条),原任务不动。 */
|
|
@@ -115,12 +115,11 @@ export function useFeedback({
|
|
|
115
115
|
!isDraft && task != null && !/^draft/i.test(String(task))
|
|
116
116
|
? { forkOf: String(task), forkKind: 'reopen' }
|
|
117
117
|
: {};
|
|
118
|
-
const res = await
|
|
119
|
-
|
|
120
|
-
body: isGlobal
|
|
118
|
+
const res = await addTask(
|
|
119
|
+
isGlobal
|
|
121
120
|
? { global: true, text, ...linkFields }
|
|
122
121
|
: { cwd: topic?.cwd, text, ...linkFields },
|
|
123
|
-
|
|
122
|
+
);
|
|
124
123
|
const newId = String(res?.task?.id ?? res?.id ?? '');
|
|
125
124
|
if (!newId) {
|
|
126
125
|
toast('反馈已提交,但未拿到新任务编号');
|
|
@@ -184,23 +183,20 @@ export function useFeedback({
|
|
|
184
183
|
};
|
|
185
184
|
text = buildReopenText(reopenArgs);
|
|
186
185
|
}
|
|
187
|
-
const res = await
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
url: a.url || '',
|
|
202
|
-
})),
|
|
203
|
-
},
|
|
186
|
+
const res = await postReopen({
|
|
187
|
+
...(isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd }),
|
|
188
|
+
id: Number(task),
|
|
189
|
+
...(text ? { text } : {}),
|
|
190
|
+
kind: 'comment',
|
|
191
|
+
quote: quoteText,
|
|
192
|
+
feedback: fb,
|
|
193
|
+
attachments: (attachments || []).map((a: Attachment) => ({
|
|
194
|
+
id: a.id,
|
|
195
|
+
name: a.name,
|
|
196
|
+
type: a.type,
|
|
197
|
+
size: a.size,
|
|
198
|
+
url: a.url || '',
|
|
199
|
+
})),
|
|
204
200
|
});
|
|
205
201
|
// 回写后的正文以服务端为准刷回编辑器(服务端拼装时新段只有服务端知道)
|
|
206
202
|
const landedKey = res?.key || topicKey;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// 时间目标(任务级 timegoal 声明)状态与日志查询。
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { getGoalLog } from './api.js';
|
|
4
4
|
import type { LocalTask } from '../../types.js';
|
|
5
|
-
import type { DeclaredGoal,
|
|
5
|
+
import type { DeclaredGoal, GoalLogState, TimeGoal } from './task-utils.js';
|
|
6
6
|
|
|
7
7
|
interface UseGoalArgs {
|
|
8
8
|
id: string;
|
|
@@ -36,7 +36,7 @@ export function useGoal({ id, isDraft, topicKey, task, taskRow }: UseGoalArgs) {
|
|
|
36
36
|
if (isDraft || !topicKey || task == null) return;
|
|
37
37
|
setGoalLog((s) => ({ ...s, busy: true, error: '' }));
|
|
38
38
|
const q = new URLSearchParams({ id: String(task), key: String(topicKey) });
|
|
39
|
-
|
|
39
|
+
getGoalLog(q.toString())
|
|
40
40
|
.then((d) => setGoalLog((s) => ({ ...s, data: d, busy: false })))
|
|
41
41
|
.catch((e) => setGoalLog((s) => ({ ...s, busy: false, error: String((e as Error).message || e) })));
|
|
42
42
|
}, [isDraft, topicKey, task]);
|
|
@@ -11,7 +11,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
11
11
|
import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
12
12
|
import { Actions } from 'flexlayout-react';
|
|
13
13
|
import type { Model } from 'flexlayout-react';
|
|
14
|
-
import {
|
|
14
|
+
import { getTaskAttachments, previewTask } from './api.js';
|
|
15
15
|
import { useToast } from '../../components/toast/index.jsx';
|
|
16
16
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
17
17
|
import { GLOBAL_KEY } from '../../modules/board/board-view.js';
|
|
@@ -172,7 +172,7 @@ export default function PagePanel({ dirKey, groupId, task, beside = false, tabId
|
|
|
172
172
|
const q = new URLSearchParams({ id: String(t.id) });
|
|
173
173
|
if (topicKey) q.set('key', topicKey);
|
|
174
174
|
else if (t.cwd) q.set('cwd', t.cwd);
|
|
175
|
-
|
|
175
|
+
getTaskAttachments(q.toString())
|
|
176
176
|
.then((d) => { if (alive) setRefAtts((d && (d.attachments || d.data?.attachments)) || []); })
|
|
177
177
|
.catch(() => { if (alive) setRefAtts([]); });
|
|
178
178
|
return () => { alive = false; };
|
|
@@ -257,7 +257,7 @@ export default function PagePanel({ dirKey, groupId, task, beside = false, tabId
|
|
|
257
257
|
? { text: composeText((doc?.title || '').trim() || '未命名任务', doc?.body || '') }
|
|
258
258
|
: { id: Number(task) }),
|
|
259
259
|
};
|
|
260
|
-
|
|
260
|
+
previewTask(body)
|
|
261
261
|
.then((d) => setPreview({ data: d }))
|
|
262
262
|
.catch((e) => setPreview({ error: String((e as Error).message || e) }));
|
|
263
263
|
}, [isGlobal, topic?.cwd, topicKey, isDraft, doc?.title, doc?.body, task, composeText]);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// doc 页的 API 收口:页面组件只消费这里的函数,不直接调 api()(模板约定)。
|
|
2
|
+
//
|
|
3
|
+
// 只搬调用不改语义:路径 / 方法 / body / 编码方式与收口前逐字一致。
|
|
4
|
+
import { api } from '../../api/client.js';
|
|
5
|
+
|
|
6
|
+
/** docs 索引条目清单(GET /api/docs/index 的返回)。 */
|
|
7
|
+
export interface DocsIndex {
|
|
8
|
+
index?: any[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 读 docs 索引(GET /api/docs/index)。 */
|
|
12
|
+
export function getDocsIndex(): Promise<DocsIndex> {
|
|
13
|
+
return api('/api/docs/index');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 参考仓库已登记的文档集(GET /api/repos/docs?id=<ownerKey>)。 */
|
|
17
|
+
export function repoDocs(ownerKey: string): Promise<any> {
|
|
18
|
+
return api('/api/repos/docs?id=' + encodeURIComponent(ownerKey));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 看板清单(GET /api/boards)。 */
|
|
22
|
+
export function listBoards(): Promise<any> {
|
|
23
|
+
return api('/api/boards');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 读 docs 索引(同 getDocsIndex;供引言链接加载用,保留独立命名以便区分用途)。 */
|
|
27
|
+
export function loadDocsIndex(): Promise<any> {
|
|
28
|
+
return api('/api/docs/index');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 某文档的附件清单(GET /api/docs/attachments?ref=<docId>)。 */
|
|
32
|
+
export function docAttachments(docId: string): Promise<any> {
|
|
33
|
+
return api(`/api/docs/attachments?ref=${encodeURIComponent(docId)}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** 文档条目(GET /api/docs/item?ref=… 的返回;原定义在页面里,收口时搬到这里)。 */
|
|
37
|
+
export interface DocItem {
|
|
38
|
+
body?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
summary?: string;
|
|
41
|
+
rel?: string;
|
|
42
|
+
path?: string;
|
|
43
|
+
writable?: boolean;
|
|
44
|
+
external?: boolean;
|
|
45
|
+
docId?: string;
|
|
46
|
+
[k: string]: any;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 按 ref 查单条文档(GET /api/docs/item?ref=…)。 */
|
|
50
|
+
export function getDocItem(ref: string): Promise<DocItem> {
|
|
51
|
+
return api('/api/docs/item?ref=' + encodeURIComponent(ref));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** 改文档正文(PATCH /api/docs/item;返回带 summary 摘要)。 */
|
|
55
|
+
export function updateDocItem(body: { ref?: string; body?: string }): Promise<any> {
|
|
56
|
+
return api('/api/docs/item', { method: 'PATCH', body });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface DocItemBody {
|
|
60
|
+
rel: string;
|
|
61
|
+
body?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 新建 / 写入自有文档(POST /api/docs/item)。 */
|
|
65
|
+
export function createDocItem(body: DocItemBody): Promise<any> {
|
|
66
|
+
return api('/api/docs/item', { method: 'POST', body });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** 删除文档(DELETE /api/docs/item;ref 是文档 id)。 */
|
|
70
|
+
export function removeDocItem(body: { ref?: string }): Promise<any> {
|
|
71
|
+
return api('/api/docs/item', { method: 'DELETE', body });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 把文档登记进参考仓库的文档集(POST /api/repos/docs)。 */
|
|
75
|
+
export function bindRepoDoc(body: { id: string; rel: string }): Promise<any> {
|
|
76
|
+
return api('/api/repos/docs', { method: 'POST', body });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 把文档挂到看板(POST /api/docs/link)。 */
|
|
80
|
+
export function linkBoardDoc(body: { board: string; doc: string }): Promise<any> {
|
|
81
|
+
return api('/api/docs/link', { method: 'POST', body });
|
|
82
|
+
}
|
|
@@ -12,7 +12,20 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
12
12
|
import type { MouseEvent as ReactMouseEvent } from 'react';
|
|
13
13
|
import { Actions } from 'flexlayout-react';
|
|
14
14
|
import type { Model } from 'flexlayout-react';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
bindRepoDoc,
|
|
17
|
+
createDocItem,
|
|
18
|
+
docAttachments,
|
|
19
|
+
getDocsIndex,
|
|
20
|
+
linkBoardDoc,
|
|
21
|
+
listBoards,
|
|
22
|
+
loadDocsIndex,
|
|
23
|
+
removeDocItem,
|
|
24
|
+
getDocItem,
|
|
25
|
+
updateDocItem,
|
|
26
|
+
type DocItem,
|
|
27
|
+
repoDocs,
|
|
28
|
+
} from './api.js';
|
|
16
29
|
import { useToast } from '../../components/toast/index.jsx';
|
|
17
30
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
18
31
|
import { useApp } from '../../app-context.jsx';
|
|
@@ -52,19 +65,6 @@ export interface WikiNav {
|
|
|
52
65
|
}
|
|
53
66
|
|
|
54
67
|
/** GET /api/docs/item 的返回:正文之外还有只读 / 目录 / 缺失几种形态。 */
|
|
55
|
-
interface DocItem {
|
|
56
|
-
body?: string;
|
|
57
|
-
title?: string;
|
|
58
|
-
summary?: string;
|
|
59
|
-
rel?: string;
|
|
60
|
-
path?: string;
|
|
61
|
-
writable?: boolean;
|
|
62
|
-
external?: boolean;
|
|
63
|
-
missing?: boolean;
|
|
64
|
-
dir?: boolean;
|
|
65
|
-
files?: string[];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
68
|
/** 介绍文档集的一行(右侧轨)。 */
|
|
69
69
|
interface IntroLink {
|
|
70
70
|
docId: string;
|
|
@@ -99,7 +99,7 @@ export function useWikiNav(model?: Model | null): WikiNav {
|
|
|
99
99
|
const ensureIndex = useCallback(async () => {
|
|
100
100
|
if (!indexRef.current) {
|
|
101
101
|
try {
|
|
102
|
-
indexRef.current = (await
|
|
102
|
+
indexRef.current = (await getDocsIndex()).index || [];
|
|
103
103
|
} catch {
|
|
104
104
|
indexRef.current = [];
|
|
105
105
|
}
|
|
@@ -190,7 +190,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
190
190
|
const load = useCallback(async () => {
|
|
191
191
|
setError('');
|
|
192
192
|
try {
|
|
193
|
-
const d = await
|
|
193
|
+
const d = await getDocItem(docId || '');
|
|
194
194
|
setDoc(d);
|
|
195
195
|
setDirty(false);
|
|
196
196
|
} catch (e) {
|
|
@@ -211,7 +211,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
if (ownerKind === 'repo') {
|
|
214
|
-
|
|
214
|
+
repoDocs(ownerKey)
|
|
215
215
|
.then((d) => {
|
|
216
216
|
const out: IntroLink[] = [];
|
|
217
217
|
const push = (x: { rel?: string; path?: string; note?: string } | null | undefined, main: boolean) => {
|
|
@@ -233,7 +233,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
233
233
|
return;
|
|
234
234
|
}
|
|
235
235
|
// board:从看板数据里取 docLinks(看板在 /api/boards,不在 /api/repos)
|
|
236
|
-
|
|
236
|
+
listBoards()
|
|
237
237
|
.then((d) => {
|
|
238
238
|
const boards = (d && d.boards) || (Array.isArray(d) ? d : []);
|
|
239
239
|
const b = boards.find((x: { id?: string; key?: string }) => x.id === ownerKey || x.key === ownerKey);
|
|
@@ -253,7 +253,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
253
253
|
// 双链索引:一次拉取(刷新页签即刷新;不监听文件系统是第一块的取舍)
|
|
254
254
|
const [known, setKnown] = useState<Set<string> | null>(null); // 双链已解析名集合(渲染未解析态用)
|
|
255
255
|
useEffect(() => {
|
|
256
|
-
|
|
256
|
+
loadDocsIndex()
|
|
257
257
|
.then((d) => {
|
|
258
258
|
const set = new Set<string>();
|
|
259
259
|
for (const x of d.index || []) {
|
|
@@ -273,7 +273,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
273
273
|
useEffect(() => {
|
|
274
274
|
let alive = true;
|
|
275
275
|
if (!docId) return undefined;
|
|
276
|
-
|
|
276
|
+
docAttachments(docId)
|
|
277
277
|
.then((d) => { if (alive) setAttList((d && (d.attachments || d.data?.attachments)) || []); })
|
|
278
278
|
.catch(() => { if (alive) setAttList([]); });
|
|
279
279
|
return () => { alive = false; };
|
|
@@ -333,15 +333,12 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
333
333
|
? introDirFromRef(docId)
|
|
334
334
|
: (ownerKind === 'repo' ? `repo/${ownerKey}` : `board/${boardName || ownerKey}`);
|
|
335
335
|
const rel = `${base}/reference/${slug}.md`;
|
|
336
|
-
await
|
|
337
|
-
method: 'POST',
|
|
338
|
-
body: { rel, body: `# ${String(name).trim() || slug}\n\n(待补)\n` },
|
|
339
|
-
});
|
|
336
|
+
await createDocItem({ rel, body: `# ${String(name).trim() || slug}\n\n(待补)\n` });
|
|
340
337
|
try {
|
|
341
338
|
if (ownerKind === 'repo') {
|
|
342
|
-
await
|
|
339
|
+
await bindRepoDoc({ id: ownerKey, rel });
|
|
343
340
|
} else {
|
|
344
|
-
await
|
|
341
|
+
await linkBoardDoc({ board: ownerKey, doc: rel });
|
|
345
342
|
}
|
|
346
343
|
} catch {
|
|
347
344
|
/* 已在集里 / 旧数据:文件已创建即可打开 */
|
|
@@ -357,7 +354,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
357
354
|
guard(async () => {
|
|
358
355
|
if (!doc || !writable) return;
|
|
359
356
|
const nextBody = doc.body;
|
|
360
|
-
const res = await
|
|
357
|
+
const res = await updateDocItem({ ref: docId, body: nextBody });
|
|
361
358
|
setDoc((d) => (d ? { ...d, body: nextBody, summary: res.summary } : d));
|
|
362
359
|
setDirty(false);
|
|
363
360
|
clearHistory(histRef.current, docId);
|
|
@@ -445,13 +442,13 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
445
442
|
if (!rel || rel === prevRel) return;
|
|
446
443
|
if (!/\.md$/i.test(rel)) return toast('文档路径必须以 .md 结尾');
|
|
447
444
|
try {
|
|
448
|
-
await
|
|
445
|
+
await createDocItem({ rel, body: prevBody });
|
|
449
446
|
} catch (e) {
|
|
450
447
|
// 目标已存在等冲突由后端报错,原样透出
|
|
451
448
|
toast(`重命名失败:${String((e as Error).message || e)}`);
|
|
452
449
|
return;
|
|
453
450
|
}
|
|
454
|
-
await
|
|
451
|
+
await removeDocItem({ ref: docId });
|
|
455
452
|
clearHistory(histRef.current, docId);
|
|
456
453
|
toast(`已重命名为:${rel}`);
|
|
457
454
|
openByDocId('rel:' + rel, null, openExtra);
|
|
@@ -471,7 +468,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
471
468
|
okText: '删除',
|
|
472
469
|
});
|
|
473
470
|
if (!ok) return;
|
|
474
|
-
await
|
|
471
|
+
await removeDocItem({ ref: docId });
|
|
475
472
|
toast(`已删除:${docRel || docId}`);
|
|
476
473
|
if (model && tabId) model.doAction(Actions.deleteTab(tabId));
|
|
477
474
|
});
|
|
@@ -487,7 +484,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
487
484
|
: String(docId || '');
|
|
488
485
|
if (!rel) return;
|
|
489
486
|
const name = rel.replace(/\.md$/i, '').split('/').pop() || '未命名文档';
|
|
490
|
-
await
|
|
487
|
+
await createDocItem({ rel, body: `# ${name}\n\n(待补)\n` });
|
|
491
488
|
toast(`已创建:${rel}`);
|
|
492
489
|
await load();
|
|
493
490
|
});
|
|
@@ -501,7 +498,7 @@ export default function DocPanel({ docId, repoKey, boardKey, boardName, model, t
|
|
|
501
498
|
<span className="docp-tag ext">外部目录 · 只读</span>
|
|
502
499
|
</div>
|
|
503
500
|
<div className="docp-files">
|
|
504
|
-
{(doc.files || []).map((f) => (
|
|
501
|
+
{(doc.files || []).map((f: string) => (
|
|
505
502
|
<button key={f} className="docp-file" onClick={() => openByDocId('path:' + f, null)}>
|
|
506
503
|
{f}
|
|
507
504
|
</button>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// group 页的 API 收口:页面组件只消费这里的函数,不直接调 api()(模板约定)。
|
|
2
|
+
//
|
|
3
|
+
// 只搬调用不改语义:路径 / 方法 / body 与收口前逐字一致。
|
|
4
|
+
import { api } from '../../api/client.js';
|
|
5
|
+
|
|
6
|
+
/** 恢复软删除的任务(POST /api/localtasks/tasks/restore;CLI localtask task-restore 等价)。 */
|
|
7
|
+
export function restoreTask(body: { cwd?: string; id?: number | string }): Promise<any> {
|
|
8
|
+
return api('/api/localtasks/tasks/restore', { method: 'POST', body });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 删除单个本地任务(DELETE /api/localtasks/item;purge=true 彻底删除不可恢复)。 */
|
|
12
|
+
export function removeTask(body: { cwd?: string; id?: number | string; purge?: boolean }): Promise<any> {
|
|
13
|
+
return api('/api/localtasks/item', { method: 'DELETE', body });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 队列内调序(PATCH /api/localtasks/reorder;beforeId / afterId 二选一)。 */
|
|
17
|
+
export function reorderTask(body: {
|
|
18
|
+
cwd?: string;
|
|
19
|
+
id?: number | string;
|
|
20
|
+
beforeId?: number | string;
|
|
21
|
+
afterId?: number | string;
|
|
22
|
+
}): Promise<any> {
|
|
23
|
+
return api('/api/localtasks/reorder', { method: 'PATCH', body });
|
|
24
|
+
}
|
|
@@ -22,7 +22,7 @@ import DeletedPanel from '../dir/deleted-panel.jsx';
|
|
|
22
22
|
import TaskRow from '../../components/task-panel/task-row.jsx';
|
|
23
23
|
import Pager, { usePager } from '../../components/pager.jsx';
|
|
24
24
|
import { useApp } from '../../app-context.jsx';
|
|
25
|
-
import {
|
|
25
|
+
import { removeTask, reorderTask, restoreTask } from './api.js';
|
|
26
26
|
import { openPanel } from '../../workspace.js';
|
|
27
27
|
import { openTemplateEditor } from '../../panels.jsx';
|
|
28
28
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
@@ -296,10 +296,7 @@ export default function GroupView({ dirKey, rows, repoData, model }: {
|
|
|
296
296
|
const restoreDeleted = async (t: DeletedRow) => {
|
|
297
297
|
if (!t) return;
|
|
298
298
|
try {
|
|
299
|
-
await
|
|
300
|
-
method: 'POST',
|
|
301
|
-
body: { cwd: t.memberCwd, id: t.id },
|
|
302
|
-
});
|
|
299
|
+
await restoreTask({ cwd: t.memberCwd, id: t.id });
|
|
303
300
|
toast(`已恢复 #${t.id}`);
|
|
304
301
|
if (app.refreshLocal) await app.refreshLocal();
|
|
305
302
|
} catch (e) {
|
|
@@ -318,10 +315,7 @@ export default function GroupView({ dirKey, rows, repoData, model }: {
|
|
|
318
315
|
});
|
|
319
316
|
if (!ok) return;
|
|
320
317
|
try {
|
|
321
|
-
await
|
|
322
|
-
method: 'DELETE',
|
|
323
|
-
body: { cwd: t.memberCwd, id: t.id, purge: true },
|
|
324
|
-
});
|
|
318
|
+
await removeTask({ cwd: t.memberCwd, id: t.id, purge: true });
|
|
325
319
|
toast(`已彻底删除 #${t.id}`);
|
|
326
320
|
if (app.refreshLocal) await app.refreshLocal();
|
|
327
321
|
} catch (e) {
|
|
@@ -384,13 +378,10 @@ export default function GroupView({ dirKey, rows, repoData, model }: {
|
|
|
384
378
|
return;
|
|
385
379
|
}
|
|
386
380
|
try {
|
|
387
|
-
await
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
id: drag.id,
|
|
392
|
-
...(zone === 'before' ? { beforeId: Number(task.id) } : { afterId: Number(task.id) }),
|
|
393
|
-
},
|
|
381
|
+
await reorderTask({
|
|
382
|
+
cwd,
|
|
383
|
+
id: drag.id,
|
|
384
|
+
...(zone === 'before' ? { beforeId: Number(task.id) } : { afterId: Number(task.id) }),
|
|
394
385
|
});
|
|
395
386
|
if (app.refreshLocal) await app.refreshLocal();
|
|
396
387
|
} catch (err) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// overview 页的 API 收口:页面组件只消费这里的函数,不直接调 api()(模板约定)。
|
|
2
|
+
//
|
|
3
|
+
// 只搬调用不改语义:路径 / 方法 / body 与收口前逐字一致。
|
|
4
|
+
// 入参类型按页面实际用法声明(ids 是 number,服务端归一化层会统一转成字符串)。
|
|
5
|
+
import { api } from '../../api/client.js';
|
|
6
|
+
|
|
7
|
+
/** 批量软删除返回:count=成功删除数;missing=没找到的编号。 */
|
|
8
|
+
export interface RemoveManyResult {
|
|
9
|
+
count?: number;
|
|
10
|
+
missing?: number[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 批量软删除任务(DELETE /api/localtasks/items;CLI localtask remove-many 等价)。 */
|
|
14
|
+
export function removeTasks(input: { key: string; ids: number[] }): Promise<any> {
|
|
15
|
+
return api('/api/localtasks/items', { method: 'DELETE', body: input });
|
|
16
|
+
}
|