@michengai/dsh-automation 0.1.17 → 0.1.18

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 CHANGED
@@ -4,6 +4,13 @@
4
4
 
5
5
  The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
6
6
 
7
+ ## 0.1.18 — 2026-08-26
8
+
9
+ - Replaced the native task and status filters in run history with the same styled dropdown used for task sorting.
10
+ - Added consistent selected states, long-label truncation, scrolling, outside-click dismissal, and Escape handling for those filters.
11
+
12
+ Published package: [`@michengai/dsh-automation@0.1.18`](https://www.npmjs.com/package/@michengai/dsh-automation/v/0.1.18).
13
+
7
14
  ## 0.1.17 — 2026-08-26
8
15
 
9
16
  - Removed the redundant full-width divider below the scheduled-task tabs while retaining the active-tab underline.
@@ -33,9 +40,3 @@ Published package: [`@michengai/dsh-automation@0.1.15`](https://www.npmjs.com/pa
33
40
  - Linked the release history from both README editions and included it in the npm package.
34
41
 
35
42
  Published package: [`@michengai/dsh-automation@0.1.14`](https://www.npmjs.com/package/@michengai/dsh-automation/v/0.1.14).
36
-
37
- ## 0.1.13 — 2026-08-23
38
-
39
- - Logged internal RPC failures instead of leaving automation failures silent.
40
-
41
- Release commit: [`6f04ae9`](https://github.com/MichengAI/dsh-automation/commit/6f04ae9).
@@ -4,6 +4,13 @@
4
4
 
5
5
  以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 0.1.18 — 2026-08-26
8
+
9
+ - 将执行记录中的“全部任务”和“全部状态”从原生下拉框替换为与任务排序一致的自定义样式菜单。
10
+ - 为这些筛选菜单增加统一的选中状态、长名称省略、滚动、点击外部关闭和 Escape 关闭行为。
11
+
12
+ 发布包:[`@michengai/dsh-automation@0.1.18`](https://www.npmjs.com/package/@michengai/dsh-automation/v/0.1.18)。
13
+
7
14
  ## 0.1.17 — 2026-08-26
8
15
 
9
16
  - 移除定时任务标签栏下方多余的整行分隔线,同时保留当前标签的短下划线。
@@ -33,9 +40,3 @@
33
40
  - 在中英文 README 中加入更新日志入口,并将日志纳入 npm 包。
34
41
 
35
42
  发布包:[`@michengai/dsh-automation@0.1.14`](https://www.npmjs.com/package/@michengai/dsh-automation/v/0.1.14)。
36
-
37
- ## 0.1.13 — 2026-08-23
38
-
39
- - 记录内部 RPC 失败,避免自动化执行错误被静默吞掉。
40
-
41
- 发布提交:[`6f04ae9`](https://github.com/MichengAI/dsh-automation/commit/6f04ae9)。
package/lib/client.js CHANGED
@@ -1429,14 +1429,36 @@ function AutomationView({ t, permissionT, modelT, runtime, closeSettings }) {
1429
1429
  ),
1430
1430
  tab === "runs" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dsh-st-filters", children: [
1431
1431
  ["day", "week", "month"].map((range) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: historyRange === range ? "is-on" : "", onClick: () => setHistoryRange(range), children: t(`history.range.${range}`) }, range)),
1432
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { value: historyTask, onChange: (event) => setHistoryTask(event.target.value), children: [
1433
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "all", children: t("history.allTasks") }),
1434
- (snapshot?.automations ?? []).map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: item.id, children: item.name }, item.id))
1435
- ] }),
1436
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { value: historyStatus, onChange: (event) => setHistoryStatus(event.target.value), children: [
1437
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "all", children: t("history.allStatus") }),
1438
- ["succeeded", "failed", "running", "queued", "skipped", "cancelled"].map((status) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: status, children: t(`status.${status}`) }, status))
1439
- ] })
1432
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1433
+ DropdownMenu,
1434
+ {
1435
+ ariaLabel: t("history.allTasks"),
1436
+ options: [
1437
+ { key: "all", label: t("history.allTasks"), selected: historyTask === "all", onSelect: () => setHistoryTask("all") },
1438
+ ...(snapshot?.automations ?? []).map((item) => ({
1439
+ key: item.id,
1440
+ label: item.name,
1441
+ selected: historyTask === item.id,
1442
+ onSelect: () => setHistoryTask(item.id)
1443
+ }))
1444
+ ]
1445
+ }
1446
+ ),
1447
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1448
+ DropdownMenu,
1449
+ {
1450
+ ariaLabel: t("history.allStatus"),
1451
+ options: [
1452
+ { key: "all", label: t("history.allStatus"), selected: historyStatus === "all", onSelect: () => setHistoryStatus("all") },
1453
+ ...["succeeded", "failed", "running", "queued", "skipped", "cancelled"].map((status) => ({
1454
+ key: status,
1455
+ label: t(`status.${status}`),
1456
+ selected: historyStatus === status,
1457
+ onSelect: () => setHistoryStatus(status)
1458
+ }))
1459
+ ]
1460
+ }
1461
+ )
1440
1462
  ] })
