@parallelworks/tandem-web 0.157.1 → 0.159.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.
@@ -6,130 +6,142 @@ import { useTime as a } from "../../../lib/time.js";
6
6
  import { useConfirm as o } from "../../../lib/confirm.js";
7
7
  import { SettingsPage as s } from "../../../components/settings.js";
8
8
  import { Route as c } from "./runners.js";
9
- import { Table as l, menuDivider as u, useOpenMenu as d } from "@parallelworks/ui";
10
- import { useMemo as f } from "react";
11
- import { useFormatter as p, useTranslations as m } from "use-intl";
12
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
13
- import { useMutation as _, useQueryClient as v, useSuspenseQuery as y } from "@tanstack/react-query";
14
- import { ListCellText as b, ListColumns as x, ListPage as S, ListRow as C, ListToolbar as w, NameCell as T, listTableProps as E, useListNavigate as D, useListSearch as O, useListView as k } from "@parallelworks/ui/list";
9
+ import { ComputeTargets as l } from "../../../components/ComputeTargets.js";
10
+ import { StatusDot as u, Table as d, menuDivider as f, useOpenMenu as p } from "@parallelworks/ui";
11
+ import { useMemo as m } from "react";
12
+ import { useFormatter as h, useTranslations as g } from "use-intl";
13
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import { useMutation as y, useQueryClient as b, useSuspenseQuery as x } from "@tanstack/react-query";
15
+ 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";
15
16
  // src/routes/$workspace/settings/runners.tsx?tsr-split=component
