@michengai/dsh-automation 0.1.4 → 0.1.5

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/README.md CHANGED
@@ -72,7 +72,7 @@ dsh plugin --profile web add @michengai/dsh-automation@latest --registry=https:/
72
72
  dsh --profile web --dump-config
73
73
  ```
74
74
 
75
- Restart DSH Web and hard-refresh the browser. Pin a version with `@0.1.4` instead of `@latest` when needed.
75
+ Restart DSH Web and hard-refresh the browser. Pin a version with `@0.1.5` instead of `@latest` when needed.
76
76
 
77
77
  ### Install from source
78
78
 
package/README.zh-CN.md CHANGED
@@ -72,7 +72,7 @@ dsh plugin --profile web add @michengai/dsh-automation@latest --registry=https:/
72
72
  dsh --profile web --dump-config
73
73
  ```
74
74
 
75
- 安装后重启 DSH Web,并在浏览器硬刷新。需要钉死某一版时,把 `@latest` 换成 `@0.1.4`。
75
+ 安装后重启 DSH Web,并在浏览器硬刷新。需要钉死某一版时,把 `@latest` 换成 `@0.1.5`。
76
76
 
77
77
  ### 从源码安装
78
78
 
package/lib/client.js CHANGED
@@ -2021,6 +2021,12 @@ function groupScheduledSessions(automations, runs) {
2021
2021
  };
2022
2022
  }).filter((group) => group.sessions.length > 0);
2023
2023
  }
2024
+ function keepScheduledSessionLink(sessionId, archived, presentIds) {
2025
+ if (sessionId === void 0 || sessionId === "") return false;
2026
+ if (archived.has(sessionId)) return false;
2027
+ if (presentIds === void 0) return true;
2028
+ return presentIds.has(sessionId);
2029
+ }
2024
2030
  function collectScheduledSessionIds(runs) {
2025
2031
  const ids = /* @__PURE__ */ new Set();
2026
2032
  for (const run of runs ?? []) {
@@ -2360,12 +2366,18 @@ function NativeScheduleSessionList(props) {
2360
2366
  };
2361
2367
  }, [runtime]);
2362
2368
  const archived = (0, import_react5.useMemo)(() => new Set(archivedIds), [archivedIds]);
2369
+ const listedIds = useSessions ? useSessions((snap) => Array.isArray(snap?.ids) ? snap.ids : void 0) : void 0;
2370
+ const presentIds = (0, import_react5.useMemo)(() => {
2371
+ if (listedIds !== void 0) return new Set(listedIds);
2372
+ const keys = Object.keys(sessionById);
2373
+ return keys.length > 0 ? new Set(keys) : void 0;
2374
+ }, [listedIds, sessionById]);
2363
2375
  const groups = (0, import_react5.useMemo)(() => {
2364
2376
  const snapshot = state.snapshot;
2365
2377
  if (snapshot === void 0) return [];
2366
2378
  return groupScheduledSessions(snapshot.automations, snapshot.runs).map((group) => ({
2367
2379
  ...group,
2368
- sessions: group.sessions.filter((session) => !archived.has(session.id)).map((session) => {
2380
+ sessions: group.sessions.filter((session) => keepScheduledSessionLink(session.id, archived, presentIds)).map((session) => {
2369
2381
  const run = snapshot.runs.find((item) => item.sessionId === session.id);
2370
2382
  return {
2371
2383
  ...session,
@@ -2375,7 +2387,7 @@ function NativeScheduleSessionList(props) {
2375
2387
  };
2376
2388
  })
2377
2389
  })).filter((group) => group.sessions.length > 0);
2378
- }, [archived, sessionById, state.snapshot]);
2390
+ }, [archived, presentIds, sessionById, state.snapshot]);
2379
2391
  const visibleGroups = (0, import_react5.useMemo)(() => applyWorkspaceBrowserQuery(groups.map((group) => ({ ...group, name: group.name })), query, sort, groupMode), [groups, query, sort, groupMode]);
2380
2392
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "dsh-st-n", children: [
2381
2393
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(WorkspaceToolbar, { t, query, sort, groupMode, onQueryChange: setQuery, onSortChange: setSort, onGroupModeChange: setGroupMode }),