@linxin666/dsh-client-ui-task-board 0.1.19 → 0.1.20
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 +25 -31
- package/lib/client.js.map +1 -1
- package/lib/index.js +43 -1
- package/lib/types/client/PluginSettingsCard.d.ts +1 -1
- package/lib/types/client/board/status-key.d.ts +4 -0
- package/lib/types/core/scheduler.d.ts +3 -0
- package/lib/types/core/tasks.d.ts +3 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/mount-once.d.ts +24 -0
- package/package.json +1 -1
- package/src/client/board/TaskBoard.tsx +1 -9
- package/src/client/board/TaskDetail.tsx +1 -9
- package/src/client/board/status-key.ts +11 -0
- package/src/core/scheduler.ts +12 -2
- package/src/core/store.ts +1 -6
- package/src/core/tasks.ts +1 -1
- package/src/core/use-cases/task-update.ts +1 -6
- package/src/index.ts +4 -1
- package/src/mount-once.ts +48 -0
package/lib/client.js
CHANGED
|
@@ -59,7 +59,7 @@ window.__ModuleLoader__.load({
|
|
|
59
59
|
return typeof value === "string" && ALL_STATUSES.includes(value);
|
|
60
60
|
}
|
|
61
61
|
/** Normalize one optional execution-target string: trim; blank collapses to undefined. */
|
|
62
|
-
function normalizeTargetId
|
|
62
|
+
function normalizeTargetId(value) {
|
|
63
63
|
const trimmed = value?.trim();
|
|
64
64
|
return trimmed === void 0 || trimmed === "" ? void 0 : trimmed;
|
|
65
65
|
}
|
|
@@ -74,8 +74,8 @@ window.__ModuleLoader__.load({
|
|
|
74
74
|
createdAt: now,
|
|
75
75
|
updatedAt: now,
|
|
76
76
|
executions: [],
|
|
77
|
-
workspaceId: normalizeTargetId
|
|
78
|
-
mode: normalizeTargetId
|
|
77
|
+
workspaceId: normalizeTargetId(input.workspaceId),
|
|
78
|
+
mode: normalizeTargetId(input.mode),
|
|
79
79
|
permission: isTaskPermission(input.permission) ? input.permission : void 0
|
|
80
80
|
};
|
|
81
81
|
}
|
|
@@ -425,10 +425,6 @@ window.__ModuleLoader__.load({
|
|
|
425
425
|
* back to the runtime default); an unknown permission string is ignored so
|
|
426
426
|
* stale UI can never persist a value the execution service rejects.
|
|
427
427
|
*/
|
|
428
|
-
/** Collapse a blank target string to undefined (clears the pin). */
|
|
429
|
-
function normalizeTargetId$1(value) {
|
|
430
|
-
return value !== void 0 && value.trim() === "" ? void 0 : value;
|
|
431
|
-
}
|
|
432
428
|
/** Keep an unknown permission string from entering the ledger. */
|
|
433
429
|
function normalizePermission(current, value) {
|
|
434
430
|
if (value === void 0) return void 0;
|
|
@@ -445,8 +441,8 @@ window.__ModuleLoader__.load({
|
|
|
445
441
|
function applyUpdateTask(tasks, id, patch, now) {
|
|
446
442
|
return tasks.map((task) => {
|
|
447
443
|
if (task.id !== id) return task;
|
|
448
|
-
const workspaceId = "workspaceId" in patch ? normalizeTargetId
|
|
449
|
-
const mode = "mode" in patch ? normalizeTargetId
|
|
444
|
+
const workspaceId = "workspaceId" in patch ? normalizeTargetId(patch.workspaceId) : void 0;
|
|
445
|
+
const mode = "mode" in patch ? normalizeTargetId(patch.mode) : void 0;
|
|
450
446
|
const permission = "permission" in patch ? normalizePermission(task.permission, patch.permission) : void 0;
|
|
451
447
|
const next = {
|
|
452
448
|
...task,
|
|
@@ -1117,6 +1113,9 @@ window.__ModuleLoader__.load({
|
|
|
1117
1113
|
environmentListener;
|
|
1118
1114
|
disposed = false;
|
|
1119
1115
|
started = false;
|
|
1116
|
+
/** Cron expressions that matched no instant in the scan window, per task —
|
|
1117
|
+
* remembered so a never-matching rule is not re-scanned on every tick. */
|
|
1118
|
+
unmatchableRepair = /* @__PURE__ */ new Map();
|
|
1120
1119
|
/** @param deps - tasks/clock/trigger/apply faces (see {@link SchedulerDeps}). */
|
|
1121
1120
|
constructor(deps) {
|
|
1122
1121
|
this.deps = deps;
|
|
@@ -1178,8 +1177,13 @@ window.__ModuleLoader__.load({
|
|
|
1178
1177
|
const schedule = task.schedule;
|
|
1179
1178
|
if (schedule === void 0 || !schedule.enabled) continue;
|
|
1180
1179
|
if (schedule.nextRunAt === void 0) {
|
|
1180
|
+
if (this.unmatchableRepair.get(task.id) === schedule.cron) continue;
|
|
1181
1181
|
const repaired = nextRunAtMs(schedule.cron, now);
|
|
1182
|
-
if (repaired === void 0)
|
|
1182
|
+
if (repaired === void 0) {
|
|
1183
|
+
this.unmatchableRepair.set(task.id, schedule.cron);
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
this.unmatchableRepair.delete(task.id);
|
|
1183
1187
|
this.deps.applySchedule(task.id, repaired, void 0);
|
|
1184
1188
|
continue;
|
|
1185
1189
|
}
|
|
@@ -1239,10 +1243,6 @@ window.__ModuleLoader__.load({
|
|
|
1239
1243
|
}
|
|
1240
1244
|
return true;
|
|
1241
1245
|
}
|
|
1242
|
-
/** Collapse a blank persisted target string to undefined (clears the pin). */
|
|
1243
|
-
function normalizeTargetId(value) {
|
|
1244
|
-
return value !== void 0 && value.trim() === "" ? void 0 : value;
|
|
1245
|
-
}
|
|
1246
1246
|
/** Normalize an unknown persisted status back into the closed status union. */
|
|
1247
1247
|
function normalizeStatus(status) {
|
|
1248
1248
|
return isTaskStatus(status) ? status : "todo";
|
|
@@ -1972,6 +1972,16 @@ window.__ModuleLoader__.load({
|
|
|
1972
1972
|
});
|
|
1973
1973
|
}
|
|
1974
1974
|
//#endregion
|
|
1975
|
+
//#region src/client/board/status-key.ts
|
|
1976
|
+
/** Task status → locale key (board column titles and the detail badge). */
|
|
1977
|
+
const STATUS_KEY = {
|
|
1978
|
+
backlog: "board.status.backlog",
|
|
1979
|
+
todo: "board.status.todo",
|
|
1980
|
+
running: "board.status.running",
|
|
1981
|
+
done: "board.status.done",
|
|
1982
|
+
failed: "board.status.failed"
|
|
1983
|
+
};
|
|
1984
|
+
//#endregion
|
|
1975
1985
|
//#region src/client/board/TaskCard.tsx
|
|
1976
1986
|
/**
|
|
1977
1987
|
* Task card: the board's column item. Clicking opens the task detail — it
|
|
@@ -2112,14 +2122,6 @@ window.__ModuleLoader__.load({
|
|
|
2112
2122
|
failed: "detail.result.failed",
|
|
2113
2123
|
cancelled: "detail.result.cancelled"
|
|
2114
2124
|
};
|
|
2115
|
-
/** Status → locale key (detail badge). */
|
|
2116
|
-
const STATUS_KEY$1 = {
|
|
2117
|
-
backlog: "board.status.backlog",
|
|
2118
|
-
todo: "board.status.todo",
|
|
2119
|
-
running: "board.status.running",
|
|
2120
|
-
done: "board.status.done",
|
|
2121
|
-
failed: "board.status.failed"
|
|
2122
|
-
};
|
|
2123
2125
|
/** One execution-history row. */
|
|
2124
2126
|
function ExecutionRow({ execution, onOpen }) {
|
|
2125
2127
|
const result = execution.result;
|
|
@@ -2403,7 +2405,7 @@ window.__ModuleLoader__.load({
|
|
|
2403
2405
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2404
2406
|
className: board_module_css_default.statusBadge,
|
|
2405
2407
|
"data-status": current.status,
|
|
2406
|
-
children: t(STATUS_KEY
|
|
2408
|
+
children: t(STATUS_KEY[current.status])
|
|
2407
2409
|
}),
|
|
2408
2410
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2409
2411
|
type: "button",
|
|
@@ -2546,14 +2548,6 @@ window.__ModuleLoader__.load({
|
|
|
2546
2548
|
* active. Cards open the task detail (never execute directly); the header
|
|
2547
2549
|
* offers filter, new-task, and a back-to-chat escape.
|
|
2548
2550
|
*/
|
|
2549
|
-
/** Column status → locale key. */
|
|
2550
|
-
const STATUS_KEY = {
|
|
2551
|
-
backlog: "board.status.backlog",
|
|
2552
|
-
todo: "board.status.todo",
|
|
2553
|
-
running: "board.status.running",
|
|
2554
|
-
done: "board.status.done",
|
|
2555
|
-
failed: "board.status.failed"
|
|
2556
|
-
};
|
|
2557
2551
|
/** Case-insensitive title/description match. */
|
|
2558
2552
|
function matchesFilter(task, filter) {
|
|
2559
2553
|
if (filter.trim() === "") return true;
|