1441
1463
  ] }),
1442
1464
  tab === "mine" && (automations.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dsh-st-empty", children: [
@@ -1570,6 +1592,25 @@ function SortMenu({
1570
1592
  sortKey,
1571
1593
  sortDirection,
1572
1594
  onSelect
1595
+ }) {
1596
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1597
+ DropdownMenu,
1598
+ {
1599
+ className: "dsh-st-sort",
1600
+ ariaLabel: t("sort.by"),
1601
+ options: [
1602
+ { key: "created-desc", label: t("sort.created.desc"), selected: sortKey === "created" && sortDirection === "desc", onSelect: () => onSelect("created", "desc") },
1603
+ { key: "created-asc", label: t("sort.created.asc"), selected: sortKey === "created" && sortDirection === "asc", onSelect: () => onSelect("created", "asc") },
1604
+ { key: "planned-asc", label: t("sort.planned.asc"), selected: sortKey === "planned" && sortDirection === "asc", onSelect: () => onSelect("planned", "asc") },
1605
+ { key: "planned-desc", label: t("sort.planned.desc"), selected: sortKey === "planned" && sortDirection === "desc", onSelect: () => onSelect("planned", "desc") }
1606
+ ]
1607
+ }
1608
+ );
1609
+ }
1610
+ function DropdownMenu({
1611
+ ariaLabel,
1612
+ className,
1613
+ options
1573
1614
  }) {
1574
1615
  const [open, setOpen] = (0, import_react3.useState)(false);
1575
1616
  const root = (0, import_react3.useRef)(null);
@@ -1588,33 +1629,27 @@ function SortMenu({
1588
1629
  document.removeEventListener("keydown", closeOnEscape);
1589
1630
  };
1590
1631
  }, [open]);
1591
- const options = [
1592
- { key: "created", direction: "desc", label: t("sort.created.desc") },
1593
- { key: "created", direction: "asc", label: t("sort.created.asc") },
1594
- { key: "planned", direction: "asc", label: t("sort.planned.asc") },
1595
- { key: "planned", direction: "desc", label: t("sort.planned.desc") }
1596
- ];
1597
- const selectedLabel = options.find((option) => option.key === sortKey && option.direction === sortDirection)?.label ?? t("sort.by");
1598
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "dsh-st-sort", ref: root, children: [
1599
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: `dsh-st-sort-btn${open ? " is-open" : ""}`, "aria-label": t("sort.by"), "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
1600
- selectedLabel,
1601
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronIcon, { width: 10, height: 10, className: "dsh-st-sort-chevron" })
1632
+ const selectedLabel = options.find((option) => option.selected)?.label ?? options[0]?.label ?? ariaLabel;
1633
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: `dsh-st-dropdown${className === void 0 ? "" : ` ${className}`}`, ref: root, children: [
1634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("button", { type: "button", className: `dsh-st-dropdown-btn${open ? " is-open" : ""}`, "aria-label": ariaLabel, "aria-expanded": open, onClick: () => setOpen((value) => !value), children: [
1635
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "dsh-st-dropdown-label", children: selectedLabel }),
1636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChevronIcon, { width: 10, height: 10, className: "dsh-st-dropdown-chevron" })
1602
1637
  ] }),
