@parallelworks/tandem-web 0.175.0 → 0.175.2
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/_virtual/_virtual_i18n/en/common.js +1 -0
- package/_virtual/_virtual_i18n/es/common.js +1 -0
- package/_virtual/_virtual_i18n/ja/common.js +1 -0
- package/_virtual/_virtual_i18n/ko/common.js +1 -0
- package/_virtual/_virtual_i18n/zh/common.js +1 -0
- package/components/InlineCommand.js +13 -0
- package/components/TriageButtons.js +10 -6
- package/package.json +1 -1
- package/routes/_workspace/notifications2.js +105 -102
- package/routes/_workspace/settings/runners2.js +41 -43
- package/routes/_workspace/settings/tokens2.js +115 -117
|
@@ -132,6 +132,7 @@ var e = {
|
|
|
132
132
|
usernameDescription: "Used in links and the API. Old links stop working when you change it.",
|
|
133
133
|
tokens: "CLI and API tokens",
|
|
134
134
|
tokensDescription: "Tokens act as you, within the access you give them. Create one here for a script or integration, or sign in with <code>tandem login</code>. Unused tokens expire after 90 days.",
|
|
135
|
+
command: "command",
|
|
135
136
|
revoke: "Revoke",
|
|
136
137
|
revokeTokenTitle: "Revoke token?",
|
|
137
138
|
revokeTokenDescription: "Anything using {name} will be signed out.",
|
|
@@ -132,6 +132,7 @@ var e = {
|
|
|
132
132
|
usernameDescription: "Se usa en los enlaces y en la API. Los enlaces antiguos dejan de funcionar cuando lo cambias.",
|
|
133
133
|
tokens: "Tokens de CLI y API",
|
|
134
134
|
tokensDescription: "Los tokens actúan como tú, dentro del acceso que les des. Crea uno aquí para un script o una integración, o inicia sesión con <code>tandem login</code>. Los tokens sin usar caducan a los 90 días.",
|
|
135
|
+
command: "comando",
|
|
135
136
|
revoke: "Revocar",
|
|
136
137
|
revokeTokenTitle: "¿Revocar el token?",
|
|
137
138
|
revokeTokenDescription: "Se cerrará la sesión de todo lo que use {name}.",
|
|
@@ -132,6 +132,7 @@ var e = {
|
|
|
132
132
|
usernameDescription: "リンクや API で使われます。変更すると、古いリンクは使えなくなります。",
|
|
133
133
|
tokens: "CLI・API トークン",
|
|
134
134
|
tokensDescription: "トークンは、付与したアクセス権の範囲内であなたとして動作します。スクリプトや連携用にここで作成するか、<code>tandem login</code> でサインインしてください。使われていないトークンは 90 日後に失効します。",
|
|
135
|
+
command: "コマンド",
|
|
135
136
|
revoke: "取り消す",
|
|
136
137
|
revokeTokenTitle: "トークンを取り消しますか?",
|
|
137
138
|
revokeTokenDescription: "{name} を使っているものはすべてサインアウトされます。",
|
|
@@ -132,6 +132,7 @@ var e = {
|
|
|
132
132
|
usernameDescription: "링크와 API에 사용됩니다. 변경하면 이전 링크는 더 이상 작동하지 않습니다.",
|
|
133
133
|
tokens: "CLI 및 API 토큰",
|
|
134
134
|
tokensDescription: "토큰은 부여한 액세스 범위 안에서 회원님으로 동작합니다. 스크립트나 통합에 사용할 토큰을 여기에서 만들거나 <code>tandem login</code>으로 로그인하세요. 사용하지 않는 토큰은 90일 후 만료됩니다.",
|
|
135
|
+
command: "명령어",
|
|
135
136
|
revoke: "해지",
|
|
136
137
|
revokeTokenTitle: "토큰을 해지하시겠습니까?",
|
|
137
138
|
revokeTokenDescription: "{name}을(를) 사용하는 모든 항목이 로그아웃됩니다.",
|
|
@@ -132,6 +132,7 @@ var e = {
|
|
|
132
132
|
usernameDescription: "用于链接和 API。更改后,旧链接将失效。",
|
|
133
133
|
tokens: "CLI 和 API 令牌",
|
|
134
134
|
tokensDescription: "令牌以您的身份操作,权限不超出您授予的范围。可在此为脚本或集成创建令牌,也可以使用 <code>tandem login</code> 登录。未使用的令牌将在 90 天后过期。",
|
|
135
|
+
command: "命令",
|
|
135
136
|
revoke: "撤销",
|
|
136
137
|
revokeTokenTitle: "撤销令牌?",
|
|
137
138
|
revokeTokenDescription: "所有使用 {name} 的程序都将退出登录。",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CopyCodeBlock as e } from "@parallelworks/ui";
|
|
2
|
+
import { useTranslations as t } from "use-intl";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
// src/components/InlineCommand.tsx
|
|
5
|
+
function r({ children: r }) {
|
|
6
|
+
let i = t("account");
|
|
7
|
+
return /* @__PURE__ */ n(e, {
|
|
8
|
+
inline: !0,
|
|
9
|
+
text: [r].flat().join(""),
|
|
10
|
+
label: i("command")
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export { r as InlineCommand };
|
|
@@ -5,9 +5,9 @@ import { useErrorMessage as r } from "@parallelworks/problem/react";
|
|
|
5
5
|
import { useTranslations as i } from "use-intl";
|
|
6
6
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
// src/components/TriageButtons.tsx
|
|
8
|
-
function c({ workspace:
|
|
9
|
-
let d = i("triage"), f = e
|
|
10
|
-
if (!f
|
|
8
|
+
function c({ workspace: e, issue: r, onDecided: c }) {
|
|
9
|
+
let d = i("triage"), f = l(e, r), p = t(e, r, c);
|
|
10
|
+
if (!f) return null;
|
|
11
11
|
let m = (e) => /* @__PURE__ */ o(n, {
|
|
12
12
|
variant: e === "accept" ? "primary" : "outline",
|
|
13
13
|
size: "sm",
|
|
@@ -20,14 +20,18 @@ function c({ workspace: r, issue: c, onDecided: u }) {
|
|
|
20
20
|
return /* @__PURE__ */ s(a, { children: [
|
|
21
21
|
m("accept"),
|
|
22
22
|
m("decline"),
|
|
23
|
-
p.error && /* @__PURE__ */ o(
|
|
23
|
+
p.error && /* @__PURE__ */ o(u, { error: p.error })
|
|
24
24
|
] });
|
|
25
25
|
}
|
|
26
|
-
function l(
|
|
26
|
+
function l(t, n) {
|
|
27
|
+
let r = e(t, n?.teamId ?? "");
|
|
28
|
+
return !!n?.triage && r;
|
|
29
|
+
}
|
|
30
|
+
function u({ error: e }) {
|
|
27
31
|
let t = r();
|
|
28
32
|
return /* @__PURE__ */ o("p", {
|
|
29
33
|
className: "basis-full text-xs text-danger",
|
|
30
34
|
children: t(e)
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
|
-
export { c as TriageButtons };
|
|
37
|
+
export { c as TriageButtons, l as useCanDecideTriage };
|
package/package.json
CHANGED
|
@@ -4,25 +4,25 @@ import { DecisionCard as a } from "../../components/AgentWork.js";
|
|
|
4
4
|
import { Editor as o } from "../../components/Editor.js";
|
|
5
5
|
import { ArchiveIcon as s, ArrowRightIcon as c, CheckIcon as l, CommentIcon as u, FileTextIcon as d, InboxIcon as f, PriorityIcon as p, ProjectIcon as m, StatusIcon as h, UserIcon as g, usePriorityNames as _ } from "../../components/icons.js";
|
|
6
6
|
import { PersonHoverCard as v } from "../../components/PersonHoverCard.js";
|
|
7
|
-
import { TriageButtons as y } from "../../components/TriageButtons.js";
|
|
8
|
-
import { parseApproval as
|
|
9
|
-
import { copyItem as
|
|
10
|
-
import { useArchiveNotifications as ee, useReadNotifications as te, useUnreadNotifications as
|
|
11
|
-
import { usePageTitle as
|
|
7
|
+
import { TriageButtons as y, useCanDecideTriage as b } from "../../components/TriageButtons.js";
|
|
8
|
+
import { parseApproval as x } from "../../lib/approval.js";
|
|
9
|
+
import { copyItem as S, useLinkItems as C } from "../../lib/menus.js";
|
|
10
|
+
import { useArchiveNotifications as ee, useReadNotifications as te, useUnreadNotifications as ne } from "../../lib/notifications.js";
|
|
11
|
+
import { usePageTitle as re } from "../../lib/pageTitle.js";
|
|
12
12
|
import { usePeople as w } from "../../lib/people.js";
|
|
13
13
|
import { plainText as T } from "../../lib/plainText.js";
|
|
14
|
-
import { Link as E, useNavigate as
|
|
15
|
-
import { useShortcuts as
|
|
14
|
+
import { Link as E, useNavigate as ie } from "../../lib/router.js";
|
|
15
|
+
import { useShortcuts as ae } from "../../lib/shortcuts.js";
|
|
16
16
|
import { Route as D } from "./notifications.js";
|
|
17
17
|
import { Avatar as O, Button as k, Card as A, EmptyState as j, IconButton as M, RelativeTime as N, buttonClasses as P, menuDivider as F, useOpenMenu as I } from "@parallelworks/ui";
|
|
18
|
-
import { useEffect as
|
|
18
|
+
import { useEffect as oe, useMemo as L, useRef as se, useState as ce } from "react";
|
|
19
19
|
import { useTranslations as R } from "use-intl";
|
|
20
20
|
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
21
|
-
import { useQuery as H, useQueryClient as U, useSuspenseQuery as
|
|
22
|
-
import { ListFilterMenu as
|
|
21
|
+
import { useQuery as H, useQueryClient as U, useSuspenseQuery as le } from "@tanstack/react-query";
|
|
22
|
+
import { ListFilterMenu as ue, useListView as W } from "@parallelworks/ui/list";
|
|
23
23
|
// src/routes/$workspace/notifications.tsx?tsr-split=component
|
|
24
24
|
var G = (...e) => e.filter(Boolean).join(" ");
|
|
25
|
-
function
|
|
25
|
+
function de(e, t) {
|
|
26
26
|
let n = /* @__PURE__ */ new Map();
|
|
27
27
|
for (let r of t) {
|
|
28
28
|
let t = r.projectId ? "project" : r.documentId ? "doc" : "issue", i = r.projectId ? `project:${r.projectId}` : r.documentId ? `doc:${r.documentId}` : r.identifier, a = n.get(i);
|
|
@@ -52,7 +52,7 @@ var K = {
|
|
|
52
52
|
reminders: ["reminder"],
|
|
53
53
|
mentions: ["mentioned"]
|
|
54
54
|
}, q = (e) => e.reason === "reminder" && e.excerpt ? /* @__PURE__ */ new Date(`${e.excerpt}T00:00:00`) : /* @__PURE__ */ new Date(0), J = (e) => e.slice(0, e.lastIndexOf("-"));
|
|
55
|
-
function
|
|
55
|
+
function fe(e, t) {
|
|
56
56
|
let n = R("notifications"), r = L(() => {
|
|
57
57
|
let e = [{
|
|
58
58
|
key: "state",
|
|
@@ -88,11 +88,11 @@ function de(e, t) {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
function Y() {
|
|
91
|
-
let { workspace: e } = D.useParams(), { issue: t } = D.useSearch(), i = R("notifications"), a =
|
|
92
|
-
|
|
93
|
-
let u = te(e), d =
|
|
91
|
+
let { workspace: e } = D.useParams(), { issue: t } = D.useSearch(), i = R("notifications"), a = ie(), { data: { notifications: o, unread: c } } = le(n(e));
|
|
92
|
+
re(c > 0 ? `${i("title")} (${c})` : i("title"));
|
|
93
|
+
let u = te(e), d = ne(e), p = ee(e), { data: m = [] } = H(r(e)), h = fe(e, m), g = h.activeFilterCount > 0, _ = (h.filters.state ?? []).includes("unread"), v = h.filters.kind ?? [], y = h.filters.team ?? [], b = L(() => {
|
|
94
94
|
let n = o.filter((e) => (v.length === 0 || v.some((t) => K[t]?.includes(e.reason))) && (y.length === 0 || !!e.identifier && y.includes(J(e.identifier))));
|
|
95
|
-
return
|
|
95
|
+
return de(e, n).filter((e) => !_ || e.unread.length > 0 || e.key === t);
|
|
96
96
|
}, [
|
|
97
97
|
e,
|
|
98
98
|
o,
|
|
@@ -100,58 +100,58 @@ function Y() {
|
|
|
100
100
|
v,
|
|
101
101
|
y,
|
|
102
102
|
t
|
|
103
|
-
]), x = b.findIndex((e) => e.key === t), S = x >= 0 ? b[x] : void 0, [
|
|
103
|
+
]), x = b.findIndex((e) => e.key === t), S = x >= 0 ? b[x] : void 0, [C, w] = ce(/* @__PURE__ */ new Set()), T = se(null), E = L(() => b.filter((e) => C.has(e.key)), [b, C]), O = (t) => {
|
|
104
104
|
a({
|
|
105
105
|
to: "/$workspace/notifications",
|
|
106
106
|
params: { workspace: e },
|
|
107
107
|
search: t ? { issue: t.key } : {},
|
|
108
108
|
replace: !0
|
|
109
109
|
}), t && t.unread.length > 0 && u.mutate(t.unread);
|
|
110
|
-
},
|
|
110
|
+
}, A = (e) => {
|
|
111
111
|
let t = e.flatMap((e) => e.unread);
|
|
112
112
|
t.length > 0 ? u.mutate(t) : d.mutate(e.flatMap((e) => e.items.map((e) => e.id)));
|
|
113
|
-
},
|
|
114
|
-
if (p.mutate(e.flatMap((e) => e.items.map((e) => e.id))),
|
|
113
|
+
}, N = (e) => {
|
|
114
|
+
if (p.mutate(e.flatMap((e) => e.items.map((e) => e.id))), w(/* @__PURE__ */ new Set()), S && e.includes(S)) {
|
|
115
115
|
let t = b.filter((t) => !e.includes(t));
|
|
116
|
-
|
|
116
|
+
O(t[t.findIndex((e) => b.indexOf(e) > x)] ?? t.at(-1));
|
|
117
117
|
}
|
|
118
|
-
},
|
|
118
|
+
}, P = (e) => a({ to: e.href }), F = E.length > 0 ? E : S ? [S] : [], I = (e) => w((t) => {
|
|
119
119
|
let n = new Set(t);
|
|
120
120
|
return n.has(e.key) ? n.delete(e.key) : n.add(e.key), n;
|
|
121
|
-
}),
|
|
121
|
+
}), U = (e, t) => {
|
|
122
122
|
let [n, r] = e < t ? [e, t] : [t, e];
|
|
123
|
-
|
|
124
|
-
},
|
|
123
|
+
w(new Set(b.slice(n, r + 1).map((e) => e.key)));
|
|
124
|
+
}, W = (e, t) => {
|
|
125
125
|
let n = b.indexOf(t);
|
|
126
|
-
e.metaKey || e.ctrlKey ? (
|
|
127
|
-
},
|
|
126
|
+
e.metaKey || e.ctrlKey ? (I(t), T.current = n) : e.shiftKey ? U(T.current ?? (x >= 0 ? x : n), n) : (w(/* @__PURE__ */ new Set()), T.current = n, O(t));
|
|
127
|
+
}, q = (e, t) => {
|
|
128
128
|
let n = Math.min(Math.max(x + e, 0), b.length - 1);
|
|
129
|
-
t && ((
|
|
129
|
+
t && ((T.current === null || C.size === 0) && (T.current = Math.max(x, 0)), U(T.current, n)), O(b[n]);
|
|
130
130
|
};
|
|
131
|
-
|
|
132
|
-
j: () =>
|
|
133
|
-
k: () =>
|
|
134
|
-
J: () =>
|
|
135
|
-
K: () =>
|
|
136
|
-
ArrowDown: (e) =>
|
|
137
|
-
ArrowUp: (e) =>
|
|
131
|
+
ae({
|
|
132
|
+
j: () => q(1, !1),
|
|
133
|
+
k: () => q(-1, !1),
|
|
134
|
+
J: () => q(1, !0),
|
|
135
|
+
K: () => q(-1, !0),
|
|
136
|
+
ArrowDown: (e) => q(1, e.shiftKey),
|
|
137
|
+
ArrowUp: (e) => q(-1, e.shiftKey),
|
|
138
138
|
x: () => {
|
|
139
|
-
S && (
|
|
139
|
+
S && (I(S), T.current = x);
|
|
140
140
|
},
|
|
141
|
-
Enter: () => S &&
|
|
142
|
-
e: () =>
|
|
143
|
-
u: () =>
|
|
144
|
-
Escape: () =>
|
|
145
|
-
}),
|
|
141
|
+
Enter: () => S && P(S),
|
|
142
|
+
e: () => F.length > 0 && N(F),
|
|
143
|
+
u: () => F.length > 0 && A(F),
|
|
144
|
+
Escape: () => C.size > 0 ? w(/* @__PURE__ */ new Set()) : O(void 0)
|
|
145
|
+
}), oe(() => {
|
|
146
146
|
document.getElementById(`inbox-${S?.key}`)?.scrollIntoView({ block: "nearest" });
|
|
147
147
|
}, [S]);
|
|
148
|
-
let
|
|
149
|
-
select:
|
|
150
|
-
toggleRead:
|
|
151
|
-
archiveGroups:
|
|
152
|
-
openIssue:
|
|
153
|
-
clickRow:
|
|
154
|
-
targetsOf: (e) =>
|
|
148
|
+
let Y = {
|
|
149
|
+
select: O,
|
|
150
|
+
toggleRead: A,
|
|
151
|
+
archiveGroups: N,
|
|
152
|
+
openIssue: P,
|
|
153
|
+
clickRow: W,
|
|
154
|
+
targetsOf: (e) => C.has(e.key) ? E : (w(/* @__PURE__ */ new Set()), [e])
|
|
155
155
|
};
|
|
156
156
|
return /* @__PURE__ */ V("div", {
|
|
157
157
|
className: "flex h-full flex-col",
|
|
@@ -167,7 +167,7 @@ function Y() {
|
|
|
167
167
|
className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
|
|
168
168
|
children: i("unreadCount", { count: c })
|
|
169
169
|
}),
|
|
170
|
-
/* @__PURE__ */ B(
|
|
170
|
+
/* @__PURE__ */ B(ue, { view: h }),
|
|
171
171
|
c > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(k, {
|
|
172
172
|
type: "button",
|
|
173
173
|
size: "sm",
|
|
@@ -200,16 +200,16 @@ function Y() {
|
|
|
200
200
|
})] })
|
|
201
201
|
]
|
|
202
202
|
}),
|
|
203
|
-
|
|
203
|
+
E.length > 0 && /* @__PURE__ */ V("div", {
|
|
204
204
|
className: "flex min-h-9 shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border bg-human-soft px-4 py-1 text-xs md:px-5",
|
|
205
205
|
children: [
|
|
206
206
|
/* @__PURE__ */ B("span", {
|
|
207
207
|
className: "font-medium text-human",
|
|
208
|
-
children: i("selected", { count:
|
|
208
|
+
children: i("selected", { count: E.length })
|
|
209
209
|
}),
|
|
210
|
-
|
|
210
|
+
E.length < b.length && /* @__PURE__ */ B("button", {
|
|
211
211
|
type: "button",
|
|
212
|
-
onClick: () =>
|
|
212
|
+
onClick: () => w(new Set(b.map((e) => e.key))),
|
|
213
213
|
className: "hover:underline",
|
|
214
214
|
children: i("selectAll", { count: b.length })
|
|
215
215
|
}),
|
|
@@ -219,25 +219,25 @@ function Y() {
|
|
|
219
219
|
/* @__PURE__ */ B(k, {
|
|
220
220
|
type: "button",
|
|
221
221
|
size: "sm",
|
|
222
|
-
onClick: () => u.mutate(
|
|
223
|
-
disabled:
|
|
222
|
+
onClick: () => u.mutate(E.flatMap((e) => e.unread)),
|
|
223
|
+
disabled: E.every((e) => e.unread.length === 0),
|
|
224
224
|
children: i("markRead")
|
|
225
225
|
}),
|
|
226
226
|
/* @__PURE__ */ B(k, {
|
|
227
227
|
type: "button",
|
|
228
228
|
size: "sm",
|
|
229
|
-
onClick: () => d.mutate(
|
|
229
|
+
onClick: () => d.mutate(E.flatMap((e) => e.items.map((e) => e.id))),
|
|
230
230
|
children: i("markUnread")
|
|
231
231
|
}),
|
|
232
232
|
/* @__PURE__ */ B(k, {
|
|
233
233
|
type: "button",
|
|
234
234
|
size: "sm",
|
|
235
|
-
onClick: () =>
|
|
235
|
+
onClick: () => N(E),
|
|
236
236
|
children: i("archive")
|
|
237
237
|
}),
|
|
238
238
|
/* @__PURE__ */ B("button", {
|
|
239
239
|
type: "button",
|
|
240
|
-
onClick: () =>
|
|
240
|
+
onClick: () => w(/* @__PURE__ */ new Set()),
|
|
241
241
|
className: "shrink-0 px-1 hover:underline",
|
|
242
242
|
children: i("clear")
|
|
243
243
|
})
|
|
@@ -266,19 +266,19 @@ function Y() {
|
|
|
266
266
|
children: [/* @__PURE__ */ B("ul", {
|
|
267
267
|
"aria-label": i("title"),
|
|
268
268
|
className: G("min-h-0 min-w-0 flex-1 flex-col overflow-y-auto px-2 py-2 md:flex md:max-w-md md:border-r md:border-border", S ? "hidden" : "flex"),
|
|
269
|
-
children: b.map((t) => /* @__PURE__ */ B(
|
|
269
|
+
children: b.map((t) => /* @__PURE__ */ B(Q, {
|
|
270
270
|
workspace: e,
|
|
271
271
|
group: t,
|
|
272
272
|
selected: t === S,
|
|
273
|
-
picked:
|
|
274
|
-
actions:
|
|
273
|
+
picked: C.has(t.key),
|
|
274
|
+
actions: Y
|
|
275
275
|
}, t.key))
|
|
276
276
|
}), /* @__PURE__ */ B("div", {
|
|
277
277
|
className: G("min-w-0 flex-1 overflow-y-auto md:block", S ? "block" : "hidden"),
|
|
278
|
-
children: S ? /* @__PURE__ */ B(
|
|
278
|
+
children: S ? /* @__PURE__ */ B(ge, {
|
|
279
279
|
workspace: e,
|
|
280
280
|
group: S,
|
|
281
|
-
actions:
|
|
281
|
+
actions: Y
|
|
282
282
|
}) : /* @__PURE__ */ B("div", {
|
|
283
283
|
className: "px-6 py-24",
|
|
284
284
|
children: /* @__PURE__ */ B(j, {
|
|
@@ -292,7 +292,7 @@ function Y() {
|
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
function X(e) {
|
|
295
|
-
let t = R("notifications"), n =
|
|
295
|
+
let t = R("notifications"), n = C();
|
|
296
296
|
return (r) => {
|
|
297
297
|
let [i] = r;
|
|
298
298
|
return [
|
|
@@ -309,7 +309,7 @@ function X(e) {
|
|
|
309
309
|
...r.length === 1 && i ? [
|
|
310
310
|
F,
|
|
311
311
|
...n(i.href),
|
|
312
|
-
...i.identifier ? [
|
|
312
|
+
...i.identifier ? [S(t("copyId"), i.identifier)] : []
|
|
313
313
|
] : []
|
|
314
314
|
];
|
|
315
315
|
};
|
|
@@ -318,7 +318,7 @@ function Z(e) {
|
|
|
318
318
|
let { actorName: t } = w(e);
|
|
319
319
|
return (e) => e.actor.kind === "agent" && e.agentName ? e.agentName : t(e.actor);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Q({ workspace: e, group: t, selected: n, picked: r, actions: a }) {
|
|
322
322
|
let o = R("notifications"), { avatarOf: s } = w(e), c = Z(e), l = I(), u = X(a), d = t.items[0], f = c(d), p = t.unread.length > 0;
|
|
323
323
|
return /* @__PURE__ */ B("li", {
|
|
324
324
|
id: `inbox-${t.key}`,
|
|
@@ -355,7 +355,7 @@ function fe({ workspace: e, group: t, selected: n, picked: r, actions: a }) {
|
|
|
355
355
|
actor: d.actor,
|
|
356
356
|
name: f,
|
|
357
357
|
src: s(d.actor.kind, d.actor.handle),
|
|
358
|
-
badge:
|
|
358
|
+
badge: pe(d)
|
|
359
359
|
})
|
|
360
360
|
}),
|
|
361
361
|
/* @__PURE__ */ V("span", {
|
|
@@ -377,7 +377,7 @@ function fe({ workspace: e, group: t, selected: n, picked: r, actions: a }) {
|
|
|
377
377
|
actor: f,
|
|
378
378
|
agent: d.agentName ?? f,
|
|
379
379
|
date: q(d)
|
|
380
|
-
}), d.excerpt && d.reason !== "reminder" && /* @__PURE__ */ V(z, { children: [": ", /* @__PURE__ */ B(
|
|
380
|
+
}), d.excerpt && d.reason !== "reminder" && /* @__PURE__ */ V(z, { children: [": ", /* @__PURE__ */ B(ve, { text: d.excerpt })] })]
|
|
381
381
|
}), t.items.length > 1 && /* @__PURE__ */ B("span", {
|
|
382
382
|
className: "shrink-0",
|
|
383
383
|
children: o("more", { count: t.items.length - 1 })
|
|
@@ -407,7 +407,7 @@ function fe({ workspace: e, group: t, selected: n, picked: r, actions: a }) {
|
|
|
407
407
|
})
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function pe(e) {
|
|
411
411
|
switch (e.reason) {
|
|
412
412
|
case "assigned": return /* @__PURE__ */ B(g, {});
|
|
413
413
|
case "commented":
|
|
@@ -416,7 +416,7 @@ function Q(e) {
|
|
|
416
416
|
default: return null;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function me({ workspace: e, identifier: n }) {
|
|
420
420
|
let { data: r } = H(t(e, n)), i = _(), { nameOf: a, avatarOf: s } = w(e);
|
|
421
421
|
return r ? /* @__PURE__ */ V("section", {
|
|
422
422
|
className: "mt-5 rounded-lg border border-border px-4 py-3",
|
|
@@ -454,7 +454,7 @@ function pe({ workspace: e, identifier: n }) {
|
|
|
454
454
|
})]
|
|
455
455
|
}) : null;
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function he({ workspace: e, identifier: r }) {
|
|
458
458
|
let i = U(), { data: a } = H(t(e, r));
|
|
459
459
|
return a ? /* @__PURE__ */ B(y, {
|
|
460
460
|
workspace: e,
|
|
@@ -462,65 +462,68 @@ function me({ workspace: e, identifier: r }) {
|
|
|
462
462
|
onDecided: () => i.invalidateQueries({ queryKey: n(e).queryKey })
|
|
463
463
|
}) : null;
|
|
464
464
|
}
|
|
465
|
-
function
|
|
466
|
-
let
|
|
465
|
+
function ge({ workspace: e, group: n, actions: r }) {
|
|
466
|
+
let i = R("notifications"), { avatarOf: a } = w(e), o = Z(e), s = I(), c = X(r), { data: l } = H({
|
|
467
|
+
...t(e, n.identifier ?? ""),
|
|
468
|
+
enabled: !!n.identifier
|
|
469
|
+
}), u = b(e, n.identifier ? l : void 0);
|
|
467
470
|
return /* @__PURE__ */ V("article", {
|
|
468
471
|
className: "w-full px-4 py-5 md:px-8",
|
|
469
|
-
onContextMenu: (e) =>
|
|
472
|
+
onContextMenu: (e) => s(e, c([n])),
|
|
470
473
|
children: [
|
|
471
474
|
/* @__PURE__ */ B("button", {
|
|
472
475
|
type: "button",
|
|
473
|
-
onClick: () =>
|
|
476
|
+
onClick: () => r.select(void 0),
|
|
474
477
|
className: "mb-3 text-xs text-muted-foreground hover:text-foreground md:hidden",
|
|
475
|
-
children:
|
|
478
|
+
children: i("back")
|
|
476
479
|
}),
|
|
477
480
|
/* @__PURE__ */ B("p", {
|
|
478
481
|
className: "text-xs text-muted-foreground",
|
|
479
|
-
children: /* @__PURE__ */ B($, { group:
|
|
482
|
+
children: /* @__PURE__ */ B($, { group: n })
|
|
480
483
|
}),
|
|
481
484
|
/* @__PURE__ */ B("h2", {
|
|
482
485
|
className: "mt-0.5 text-sm font-semibold",
|
|
483
486
|
children: /* @__PURE__ */ B(E, {
|
|
484
|
-
to:
|
|
487
|
+
to: n.href,
|
|
485
488
|
className: "hover:underline",
|
|
486
|
-
children:
|
|
489
|
+
children: n.issueTitle
|
|
487
490
|
})
|
|
488
491
|
}),
|
|
489
492
|
/* @__PURE__ */ V("div", {
|
|
490
493
|
className: "mt-3 flex flex-wrap gap-2",
|
|
491
494
|
children: [
|
|
492
495
|
/* @__PURE__ */ B(E, {
|
|
493
|
-
to:
|
|
496
|
+
to: n.href,
|
|
494
497
|
className: P({
|
|
495
|
-
variant: "primary",
|
|
498
|
+
variant: u ? "secondary" : "primary",
|
|
496
499
|
size: "sm"
|
|
497
500
|
}),
|
|
498
|
-
children:
|
|
501
|
+
children: i(n.kind === "project" ? "openProject" : n.kind === "doc" ? "openDoc" : "openIssue")
|
|
499
502
|
}),
|
|
500
503
|
/* @__PURE__ */ B(k, {
|
|
501
504
|
type: "button",
|
|
502
505
|
size: "sm",
|
|
503
|
-
onClick: () =>
|
|
504
|
-
children:
|
|
506
|
+
onClick: () => r.toggleRead([n]),
|
|
507
|
+
children: n.unread.length > 0 ? i("markRead") : i("markUnread")
|
|
505
508
|
}),
|
|
506
509
|
/* @__PURE__ */ B(k, {
|
|
507
510
|
type: "button",
|
|
508
511
|
size: "sm",
|
|
509
|
-
onClick: () =>
|
|
510
|
-
children:
|
|
512
|
+
onClick: () => r.archiveGroups([n]),
|
|
513
|
+
children: i("archive")
|
|
511
514
|
}),
|
|
512
|
-
|
|
515
|
+
n.identifier && /* @__PURE__ */ B(he, {
|
|
513
516
|
workspace: e,
|
|
514
|
-
identifier:
|
|
517
|
+
identifier: n.identifier
|
|
515
518
|
})
|
|
516
519
|
]
|
|
517
520
|
}),
|
|
518
|
-
|
|
521
|
+
n.identifier && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(me, {
|
|
519
522
|
workspace: e,
|
|
520
|
-
identifier:
|
|
521
|
-
}), /* @__PURE__ */ B(
|
|
523
|
+
identifier: n.identifier
|
|
524
|
+
}), /* @__PURE__ */ B(ye, {
|
|
522
525
|
workspace: e,
|
|
523
|
-
identifier:
|
|
526
|
+
identifier: n.identifier
|
|
524
527
|
})] }),
|
|
525
528
|
/* @__PURE__ */ B(A, {
|
|
526
529
|
size: "fill",
|
|
@@ -529,8 +532,8 @@ function he({ workspace: e, group: t, actions: n }) {
|
|
|
529
532
|
interactive: !1,
|
|
530
533
|
render: /* @__PURE__ */ B("ol", {}),
|
|
531
534
|
className: "mt-5 overflow-hidden",
|
|
532
|
-
children:
|
|
533
|
-
let n =
|
|
535
|
+
children: n.items.map((t) => {
|
|
536
|
+
let n = o(t);
|
|
534
537
|
return /* @__PURE__ */ V("li", {
|
|
535
538
|
className: "flex gap-3 px-3 py-3",
|
|
536
539
|
children: [/* @__PURE__ */ B(v, {
|
|
@@ -540,7 +543,7 @@ function he({ workspace: e, group: t, actions: n }) {
|
|
|
540
543
|
className: "inline-flex shrink-0 self-start",
|
|
541
544
|
children: /* @__PURE__ */ B(O, {
|
|
542
545
|
name: n,
|
|
543
|
-
src:
|
|
546
|
+
src: a(t.actor.kind, t.actor.handle),
|
|
544
547
|
size: "sm"
|
|
545
548
|
})
|
|
546
549
|
}), /* @__PURE__ */ V("div", {
|
|
@@ -549,7 +552,7 @@ function he({ workspace: e, group: t, actions: n }) {
|
|
|
549
552
|
className: "flex items-baseline gap-2 text-sm",
|
|
550
553
|
children: [/* @__PURE__ */ B("span", {
|
|
551
554
|
className: G("flex-1", !t.readAt && "font-medium"),
|
|
552
|
-
children:
|
|
555
|
+
children: i(t.reason, {
|
|
553
556
|
actor: n,
|
|
554
557
|
agent: t.agentName ?? n,
|
|
555
558
|
date: q(t)
|
|
@@ -560,7 +563,7 @@ function he({ workspace: e, group: t, actions: n }) {
|
|
|
560
563
|
exact: "medium",
|
|
561
564
|
className: "text-xs text-muted-foreground"
|
|
562
565
|
})]
|
|
563
|
-
}), t.excerpt && t.reason !== "reminder" && /* @__PURE__ */ B(
|
|
566
|
+
}), t.excerpt && t.reason !== "reminder" && /* @__PURE__ */ B(_e, { text: t.excerpt })]
|
|
564
567
|
})]
|
|
565
568
|
}, t.id);
|
|
566
569
|
})
|
|
@@ -568,8 +571,8 @@ function he({ workspace: e, group: t, actions: n }) {
|
|
|
568
571
|
]
|
|
569
572
|
});
|
|
570
573
|
}
|
|
571
|
-
function
|
|
572
|
-
let t = R("agentWork"), n =
|
|
574
|
+
function _e({ text: e }) {
|
|
575
|
+
let t = R("agentWork"), n = x(e);
|
|
573
576
|
return n ? /* @__PURE__ */ V("div", {
|
|
574
577
|
className: "mt-1 min-w-0 text-sm text-muted-foreground",
|
|
575
578
|
children: [
|
|
@@ -591,14 +594,14 @@ function ge({ text: e }) {
|
|
|
591
594
|
})
|
|
592
595
|
});
|
|
593
596
|
}
|
|
594
|
-
function
|
|
595
|
-
let t =
|
|
597
|
+
function ve({ text: e }) {
|
|
598
|
+
let t = x(e);
|
|
596
599
|
return t ? /* @__PURE__ */ B("code", {
|
|
597
600
|
className: "font-mono",
|
|
598
601
|
children: t.command
|
|
599
602
|
}) : T(e);
|
|
600
603
|
}
|
|
601
|
-
function
|
|
604
|
+
function ye({ workspace: t, identifier: n }) {
|
|
602
605
|
let r = R("notifications"), { data: i = [] } = H(e(t, n)), o = i.filter((e) => !e.answer && !e.canceled);
|
|
603
606
|
return o.length === 0 ? null : /* @__PURE__ */ V("section", {
|
|
604
607
|
"aria-label": r("waitingOnYou"),
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
2
|
import { runnersQuery as n } from "../../../api/queries.js";
|
|
3
3
|
import { ComputeTargets as r } from "../../../components/ComputeTargets.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
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";
|
|
10
|
+
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";
|
|
15
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";
|
|
16
17
|
// src/routes/$workspace/settings/runners.tsx?tsr-split=component
|
|
17
18
|
var N = {
|
|
@@ -21,22 +22,22 @@ var N = {
|
|
|
21
22
|
bypass: "runnerModeBypass"
|
|
22
23
|
};
|
|
23
24
|
function P() {
|
|
24
|
-
let { workspace: e } =
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
let { workspace: e } = u.useParams();
|
|
26
|
+
return /* @__PURE__ */ y(F, { workspace: e });
|
|
26
27
|
}
|
|
27
|
-
function F({ workspace:
|
|
28
|
-
let { data: P } = S(n(
|
|
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
30
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/runners/{runnerId}", { params: { path: {
|
|
30
|
-
workspace:
|
|
31
|
+
workspace: u,
|
|
31
32
|
runnerId: n
|
|
32
33
|
} } })),
|
|
33
|
-
onSettled: () => z.invalidateQueries({ queryKey: n(
|
|
34
|
-
}), { confirm: W, dialog: G } =
|
|
34
|
+
onSettled: () => z.invalidateQueries({ queryKey: n(u).queryKey })
|
|
35
|
+
}), { confirm: W, dialog: G } = s(), K = (e) => W({
|
|
35
36
|
title: F("revokeRunnerTitle"),
|
|
36
37
|
description: F("revokeRunnerDescription", { name: e.name }),
|
|
37
38
|
confirmLabel: F("revoke"),
|
|
38
39
|
onConfirm: () => U.mutateAsync(e.id)
|
|
39
|
-
}), q =
|
|
40
|
+
}), q = g(() => [{
|
|
40
41
|
key: "name",
|
|
41
42
|
label: L("name"),
|
|
42
43
|
headerClassName: "py-2",
|
|
@@ -46,7 +47,7 @@ function F({ workspace: l }) {
|
|
|
46
47
|
label: F("runnerColSeen"),
|
|
47
48
|
headerClassName: "py-2 w-40",
|
|
48
49
|
align: "end"
|
|
49
|
-
}], [F, L]), J =
|
|
50
|
+
}], [F, L]), J = g(() => [{
|
|
50
51
|
value: "name",
|
|
51
52
|
label: L("name"),
|
|
52
53
|
compare: (e, t) => e.name.localeCompare(t.name)
|
|
@@ -55,7 +56,7 @@ function F({ workspace: l }) {
|
|
|
55
56
|
label: F("runnerColSeen"),
|
|
56
57
|
compare: (e, t) => (t.lastSeenAt ?? "").localeCompare(e.lastSeenAt ?? "")
|
|
57
58
|
}], [F, L]), Y = M({
|
|
58
|
-
storageKey: `tandem-runners-${
|
|
59
|
+
storageKey: `tandem-runners-${u}`,
|
|
59
60
|
defaultShowColumnHeaders: !1,
|
|
60
61
|
columns: q,
|
|
61
62
|
orderBys: J,
|
|
@@ -67,21 +68,18 @@ function F({ workspace: l }) {
|
|
|
67
68
|
...e.harnesses,
|
|
68
69
|
...e.labels
|
|
69
70
|
].some((e) => e.toLowerCase().includes(X))), Q = P.filter((e) => e.sharingRefused), $ = P.filter((e) => e.sharingUnchecked);
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ b(o, {
|
|
71
72
|
wide: !0,
|
|
72
73
|
title: F("runners"),
|
|
73
|
-
description: F.rich("runnersDescription", { code: (e) => /* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
children: e
|
|
76
|
-
}) }),
|
|
77
|
-
toolbar: P.length > 0 && /* @__PURE__ */ v(D, {
|
|
74
|
+
description: F.rich("runnersDescription", { code: (e) => /* @__PURE__ */ y(i, { children: e }) }),
|
|
75
|
+
toolbar: P.length > 0 && /* @__PURE__ */ y(D, {
|
|
78
76
|
view: Y,
|
|
79
77
|
search: B,
|
|
80
78
|
searchLabel: F("runnerSearch"),
|
|
81
79
|
searchPlaceholder: F("runnerSearch")
|
|
82
80
|
}),
|
|
83
81
|
children: [
|
|
84
|
-
Q.length > 0 && /* @__PURE__ */
|
|
82
|
+
Q.length > 0 && /* @__PURE__ */ y(d, {
|
|
85
83
|
tone: "warning",
|
|
86
84
|
className: "mb-6",
|
|
87
85
|
children: F("runnerSharingRefused", {
|
|
@@ -89,7 +87,7 @@ function F({ workspace: l }) {
|
|
|
89
87
|
names: I.list(Q.map((e) => e.name), { type: "conjunction" })
|
|
90
88
|
})
|
|
91
89
|
}),
|
|
92
|
-
$.length > 0 && /* @__PURE__ */
|
|
90
|
+
$.length > 0 && /* @__PURE__ */ y(d, {
|
|
93
91
|
tone: "muted",
|
|
94
92
|
className: "mb-6",
|
|
95
93
|
children: F("runnerSharingUnchecked", {
|
|
@@ -97,9 +95,9 @@ function F({ workspace: l }) {
|
|
|
97
95
|
names: I.list($.map((e) => e.name), { type: "conjunction" })
|
|
98
96
|
})
|
|
99
97
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ y("div", {
|
|
101
99
|
className: "border-t border-border",
|
|
102
|
-
children: /* @__PURE__ */
|
|
100
|
+
children: /* @__PURE__ */ y(T, {
|
|
103
101
|
view: Y,
|
|
104
102
|
total: P.length,
|
|
105
103
|
matches: Z.length,
|
|
@@ -109,28 +107,28 @@ function F({ workspace: l }) {
|
|
|
109
107
|
nounPlural: F("runnerNounPlural")
|
|
110
108
|
},
|
|
111
109
|
empty: {
|
|
112
|
-
icon: /* @__PURE__ */
|
|
110
|
+
icon: /* @__PURE__ */ y(a, {}),
|
|
113
111
|
title: F("noRunners")
|
|
114
112
|
},
|
|
115
113
|
noMatches: F("runnerNoMatches"),
|
|
116
|
-
children: /* @__PURE__ */
|
|
114
|
+
children: /* @__PURE__ */ b(p, {
|
|
117
115
|
...k,
|
|
118
|
-
children: [/* @__PURE__ */
|
|
116
|
+
children: [/* @__PURE__ */ y(w, { view: Y }), Y.applyOrder(Z).map((e) => /* @__PURE__ */ b(E, {
|
|
119
117
|
href: null,
|
|
120
118
|
goTo: V,
|
|
121
119
|
openMenu: H,
|
|
122
120
|
items: [
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
c(F("copyRunnerId"), e.id),
|
|
122
|
+
c(L("copyName"), e.name),
|
|
123
|
+
m,
|
|
126
124
|
{
|
|
127
125
|
label: F("revoke"),
|
|
128
126
|
destructive: !0,
|
|
129
127
|
onClick: () => K(e)
|
|
130
128
|
}
|
|
131
129
|
],
|
|
132
|
-
children: [/* @__PURE__ */
|
|
133
|
-
icon: /* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ y(O, {
|
|
131
|
+
icon: /* @__PURE__ */ y(a, {}),
|
|
134
132
|
iconTile: !0,
|
|
135
133
|
name: e.name,
|
|
136
134
|
subtitle: I.list([
|
|
@@ -142,12 +140,12 @@ function F({ workspace: l }) {
|
|
|
142
140
|
...e.labels
|
|
143
141
|
], { type: "unit" }),
|
|
144
142
|
href: null
|
|
145
|
-
}), Y.isVisible("seen") && /* @__PURE__ */
|
|
143
|
+
}), Y.isVisible("seen") && /* @__PURE__ */ b(p.Item, {
|
|
146
144
|
className: "py-2.5",
|
|
147
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ y(C, { children: e.lastSeenAt ? F("runnerSeen", { seen: R.relative(e.lastSeenAt) }) : F("runnerNeverConnected") }), e.isolation && /* @__PURE__ */ b("span", {
|
|
148
146
|
className: "flex items-center justify-end gap-1.5 text-xs text-muted-foreground",
|
|
149
147
|
title: e.isolation.failures.join("\n") || void 0,
|
|
150
|
-
children: [/* @__PURE__ */
|
|
148
|
+
children: [/* @__PURE__ */ y(f, {
|
|
151
149
|
variant: e.isolation.passed ? "success" : "error",
|
|
152
150
|
size: 8
|
|
153
151
|
}), e.isolation.passed ? F("runnerIsolated") : F("runnerNotIsolated", { count: e.isolation.failures.length })]
|
|
@@ -157,7 +155,7 @@ function F({ workspace: l }) {
|
|
|
157
155
|
})
|
|
158
156
|
})
|
|
159
157
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ y(r, { workspace: u }),
|
|
161
159
|
G
|
|
162
160
|
]
|
|
163
161
|
});
|
|
@@ -1,160 +1,158 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
2
|
import { tokensQuery as n } from "../../../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
3
|
+
import { InlineCommand as r } from "../../../components/InlineCommand.js";
|
|
4
|
+
import { KeyIcon as i } from "../../../components/icons.js";
|
|
5
|
+
import { OneTimeSecret as a } from "../../../components/OneTimeSecret.js";
|
|
6
|
+
import { SettingsPage as o, useFormError 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 { useTime as u } from "../../../lib/time.js";
|
|
10
|
+
import { Route as d } from "./tokens.js";
|
|
11
|
+
import { Button as f, ErrorText as p, Input as m, Modal as h, ModalTitle as g, PageHeaderAddButton as _, Select as v, Table as y, menuDivider as b, useOpenMenu as x } from "@parallelworks/ui";
|
|
12
|
+
import { useMemo as S, useState as C } from "react";
|
|
13
|
+
import { useTranslations as w } from "use-intl";
|
|
14
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
15
|
+
import { useMutation as D, useQueryClient as O, useSuspenseQuery as k } from "@tanstack/react-query";
|
|
16
|
+
import { ListCellText as A, ListColumns as j, ListPage as M, ListRow as N, ListToolbar as P, NameCell as F, listTableProps as I, useListNavigate as L, useListSearch as R, useListView as z } from "@parallelworks/ui/list";
|
|
16
17
|
// src/routes/$workspace/settings/tokens.tsx?tsr-split=component
|
|
17
|
-
function
|
|
18
|
-
let { workspace:
|
|
18
|
+
function B() {
|
|
19
|
+
let { workspace: s } = d.useParams(), { data: f } = k(n), p = w("account"), m = w("common"), h = u(), g = O(), v = R(), B = L(), H = x(), [U, W] = C(!1), [G, K] = C(null), q = D({
|
|
19
20
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/me/tokens/{tokenId}", { params: { path: { tokenId: n } } })),
|
|
20
|
-
onSettled: () =>
|
|
21
|
-
}), { confirm:
|
|
22
|
-
title:
|
|
23
|
-
description:
|
|
24
|
-
confirmLabel:
|
|
25
|
-
onConfirm: () =>
|
|
26
|
-
}),
|
|
21
|
+
onSettled: () => g.invalidateQueries({ queryKey: n.queryKey })
|
|
22
|
+
}), { confirm: J, dialog: Y } = c(), X = (e) => J({
|
|
23
|
+
title: p("revokeTokenTitle"),
|
|
24
|
+
description: p("revokeTokenDescription", { name: e.name }),
|
|
25
|
+
confirmLabel: p("revoke"),
|
|
26
|
+
onConfirm: () => q.mutateAsync(e.id)
|
|
27
|
+
}), ee = S(() => [
|
|
27
28
|
{
|
|
28
29
|
key: "name",
|
|
29
|
-
label:
|
|
30
|
+
label: m("name"),
|
|
30
31
|
headerClassName: "py-2",
|
|
31
32
|
alwaysVisible: !0
|
|
32
33
|
},
|
|
33
34
|
{
|
|
34
35
|
key: "access",
|
|
35
|
-
label:
|
|
36
|
+
label: p("tokenAccess"),
|
|
36
37
|
headerClassName: "py-2 w-56"
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
key: "used",
|
|
40
|
-
label:
|
|
41
|
+
label: p("tokenColUsed"),
|
|
41
42
|
headerClassName: "py-2 w-40",
|
|
42
43
|
align: "end"
|
|
43
44
|
}
|
|
44
|
-
], [
|
|
45
|
+
], [p, m]), te = S(() => [{
|
|
45
46
|
value: "name",
|
|
46
|
-
label:
|
|
47
|
+
label: m("name"),
|
|
47
48
|
compare: (e, t) => e.name.localeCompare(t.name)
|
|
48
49
|
}, {
|
|
49
50
|
value: "used",
|
|
50
|
-
label:
|
|
51
|
+
label: p("tokenColUsed"),
|
|
51
52
|
compare: (e, t) => (t.lastUsedAt ?? "").localeCompare(e.lastUsedAt ?? "")
|
|
52
|
-
}], [
|
|
53
|
+
}], [p, m]), Z = z({
|
|
53
54
|
storageKey: "tandem-tokens",
|
|
54
55
|
defaultShowColumnHeaders: !1,
|
|
55
|
-
columns:
|
|
56
|
-
orderBys:
|
|
56
|
+
columns: ee,
|
|
57
|
+
orderBys: te,
|
|
57
58
|
defaultOrderBy: "name",
|
|
58
59
|
facets: []
|
|
59
|
-
}), Q =
|
|
60
|
-
return /* @__PURE__ */
|
|
60
|
+
}), Q = v.filter.trim().toLowerCase(), $ = f.filter((e) => !Q || e.name.toLowerCase().includes(Q));
|
|
61
|
+
return /* @__PURE__ */ E(o, {
|
|
61
62
|
wide: !0,
|
|
62
|
-
title:
|
|
63
|
-
description:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}) }),
|
|
67
|
-
actions: /* @__PURE__ */ w(g, {
|
|
68
|
-
label: f("newToken"),
|
|
63
|
+
title: p("tokens"),
|
|
64
|
+
description: p.rich("tokensDescription", { code: (e) => /* @__PURE__ */ T(r, { children: e }) }),
|
|
65
|
+
actions: /* @__PURE__ */ T(_, {
|
|
66
|
+
label: p("newToken"),
|
|
69
67
|
word: "create",
|
|
70
|
-
onClick: () =>
|
|
68
|
+
onClick: () => W(!0)
|
|
71
69
|
}),
|
|
72
|
-
toolbar:
|
|
70
|
+
toolbar: f.length > 0 && /* @__PURE__ */ T(P, {
|
|
73
71
|
view: Z,
|
|
74
|
-
search:
|
|
75
|
-
searchLabel:
|
|
76
|
-
searchPlaceholder:
|
|
72
|
+
search: v,
|
|
73
|
+
searchLabel: p("tokenSearch"),
|
|
74
|
+
searchPlaceholder: p("tokenSearch")
|
|
77
75
|
}),
|
|
78
76
|
children: [
|
|
79
|
-
|
|
77
|
+
G && /* @__PURE__ */ T("div", {
|
|
80
78
|
className: "px-4 pb-4",
|
|
81
|
-
children: /* @__PURE__ */
|
|
82
|
-
title:
|
|
83
|
-
secret:
|
|
84
|
-
onDismiss: () =>
|
|
79
|
+
children: /* @__PURE__ */ T(a, {
|
|
80
|
+
title: p("tokenCreated", { name: G.name }),
|
|
81
|
+
secret: G.secret,
|
|
82
|
+
onDismiss: () => K(null)
|
|
85
83
|
})
|
|
86
84
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ T("div", {
|
|
88
86
|
className: "border-t border-border",
|
|
89
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ T(M, {
|
|
90
88
|
view: Z,
|
|
91
|
-
total:
|
|
89
|
+
total: f.length,
|
|
92
90
|
matches: $.length,
|
|
93
91
|
count: {
|
|
94
|
-
filterActive:
|
|
95
|
-
noun:
|
|
96
|
-
nounPlural:
|
|
92
|
+
filterActive: v.filter.trim() !== "",
|
|
93
|
+
noun: p("tokenNoun"),
|
|
94
|
+
nounPlural: p("tokenNounPlural")
|
|
97
95
|
},
|
|
98
96
|
empty: {
|
|
99
|
-
icon: /* @__PURE__ */
|
|
100
|
-
title:
|
|
97
|
+
icon: /* @__PURE__ */ T(i, {}),
|
|
98
|
+
title: p("noTokens")
|
|
101
99
|
},
|
|
102
|
-
noMatches:
|
|
103
|
-
children: /* @__PURE__ */
|
|
104
|
-
...
|
|
105
|
-
children: [/* @__PURE__ */
|
|
100
|
+
noMatches: p("tokenNoMatches"),
|
|
101
|
+
children: /* @__PURE__ */ E(y, {
|
|
102
|
+
...I,
|
|
103
|
+
children: [/* @__PURE__ */ T(j, { view: Z }), Z.applyOrder($).map((e) => /* @__PURE__ */ E(N, {
|
|
106
104
|
href: null,
|
|
107
|
-
goTo:
|
|
108
|
-
openMenu:
|
|
105
|
+
goTo: B,
|
|
106
|
+
openMenu: H,
|
|
109
107
|
items: [
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
l(m("copyName"), e.name),
|
|
109
|
+
b,
|
|
112
110
|
{
|
|
113
|
-
label:
|
|
111
|
+
label: p("revoke"),
|
|
114
112
|
destructive: !0,
|
|
115
|
-
onClick: () =>
|
|
113
|
+
onClick: () => X(e)
|
|
116
114
|
}
|
|
117
115
|
],
|
|
118
116
|
children: [
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
icon: /* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ T(F, {
|
|
118
|
+
icon: /* @__PURE__ */ T(i, {}),
|
|
121
119
|
iconTile: !0,
|
|
122
120
|
name: e.name,
|
|
123
|
-
subtitle:
|
|
121
|
+
subtitle: p("tokenCreatedAgo", { created: h.relative(e.createdAt) }),
|
|
124
122
|
href: null
|
|
125
123
|
}),
|
|
126
|
-
Z.isVisible("access") && /* @__PURE__ */
|
|
124
|
+
Z.isVisible("access") && /* @__PURE__ */ T(y.Item, {
|
|
127
125
|
className: "py-2.5",
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
e.readOnly ?
|
|
126
|
+
children: /* @__PURE__ */ E(A, { children: [
|
|
127
|
+
e.readOnly ? p("readOnly") : p("readWrite"),
|
|
130
128
|
" · ",
|
|
131
|
-
e.workspace ||
|
|
129
|
+
e.workspace || p("allWorkspaces")
|
|
132
130
|
] })
|
|
133
131
|
}),
|
|
134
|
-
Z.isVisible("used") && /* @__PURE__ */
|
|
132
|
+
Z.isVisible("used") && /* @__PURE__ */ T(y.Item, {
|
|
135
133
|
className: "py-2.5",
|
|
136
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ T(A, { children: e.lastUsedAt ? h.relative(e.lastUsedAt) : p("tokenNotUsed") })
|
|
137
135
|
})
|
|
138
136
|
]
|
|
139
137
|
}, e.id))]
|
|
140
138
|
})
|
|
141
139
|
})
|
|
142
140
|
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
workspace:
|
|
141
|
+
Y,
|
|
142
|
+
U && /* @__PURE__ */ T(V, {
|
|
143
|
+
workspace: s,
|
|
146
144
|
onCreated: (e) => {
|
|
147
|
-
|
|
145
|
+
W(!1), K(e);
|
|
148
146
|
},
|
|
149
|
-
onClose: () =>
|
|
147
|
+
onClose: () => W(!1)
|
|
150
148
|
})
|
|
151
149
|
]
|
|
152
150
|
});
|
|
153
151
|
}
|
|
154
|
-
function
|
|
155
|
-
let
|
|
152
|
+
function V({ workspace: r, onCreated: i, onClose: a }) {
|
|
153
|
+
let o = w("account"), c = w("common"), l = O(), u = s(), [d, _] = C(""), [y, b] = C("read"), [x, S] = C("one"), [k, A] = C("90"), j = D({
|
|
156
154
|
mutationFn: async () => t(await e.POST("/api/v1/me/tokens", { body: {
|
|
157
|
-
name:
|
|
155
|
+
name: d,
|
|
158
156
|
readOnly: y === "read",
|
|
159
157
|
...x === "one" && { workspace: r },
|
|
160
158
|
...k !== "0" && { expiresInDays: Number(k) }
|
|
@@ -167,104 +165,104 @@ function B({ workspace: r, onCreated: i, onClose: a }) {
|
|
|
167
165
|
onSettled: () => l.invalidateQueries({ queryKey: n.queryKey }),
|
|
168
166
|
onError: u.set
|
|
169
167
|
});
|
|
170
|
-
return /* @__PURE__ */
|
|
168
|
+
return /* @__PURE__ */ T(h, {
|
|
171
169
|
open: !0,
|
|
172
170
|
onClose: a,
|
|
173
171
|
className: "w-full max-w-md p-5",
|
|
174
|
-
children: /* @__PURE__ */
|
|
172
|
+
children: /* @__PURE__ */ E("form", {
|
|
175
173
|
onSubmit: (e) => {
|
|
176
174
|
e.preventDefault(), j.mutate();
|
|
177
175
|
},
|
|
178
176
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ T(g, {
|
|
180
178
|
className: "text-sm font-semibold",
|
|
181
|
-
children:
|
|
179
|
+
children: o("newToken")
|
|
182
180
|
}),
|
|
183
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ T(m, {
|
|
184
182
|
required: !0,
|
|
185
183
|
autoFocus: !0,
|
|
186
|
-
value:
|
|
187
|
-
onChange: (e) =>
|
|
188
|
-
placeholder:
|
|
189
|
-
"aria-label":
|
|
184
|
+
value: d,
|
|
185
|
+
onChange: (e) => _(e.target.value),
|
|
186
|
+
placeholder: o("tokenNamePlaceholder"),
|
|
187
|
+
"aria-label": o("tokenName"),
|
|
190
188
|
className: "mt-4 w-full"
|
|
191
189
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ E("div", {
|
|
193
191
|
className: "mt-3 flex flex-wrap gap-2",
|
|
194
192
|
children: [
|
|
195
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ T(v, {
|
|
196
194
|
value: y,
|
|
197
195
|
onValueChange: b,
|
|
198
|
-
"aria-label":
|
|
196
|
+
"aria-label": o("tokenAccess"),
|
|
199
197
|
items: [{
|
|
200
198
|
value: "read",
|
|
201
|
-
label:
|
|
199
|
+
label: o("readOnly")
|
|
202
200
|
}, {
|
|
203
201
|
value: "write",
|
|
204
|
-
label:
|
|
202
|
+
label: o("readWrite")
|
|
205
203
|
}],
|
|
206
204
|
width: "content"
|
|
207
205
|
}),
|
|
208
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ T(v, {
|
|
209
207
|
value: x,
|
|
210
|
-
onValueChange:
|
|
211
|
-
"aria-label":
|
|
208
|
+
onValueChange: S,
|
|
209
|
+
"aria-label": o("tokenWorkspace"),
|
|
212
210
|
items: [{
|
|
213
211
|
value: "one",
|
|
214
|
-
label:
|
|
212
|
+
label: o("thisWorkspace", { workspace: r })
|
|
215
213
|
}, {
|
|
216
214
|
value: "all",
|
|
217
|
-
label:
|
|
215
|
+
label: o("allWorkspaces")
|
|
218
216
|
}],
|
|
219
217
|
width: "content"
|
|
220
218
|
}),
|
|
221
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ T(v, {
|
|
222
220
|
value: k,
|
|
223
221
|
onValueChange: A,
|
|
224
|
-
"aria-label":
|
|
222
|
+
"aria-label": o("tokenExpiry"),
|
|
225
223
|
items: [
|
|
226
224
|
{
|
|
227
225
|
value: "30",
|
|
228
|
-
label:
|
|
226
|
+
label: o("expiresIn", { days: 30 })
|
|
229
227
|
},
|
|
230
228
|
{
|
|
231
229
|
value: "90",
|
|
232
|
-
label:
|
|
230
|
+
label: o("expiresIn", { days: 90 })
|
|
233
231
|
},
|
|
234
232
|
{
|
|
235
233
|
value: "365",
|
|
236
|
-
label:
|
|
234
|
+
label: o("expiresIn", { days: 365 })
|
|
237
235
|
},
|
|
238
236
|
{
|
|
239
237
|
value: "0",
|
|
240
|
-
label:
|
|
238
|
+
label: o("noExpiry")
|
|
241
239
|
}
|
|
242
240
|
],
|
|
243
241
|
width: "content"
|
|
244
242
|
})
|
|
245
243
|
]
|
|
246
244
|
}),
|
|
247
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ T(p, {
|
|
248
246
|
size: "md",
|
|
249
247
|
className: "mt-3",
|
|
250
248
|
children: u.error
|
|
251
249
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ E("div", {
|
|
253
251
|
className: "mt-5 flex justify-end gap-2",
|
|
254
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ T(f, {
|
|
255
253
|
type: "button",
|
|
256
254
|
onClick: a,
|
|
257
255
|
children: c("cancel")
|
|
258
|
-
}), /* @__PURE__ */
|
|
256
|
+
}), /* @__PURE__ */ T(f, {
|
|
259
257
|
type: "submit",
|
|
260
258
|
variant: "primary",
|
|
261
|
-
disabled: !
|
|
259
|
+
disabled: !d.trim(),
|
|
262
260
|
loading: j.isPending,
|
|
263
|
-
children:
|
|
261
|
+
children: o("createToken")
|
|
264
262
|
})]
|
|
265
263
|
})
|
|
266
264
|
]
|
|
267
265
|
})
|
|
268
266
|
});
|
|
269
267
|
}
|
|
270
|
-
export {
|
|
268
|
+
export { B as component };
|