nx-kv 0.48.1 → 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 +20 -0
- package/package.json +1 -1
- package/src/modules/auth/actions/auth-login.ts +11 -4
- package/src/modules/auth/actions/auth-logout.ts +9 -4
- package/src/modules/auth/actions/auth-me.ts +9 -4
- package/src/modules/auth/actions/auth-status.ts +9 -4
- package/src/modules/bundled/actions/bundled-get.ts +12 -4
- package/src/modules/bundled/actions/bundled-groups.ts +9 -4
- package/src/modules/bundled/actions/bundled-install.ts +13 -4
- package/src/modules/bundled/actions/bundled-list.ts +9 -4
- package/src/modules/db/actions/db-backup.ts +10 -4
- package/src/modules/db/actions/db-migrate.ts +10 -4
- package/src/modules/db/actions/db-status.ts +9 -4
- package/src/modules/db/actions/db-verify.ts +9 -4
- package/src/modules/docs/actions/doc-add.ts +12 -4
- package/src/modules/docs/actions/doc-attach-note.ts +11 -4
- package/src/modules/docs/actions/doc-attach.ts +18 -4
- package/src/modules/docs/actions/doc-attachments.ts +9 -4
- package/src/modules/docs/actions/doc-detach.ts +11 -4
- package/src/modules/docs/actions/doc-get.ts +9 -4
- package/src/modules/docs/actions/doc-list.ts +9 -4
- package/src/modules/docs/actions/doc-remove.ts +9 -4
- package/src/modules/docs/actions/doc-update.ts +12 -4
- package/src/modules/docs/actions/docs-bind.ts +13 -4
- package/src/modules/docs/actions/docs-index.ts +9 -4
- package/src/modules/docs/actions/docs-link.ts +14 -4
- package/src/modules/docs/actions/docs-notebind.ts +13 -4
- package/src/modules/docs/actions/docs-seed.ts +9 -4
- package/src/modules/file/actions/file-content.ts +10 -4
- package/src/modules/file/actions/file-get.ts +10 -4
- package/src/modules/file/actions/file-list.ts +11 -4
- package/src/modules/file/actions/file-orphans.ts +9 -4
- package/src/modules/file/actions/file-prune.ts +10 -4
- package/src/modules/file/actions/file-remove.ts +10 -4
- package/src/modules/file/actions/file-sync.ts +13 -4
- package/src/modules/file/actions/file-upload.ts +15 -4
- package/src/modules/localtask/actions/localtask-add.ts +24 -4
- package/src/modules/localtask/actions/localtask-attach-note.ts +13 -4
- package/src/modules/localtask/actions/localtask-attach.ts +22 -4
- package/src/modules/localtask/actions/localtask-attachments.ts +11 -4
- package/src/modules/localtask/actions/localtask-cancel.ts +10 -4
- package/src/modules/localtask/actions/localtask-cancelMany.ts +11 -4
- package/src/modules/localtask/actions/localtask-chain.ts +11 -4
- package/src/modules/localtask/actions/localtask-claim.ts +12 -4
- package/src/modules/localtask/actions/localtask-clone.ts +11 -4
- package/src/modules/localtask/actions/localtask-closeMany.ts +13 -4
- package/src/modules/localtask/actions/localtask-config.ts +19 -4
- package/src/modules/localtask/actions/localtask-detach.ts +13 -4
- package/src/modules/localtask/actions/localtask-done.ts +12 -4
- package/src/modules/localtask/actions/localtask-events.ts +12 -4
- package/src/modules/localtask/actions/localtask-fork.ts +11 -4
- package/src/modules/localtask/actions/localtask-get.ts +11 -4
- package/src/modules/localtask/actions/localtask-importRemote.ts +13 -4
- package/src/modules/localtask/actions/localtask-list.ts +9 -4
- package/src/modules/localtask/actions/localtask-presence.ts +9 -4
- package/src/modules/localtask/actions/localtask-preview.ts +13 -4
- package/src/modules/localtask/actions/localtask-prune.ts +10 -4
- package/src/modules/localtask/actions/localtask-remove.ts +12 -4
- package/src/modules/localtask/actions/localtask-removeMany.ts +12 -4
- package/src/modules/localtask/actions/localtask-reopen.ts +17 -4
- package/src/modules/localtask/actions/localtask-reorder.ts +15 -4
- package/src/modules/localtask/actions/localtask-task-restore.ts +11 -4
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +11 -4
- package/src/modules/localtask/actions/localtask-topic-add.ts +10 -4
- package/src/modules/localtask/actions/localtask-topic-remove.ts +11 -4
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +12 -4
- package/src/modules/localtask/actions/localtask-update.ts +22 -4
- package/src/modules/localtask/actions/localtask-wait.ts +13 -4
- package/src/modules/localtask/actions/task-move.ts +21 -4
- package/src/modules/repos/actions/board-add.ts +10 -4
- package/src/modules/repos/actions/board-assign.ts +12 -4
- package/src/modules/repos/actions/board-export.ts +9 -4
- package/src/modules/repos/actions/board-get.ts +9 -4
- package/src/modules/repos/actions/board-import.ts +9 -4
- package/src/modules/repos/actions/board-list.ts +9 -4
- package/src/modules/repos/actions/board-note.ts +11 -4
- package/src/modules/repos/actions/board-prefix.ts +10 -4
- package/src/modules/repos/actions/board-prune.ts +11 -4
- package/src/modules/repos/actions/board-rekey.ts +11 -4
- package/src/modules/repos/actions/board-remove.ts +9 -4
- package/src/modules/repos/actions/board-update.ts +11 -4
- package/src/modules/repos/actions/repo-add.ts +17 -4
- package/src/modules/repos/actions/repo-bind-topics.ts +10 -4
- package/src/modules/repos/actions/repo-bind.ts +12 -4
- package/src/modules/repos/actions/repo-clone.ts +14 -4
- package/src/modules/repos/actions/repo-detect.ts +9 -4
- package/src/modules/repos/actions/repo-doc-add.ts +15 -4
- package/src/modules/repos/actions/repo-doc-list.ts +9 -4
- package/src/modules/repos/actions/repo-doc-remove.ts +10 -4
- package/src/modules/repos/actions/repo-export.ts +12 -4
- package/src/modules/repos/actions/repo-get.ts +9 -4
- package/src/modules/repos/actions/repo-import-diff.ts +10 -4
- package/src/modules/repos/actions/repo-import.ts +14 -4
- package/src/modules/repos/actions/repo-key-migrate.ts +9 -4
- package/src/modules/repos/actions/repo-key-refresh.ts +11 -4
- package/src/modules/repos/actions/repo-key-set.ts +11 -4
- package/src/modules/repos/actions/repo-knowledge.ts +10 -4
- package/src/modules/repos/actions/repo-list.ts +9 -4
- package/src/modules/repos/actions/repo-open.ts +9 -4
- package/src/modules/repos/actions/repo-ref-add.ts +13 -4
- package/src/modules/repos/actions/repo-ref-backfill.ts +10 -4
- package/src/modules/repos/actions/repo-ref-check.ts +9 -4
- package/src/modules/repos/actions/repo-ref-clone.ts +16 -4
- package/src/modules/repos/actions/repo-ref-note.ts +12 -4
- package/src/modules/repos/actions/repo-ref-of.ts +9 -4
- package/src/modules/repos/actions/repo-ref-sync.ts +10 -4
- package/src/modules/repos/actions/repo-remote-check.ts +10 -4
- package/src/modules/repos/actions/repo-remote-list.ts +9 -4
- package/src/modules/repos/actions/repo-remote-pick.ts +10 -4
- package/src/modules/repos/actions/repo-remote.ts +11 -4
- package/src/modules/repos/actions/repo-remove.ts +9 -4
- package/src/modules/repos/actions/repo-scan.ts +11 -4
- package/src/modules/repos/actions/repo-update.ts +21 -4
- package/src/modules/setting/actions/setting-get.ts +9 -4
- package/src/modules/setting/actions/setting-set.ts +12 -4
- package/src/modules/system/actions/bootstrap.ts +7 -4
- package/src/modules/system/actions/health.ts +6 -3
- package/src/modules/system/actions/routes.ts +11 -3
- package/src/modules/system/routes.ts +1 -1
- package/src/modules/tasktool/actions/timegoal-check.ts +11 -4
- package/src/modules/tasktool/actions/timegoal-clear.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-list.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-log.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-prune.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-set.ts +11 -4
- package/src/modules/tasktool/actions/timegoal-show.ts +10 -4
- package/src/modules/tasktool/actions/timegoal-update.ts +11 -4
- package/src/modules/templates/actions/templates-add.ts +17 -4
- package/src/modules/templates/actions/templates-default.ts +13 -4
- package/src/modules/templates/actions/templates-list.ts +11 -4
- package/src/modules/templates/actions/templates-remove.ts +9 -4
- package/src/modules/templates/actions/templates-update.ts +15 -4
- package/src/modules/todo/actions/group-add.ts +10 -4
- package/src/modules/todo/actions/group-current.ts +9 -4
- package/src/modules/todo/actions/group-get.ts +9 -4
- package/src/modules/todo/actions/group-list.ts +9 -4
- package/src/modules/todo/actions/group-members.ts +9 -4
- package/src/modules/todo/actions/group-remove.ts +9 -4
- package/src/modules/todo/actions/group-update.ts +11 -4
- package/src/modules/todo/actions/group-use.ts +9 -4
- package/src/modules/todo/actions/prompt-get.ts +10 -4
- package/src/modules/todo/actions/prompt-remove.ts +10 -4
- package/src/modules/todo/actions/prompt-set.ts +11 -4
- package/src/modules/todo/actions/todo-add.ts +11 -4
- package/src/modules/todo/actions/todo-archive.ts +10 -4
- package/src/modules/todo/actions/todo-attach.ts +17 -4
- package/src/modules/todo/actions/todo-attachments.ts +12 -4
- package/src/modules/todo/actions/todo-done.ts +13 -4
- package/src/modules/todo/actions/todo-freeze.ts +12 -4
- package/src/modules/todo/actions/todo-get.ts +12 -4
- package/src/modules/todo/actions/todo-list.ts +11 -4
- package/src/modules/todo/actions/todo-remove.ts +12 -4
- package/src/modules/todo/actions/todo-unfreeze.ts +12 -4
- package/src/modules/todo/actions/todo-update.ts +15 -4
- package/src/modules/todo/actions/topic-add.ts +10 -4
- package/src/modules/todo/actions/topic-list.ts +9 -4
- package/src/modules/todo/actions/topic-remove.ts +10 -4
- package/src/runtime/action-decorator.ts +2 -2
- package/src/runtime/codegen.ts +26 -41
- package/src/runtime/registry.ts +2 -2
- package/src/web/frontend/api/client.generated.ts +384 -532
- 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 -30
- 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
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// 仍是软删除(CLI localtask task restore 可恢复)。
|
|
20
20
|
import RouteBreadcrumb from '../../components/layout/route-crumb.jsx';
|
|
21
21
|
import { useMemo, useState } from 'react';
|
|
22
|
-
import {
|
|
22
|
+
import { removeTasks } from './api.js';
|
|
23
23
|
import { useToast } from '../../components/toast/index.jsx';
|
|
24
24
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
25
25
|
import StatusTag from '../../components/status-tag/index.jsx';
|
|
@@ -158,7 +158,7 @@ export default function Overview({ rows, onNavigate, refreshLocal }: OverviewPro
|
|
|
158
158
|
const errs = [];
|
|
159
159
|
for (const g of groups) {
|
|
160
160
|
try {
|
|
161
|
-
const r = await
|
|
161
|
+
const r = await removeTasks({ key: g.key, ids: g.ids });
|
|
162
162
|
n += Number(r?.count ?? 0);
|
|
163
163
|
miss += (r?.missing || []).length;
|
|
164
164
|
} catch (e) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// progress 页的 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: {
|
|
15
|
+
key?: string;
|
|
16
|
+
cwd?: string;
|
|
17
|
+
ids: (number | undefined)[];
|
|
18
|
+
}): Promise<any> {
|
|
19
|
+
return api('/api/localtasks/items', { method: 'DELETE', body: input });
|
|
20
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// 过滤,统计随筛选范围走。非成员队列里「组发布」的旧任务(frontmatter.board 指向
|
|
10
10
|
// 本组)仍兜底收录。
|
|
11
11
|
import { useEffect, useMemo, useState } from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import { removeTasks } from './api.js';
|
|
13
13
|
import { Icon } from '../../components/icons.jsx';
|
|
14
14
|
import { GLOBAL_KEY, isGroupTask } from '../../modules/board/board-view.js';
|
|
15
15
|
import { parseFrontmatter, taskToProgress } from '../../modules/md/md-parse.js';
|
|
@@ -304,16 +304,13 @@ export default function ProgressPanel({
|
|
|
304
304
|
if (bucket) bucket.ids.push(c.taskId);
|
|
305
305
|
}
|
|
306
306
|
for (const { cwd, ids } of byTopic.values()) {
|
|
307
|
-
const res = await
|
|
307
|
+
const res = await removeTasks({ cwd, ids });
|
|
308
308
|
n += res?.count ?? ids.length;
|
|
309
309
|
miss += res?.missing?.length || 0;
|
|
310
310
|
}
|
|
311
311
|
} else {
|
|
312
312
|
const ids = pickedCards.map((c) => c.id);
|
|
313
|
-
const res = await
|
|
314
|
-
method: 'DELETE',
|
|
315
|
-
body: { ...(isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd }), ids },
|
|
316
|
-
});
|
|
313
|
+
const res = await removeTasks({ ...(isGlobal ? { key: GLOBAL_KEY } : { cwd: topic?.cwd }), ids });
|
|
317
314
|
n = res?.count ?? ids.length;
|
|
318
315
|
miss = res?.missing?.length || 0;
|
|
319
316
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// refs 页的 API 收口:页面组件只消费这里的函数,不直接调 api()(模板约定)。
|
|
2
|
+
//
|
|
3
|
+
// 只搬调用不改语义:路径 / 方法 / 编码方式与收口前逐字一致。
|
|
4
|
+
import { api } from '../../api/client.js';
|
|
5
|
+
|
|
6
|
+
/** 参考仓库已登记的文档集(GET /api/repos/docs?id=<repoKey>)。 */
|
|
7
|
+
export function repoDocs(repoKey: string): Promise<any> {
|
|
8
|
+
return api('/api/repos/docs?id=' + encodeURIComponent(repoKey));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** 看板详情(GET /api/boards/<boardKey>)。 */
|
|
12
|
+
export function boardDetail(boardKey: string): Promise<any> {
|
|
13
|
+
return api('/api/boards/' + encodeURIComponent(String(boardKey)));
|
|
14
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 点一行 → 在工作区开该文档的页签(带归属上下文,双链可跳)。
|
|
6
6
|
// 数据面与 DocsModal 同源:repo → GET /api/repos/docs;board → GET /api/boards/:id。
|
|
7
7
|
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { boardDetail, repoDocs } from './api.js';
|
|
9
9
|
import { Icon } from '../../components/icons.jsx';
|
|
10
10
|
import { useWikiNav } from '../doc/index.jsx';
|
|
11
11
|
import type { DocOpenExtra } from '../doc/index.jsx';
|
|
@@ -88,9 +88,7 @@ export default function RefsPanel({ repoKey, boardKey, boardName, model }: {
|
|
|
88
88
|
setErr('');
|
|
89
89
|
(async () => {
|
|
90
90
|
try {
|
|
91
|
-
const d = repoKey
|
|
92
|
-
? await api('/api/repos/docs?id=' + encodeURIComponent(repoKey))
|
|
93
|
-
: await api('/api/boards/' + encodeURIComponent(String(boardKey)));
|
|
91
|
+
const d = repoKey ? await repoDocs(repoKey) : await boardDetail(String(boardKey));
|
|
94
92
|
if (alive) setData(d);
|
|
95
93
|
} catch (e) {
|
|
96
94
|
if (alive) { setData(null); setErr(String((e as Error).message || e)); }
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// repos 页的 API 收口:页面组件(index / 各弹窗 / 分区组件)只消费这里的函数,
|
|
2
|
+
// 不直接调 api()(模板约定)。
|
|
3
|
+
//
|
|
4
|
+
// 只搬调用不改语义:路径 / 方法 / body / 编码方式与收口前逐字一致。
|
|
5
|
+
import { api } from '../../api/client.js';
|
|
6
|
+
import type { BoardsPayload, RefCheckRow, RepoRecord } from './repo-table.js';
|
|
7
|
+
|
|
8
|
+
/** 参考仓库体检结果(GET /api/repos/ref/check;原定义在页面里,收口时搬到这里)。 */
|
|
9
|
+
export interface RefCheckPayload {
|
|
10
|
+
refRepos?: RefCheckRow[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 存储根设置(GET/POST /api/setting;原定义在 ref-panel 里,收口时搬到这里)。 */
|
|
14
|
+
export interface SettingInfo {
|
|
15
|
+
gitRepoRoot?: string;
|
|
16
|
+
gitDevRoot?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 仓库的远程地址清单(GET /api/repos/remote/list;原定义在弹窗里,收口时搬到这里)。 */
|
|
20
|
+
/** 单个远程地址(原定义在弹窗里,收口时搬到这里)。 */
|
|
21
|
+
export interface RemoteItem {
|
|
22
|
+
name: string;
|
|
23
|
+
url: string;
|
|
24
|
+
side?: string;
|
|
25
|
+
[k: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RemoteInfo {
|
|
29
|
+
key: string;
|
|
30
|
+
name: string;
|
|
31
|
+
current?: string;
|
|
32
|
+
remotes: RemoteItem[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 远程存在性检查结果(GET /api/repos/remote/check;原定义在弹窗里,收口时搬到这里)。 */
|
|
36
|
+
export interface CheckState {
|
|
37
|
+
url: string;
|
|
38
|
+
status: string;
|
|
39
|
+
detail?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 仓库清单(GET /api/repos)。 */
|
|
43
|
+
export function listRepos(): Promise<RepoRecord[]> {
|
|
44
|
+
return api('/api/repos');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** 看板清单(GET /api/boards)。 */
|
|
48
|
+
export function listBoards(): Promise<BoardsPayload> {
|
|
49
|
+
return api('/api/boards');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** 参考仓库体检(GET /api/repos/ref/check)。 */
|
|
53
|
+
export function fetchRefCheck(): Promise<RefCheckPayload> {
|
|
54
|
+
return api('/api/repos/ref/check');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 读本机设置(GET /api/setting)。 */
|
|
58
|
+
export function getSettings(): Promise<any> {
|
|
59
|
+
return api('/api/setting');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 改本机设置(POST /api/setting;只改传入项)。 */
|
|
63
|
+
export function saveSettings(body: any): Promise<any> {
|
|
64
|
+
return api('/api/setting', { method: 'POST', body });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 仓库的远程地址清单(GET /api/repos/remote/list?id=…)。 */
|
|
68
|
+
export function listRemotes(repoKey: string): Promise<any> {
|
|
69
|
+
return api('/api/repos/remote/list?id=' + encodeURIComponent(repoKey));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** 远程存在性检查(GET /api/repos/remote/check?id=…[&url=…])。 */
|
|
73
|
+
export function checkRemote(key: string, url?: string): Promise<any> {
|
|
74
|
+
return api(
|
|
75
|
+
'/api/repos/remote/check?id=' +
|
|
76
|
+
encodeURIComponent(key) +
|
|
77
|
+
(url ? '&url=' + encodeURIComponent(url) : ''),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// —— 绑定关系(ref ↔ board / repo)——
|
|
82
|
+
|
|
83
|
+
/** 绑定参考仓库到看板 / 开发仓库(POST /api/repos/bind;remove=true 摘除)。 */
|
|
84
|
+
export function bindRef(body: { id?: string; board?: string[]; repo?: string[]; remove?: boolean }): Promise<any> {
|
|
85
|
+
return api('/api/repos/bind', { method: 'POST', body });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** 给参考仓库写备注(POST /api/repos/ref/note)。 */
|
|
89
|
+
export function refNote(body: { id?: string; board?: string; note?: string }): Promise<any> {
|
|
90
|
+
return api('/api/repos/ref/note', { method: 'POST', body });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** 同步参考仓库(POST /api/repos/ref/sync;{id} 单个或 {all:true} 全量)。 */
|
|
94
|
+
export function refSync(body: { id?: string; all?: boolean }): Promise<any> {
|
|
95
|
+
return api('/api/repos/ref/sync', { method: 'POST', body });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** 克隆参考仓库(POST /api/repos/ref/clone)。 */
|
|
99
|
+
export function refClone(body: any): Promise<any> {
|
|
100
|
+
return api('/api/repos/ref/clone', { method: 'POST', body });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// —— 看板 ——
|
|
104
|
+
|
|
105
|
+
/** 改看板(PATCH /api/boards/:id)。 */
|
|
106
|
+
export function updateBoard(id: string, body: any): Promise<any> {
|
|
107
|
+
return api(`/api/boards/${encodeURIComponent(id)}`, { method: 'PATCH', body });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** 建看板(POST /api/boards)。 */
|
|
111
|
+
export function createBoard(body: any): Promise<any> {
|
|
112
|
+
return api('/api/boards', { method: 'POST', body });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** 删看板(DELETE /api/boards/:id;body 空对象与收口前一致)。 */
|
|
116
|
+
export function deleteBoard(id: string) {
|
|
117
|
+
return api(`/api/boards/${encodeURIComponent(id)}`, { method: 'DELETE', body: {} });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** 导入看板布局(POST /api/boards/import)。 */
|
|
121
|
+
export function importBoards(body: { json?: string }): Promise<any> {
|
|
122
|
+
return api('/api/boards/import', { method: 'POST', body });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** 导出看板布局(GET /api/boards/export)。 */
|
|
126
|
+
export function exportBoards(): Promise<any> {
|
|
127
|
+
return api('/api/boards/export');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** 看板改 key(POST /api/boards/rekey)。 */
|
|
131
|
+
export function rekeyBoard(body: { from?: any; to?: any }): Promise<any> {
|
|
132
|
+
return api('/api/boards/rekey', { method: 'POST', body });
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** 把未绑定队列绑到看板(POST /api/boards/assign)。 */
|
|
136
|
+
export function assignBoard(body: { key?: string; board?: string; remove?: boolean }): Promise<any> {
|
|
137
|
+
return api('/api/boards/assign', { method: 'POST', body });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** 清理空看板(POST /api/boards/prune;apply=false 只预览)。 */
|
|
141
|
+
export function pruneBoards(body: { apply?: boolean }): Promise<any> {
|
|
142
|
+
return api('/api/boards/prune', { method: 'POST', body });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// —— 仓库本体 ——
|
|
146
|
+
|
|
147
|
+
/** 登记仓库(POST /api/repos)。 */
|
|
148
|
+
export function addRepo(body: any): Promise<any> {
|
|
149
|
+
return api('/api/repos', { method: 'POST', body });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** 改仓库(PATCH /api/repos/:id)。 */
|
|
153
|
+
export function updateRepo(id: string, body: any): Promise<any> {
|
|
154
|
+
return api(`/api/repos/${encodeURIComponent(id)}`, { method: 'PATCH', body });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** 删仓库(DELETE /api/repos/:id)。 */
|
|
158
|
+
export function removeRepo(id: string): Promise<any> {
|
|
159
|
+
return api(`/api/repos/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** 登记前探测 remote(POST /api/repos/detect)。 */
|
|
163
|
+
export function detectRepo(body: { path?: string }): Promise<any> {
|
|
164
|
+
return api('/api/repos/detect', { method: 'POST', body });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** 在文件管理器 / IDE 打开仓库目录(POST /api/repos/open)。 */
|
|
168
|
+
export function openRepo(body: { id?: string }): Promise<any> {
|
|
169
|
+
return api('/api/repos/open', { method: 'POST', body });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** 克隆仓库并登记(POST /api/repos/clone)。 */
|
|
173
|
+
export function cloneRepo(body: { remote?: string; key?: string; name?: string; type?: string }): Promise<any> {
|
|
174
|
+
return api('/api/repos/clone', { method: 'POST', body });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 收紧远程地址(POST /api/repos/remote/pick)。 */
|
|
178
|
+
export function pickRemote(body: { id?: string; url?: string }): Promise<any> {
|
|
179
|
+
return api('/api/repos/remote/pick', { method: 'POST', body });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// —— 文档 ——
|
|
183
|
+
|
|
184
|
+
/** 全仓文档搜索(GET /api/docs)。 */
|
|
185
|
+
export function listDocs(): Promise<any> {
|
|
186
|
+
return api('/api/docs');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** 新建 / 写入文档(POST /api/docs/item)。 */
|
|
190
|
+
export function createDocItem(body: { rel?: string; body?: string }) {
|
|
191
|
+
return api('/api/docs/item', { method: 'POST', body });
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** 删除文档(DELETE /api/docs/item)。 */
|
|
195
|
+
export function removeDocItem(body: { ref?: string }) {
|
|
196
|
+
return api('/api/docs/item', { method: 'DELETE', body });
|
|
197
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// 绑定关系弹窗:dev 侧绑定(一个开发仓库所属组挂哪些参考)+ 组级绑定描述编辑。
|
|
2
2
|
// v4 语义:参考仓库绑定在「组」上,组内所有仓库共享;仓库不属于任何组时无处可挂。
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { bindRef, refNote } from './api.js';
|
|
5
5
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
6
6
|
import { Modal } from '../../components/popup/index.jsx';
|
|
7
7
|
import { Button } from '../../components/button/index.jsx';
|
|
@@ -43,11 +43,11 @@ export default function BindRepoModal({ repo, refRepos, boardList, currentRefs,
|
|
|
43
43
|
const want = new Set(Object.keys(sel).filter((k) => sel[k]));
|
|
44
44
|
for (const rid of want) {
|
|
45
45
|
if (current.has(rid)) continue;
|
|
46
|
-
for (const g of groups) await
|
|
46
|
+
for (const g of groups) await bindRef({ id: rid, board: [g.id] });
|
|
47
47
|
}
|
|
48
48
|
for (const rid of current) {
|
|
49
49
|
if (want.has(rid)) continue;
|
|
50
|
-
for (const g of groups) await
|
|
50
|
+
for (const g of groups) await bindRef({ id: rid, board: [g.id], remove: true });
|
|
51
51
|
}
|
|
52
52
|
onClose();
|
|
53
53
|
await onSaved();
|
|
@@ -102,10 +102,7 @@ export function LinkNoteModal({ linkNoteFor, onClose, onSaved }: {
|
|
|
102
102
|
const [text, setText] = useState(() => note || '');
|
|
103
103
|
|
|
104
104
|
const save = () => guard(async () => {
|
|
105
|
-
await
|
|
106
|
-
method: 'POST',
|
|
107
|
-
body: { id: ref.key, board: groupId, note: text },
|
|
108
|
-
});
|
|
105
|
+
await refNote({ id: ref.key, board: groupId, note: text });
|
|
109
106
|
onClose();
|
|
110
107
|
await onSaved();
|
|
111
108
|
toast('已保存组级绑定描述');
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 分组里;取消某份副本只摘那个分组的引用,仓库本体纹丝不动。
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import type { ChangeEvent } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { createBoard, deleteBoard, exportBoards, importBoards, updateBoard } from './api.js';
|
|
9
9
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
10
10
|
import { useDialog, Modal } from '../../components/popup/index.jsx';
|
|
11
11
|
import { Button } from '../../components/button/index.jsx';
|
|
@@ -45,8 +45,8 @@ export default function BoardAdminModal({ boardList, unassigned, onClose, onFilt
|
|
|
45
45
|
// 描述是文档:编辑时不再提交 desc(领域描述在组介绍文档里写);
|
|
46
46
|
// 新建时给的那段仍是「初始正文」,后端落成 board/<组>.md
|
|
47
47
|
if (!boardForm.id) body.desc = boardForm.desc.trim() || undefined;
|
|
48
|
-
if (boardForm.id) await
|
|
49
|
-
else await
|
|
48
|
+
if (boardForm.id) await updateBoard(encodeURIComponent(boardForm.id), body);
|
|
49
|
+
else await createBoard(body);
|
|
50
50
|
setBoardForm(null);
|
|
51
51
|
await reload.boards();
|
|
52
52
|
});
|
|
@@ -57,13 +57,13 @@ export default function BoardAdminModal({ boardList, unassigned, onClose, onFilt
|
|
|
57
57
|
danger: true,
|
|
58
58
|
});
|
|
59
59
|
if (!ok) return;
|
|
60
|
-
await
|
|
60
|
+
await deleteBoard(encodeURIComponent(b.id));
|
|
61
61
|
await Promise.all([reload.repos(), reload.boards()]);
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
const doImport = () => guard(async () => {
|
|
65
65
|
if (!impText.trim()) return;
|
|
66
|
-
const r = await
|
|
66
|
+
const r = await importBoards({ json: impText });
|
|
67
67
|
setImpOpen(false);
|
|
68
68
|
setImpText('');
|
|
69
69
|
toast(`已导入:新建 ${r.created} 个看板、合并 ${r.merged} 个、匹配仓库 ${r.matched} 个`
|
|
@@ -72,7 +72,7 @@ export default function BoardAdminModal({ boardList, unassigned, onClose, onFilt
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
const doExport = () => guard(async () => {
|
|
75
|
-
const r = await
|
|
75
|
+
const r = await exportBoards();
|
|
76
76
|
setExpText(JSON.stringify(r, null, 2));
|
|
77
77
|
});
|
|
78
78
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// 再叠加关键词过滤;绑定 chip 可点,直接跳到宿主。
|
|
3
3
|
// 文档自己不记宿主,宿主关系散在仓库/分组的绑定字段上(docHosts 反推)。
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { createDocItem, listDocs, removeDocItem } from './api.js';
|
|
6
6
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
7
7
|
import { useDialog, Modal } from '../../components/popup/index.jsx';
|
|
8
8
|
import { Button } from '../../components/button/index.jsx';
|
|
@@ -48,7 +48,7 @@ export default function DocSearchModal({ repos, boardList, onClose, onFilter, re
|
|
|
48
48
|
const [docKw, setDocKw] = useState('');
|
|
49
49
|
|
|
50
50
|
const loadDocs = useCallback(async () => {
|
|
51
|
-
const d = await
|
|
51
|
+
const d = await listDocs().catch(() => null);
|
|
52
52
|
setDocs((d && d.docs) || []);
|
|
53
53
|
}, []);
|
|
54
54
|
useEffect(() => { loadDocs(); }, [loadDocs]);
|
|
@@ -166,7 +166,7 @@ export default function DocSearchModal({ repos, boardList, onClose, onFilter, re
|
|
|
166
166
|
// 新建文档:默认路径 → 落空文档 → 打开编辑器(一步到位,不弹命名框)
|
|
167
167
|
const createDoc = () => guard(async () => {
|
|
168
168
|
const rel = nextDocRel('note/untitled');
|
|
169
|
-
await
|
|
169
|
+
await createDocItem({ rel, body: '' }).catch(() => {});
|
|
170
170
|
onClose(); // 先关弹窗,落点是编辑器
|
|
171
171
|
openByDocId('rel:' + rel);
|
|
172
172
|
await loadDocs();
|
|
@@ -181,7 +181,7 @@ export default function DocSearchModal({ repos, boardList, onClose, onFilter, re
|
|
|
181
181
|
danger: true,
|
|
182
182
|
});
|
|
183
183
|
if (!ok) return;
|
|
184
|
-
await
|
|
184
|
+
await removeDocItem({ ref: d.docId });
|
|
185
185
|
toast(`已删除:${d.rel}`);
|
|
186
186
|
await Promise.all([loadDocs(), reload.repos(), reload.boards()]);
|
|
187
187
|
});
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// 分组里;取消某份副本只摘那个分组的引用,仓库本体纹丝不动。
|
|
16
16
|
import RouteBreadcrumb from '../../components/layout/route-crumb.jsx';
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
18
|
-
import {
|
|
18
|
+
import { bindRef, createDocItem, fetchRefCheck, listBoards, listRepos, openRepo, refSync, removeRepo, type RefCheckPayload } from './api.js';
|
|
19
19
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
20
20
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
21
21
|
import MemberPicker from '../../components/board/member-picker.jsx';
|
|
@@ -51,10 +51,6 @@ import type { LinkNoteTarget } from './bind-modals.jsx';
|
|
|
51
51
|
import RemoteModal from './remote-modal.jsx';
|
|
52
52
|
|
|
53
53
|
/** /api/repos/ref/check 的出站形状。 */
|
|
54
|
-
interface RefCheckPayload {
|
|
55
|
-
refRepos?: RefCheckRow[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
54
|
/** 「查看详情」弹窗的目标(行内入口)。 */
|
|
59
55
|
interface DocsTarget {
|
|
60
56
|
kind: string;
|
|
@@ -74,13 +70,13 @@ export default function ReposView() {
|
|
|
74
70
|
const [boards, setBoards] = useState<BoardsPayload | null>(null); // { boards: [...], unassigned: [...] }
|
|
75
71
|
const [refCheck, setRefCheck] = useState<RefCheckPayload | null>(null); // repo.ref.check 的结果(状态徽标的数据面)
|
|
76
72
|
const loadRepos = useCallback(async () => {
|
|
77
|
-
setRepos((await
|
|
73
|
+
setRepos((await listRepos().catch(() => [])) || []);
|
|
78
74
|
}, []);
|
|
79
75
|
const loadBoards = useCallback(async () => {
|
|
80
|
-
setBoards(await
|
|
76
|
+
setBoards(await listBoards().catch(() => null));
|
|
81
77
|
}, []);
|
|
82
78
|
const loadRefCheck = useCallback(async () => {
|
|
83
|
-
setRefCheck(await
|
|
79
|
+
setRefCheck(await fetchRefCheck().catch(() => null));
|
|
84
80
|
}, []);
|
|
85
81
|
useEffect(() => { loadRepos(); loadBoards(); loadRefCheck(); }, [loadRepos, loadBoards, loadRefCheck]);
|
|
86
82
|
|
|
@@ -289,19 +285,19 @@ export default function ReposView() {
|
|
|
289
285
|
// ---- 跨区块共享动作 ----
|
|
290
286
|
|
|
291
287
|
const syncOne = (r: RepoRecord) => guard(async () => {
|
|
292
|
-
const d = await
|
|
288
|
+
const d = await refSync({ id: r.id });
|
|
293
289
|
toast(d.status === 'updated' ? `已更新: ${d.name}` : d.status === 'upToDate' ? `${d.name} 已是最新` : `${d.name}: ${d.status} ${d.output || ''}`);
|
|
294
290
|
});
|
|
295
291
|
|
|
296
292
|
// 从某个组摘除这条参考绑定(只摘组级,不动仓库级)
|
|
297
293
|
const unbindOne = (ref: RepoRecord, groupId: string) => guard(async () => {
|
|
298
|
-
await
|
|
294
|
+
await bindRef({ id: ref.key, board: [groupId], remove: true });
|
|
299
295
|
await Promise.all([loadRepos(), loadBoards(), loadRefCheck()]);
|
|
300
296
|
});
|
|
301
297
|
|
|
302
298
|
// 从某个开发仓库摘除这条参考绑定(只摘仓库级,不影响组级)
|
|
303
299
|
const unbindRepo = (ref: RepoRecord, repoKey: string) => guard(async () => {
|
|
304
|
-
await
|
|
300
|
+
await bindRef({ id: ref.key, repo: [repoKey], remove: true });
|
|
305
301
|
await Promise.all([loadRepos(), loadBoards(), loadRefCheck()]);
|
|
306
302
|
});
|
|
307
303
|
|
|
@@ -312,14 +308,14 @@ export default function ReposView() {
|
|
|
312
308
|
|
|
313
309
|
const rowAct = (act: string, r: RepoRecord) => guard(async () => {
|
|
314
310
|
if (act === 'open') {
|
|
315
|
-
await
|
|
311
|
+
await openRepo({ id: r.id });
|
|
316
312
|
} else if (act === 'del') {
|
|
317
313
|
const ok = await dialog({
|
|
318
314
|
message: `删除仓库登记「${r.name}」?(仅移除登记,磁盘文件不受影响;各看板里的归属同步摘除)`,
|
|
319
315
|
danger: true,
|
|
320
316
|
});
|
|
321
317
|
if (!ok) return;
|
|
322
|
-
await
|
|
318
|
+
await removeRepo(encodeURIComponent(r.id));
|
|
323
319
|
await reload.all();
|
|
324
320
|
}
|
|
325
321
|
});
|
|
@@ -329,7 +325,7 @@ export default function ReposView() {
|
|
|
329
325
|
// create 失败(已存在 / 并发)一律当成功:下一步是打开,存在与否由文档页自己判断。
|
|
330
326
|
const openDescDoc = (rel?: string, title?: string) => guard(async () => {
|
|
331
327
|
if (!rel) return;
|
|
332
|
-
await
|
|
328
|
+
await createDocItem({ rel, body: `# ${title || rel}\n\n` }).catch(() => {});
|
|
333
329
|
openByDocId('rel:' + rel);
|
|
334
330
|
loadRepos();
|
|
335
331
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 三条出口:接到本机仓库(改关系,不动身份)/ 克隆到本地 / 直接移除。
|
|
6
6
|
// 「无远程地址」的占位克隆不回来,只能清 —— 所以给一条批量清理。
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { assignBoard, cloneRepo, pruneBoards, rekeyBoard } from './api.js';
|
|
9
9
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
10
10
|
import { useDialog } from '../../components/popup/index.jsx';
|
|
11
11
|
import { Button } from '../../components/button/index.jsx';
|
|
@@ -50,10 +50,7 @@ export default function PendingSection({ boards, devRepos, refRepos, reload }: {
|
|
|
50
50
|
|
|
51
51
|
const clonePending = (m: PendingItem) =>
|
|
52
52
|
guard(async () => {
|
|
53
|
-
await
|
|
54
|
-
method: 'POST',
|
|
55
|
-
body: { remote: m.remote, key: m.key, name: m.name || undefined, type: 'dev' },
|
|
56
|
-
});
|
|
53
|
+
await cloneRepo({ remote: m.remote, key: m.key, name: m.name || undefined, type: 'dev' });
|
|
57
54
|
toast(`已克隆并登记:${m.name || m.key}`);
|
|
58
55
|
reload.repos();
|
|
59
56
|
reload.boards();
|
|
@@ -64,7 +61,7 @@ export default function PendingSection({ boards, devRepos, refRepos, reload }: {
|
|
|
64
61
|
// 那样会把真实身份降级成 local/xxx,再导出就把假 key 传播出去。
|
|
65
62
|
const bindPending = (m: PendingItem, target: string) =>
|
|
66
63
|
guard(async () => {
|
|
67
|
-
await
|
|
64
|
+
await rekeyBoard({ from: m.key, to: target });
|
|
68
65
|
toast(`已把「${m.name || m.key}」这个位置接到本机仓库`);
|
|
69
66
|
reload.repos();
|
|
70
67
|
reload.boards();
|
|
@@ -78,7 +75,7 @@ export default function PendingSection({ boards, devRepos, refRepos, reload }: {
|
|
|
78
75
|
placeholder: '本机仓库:id / key / 名称 / 绝对路径',
|
|
79
76
|
});
|
|
80
77
|
if (!which) return;
|
|
81
|
-
await
|
|
78
|
+
await rekeyBoard({ from: m.key, to: which });
|
|
82
79
|
toast('已重绑——这个位置现在指向本机仓库');
|
|
83
80
|
reload.repos();
|
|
84
81
|
reload.boards();
|
|
@@ -87,10 +84,7 @@ export default function PendingSection({ boards, devRepos, refRepos, reload }: {
|
|
|
87
84
|
const removePending = (m: PendingItem) =>
|
|
88
85
|
guard(async () => {
|
|
89
86
|
if (!confirm(`把「${m.name || m.key}」从组「${m.board}」里移除?\n\n只摘这个组里的位置:本机仓库与看板本身都不动。`)) return;
|
|
90
|
-
await
|
|
91
|
-
method: 'POST',
|
|
92
|
-
body: { key: m.key, board: m.boardId, remove: true },
|
|
93
|
-
});
|
|
87
|
+
await assignBoard({ key: m.key, board: m.boardId, remove: true });
|
|
94
88
|
toast(`已从组「${m.board}」移除`);
|
|
95
89
|
reload.boards();
|
|
96
90
|
});
|
|
@@ -99,14 +93,14 @@ export default function PendingSection({ boards, devRepos, refRepos, reload }: {
|
|
|
99
93
|
// 先预览再落盘,清单给到人看。
|
|
100
94
|
const prunePending = () =>
|
|
101
95
|
guard(async () => {
|
|
102
|
-
const dry = await
|
|
96
|
+
const dry = await pruneBoards({ apply: false });
|
|
103
97
|
if (!dry?.total) {
|
|
104
98
|
toast('没有可清理的占位(有远程地址的那些留着等 clone)');
|
|
105
99
|
return;
|
|
106
100
|
}
|
|
107
101
|
const names = dry.items.map((i: { name?: string; board?: string }) => `· ${i.name}(组 ${i.board})`).join('\n');
|
|
108
102
|
if (!confirm(`清理 ${dry.total} 个无来源占位?\n\n${names}\n\n它们没有远程地址,克隆不回来,只能删。`)) return;
|
|
109
|
-
await
|
|
103
|
+
await pruneBoards({ apply: true });
|
|
110
104
|
toast(`已清理 ${dry.total} 个占位`);
|
|
111
105
|
reload.boards();
|
|
112
106
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// 绑定一律选项式(「绑定」弹窗里勾选),不手填字符串。
|
|
7
7
|
// 做成弹窗:它是「隔一阵来维护一次」的东西,平铺会把开发仓库主表顶到两屏之外。
|
|
8
8
|
import { useCallback, useEffect, useState } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { bindRef, getSettings, refClone, refSync, saveSettings, type SettingInfo } from './api.js';
|
|
10
10
|
import { Copyable } from '../../components/ui.jsx';
|
|
11
11
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
12
12
|
import { Modal } from '../../components/popup/index.jsx';
|
|
@@ -15,11 +15,6 @@ import { DocsEntry } from './repo-table.jsx';
|
|
|
15
15
|
import type { BoardRecord, RefBackLink, RefCheckMap, RepoRecord, ReposReload } from './repo-table.js';
|
|
16
16
|
|
|
17
17
|
/** /api/setting 里本面板用到的两项(存储根)。 */
|
|
18
|
-
interface SettingInfo {
|
|
19
|
-
gitRepoRoot?: string;
|
|
20
|
-
gitDevRoot?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
18
|
/** 克隆提交体:绑定走选项式(bind=开发仓库 id,board=看板 id)。 */
|
|
24
19
|
interface CloneBody {
|
|
25
20
|
url: string;
|
|
@@ -66,7 +61,7 @@ export default function RefPanel({
|
|
|
66
61
|
const [bindSel, setBindSel] = useState<Record<string, boolean>>({}); // { 'repo:<key>': bool, 'board:<key>': bool }
|
|
67
62
|
|
|
68
63
|
const loadSetting = useCallback(async () => {
|
|
69
|
-
setSettingInfo(await
|
|
64
|
+
setSettingInfo(await getSettings().catch(() => null));
|
|
70
65
|
}, []);
|
|
71
66
|
useEffect(() => { loadSetting(); }, [loadSetting]);
|
|
72
67
|
|
|
@@ -75,7 +70,7 @@ export default function RefPanel({
|
|
|
75
70
|
if (rootsForm.gitRepoRoot.trim()) body.gitRepoRoot = rootsForm.gitRepoRoot.trim();
|
|
76
71
|
if (rootsForm.gitDevRoot.trim()) body.gitDevRoot = rootsForm.gitDevRoot.trim();
|
|
77
72
|
if (!Object.keys(body).length) return;
|
|
78
|
-
setSettingInfo(await
|
|
73
|
+
setSettingInfo(await saveSettings(body));
|
|
79
74
|
setRootsOpen(false);
|
|
80
75
|
toast('已保存存储根目录');
|
|
81
76
|
});
|
|
@@ -95,7 +90,7 @@ export default function RefPanel({
|
|
|
95
90
|
const boardBinds = boardList.filter((b) => cloneTargets['board:' + b.id]).map((b) => b.id);
|
|
96
91
|
if (repoBinds.length) body.bind = repoBinds;
|
|
97
92
|
if (boardBinds.length) body.board = boardBinds;
|
|
98
|
-
const r = await
|
|
93
|
+
const r = await refClone(body);
|
|
99
94
|
setCloneOpen(false);
|
|
100
95
|
setCloneForm({ url: '', name: '', desc: '', depth: '1' });
|
|
101
96
|
setCloneTargets({});
|
|
@@ -104,7 +99,7 @@ export default function RefPanel({
|
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
const syncAll = () => guard(async () => {
|
|
107
|
-
const d = await
|
|
102
|
+
const d = await refSync({ all: true });
|
|
108
103
|
const bad = d.results.filter((x: { status?: string }) => x.status !== 'updated' && x.status !== 'upToDate');
|
|
109
104
|
toast(`同步 ${d.synced} 个${bad.length ? `,${bad.length} 个有问题(见检查结果)` : ',全部完成'}`);
|
|
110
105
|
await reload.refCheck();
|
|
@@ -140,9 +135,9 @@ export default function RefPanel({
|
|
|
140
135
|
if (k.startsWith('board:')) {
|
|
141
136
|
const b = boardOf(k);
|
|
142
137
|
if (!b) continue;
|
|
143
|
-
await
|
|
138
|
+
await bindRef({ id: bindFor.key, board: [b.id] });
|
|
144
139
|
} else {
|
|
145
|
-
await
|
|
140
|
+
await bindRef({ id: bindFor.key, repo: [k.slice('repo:'.length)] });
|
|
146
141
|
}
|
|
147
142
|
}
|
|
148
143
|
for (const k of oldKeys) {
|
|
@@ -150,9 +145,9 @@ export default function RefPanel({
|
|
|
150
145
|
if (k.startsWith('board:')) {
|
|
151
146
|
const b = boardOf(k);
|
|
152
147
|
if (!b) continue;
|
|
153
|
-
await
|
|
148
|
+
await bindRef({ id: bindFor.key, board: [b.id], remove: true });
|
|
154
149
|
} else {
|
|
155
|
-
await
|
|
150
|
+
await bindRef({ id: bindFor.key, repo: [k.slice('repo:'.length)], remove: true });
|
|
156
151
|
}
|
|
157
152
|
}
|
|
158
153
|
setBindFor(null);
|