1603
- open && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dsh-st-sort-menu", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1604
- SortRow,
1638
+ open && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "dsh-st-dropdown-menu", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1639
+ DropdownRow,
1605
1640
  {
1606
1641
  label: option.label,
1607
- selected: sortKey === option.key && sortDirection === option.direction,
1642
+ selected: option.selected,
1608
1643
  onSelect: () => {
1609
1644
  setOpen(false);
1610
- onSelect(option.key, option.direction);
1645
+ option.onSelect();
1611
1646
  }
1612
1647
  },
1613
- `${option.key}-${option.direction}`
1648
+ option.key
1614
1649
  )) })
1615
1650
  ] });
1616
1651
  }
1617
- function SortRow({
1652
+ function DropdownRow({
1618
1653
  label,
1619
1654
  selected,
1620
1655
  onSelect
@@ -3002,17 +3037,20 @@ var CSS_TEXT = `
3002
3037
  .dsh-st-tabs{display:flex;align-items:center;gap:16px;margin:4px 0 16px}
3003
3038
  .dsh-st-tabs>button{padding:8px 0;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer}
3004
3039
  .dsh-st-tabs>button.is-on{border-bottom-color:currentColor;color:var(--dsw-alias-label-primary);font-weight:650}
3005
- .dsh-st-sort{position:relative;margin-left:auto}
3006
- .dsh-st-sort-btn{display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border:0;border-radius:999px;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.14));color:var(--dsw-alias-label-primary,inherit);font:13px/20px inherit;cursor:pointer}
3007
- .dsh-st-sort-btn:hover,.dsh-st-sort-btn.is-open{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.18))}
3008
- .dsh-st-sort-chevron{transition:transform .16s ease;transform:rotate(90deg)}
3009
- .dsh-st-sort-btn.is-open .dsh-st-sort-chevron{transform:rotate(-90deg)}
3010
- .dsh-st-sort-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;width:180px;padding:6px;border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-alias-bg-layer-3,#303033);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.32))}
3011
- .dsh-st-sort-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:13px/20px inherit;cursor:pointer;text-align:left}
3012
- .dsh-st-sort-menu button:hover,.dsh-st-sort-menu button.is-selected{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary,inherit)}
3040
+ .dsh-st-dropdown{position:relative;min-width:0}
3041
+ .dsh-st-sort{margin-left:auto}
3042
+ .dsh-st-dropdown-btn{display:inline-flex;align-items:center;gap:4px;max-width:220px;height:28px;padding:0 10px;border:0;border-radius:999px;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.14));color:var(--dsw-alias-label-primary,inherit);font:13px/20px inherit;cursor:pointer;white-space:nowrap}
3043
+ .dsh-st-dropdown-btn:hover,.dsh-st-dropdown-btn.is-open{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.18))}
3044
+ .dsh-st-dropdown-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3045
+ .dsh-st-dropdown-chevron{flex:none;transition:transform .16s ease;transform:rotate(90deg)}
3046
+ .dsh-st-dropdown-btn.is-open .dsh-st-dropdown-chevron{transform:rotate(-90deg)}
3047
+ .dsh-st-dropdown-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;width:180px;max-height:260px;overflow:auto;padding:6px;border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-alias-bg-layer-3,#303033);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.32))}
3048
+ .dsh-st-dropdown-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:13px/20px inherit;cursor:pointer;text-align:left}
3049
+ .dsh-st-dropdown-menu button>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3050
+ .dsh-st-dropdown-menu button:hover,.dsh-st-dropdown-menu button.is-selected{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08));color:var(--dsw-alias-label-primary,inherit)}
3013
3051
  .dsh-st-sort-tick{width:16px;height:16px;flex:none}
3014
3052
  .dsh-st-filters{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-left:auto}
3015
- .dsh-st-filters>button,.dsh-st-filters>select{height:28px;padding:0 10px;border:0;border-radius:999px;background:rgba(255,255,255,.06);color:inherit;font-size:12px}
3053
+ .dsh-st-filters>button{height:28px;padding:0 10px;border:0;border-radius:999px;background:rgba(255,255,255,.06);color:inherit;font-size:12px}
3016
3054
  .dsh-st-filters>button.is-on{background:rgba(255,255,255,.14)}
3017
3055
  .dsh-st-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
3018
3056
  .dsh-st-card,.dsh-st-empty{position:relative;padding:16px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.03))}