16
- var A = {
17
+ var M = {
17
18
  default: "runnerModeDefault",
18
19
  "accept-edits": "runnerModeAcceptEdits",
19
20
  auto: "runnerModeAuto",
20
21
  bypass: "runnerModeBypass"
21
22
  };
22
- function j() {
23
+ function N() {
23
24
  let { workspace: e } = c.useParams();
24
- return /* @__PURE__ */ h(M, { workspace: e });
25
+ return /* @__PURE__ */ _(P, { workspace: e });
25
26
  }
26
- function M({ workspace: c }) {
27
- let { data: j } = y(n(c)), M = m("account"), N = p(), P = m("common"), F = a(), I = v(), L = O(), R = D(), z = d(), B = _({
27
+ function P({ workspace: c }) {
28
+ let { data: N } = x(n(c)), P = g("account"), F = h(), I = g("common"), L = a(), R = b(), z = A(), B = k(), V = p(), H = y({
28
29
  mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/runners/{runnerId}", { params: { path: {
29
30
  workspace: c,
30
31
  runnerId: n
31
32
  } } })),
32
- onSettled: () => I.invalidateQueries({ queryKey: n(c).queryKey })
33
- }), { confirm: V, dialog: H } = o(), U = (e) => V({
34
- title: M("revokeRunnerTitle"),
35
- description: M("revokeRunnerDescription", { name: e.name }),
36
- confirmLabel: M("revoke"),
37
- onConfirm: () => B.mutateAsync(e.id)
38
- }), W = f(() => [{
33
+ onSettled: () => R.invalidateQueries({ queryKey: n(c).queryKey })
34
+ }), { confirm: U, dialog: W } = o(), G = (e) => U({
35
+ title: P("revokeRunnerTitle"),
36
+ description: P("revokeRunnerDescription", { name: e.name }),
37
+ confirmLabel: P("revoke"),
38
+ onConfirm: () => H.mutateAsync(e.id)
39
+ }), K = m(() => [{
39
40
  key: "name",
40
- label: P("name"),
41
+ label: I("name"),
41
42
  headerClassName: "py-2",
42
43
  alwaysVisible: !0
43
44
  }, {
44
45
  key: "seen",
45
- label: M("runnerColSeen"),
46
+ label: P("runnerColSeen"),
46
47
  headerClassName: "py-2 w-40",
47
48
  align: "end"
48
- }], [M, P]), G = f(() => [{
49
+ }], [P, I]), q = m(() => [{
49
50
  value: "name",
50
- label: P("name"),
51
+ label: I("name"),
51
52
  compare: (e, t) => e.name.localeCompare(t.name)
52
53
  }, {
53
54
  value: "seen",
54
- label: M("runnerColSeen"),
55
+ label: P("runnerColSeen"),
55
56
  compare: (e, t) => (t.lastSeenAt ?? "").localeCompare(e.lastSeenAt ?? "")
56
- }], [M, P]), K = k({
57
+ }], [P, I]), J = j({
57
58
  storageKey: `tandem-runners-${c}`,
58
59
  defaultShowColumnHeaders: !1,
59
- columns: W,
60
- orderBys: G,
60
+ columns: K,
61
+ orderBys: q,
61
62
  defaultOrderBy: "name",
62
63
  facets: []
63
- }), q = L.filter.trim().toLowerCase(), J = j.filter((e) => !q || [
64
+ }), Y = z.filter.trim().toLowerCase(), X = N.filter((e) => !Y || [
64
65
  e.name,
65
66
  e.group ?? "",
66
67
  ...e.harnesses,
67
68
  ...e.labels
68
- ].some((e) => e.toLowerCase().includes(q)));
69
- return /* @__PURE__ */ g(s, {
69
+ ].some((e) => e.toLowerCase().includes(Y)));
70
+ return /* @__PURE__ */ v(s, {
70
71
  wide: !0,
71
- title: M("runners"),
72
- description: M.rich("runnersDescription", { code: (e) => /* @__PURE__ */ h("code", {
72
+ title: P("runners"),
73
+ description: P.rich("runnersDescription", { code: (e) => /* @__PURE__ */ _("code", {
73
74
  className: "rounded bg-muted px-1 py-0.5 text-xs",
74
75
  children: e
75
76
  }) }),
76
- toolbar: j.length > 0 && /* @__PURE__ */ h(w, {
77
- view: K,
78
- search: L,
79
- searchLabel: M("runnerSearch"),
80
- searchPlaceholder: M("runnerSearch")
77
+ toolbar: N.length > 0 && /* @__PURE__ */ _(E, {
78
+ view: J,
79
+ search: z,
80
+ searchLabel: P("runnerSearch"),
81
+ searchPlaceholder: P("runnerSearch")
81
82
  }),
82
- children: [/* @__PURE__ */ h("div", {
83
- className: "border-t border-border",
84
- children: /* @__PURE__ */ h(S, {
85
- view: K,
86
- total: j.length,
87
- matches: J.length,
88
- count: {
89
- filterActive: L.filter.trim() !== "",
90
- noun: M("runnerNoun"),
91
- nounPlural: M("runnerNounPlural")
92
- },
93
- empty: {
94
- icon: /* @__PURE__ */ h(i, {}),
95
- title: M("noRunners")
96
- },
97
- noMatches: M("runnerNoMatches"),
98
- children: /* @__PURE__ */ g(l, {
99
- ...E,
100
- children: [/* @__PURE__ */ h(x, { view: K }), K.applyOrder(J).map((e) => /* @__PURE__ */ g(C, {
101
- href: null,
102
- goTo: R,
103
- openMenu: z,
104
- items: [
105
- r(M("copyRunnerId"), e.id),
106
- r(P("copyName"), e.name),
107
- u,
108
- {
109
- label: M("revoke"),
110
- destructive: !0,
111
- onClick: () => U(e)
112
- }
113
- ],
114
- children: [/* @__PURE__ */ h(T, {
115
- icon: /* @__PURE__ */ h(i, {}),
116
- iconTile: !0,
117
- name: e.name,
118
- subtitle: N.list([
119
- ...e.group ? [M("runnerSharedWith", { group: e.group })] : [],
120
- ...e.permissionMode ? [M(A[e.permissionMode])] : [],
121
- ...e.harnesses,
122
- ...e.labels
123
- ], { type: "unit" }),
124
- href: null
125
- }), K.isVisible("seen") && /* @__PURE__ */ h(l.Item, {
126
- className: "py-2.5",
127
- children: /* @__PURE__ */ h(b, { children: e.lastSeenAt ? M("runnerSeen", { seen: F.relative(e.lastSeenAt) }) : M("runnerNeverConnected") })
128
- })]
129
- }, e.id))]
83
+ children: [
84
+ /* @__PURE__ */ _("div", {
85
+ className: "border-t border-border",
86
+ children: /* @__PURE__ */ _(w, {
87
+ view: J,
88
+ total: N.length,
89
+ matches: X.length,
90
+ count: {
91
+ filterActive: z.filter.trim() !== "",
92
+ noun: P("runnerNoun"),
93
+ nounPlural: P("runnerNounPlural")
94
+ },
95
+ empty: {
96
+ icon: /* @__PURE__ */ _(i, {}),
97
+ title: P("noRunners")
98
+ },
99
+ noMatches: P("runnerNoMatches"),
100
+ children: /* @__PURE__ */ v(d, {
101
+ ...O,
102
+ children: [/* @__PURE__ */ _(C, { view: J }), J.applyOrder(X).map((e) => /* @__PURE__ */ v(T, {
103
+ href: null,
104
+ goTo: B,
105
+ openMenu: V,
106
+ items: [
107
+ r(P("copyRunnerId"), e.id),
108
+ r(I("copyName"), e.name),
109
+ f,
110
+ {
111
+ label: P("revoke"),
112
+ destructive: !0,
113
+ onClick: () => G(e)
114
+ }
115
+ ],
116
+ children: [/* @__PURE__ */ _(D, {
117
+ icon: /* @__PURE__ */ _(i, {}),
118
+ iconTile: !0,
119
+ name: e.name,
120
+ subtitle: F.list([
121
+ ...e.group ? [P("runnerSharedWith", { group: e.group })] : [],
122
+ ...e.permissionMode ? [P(M[e.permissionMode])] : [],
123
+ ...e.harnesses,
124
+ ...e.labels
125
+ ], { type: "unit" }),
126
+ href: null
127
+ }), J.isVisible("seen") && /* @__PURE__ */ v(d.Item, {
128
+ className: "py-2.5",
129
+ children: [/* @__PURE__ */ _(S, { children: e.lastSeenAt ? P("runnerSeen", { seen: L.relative(e.lastSeenAt) }) : P("runnerNeverConnected") }), e.isolation && /* @__PURE__ */ v("span", {
130
+ className: "flex items-center justify-end gap-1.5 text-xs text-muted-foreground",
131
+ title: e.isolation.failures.join("\n") || void 0,
132
+ children: [/* @__PURE__ */ _(u, {
133
+ variant: e.isolation.passed ? "success" : "error",
134
+ size: 8
135
+ }), e.isolation.passed ? P("runnerIsolated") : P("runnerNotIsolated", { count: e.isolation.failures.length })]
136
+ })]
137
+ })]
138
+ }, e.id))]
139
+ })
130
140
  })
131
- })
132
- }), H]
141
+ }),
142
+ /* @__PURE__ */ _(l, { workspace: c }),
143
+ W
144
+ ]
133
145
  });
134
146
  }
135
- export { j as component };
147
+ export { N as component };