@parallelworks/tandem-web 0.187.0 → 0.188.1

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