dsh-workbench-tasks 5.5.4 → 5.9.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/lib/client.js +3588 -4346
- package/lib/index.js +18 -4
- package/lib/infra/backup.js +6 -15
- package/lib/infra/config.js +130 -418
- package/lib/infra/sync.js +1 -2
- package/lib/stats/activity-calendar.js +19 -9
- package/lib/stats/difficulty-bins.js +8 -5
- package/lib/stats/node-scope.js +151 -0
- package/lib/stats/stats-today.js +8 -4
- package/lib/stats/stats.js +81 -56
- package/lib/stats/timeline-stats.js +29 -9
- package/lib/task/write/task-bulk.js +3 -1
- package/lib/task/write/task-claim.js +8 -4
- package/lib/task/write/task-create.js +1 -1
- package/lib/task/write/task-update.js +3 -3
- package/lib/tasks.js +3 -2
- package/lib/timeline/timeline-sync.js +2 -0
- package/package.json +6 -12
package/lib/index.js
CHANGED
|
@@ -11,6 +11,18 @@
|
|
|
11
11
|
* 5.2.23:预览面板收尾——只保留右上角 × 一个关闭入口,滚动收敛到内容区(标题栏与 × 固定),滚动条跟随主题。
|
|
12
12
|
* 5.2.25:日期输入统一到共享日期控件(lib/date-picker.cjs)——创建/编辑弹窗的发布、目标、完成、关闭日期与统计页自定义范围都用 DatePicker/RangePicker。
|
|
13
13
|
* 5.2.24:事件趋势折线图可交互——图例点击开关序列(至少保留一条)、按日期悬停/键盘取值提示、量程按可见序列重算;序列顺序改为发布→目标→接取→关闭→完成(换序不换色)。
|
|
14
|
+
* 5.6.0:统计页新增「任务节点」全局范围——`tasks.statsReport` / `tasks.activityCalendar` 接收 nodeId,
|
|
15
|
+
* 按 parent_id 子树过滤全部统计口径(totals/分布/趋势/账龄/清单/排行/今日/热力图),
|
|
16
|
+
* 根节点与省略 nodeId 保持全库旧口径;非法或已删除节点回退根节点并在 scope.fallback 与 warnings 留痕。
|
|
17
|
+
* 5.7.0:删除 tasks.config*(旧配置兼容 action)/configSet/configReset/configOptions 与 configScheme* 兼容 action,
|
|
18
|
+
* 配置与方案统一由宿主配置中心(wb.configCenter*)提供;插件不再自带「设置」页。
|
|
19
|
+
* 5.8.0:终态不再清空接取时间——进入已完成/已关闭/已重启时只清 claim_token,claimed_at 与 owner 作为历史事实保留;
|
|
20
|
+
* `tasks.statsReport.lists.recentClaimed` 去掉状态过滤、只认真实接取时间戳并带出 owner,
|
|
21
|
+
* 已彻底完成或关闭的任务按真实接取时间倒序列出;历史被清空的行可用 scripts/refresh-claimed-at-from-publish.mjs 回填。
|
|
22
|
+
* 5.9.0:时间线统计页改为可控条数——`tasks.timelineStats` 的 topLimit 默认 20(仍 1–100),
|
|
23
|
+
* 回执 `top` 增 `total` 便于界面回显「共 N 条 / 显示前 M 条」;逾期清单与排行上限解耦,
|
|
24
|
+
* 固定取前 20 条并按逾期任务数降序(此前复用 topLimit 且顺序不是从严到宽);
|
|
25
|
+
* 排行表补完成率进度条、零值收敛、逾期徽标与成员分片,窄屏可横向滚动。
|
|
14
26
|
*/
|
|
15
27
|
|
|
16
28
|
import { registerActivityCalendarAction } from "./stats/activity-calendar.js";
|
|
@@ -28,7 +40,7 @@ import { taskSync } from "./infra/sync.js";
|
|
|
28
40
|
import { registerTaskActions } from "./tasks.js";
|
|
29
41
|
import { registerTreeActions } from "./tree/tree.js";
|
|
30
42
|
import { registerOverviewAction } from "./stats/overview.js";
|
|
31
|
-
import {
|
|
43
|
+
import { bindHostConfig, configDecl } from "./infra/config.js";
|
|
32
44
|
import { TASK_ROLES } from "./publisher/roles.js";
|
|
33
45
|
|
|
34
46
|
export const inject = ["workbench"];
|
|
@@ -78,6 +90,8 @@ function registerActionSchemaAction(api, defs, domain) {
|
|
|
78
90
|
/** 旧 addon 形态的初始化函数,单测/兼容直接调用。 */
|
|
79
91
|
export function setup(api) {
|
|
80
92
|
domainApi = api;
|
|
93
|
+
// 配置读写全部委托宿主配置中心(api.config 缓存 + onChange 失效),插件不再持有配置表。
|
|
94
|
+
bindHostConfig(api);
|
|
81
95
|
if (typeof api.now === "function") bindClock(api.now);
|
|
82
96
|
ensureSchema(api.db, api.log);
|
|
83
97
|
// 标签来源登记:标签域(tags ≥ 1.7.1)要求 item_type 先注册才能写 tag_mapping。
|
|
@@ -88,7 +102,6 @@ export function setup(api) {
|
|
|
88
102
|
registerTimelineStatsAction(api);
|
|
89
103
|
registerTreeActions(api);
|
|
90
104
|
registerOverviewAction(api);
|
|
91
|
-
registerConfigActions(api);
|
|
92
105
|
registerActionSchemaAction(api, actionDefs, "wb-addon-tasks");
|
|
93
106
|
if (typeof api.registerSearchProvider === "function") {
|
|
94
107
|
api.registerSearchProvider({
|
|
@@ -113,13 +126,15 @@ export function apply(ctx) {
|
|
|
113
126
|
host.registerDomain({
|
|
114
127
|
id: "wb-addon-tasks",
|
|
115
128
|
title: "任务",
|
|
116
|
-
description: "任务树 +
|
|
129
|
+
description: "任务树 + 统计/记录/时间线/工作区/Action 五个视图:紧急/已关闭/已开启/已完成/总览,可按标签筛选(需安装标签插件),附统计报表(数据浏览走宿主统一「数据」页;配置已交给宿主统一配置中心)",
|
|
117
130
|
version: ADDON_VERSION,
|
|
118
131
|
// 更新来源:宿主「插件」页按它查新版本并安装(只认官方 npm registry)。
|
|
119
132
|
update: { source: "npm", package: "dsh-workbench-tasks" },
|
|
120
133
|
category: "work",
|
|
121
134
|
roles: TASK_ROLES,
|
|
122
135
|
tables: ["task", "task_node", "task_timeline", "task_timeline_link", "task_workspace", "task_workspace_link"],
|
|
136
|
+
// 配置声明交给宿主:宿主据此建 host_config_scheme、渲染统一配置页并迁移旧 task_config_scheme。
|
|
137
|
+
config: configDecl(),
|
|
123
138
|
sync: taskSync,
|
|
124
139
|
// 贡献声明:任务往「条目操作」插槽里挂「从邮件建任务」。
|
|
125
140
|
// 与 mail 的 slotHosts 配对;对方没装时 capabilities 会写明"暂无落点"。
|
|
@@ -129,7 +144,6 @@ export function apply(ctx) {
|
|
|
129
144
|
{ id: "stats", title: { zh: "统计", en: "Stats" } },
|
|
130
145
|
{ id: "tasks", title: { zh: "记录", en: "Records" } },
|
|
131
146
|
{ id: "timeline", title: { zh: "时间线", en: "Timeline" } },
|
|
132
|
-
{ id: "config", title: { zh: "配置", en: "Config" } },
|
|
133
147
|
],
|
|
134
148
|
capability: {
|
|
135
149
|
summary: "记录可执行、可交付的工作项(任务),支持任务树、时间线、重启链与工作区关联。",
|
package/lib/infra/backup.js
CHANGED
|
@@ -97,18 +97,6 @@ function workspaceLinkValues(row) {
|
|
|
97
97
|
return [expected, workspaceId, taskId, ...stamps(row)];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function schemeValues(row) {
|
|
101
|
-
const id = identity(row.id, "task_config_scheme.id");
|
|
102
|
-
const name = asText(row.name).trim();
|
|
103
|
-
if (!name) throw new Error("配置方案名称为空:" + id);
|
|
104
|
-
let data = row.data;
|
|
105
|
-
if (typeof data === "string") {
|
|
106
|
-
try { data = JSON.parse(data); } catch { throw new Error("配置方案 JSON 损坏:" + id); }
|
|
107
|
-
}
|
|
108
|
-
if (!data || typeof data !== "object" || Array.isArray(data)) throw new Error("配置方案内容不是对象:" + id);
|
|
109
|
-
return [id, name, JSON.stringify(data), ...stamps(row)];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
100
|
const DEFINITIONS = [
|
|
113
101
|
["task_node", "taskNodes", "id,name,description,type,parent_id,path,sort,depth,created_at,updated_at,deleted_at,rev", nodeValues],
|
|
114
102
|
["task_timeline", "taskTimelines", "id,title,description,created_at,updated_at,deleted_at,rev", timelineValues],
|
|
@@ -116,7 +104,8 @@ const DEFINITIONS = [
|
|
|
116
104
|
["task_timeline_link", "taskTimelineLinks", "id,task_id,timeline_id,created_at,updated_at,deleted_at,rev", linkValues],
|
|
117
105
|
["task_workspace", "taskWorkspaces", "id,title,name,description,dir,created_at,updated_at,deleted_at,rev", workspaceValues],
|
|
118
106
|
["task_workspace_link", "taskWorkspaceLinks", "id,workspace_id,task_id,created_at,updated_at,deleted_at,rev", workspaceLinkValues],
|
|
119
|
-
|
|
107
|
+
// 配置方案已移交宿主统一配置中心(host_config_scheme),不再随任务备份导入导出;
|
|
108
|
+
// 旧备份里的 configSchemes 键会被忽略,不影响恢复。
|
|
120
109
|
];
|
|
121
110
|
|
|
122
111
|
function identity(value, field) {
|
|
@@ -157,8 +146,8 @@ function prepareBackup(data) {
|
|
|
157
146
|
const prepared = [];
|
|
158
147
|
for (const [table, key, columnText, convert] of DEFINITIONS) {
|
|
159
148
|
if (legacy && (table === "task_timeline" || table === "task_timeline_link")) continue;
|
|
160
|
-
//
|
|
161
|
-
const optional = table === "task_workspace" || table === "task_workspace_link"
|
|
149
|
+
// 旧版备份没有后来新增的表(工作区两张),缺键按空数组处理,不阻断恢复。
|
|
150
|
+
const optional = table === "task_workspace" || table === "task_workspace_link";
|
|
162
151
|
const rows = key === "taskDeps" ? [] : (data[key] === undefined && optional ? [] : data[key]);
|
|
163
152
|
if (!Array.isArray(rows)) throw new Error("任务备份结构不完整:" + key);
|
|
164
153
|
const columns = columnText.split(",");
|
|
@@ -284,6 +273,8 @@ export function importTasksData(api, raw, options) {
|
|
|
284
273
|
api.emit?.("task-timelines-changed", { source: "import" });
|
|
285
274
|
}
|
|
286
275
|
// 接取列不变量:旧备份没有 owner/claim_token,status=4 的行恢复后需要人工补齐。
|
|
276
|
+
// 只检查 status=4:5.8.0 起终态(1/2/3)允许并应当保留 claimed_at 与 owner(历史事实),
|
|
277
|
+
// 只要求 claim_token 为空,所以终态行不算「缺列」。
|
|
287
278
|
const claimBroken = [];
|
|
288
279
|
for (const id of importedTaskIds) {
|
|
289
280
|
const row = db.prepare("SELECT id,status,owner,claim_token FROM task WHERE id=?").get(id);
|