@parallelworks/tandem-web 0.177.0 → 0.178.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.177.0",
3
+ "version": "0.178.0",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -1,53 +1,67 @@
1
1
  import { api as e, unwrap as t } from "../../../api/client.js";
2
- import { runnersQuery as n } from "../../../api/queries.js";
3
- import { ComputeTargets as r } from "../../../components/ComputeTargets.js";
4
- import { InlineCommand as i } from "../../../components/InlineCommand.js";
5
- import { WorkerIcon as a } from "../../../components/icons.js";
6
- import { SettingsPage as o } from "../../../components/settings.js";
7
- import { useConfirm as s } from "../../../lib/confirm.js";
8
- import { copyItem as c } from "../../../lib/menus.js";
9
- import { useTime as l } from "../../../lib/time.js";
2
+ import { runnersQuery as n, workspaceRunsQuery as r } from "../../../api/queries.js";
3
+ import { ComputeTargets as i } from "../../../components/ComputeTargets.js";
4
+ import { InlineCommand as a } from "../../../components/InlineCommand.js";
5
+ import { WorkerIcon as o } from "../../../components/icons.js";
6
+ import { SettingsPage as s } from "../../../components/settings.js";
7
+ import { useConfirm as c } from "../../../lib/confirm.js";
8
+ import { copyItem as l } from "../../../lib/menus.js";
9
+ import { Link as ee } from "../../../lib/router.js";
10
+ import { useTime as te } from "../../../lib/time.js";
10
11
  import { Route as u } from "./runners.js";
11
- import { Callout as d, StatusDot as f, Table as p, menuDivider as m, useOpenMenu as h } from "@parallelworks/ui";
12
- import { useMemo as g } from "react";
13
- import { useFormatter as _, useTranslations as v } from "use-intl";
14
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
15
- import { useMutation as x, useQueryClient as ee, useSuspenseQuery as S } from "@tanstack/react-query";
16
- import { ListCellText as C, ListColumns as w, ListPage as T, ListRow as E, ListToolbar as D, NameCell as O, listTableProps as k, useListNavigate as A, useListSearch as j, useListView as M } from "@parallelworks/ui/list";
12
+ import { Callout as d, StatusDot as f, Table as p, menuDivider as m, useOpenMenu as ne } from "@parallelworks/ui";
13
+ import { useMemo as h } from "react";
14
+ import { useFormatter as g, useTranslations as _ } from "use-intl";
15
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
16
+ import { useMutation as re, useQuery as ie, useQueryClient as ae, useSuspenseQuery as b } from "@tanstack/react-query";
17
+ import { ListCellText as x, ListColumns as S, ListPage as C, ListRow as w, ListToolbar as T, NameCell as E, listTableProps as D, useListNavigate as O, useListSearch as k, useListView as A } from "@parallelworks/ui/list";
17
18
  // src/routes/$workspace/settings/runners.tsx?tsr-split=component
18
- var N = {
19
+ var j = {
19
20
  default: "runnerModeDefault",
20
21
  "accept-edits": "runnerModeAcceptEdits",
21
22
  auto: "runnerModeAuto",
22
23
  bypass: "runnerModeBypass"
23
24
  };
24
- function P() {
25
+ function M() {
25
26
  let { workspace: e } = u.useParams();
26
- return /* @__PURE__ */ y(F, { workspace: e });
27
+ return /* @__PURE__ */ v(N, { workspace: e });
27
28
  }
28
- function F({ workspace: u }) {
29
- let { data: P } = S(n(u)), F = v("account"), I = _(), L = v("common"), R = l(), z = ee(), B = j(), V = A(), H = h(), U = x({
29
+ function N({ workspace: u }) {
30
+ let { data: M } = b(n(u)), { data: N = [] } = ie(r(u, {
31
+ live: !0,
32
+ limit: 200
33
+ })), P = /* @__PURE__ */ new Map();
34
+ for (let e of N) e.state === "working" && e.runnerId && P.set(e.runnerId, [...P.get(e.runnerId) ?? [], e]);
35
+ let F = _("account"), I = g(), L = _("common"), R = te(), z = ae(), B = k(), V = O(), H = ne(), U = re({
30
36
  mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/runners/{runnerId}", { params: { path: {
31
37
  workspace: u,
32
38
  runnerId: n
33
39
  } } })),
34
40
  onSettled: () => z.invalidateQueries({ queryKey: n(u).queryKey })
35
- }), { confirm: W, dialog: G } = s(), K = (e) => W({
41
+ }), { confirm: W, dialog: G } = c(), K = (e) => W({
36
42
  title: F("revokeRunnerTitle"),
37
43
  description: F("revokeRunnerDescription", { name: e.name }),
38
44
  confirmLabel: F("revoke"),
39
45
  onConfirm: () => U.mutateAsync(e.id)
40
- }), q = g(() => [{
41
- key: "name",
42
- label: L("name"),
43
- headerClassName: "py-2",
44
- alwaysVisible: !0
45
- }, {
46
- key: "seen",
47
- label: F("runnerColSeen"),
48
- headerClassName: "py-2 w-40",
49
- align: "end"
50
- }], [F, L]), J = g(() => [{
46
+ }), q = h(() => [
47
+ {
48
+ key: "name",
49
+ label: L("name"),
50
+ headerClassName: "py-2",
51
+ alwaysVisible: !0
52
+ },
53
+ {
54
+ key: "working",
55
+ label: F("runnerColWorking"),
56
+ headerClassName: "py-2 w-48"
57
+ },
58
+ {
59
+ key: "seen",
60
+ label: F("runnerColSeen"),
61
+ headerClassName: "py-2 w-40",
62
+ align: "end"
63
+ }
64
+ ], [F, L]), J = h(() => [{
51
65
  value: "name",
52
66
  label: L("name"),
53
67
  compare: (e, t) => e.name.localeCompare(t.name)
@@ -55,31 +69,31 @@ function F({ workspace: u }) {
55
69
  value: "seen",
56
70
  label: F("runnerColSeen"),
57
71
  compare: (e, t) => (t.lastSeenAt ?? "").localeCompare(e.lastSeenAt ?? "")
58
- }], [F, L]), Y = M({
72
+ }], [F, L]), Y = A({
59
73
  storageKey: `tandem-runners-${u}`,
60
74
  defaultShowColumnHeaders: !1,
61
75
  columns: q,
62
76
  orderBys: J,
63
77
  defaultOrderBy: "name",
64
78
  facets: []
65
- }), X = B.filter.trim().toLowerCase(), Z = P.filter((e) => !X || [
79
+ }), X = B.filter.trim().toLowerCase(), Z = M.filter((e) => !X || [
66
80
  e.name,
67
81
  e.group ?? "",
68
82
  ...e.harnesses,
69
83
  ...e.labels
70
- ].some((e) => e.toLowerCase().includes(X))), Q = P.filter((e) => e.sharingRefused), $ = P.filter((e) => e.sharingUnchecked);
71
- return /* @__PURE__ */ b(o, {
84
+ ].some((e) => e.toLowerCase().includes(X))), Q = M.filter((e) => e.sharingRefused), $ = M.filter((e) => e.sharingUnchecked);
85
+ return /* @__PURE__ */ y(s, {
72
86
  wide: !0,
73
87
  title: F("runners"),
74
- description: F.rich("runnersDescription", { code: (e) => /* @__PURE__ */ y(i, { children: e }) }),
75
- toolbar: P.length > 0 && /* @__PURE__ */ y(D, {
88
+ description: F.rich("runnersDescription", { code: (e) => /* @__PURE__ */ v(a, { children: e }) }),
89
+ toolbar: M.length > 0 && /* @__PURE__ */ v(T, {
76
90
  view: Y,
77
91
  search: B,
78
92
  searchLabel: F("runnerSearch"),
79
93
  searchPlaceholder: F("runnerSearch")
80
94
  }),
81
95
  children: [
82
- Q.length > 0 && /* @__PURE__ */ y(d, {
96
+ Q.length > 0 && /* @__PURE__ */ v(d, {
83
97
  tone: "warning",
84
98
  className: "mb-6",
85
99
  children: F("runnerSharingRefused", {
@@ -87,7 +101,7 @@ function F({ workspace: u }) {
87
101
  names: I.list(Q.map((e) => e.name), { type: "conjunction" })
88
102
  })
89
103
  }),
90
- $.length > 0 && /* @__PURE__ */ y(d, {
104
+ $.length > 0 && /* @__PURE__ */ v(d, {
91
105
  tone: "muted",
92
106
  className: "mb-6",
93
107
  children: F("runnerSharingUnchecked", {
@@ -95,11 +109,11 @@ function F({ workspace: u }) {
95
109
  names: I.list($.map((e) => e.name), { type: "conjunction" })
96
110
  })
97
111
  }),
98
- /* @__PURE__ */ y("div", {
112
+ /* @__PURE__ */ v("div", {
99
113
  className: "border-t border-border",
100
- children: /* @__PURE__ */ y(T, {
114
+ children: /* @__PURE__ */ v(C, {
101
115
  view: Y,
102
- total: P.length,
116
+ total: M.length,
103
117
  matches: Z.length,
104
118
  count: {
105
119
  filterActive: B.filter.trim() !== "",
@@ -107,19 +121,19 @@ function F({ workspace: u }) {
107
121
  nounPlural: F("runnerNounPlural")
108
122
  },
109
123
  empty: {
110
- icon: /* @__PURE__ */ y(a, {}),
124
+ icon: /* @__PURE__ */ v(o, {}),
111
125
  title: F("noRunners")
112
126
  },
113
127
  noMatches: F("runnerNoMatches"),
114
- children: /* @__PURE__ */ b(p, {
115
- ...k,
116
- children: [/* @__PURE__ */ y(w, { view: Y }), Y.applyOrder(Z).map((e) => /* @__PURE__ */ b(E, {
128
+ children: /* @__PURE__ */ y(p, {
129
+ ...D,
130
+ children: [/* @__PURE__ */ v(S, { view: Y }), Y.applyOrder(Z).map((e) => /* @__PURE__ */ y(w, {
117
131
  href: null,
118
132
  goTo: V,
119
133
  openMenu: H,
120
134
  items: [
121
- c(F("copyRunnerId"), e.id),
122
- c(L("copyName"), e.name),
135
+ l(F("copyRunnerId"), e.id),
136
+ l(L("copyName"), e.name),
123
137
  m,
124
138
  {
125
139
  label: F("revoke"),
@@ -127,37 +141,53 @@ function F({ workspace: u }) {
127
141
  onClick: () => K(e)
128
142
  }
129
143
  ],
130
- children: [/* @__PURE__ */ y(O, {
131
- icon: /* @__PURE__ */ y(a, {}),
132
- iconTile: !0,
133
- name: e.name,
134
- subtitle: I.list([
135
- ...e.group ? [F("runnerSharedWith", { group: e.group })] : [],
136
- ...e.sharingRefused ? [F("runnerNotTakingRuns")] : [],
137
- ...e.sharingUnchecked ? [F("runnerSharingUnknown")] : [],
138
- ...e.permissionMode ? [F(N[e.permissionMode])] : [],
139
- ...e.harnesses,
140
- ...e.labels
141
- ], { type: "unit" }),
142
- href: null
143
- }), Y.isVisible("seen") && /* @__PURE__ */ b(p.Item, {
144
- className: "py-2.5",
145
- children: [/* @__PURE__ */ y(C, { children: e.lastSeenAt ? F("runnerSeen", { seen: R.relative(e.lastSeenAt) }) : F("runnerNeverConnected") }), e.isolation && /* @__PURE__ */ b("span", {
146
- className: "flex items-center justify-end gap-1.5 text-xs text-muted-foreground",
147
- title: e.isolation.failures.join("\n") || void 0,
148
- children: [/* @__PURE__ */ y(f, {
149
- variant: e.isolation.passed ? "success" : "error",
150
- size: 8
151
- }), e.isolation.passed ? F("runnerIsolated") : F("runnerNotIsolated", { count: e.isolation.failures.length })]
152
- })]
153
- })]
144
+ children: [
145
+ /* @__PURE__ */ v(E, {
146
+ icon: /* @__PURE__ */ v(o, {}),
147
+ iconTile: !0,
148
+ name: e.name,
149
+ subtitle: I.list([
150
+ ...e.group ? [F("runnerSharedWith", { group: e.group })] : [],
151
+ ...e.sharingRefused ? [F("runnerNotTakingRuns")] : [],
152
+ ...e.sharingUnchecked ? [F("runnerSharingUnknown")] : [],
153
+ ...e.permissionMode ? [F(j[e.permissionMode])] : [],
154
+ ...e.harnesses,
155
+ ...e.labels
156
+ ], { type: "unit" }),
157
+ href: null
158
+ }),
159
+ Y.isVisible("working") && /* @__PURE__ */ v(p.Item, {
160
+ className: "py-2.5",
161
+ children: /* @__PURE__ */ v(x, { children: (P.get(e.id) ?? []).length > 0 ? (P.get(e.id) ?? []).map((e, t) => /* @__PURE__ */ y("span", { children: [t > 0 && ", ", /* @__PURE__ */ v(ee, {
162
+ to: "/$workspace/issues/$identifier",
163
+ params: {
164
+ workspace: u,
165
+ identifier: e.identifier
166
+ },
167
+ className: "hover:underline",
168
+ title: e.issueTitle,
169
+ children: e.identifier
170
+ })] }, e.id)) : F("runnerIdle") })
171
+ }),
172
+ Y.isVisible("seen") && /* @__PURE__ */ y(p.Item, {
173
+ className: "py-2.5",
174
+ children: [/* @__PURE__ */ v(x, { children: e.lastSeenAt ? F("runnerSeen", { seen: R.relative(e.lastSeenAt) }) : F("runnerNeverConnected") }), e.isolation && /* @__PURE__ */ y("span", {
175
+ className: "flex items-center justify-end gap-1.5 text-xs text-muted-foreground",
176
+ title: e.isolation.failures.join("\n") || void 0,
177
+ children: [/* @__PURE__ */ v(f, {
178
+ variant: e.isolation.passed ? "success" : "error",
179
+ size: 8
180
+ }), e.isolation.passed ? F("runnerIsolated") : F("runnerNotIsolated", { count: e.isolation.failures.length })]
181
+ })]
182
+ })
183
+ ]
154
184
  }, e.id))]
155
185
  })
156
186
  })
157
187
  }),
158
- /* @__PURE__ */ y(r, { workspace: u }),
188
+ /* @__PURE__ */ v(i, { workspace: u }),
159
189
  G
160
190
  ]
161
191
  });
162
192
  }
163
- export { P as component };
193
+ export { M as component };