@parallelworks/tandem-web 0.142.0 → 0.143.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/_virtual/_virtual_i18n/en/common.js +105 -6
- package/_virtual/_virtual_i18n/es/common.js +105 -6
- package/_virtual/_virtual_i18n/ja/common.js +105 -6
- package/_virtual/_virtual_i18n/ko/common.js +105 -6
- package/_virtual/_virtual_i18n/zh/common.js +105 -6
- package/components/AccessGrants.js +6 -6
- package/components/ActivityTimeline.js +2 -0
- package/components/CodeHostSettings.js +25 -25
- package/components/CustomFields.js +349 -0
- package/components/DocProperties.js +8 -2
- package/components/GitHub.js +22 -22
- package/components/IssueBoard.js +48 -43
- package/components/IssueEvent.js +2 -0
- package/components/IssueFilters.js +210 -122
- package/components/IssueImport.js +1 -1
- package/components/IssueRow.js +96 -79
- package/components/IssueTemplates.js +216 -156
- package/components/IssueTypes.js +318 -0
- package/components/NewIssueDialog.js +254 -216
- package/components/SettingsNav.js +40 -35
- package/components/TeamForm.js +49 -35
- package/components/TeamRepositories.js +51 -51
- package/components/TeamWorkflow.js +8 -8
- package/components/Updates.js +8 -8
- package/lib/boardMove.js +69 -47
- package/lib/customFields.js +113 -0
- package/lib/issueDisplay.js +27 -12
- package/lib/issueList.js +166 -62
- package/lib/issueTypes.js +50 -0
- package/lib/teamTree.js +24 -0
- package/lib/views.js +13 -11
- package/package.json +1 -1
- package/pages/issues.js +331 -291
- package/routeTree.gen.js +151 -145
- package/routes/_workspace/agents/index2.js +9 -9
- package/routes/_workspace/issues/_identifier2.js +433 -370
- package/routes/_workspace/projects/_projectId3.js +213 -201
- package/routes/_workspace/settings/audit-log3.js +2 -0
- package/routes/_workspace/settings/fields.js +6 -0
- package/routes/_workspace/settings/fields2.js +30 -0
- package/routes/_workspace/settings/fields3.js +5 -0
- package/routes/_workspace/settings/groups2.js +74 -74
- package/routes/_workspace/settings/labels2.js +33 -33
- package/routes/_workspace/settings/members2.js +35 -35
- package/routes/_workspace/settings/roles2.js +24 -24
- package/routes/_workspace/settings/runners2.js +18 -18
- package/routes/_workspace/settings/sessions2.js +9 -9
- package/routes/_workspace/settings/slack2.js +8 -8
- package/routes/_workspace/settings/sso2.js +50 -50
- package/routes/_workspace/settings/tokens2.js +15 -15
- package/routes/_workspace/settings/webhooks2.js +42 -42
- package/routes/_workspace/teams/_key/settings2.js +138 -76
- package/routes/_workspace2.js +320 -318
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
2
|
import { providersQuery as n, ssoQuery as r } from "../../../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { useConfirm as i } from "../../../lib/confirm.js";
|
|
4
|
+
import { Route as a } from "./sso.js";
|
|
5
|
+
import { useCan as o } from "../../../lib/roles.js";
|
|
6
|
+
import { AdminOnly as s, SettingsPage as c, cardList as l, useFormError as u } from "../../../components/settings.js";
|
|
7
7
|
import { Button as d, CopyButton as f, CopyCodeBlock as p, ErrorText as m, Input as h, Section as g, Select as _, SettingRow as v, SettingsCard as y, StatusLabel as b, Switch as x } from "@parallelworks/ui";
|
|
8
8
|
import { useState as S } from "react";
|
|
9
9
|
import { useTranslations as C } from "use-intl";
|
|
@@ -11,17 +11,17 @@ import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
|
11
11
|
import { useMutation as E, useQueryClient as D, useSuspenseQuery as O } from "@tanstack/react-query";
|
|
12
12
|
// src/routes/$workspace/settings/sso.tsx?tsr-split=component
|
|
13
13
|
function k() {
|
|
14
|
-
let { workspace: e } =
|
|
15
|
-
return /* @__PURE__ */ T(
|
|
14
|
+
let { workspace: e } = a.useParams(), t = C("settingsNav"), r = C("sso"), i = o(e, "manage_workspace"), { data: l } = O(n);
|
|
15
|
+
return /* @__PURE__ */ T(c, {
|
|
16
16
|
title: t("sso"),
|
|
17
17
|
description: r("description"),
|
|
18
18
|
children: [
|
|
19
|
-
/* @__PURE__ */ w(
|
|
19
|
+
/* @__PURE__ */ w(s, { workspace: e }),
|
|
20
20
|
!l.sso && /* @__PURE__ */ w("p", {
|
|
21
21
|
className: "rounded-lg bg-muted px-3 py-2 text-sm text-muted-foreground",
|
|
22
22
|
children: r("off")
|
|
23
23
|
}),
|
|
24
|
-
|
|
24
|
+
i && l.sso && /* @__PURE__ */ w(A, { workspace: e })
|
|
25
25
|
]
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -43,7 +43,7 @@ function A({ workspace: e }) {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
function j({ workspace: n, sso: i }) {
|
|
46
|
-
let a = C("sso"), o = D(), s =
|
|
46
|
+
let a = C("sso"), o = D(), s = u(), [c, l] = S(i.issuer ?? ""), [p, m] = S(i.clientId ?? ""), [g, b] = S(""), [O, k] = S(i.defaultRole), [A, j] = S(i.requireSso), M = E({
|
|
47
47
|
mutationFn: async () => t(await e.PUT("/api/v1/workspaces/{workspace}/sso", {
|
|
48
48
|
params: { path: { workspace: n } },
|
|
49
49
|
body: {
|
|
@@ -101,7 +101,7 @@ function j({ workspace: n, sso: i }) {
|
|
|
101
101
|
required: !0,
|
|
102
102
|
placeholder: "https://login.example.com",
|
|
103
103
|
value: c,
|
|
104
|
-
onChange: (e) =>
|
|
104
|
+
onChange: (e) => l(e.target.value),
|
|
105
105
|
mono: !0
|
|
106
106
|
})
|
|
107
107
|
}),
|
|
@@ -161,14 +161,14 @@ function j({ workspace: n, sso: i }) {
|
|
|
161
161
|
})
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
function M({ workspace: n, sso:
|
|
165
|
-
let
|
|
164
|
+
function M({ workspace: n, sso: a }) {
|
|
165
|
+
let o = C("sso"), s = D(), c = u(), { confirm: f, dialog: g } = i(), [_, v] = S(""), y = () => s.invalidateQueries({ queryKey: r(n).queryKey }), x = E({
|
|
166
166
|
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/sso/domains", {
|
|
167
167
|
params: { path: { workspace: n } },
|
|
168
168
|
body: { domain: _.trim() }
|
|
169
169
|
})),
|
|
170
|
-
onMutate:
|
|
171
|
-
onError:
|
|
170
|
+
onMutate: c.clear,
|
|
171
|
+
onError: c.set,
|
|
172
172
|
onSuccess: () => v(""),
|
|
173
173
|
onSettled: y
|
|
174
174
|
}), O = E({
|
|
@@ -176,34 +176,34 @@ function M({ workspace: n, sso: i }) {
|
|
|
176
176
|
workspace: n,
|
|
177
177
|
domain: r
|
|
178
178
|
} } })),
|
|
179
|
-
onMutate:
|
|
180
|
-
onError:
|
|
179
|
+
onMutate: c.clear,
|
|
180
|
+
onError: c.set,
|
|
181
181
|
onSettled: y
|
|
182
182
|
}), k = E({
|
|
183
183
|
mutationFn: async (r) => t(await e.DELETE("/api/v1/workspaces/{workspace}/sso/domains/{domain}", { params: { path: {
|
|
184
184
|
workspace: n,
|
|
185
185
|
domain: r
|
|
186
186
|
} } })),
|
|
187
|
-
onMutate:
|
|
187
|
+
onMutate: c.clear,
|
|
188
188
|
onSettled: y
|
|
189
|
-
}), A = x.isError ?
|
|
189
|
+
}), A = x.isError ? c.error : null;
|
|
190
190
|
return /* @__PURE__ */ T("section", { children: [
|
|
191
191
|
/* @__PURE__ */ w("h2", {
|
|
192
192
|
className: "text-sm font-semibold",
|
|
193
|
-
children:
|
|
193
|
+
children: o("domains")
|
|
194
194
|
}),
|
|
195
195
|
/* @__PURE__ */ w("p", {
|
|
196
196
|
className: "mt-0.5 text-sm text-muted-foreground",
|
|
197
|
-
children:
|
|
197
|
+
children: o("domainsDescription")
|
|
198
198
|
}),
|
|
199
199
|
/* @__PURE__ */ T("div", {
|
|
200
200
|
className: "mt-4 rounded-lg border border-border",
|
|
201
|
-
children: [
|
|
201
|
+
children: [a.domains.length === 0 ? /* @__PURE__ */ w("p", {
|
|
202
202
|
className: "px-3 py-3 text-sm text-muted-foreground",
|
|
203
|
-
children:
|
|
203
|
+
children: o("noDomains")
|
|
204
204
|
}) : /* @__PURE__ */ w("ul", {
|
|
205
|
-
className:
|
|
206
|
-
children:
|
|
205
|
+
className: l,
|
|
206
|
+
children: a.domains.map((e) => /* @__PURE__ */ T("li", {
|
|
207
207
|
className: "px-3 py-3",
|
|
208
208
|
children: [
|
|
209
209
|
/* @__PURE__ */ T("div", {
|
|
@@ -216,7 +216,7 @@ function M({ workspace: n, sso: i }) {
|
|
|
216
216
|
}), /* @__PURE__ */ w(b, {
|
|
217
217
|
variant: e.verified ? "success" : "warning",
|
|
218
218
|
className: "text-xs",
|
|
219
|
-
children: e.verified ?
|
|
219
|
+
children: e.verified ? o("verified") : o("pending")
|
|
220
220
|
})]
|
|
221
221
|
}), /* @__PURE__ */ T("div", {
|
|
222
222
|
className: "flex shrink-0 gap-2",
|
|
@@ -225,55 +225,55 @@ function M({ workspace: n, sso: i }) {
|
|
|
225
225
|
variant: "outline",
|
|
226
226
|
loading: O.isPending && O.variables === e.domain,
|
|
227
227
|
onClick: () => O.mutate(e.domain),
|
|
228
|
-
children:
|
|
228
|
+
children: o("verify")
|
|
229
229
|
}), /* @__PURE__ */ w(d, {
|
|
230
230
|
size: "sm",
|
|
231
231
|
variant: "ghost",
|
|
232
232
|
onClick: () => f({
|
|
233
|
-
title:
|
|
234
|
-
description:
|
|
235
|
-
confirmLabel:
|
|
233
|
+
title: o("removeDomainTitle", { domain: e.domain }),
|
|
234
|
+
description: o("removeDomainDescription"),
|
|
235
|
+
confirmLabel: o("removeDomain"),
|
|
236
236
|
onConfirm: () => k.mutateAsync(e.domain)
|
|
237
237
|
}),
|
|
238
|
-
children:
|
|
238
|
+
children: o("removeDomain")
|
|
239
239
|
})]
|
|
240
240
|
})]
|
|
241
241
|
}),
|
|
242
242
|
/* @__PURE__ */ w(m, {
|
|
243
243
|
size: "md",
|
|
244
244
|
className: "mt-2",
|
|
245
|
-
children: O.isError && O.variables === e.domain ?
|
|
245
|
+
children: O.isError && O.variables === e.domain ? c.error : null
|
|
246
246
|
}),
|
|
247
247
|
!e.verified && /* @__PURE__ */ T("div", {
|
|
248
248
|
className: "mt-3 space-y-2",
|
|
249
249
|
children: [/* @__PURE__ */ w("p", {
|
|
250
250
|
className: "text-sm text-muted-foreground",
|
|
251
|
-
children:
|
|
251
|
+
children: o("txtInstructions")
|
|
252
252
|
}), /* @__PURE__ */ T("dl", {
|
|
253
253
|
className: "grid gap-2 sm:grid-cols-[auto_1fr] sm:items-center",
|
|
254
254
|
children: [
|
|
255
255
|
/* @__PURE__ */ w("dt", {
|
|
256
256
|
className: "text-xs text-muted-foreground",
|
|
257
|
-
children:
|
|
257
|
+
children: o("txtName")
|
|
258
258
|
}),
|
|
259
259
|
/* @__PURE__ */ w("dd", {
|
|
260
260
|
className: "min-w-0",
|
|
261
261
|
children: /* @__PURE__ */ w(p, {
|
|
262
262
|
text: e.txtName,
|
|
263
|
-
label:
|
|
263
|
+
label: o("txtName"),
|
|
264
264
|
wrap: !0,
|
|
265
265
|
children: e.txtName
|
|
266
266
|
})
|
|
267
267
|
}),
|
|
268
268
|
/* @__PURE__ */ w("dt", {
|
|
269
269
|
className: "text-xs text-muted-foreground",
|
|
270
|
-
children:
|
|
270
|
+
children: o("txtValue")
|
|
271
271
|
}),
|
|
272
272
|
/* @__PURE__ */ w("dd", {
|
|
273
273
|
className: "min-w-0",
|
|
274
274
|
children: /* @__PURE__ */ w(p, {
|
|
275
275
|
text: e.txtValue,
|
|
276
|
-
label:
|
|
276
|
+
label: o("txtValue"),
|
|
277
277
|
wrap: !0,
|
|
278
278
|
children: e.txtValue
|
|
279
279
|
})
|
|
@@ -293,7 +293,7 @@ function M({ workspace: n, sso: i }) {
|
|
|
293
293
|
children: [/* @__PURE__ */ w("div", {
|
|
294
294
|
className: "min-w-0 flex-1",
|
|
295
295
|
children: /* @__PURE__ */ w(h, {
|
|
296
|
-
"aria-label":
|
|
296
|
+
"aria-label": o("domain"),
|
|
297
297
|
"aria-describedby": A ? "sso-domain-error" : void 0,
|
|
298
298
|
placeholder: "example.com",
|
|
299
299
|
value: _,
|
|
@@ -305,7 +305,7 @@ function M({ workspace: n, sso: i }) {
|
|
|
305
305
|
type: "submit",
|
|
306
306
|
size: "sm",
|
|
307
307
|
loading: x.isPending,
|
|
308
|
-
children:
|
|
308
|
+
children: o("addDomain")
|
|
309
309
|
})]
|
|
310
310
|
}), /* @__PURE__ */ w(m, {
|
|
311
311
|
id: "sso-domain-error",
|
|
@@ -319,36 +319,36 @@ function M({ workspace: n, sso: i }) {
|
|
|
319
319
|
] });
|
|
320
320
|
}
|
|
321
321
|
function N({ workspace: n }) {
|
|
322
|
-
let
|
|
322
|
+
let a = C("sso"), o = D(), s = u(), { confirm: c, dialog: l } = i(), f = E({
|
|
323
323
|
mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/sso", { params: { path: { workspace: n } } })),
|
|
324
|
-
onMutate:
|
|
325
|
-
onSettled: () =>
|
|
324
|
+
onMutate: s.clear,
|
|
325
|
+
onSettled: () => o.invalidateQueries({ queryKey: r(n).queryKey })
|
|
326
326
|
});
|
|
327
327
|
return /* @__PURE__ */ T(g, {
|
|
328
328
|
variant: "card",
|
|
329
329
|
tone: "error",
|
|
330
330
|
collapsible: !1,
|
|
331
331
|
headingLevel: 2,
|
|
332
|
-
title:
|
|
333
|
-
description:
|
|
332
|
+
title: a("dangerZone"),
|
|
333
|
+
description: a("removeDescription"),
|
|
334
334
|
children: [
|
|
335
335
|
/* @__PURE__ */ w(d, {
|
|
336
336
|
variant: "danger",
|
|
337
337
|
loading: f.isPending,
|
|
338
|
-
onClick: () =>
|
|
339
|
-
title:
|
|
340
|
-
description:
|
|
341
|
-
confirmLabel:
|
|
338
|
+
onClick: () => c({
|
|
339
|
+
title: a("removeTitle"),
|
|
340
|
+
description: a("removeDescription"),
|
|
341
|
+
confirmLabel: a("remove"),
|
|
342
342
|
onConfirm: () => f.mutateAsync()
|
|
343
343
|
}),
|
|
344
|
-
children:
|
|
344
|
+
children: a("remove")
|
|
345
345
|
}),
|
|
346
346
|
/* @__PURE__ */ w(m, {
|
|
347
347
|
size: "md",
|
|
348
348
|
className: "mt-3",
|
|
349
|
-
children:
|
|
349
|
+
children: s.error
|
|
350
350
|
}),
|
|
351
|
-
|
|
351
|
+
l
|
|
352
352
|
]
|
|
353
353
|
});
|
|
354
354
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
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 {
|
|
3
|
+
import { useConfirm as r } from "../../../lib/confirm.js";
|
|
4
|
+
import { KeyIcon as i } from "../../../components/icons.js";
|
|
5
|
+
import { Route as a } from "./tokens.js";
|
|
6
|
+
import { copyItem as o } from "../../../lib/menus.js";
|
|
7
|
+
import { useTime as s } from "../../../lib/time.js";
|
|
8
|
+
import { SettingsPage as c, useFormError as l } from "../../../components/settings.js";
|
|
9
9
|
import { OneTimeSecret as u } from "../../../components/OneTimeSecret.js";
|
|
10
10
|
import { Button as d, ErrorText as f, Input as p, Modal as m, ModalTitle as h, PageHeaderAddButton as g, Select as _, Table as v, menuDivider as y, useOpenMenu as b } from "@parallelworks/ui";
|
|
11
11
|
import { useMemo as x, useState as S } from "react";
|
|
@@ -15,10 +15,10 @@ import { useMutation as E, useQueryClient as D, useSuspenseQuery as O } from "@t
|
|
|
15
15
|
import { ListCellText as k, ListColumns as A, ListPage as j, ListRow as M, ListToolbar as N, NameCell as P, listTableProps as F, useListNavigate as I, useListSearch as L, useListView as R } from "@parallelworks/ui/list";
|
|
16
16
|
// src/routes/$workspace/settings/tokens.tsx?tsr-split=component
|
|
17
17
|
function z() {
|
|
18
|
-
let { workspace:
|
|
18
|
+
let { workspace: l } = a.useParams(), { data: d } = O(n), f = C("account"), p = C("common"), m = s(), h = D(), _ = L(), z = I(), V = b(), [H, U] = S(!1), [W, G] = S(null), K = E({
|
|
19
19
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/me/tokens/{tokenId}", { params: { path: { tokenId: n } } })),
|
|
20
20
|
onSettled: () => h.invalidateQueries({ queryKey: n.queryKey })
|
|
21
|
-
}), { confirm: q, dialog: J } =
|
|
21
|
+
}), { confirm: q, dialog: J } = r(), Y = (e) => q({
|
|
22
22
|
title: f("revokeTokenTitle"),
|
|
23
23
|
description: f("revokeTokenDescription", { name: e.name }),
|
|
24
24
|
confirmLabel: f("revoke"),
|
|
@@ -57,7 +57,7 @@ function z() {
|
|
|
57
57
|
defaultOrderBy: "name",
|
|
58
58
|
facets: []
|
|
59
59
|
}), Q = _.filter.trim().toLowerCase(), $ = d.filter((e) => !Q || e.name.toLowerCase().includes(Q));
|
|
60
|
-
return /* @__PURE__ */ T(
|
|
60
|
+
return /* @__PURE__ */ T(c, {
|
|
61
61
|
wide: !0,
|
|
62
62
|
title: f("tokens"),
|
|
63
63
|
description: f.rich("tokensDescription", { code: (e) => /* @__PURE__ */ w("code", {
|
|
@@ -96,7 +96,7 @@ function z() {
|
|
|
96
96
|
nounPlural: f("tokenNounPlural")
|
|
97
97
|
},
|
|
98
98
|
empty: {
|
|
99
|
-
icon: /* @__PURE__ */ w(
|
|
99
|
+
icon: /* @__PURE__ */ w(i, {}),
|
|
100
100
|
title: f("noTokens")
|
|
101
101
|
},
|
|
102
102
|
noMatches: f("tokenNoMatches"),
|
|
@@ -107,7 +107,7 @@ function z() {
|
|
|
107
107
|
goTo: z,
|
|
108
108
|
openMenu: V,
|
|
109
109
|
items: [
|
|
110
|
-
|
|
110
|
+
o(p("copyName"), e.name),
|
|
111
111
|
y,
|
|
112
112
|
{
|
|
113
113
|
label: f("revoke"),
|
|
@@ -117,7 +117,7 @@ function z() {
|
|
|
117
117
|
],
|
|
118
118
|
children: [
|
|
119
119
|
/* @__PURE__ */ w(P, {
|
|
120
|
-
icon: /* @__PURE__ */ w(
|
|
120
|
+
icon: /* @__PURE__ */ w(i, {}),
|
|
121
121
|
iconTile: !0,
|
|
122
122
|
name: e.name,
|
|
123
123
|
subtitle: f("tokenCreatedAgo", { created: m.relative(e.createdAt) }),
|
|
@@ -142,7 +142,7 @@ function z() {
|
|
|
142
142
|
}),
|
|
143
143
|
J,
|
|
144
144
|
H && /* @__PURE__ */ w(B, {
|
|
145
|
-
workspace:
|
|
145
|
+
workspace: l,
|
|
146
146
|
onCreated: (e) => {
|
|
147
147
|
U(!1), G(e);
|
|
148
148
|
},
|
|
@@ -152,7 +152,7 @@ function z() {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
function B({ workspace: r, onCreated: i, onClose: a }) {
|
|
155
|
-
let o = C("account"), s = C("common"),
|
|
155
|
+
let o = C("account"), s = C("common"), c = D(), u = l(), [g, v] = S(""), [y, b] = S("read"), [x, O] = S("one"), [k, A] = S("90"), j = E({
|
|
156
156
|
mutationFn: async () => t(await e.POST("/api/v1/me/tokens", { body: {
|
|
157
157
|
name: g,
|
|
158
158
|
readOnly: y === "read",
|
|
@@ -164,7 +164,7 @@ function B({ workspace: r, onCreated: i, onClose: a }) {
|
|
|
164
164
|
name: e.name,
|
|
165
165
|
secret: e.secret
|
|
166
166
|
}),
|
|
167
|
-
onSettled: () =>
|
|
167
|
+
onSettled: () => c.invalidateQueries({ queryKey: n.queryKey }),
|
|
168
168
|
onError: u.set
|
|
169
169
|
});
|
|
170
170
|
return /* @__PURE__ */ w(m, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { api as e, unwrap as t } from "../../../api/client.js";
|
|
2
2
|
import { teamsQuery as n, webhooksQuery as r } from "../../../api/queries.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useConfirm as i } from "../../../lib/confirm.js";
|
|
4
|
+
import { Route as a } from "./webhooks.js";
|
|
5
|
+
import { useTime as o } from "../../../lib/time.js";
|
|
6
|
+
import { useCan as s } from "../../../lib/roles.js";
|
|
7
|
+
import { AdminOnly as c, SettingsPage as l, cardFooter as u, cardList as d, useFormError as f } from "../../../components/settings.js";
|
|
8
8
|
import { OneTimeSecret as p } from "../../../components/OneTimeSecret.js";
|
|
9
9
|
import { Button as m, Checkbox as h, ErrorText as g, Input as ee, Select as _, SettingsCard as v, Switch as y, Tooltip as b } from "@parallelworks/ui";
|
|
10
10
|
import { useState as x } from "react";
|
|
@@ -20,20 +20,20 @@ var A = {
|
|
|
20
20
|
plans: ["project."]
|
|
21
21
|
};
|
|
22
22
|
function j() {
|
|
23
|
-
let { workspace: e } =
|
|
24
|
-
return /* @__PURE__ */ T(
|
|
23
|
+
let { workspace: e } = a.useParams(), t = s(e, "manage_workspace"), n = S("webhooks"), r = S("settingsNav");
|
|
24
|
+
return /* @__PURE__ */ T(l, {
|
|
25
25
|
title: r("webhooks"),
|
|
26
26
|
description: n("description"),
|
|
27
|
-
children: [/* @__PURE__ */ w(
|
|
27
|
+
children: [/* @__PURE__ */ w(c, { workspace: e }), t && /* @__PURE__ */ w(M, { workspace: e })]
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
function M({ workspace:
|
|
31
|
-
let { data:
|
|
32
|
-
workspace:
|
|
30
|
+
function M({ workspace: a }) {
|
|
31
|
+
let { data: s } = k(r(a)), c = S("webhooks"), l = S("common"), j = o(), M = O(), N = f(), [P, F] = x(""), [I, L] = x([]), [R, z] = x("json"), [B, V] = x(""), { data: H = [] } = D(n(a)), [U, W] = x(null), [G, K] = x({}), q = () => M.invalidateQueries({ queryKey: r(a).queryKey }), J = (e) => ({ path: {
|
|
32
|
+
workspace: a,
|
|
33
33
|
webhookId: e
|
|
34
34
|
} }), Y = E({
|
|
35
35
|
mutationFn: async () => t(await e.POST("/api/v1/workspaces/{workspace}/webhooks", {
|
|
36
|
-
params: { path: { workspace:
|
|
36
|
+
params: { path: { workspace: a } },
|
|
37
37
|
body: {
|
|
38
38
|
url: P,
|
|
39
39
|
events: I.flatMap((e) => A[e]),
|
|
@@ -60,7 +60,7 @@ function M({ workspace: i }) {
|
|
|
60
60
|
onMutate: N.clear,
|
|
61
61
|
onSuccess: (e, t) => K((n) => ({
|
|
62
62
|
...n,
|
|
63
|
-
[t]: e.status ?
|
|
63
|
+
[t]: e.status ? c("pingAnswered", { status: e.status }) : c("pingFailed")
|
|
64
64
|
})),
|
|
65
65
|
onSettled: q,
|
|
66
66
|
onError: N.set
|
|
@@ -68,27 +68,27 @@ function M({ workspace: i }) {
|
|
|
68
68
|
mutationFn: async (n) => t(await e.DELETE("/api/v1/workspaces/{workspace}/webhooks/{webhookId}", { params: J(n) })),
|
|
69
69
|
onMutate: N.clear,
|
|
70
70
|
onSettled: q
|
|
71
|
-
}), { confirm: te, dialog: ne } =
|
|
72
|
-
if (!e.lastDeliveredAt) return
|
|
71
|
+
}), { confirm: te, dialog: ne } = i(), $ = Y.isError ? N.error : null, re = (e) => X.isError && X.variables?.id === e || Z.isError && Z.variables === e ? N.error : null, ie = (e) => e.events.length === 0 ? c("allEvents") : Object.keys(A).filter((t) => A[t].some((t) => e.events.includes(t))).map((e) => c(`groups.${e}`)).join(", "), ae = (e) => {
|
|
72
|
+
if (!e.lastDeliveredAt) return c("neverDelivered");
|
|
73
73
|
let t = j.relative(e.lastDeliveredAt);
|
|
74
|
-
return e.lastError ?
|
|
74
|
+
return e.lastError ? c("lastFailed", {
|
|
75
75
|
when: t,
|
|
76
76
|
status: e.lastStatus ?? 0,
|
|
77
77
|
hasStatus: e.lastStatus ? "yes" : "no"
|
|
78
|
-
}) :
|
|
78
|
+
}) : c("lastDelivered", {
|
|
79
79
|
when: t,
|
|
80
80
|
status: e.lastStatus ?? 0
|
|
81
81
|
});
|
|
82
82
|
};
|
|
83
83
|
return /* @__PURE__ */ T(C, { children: [
|
|
84
84
|
U && /* @__PURE__ */ w(p, {
|
|
85
|
-
title:
|
|
85
|
+
title: c("created"),
|
|
86
86
|
secret: U,
|
|
87
87
|
onDismiss: () => W(null)
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ T(v, { children: [/* @__PURE__ */ T("ul", {
|
|
90
|
-
className:
|
|
91
|
-
children: [
|
|
90
|
+
className: d,
|
|
91
|
+
children: [s.map((e) => /* @__PURE__ */ T("li", {
|
|
92
92
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 px-3 py-2 text-sm",
|
|
93
93
|
children: [
|
|
94
94
|
/* @__PURE__ */ T("div", {
|
|
@@ -103,7 +103,7 @@ function M({ workspace: i }) {
|
|
|
103
103
|
}), /* @__PURE__ */ T("p", {
|
|
104
104
|
className: "text-xs text-muted-foreground",
|
|
105
105
|
children: [
|
|
106
|
-
e.format === "chat" && /* @__PURE__ */ T(C, { children: [
|
|
106
|
+
e.format === "chat" && /* @__PURE__ */ T(C, { children: [c("chat"), " · "] }),
|
|
107
107
|
e.teamId && /* @__PURE__ */ T(C, { children: [H.find((t) => t.id === e.teamId)?.name ?? "", " · "] }),
|
|
108
108
|
ie(e),
|
|
109
109
|
" · ",
|
|
@@ -117,7 +117,7 @@ function M({ workspace: i }) {
|
|
|
117
117
|
}),
|
|
118
118
|
/* @__PURE__ */ w(y, {
|
|
119
119
|
size: "sm",
|
|
120
|
-
"aria-label":
|
|
120
|
+
"aria-label": c("enabledFor", { url: e.url }),
|
|
121
121
|
checked: e.enabled,
|
|
122
122
|
disabled: X.isPending,
|
|
123
123
|
onCheckedChange: (t) => X.mutate({
|
|
@@ -130,18 +130,18 @@ function M({ workspace: i }) {
|
|
|
130
130
|
size: "sm",
|
|
131
131
|
loading: Z.isPending,
|
|
132
132
|
onClick: () => Z.mutate(e.id),
|
|
133
|
-
children:
|
|
133
|
+
children: c("sendTest")
|
|
134
134
|
}),
|
|
135
135
|
/* @__PURE__ */ w("button", {
|
|
136
136
|
type: "button",
|
|
137
137
|
onClick: () => te({
|
|
138
|
-
title:
|
|
139
|
-
description:
|
|
140
|
-
confirmLabel:
|
|
138
|
+
title: c("deleteTitle"),
|
|
139
|
+
description: c("deleteDescription", { url: e.url }),
|
|
140
|
+
confirmLabel: c("delete"),
|
|
141
141
|
onConfirm: () => Q.mutateAsync(e.id)
|
|
142
142
|
}),
|
|
143
143
|
className: "text-xs text-muted-foreground hover:text-danger",
|
|
144
|
-
children:
|
|
144
|
+
children: l("delete")
|
|
145
145
|
}),
|
|
146
146
|
/* @__PURE__ */ w(g, {
|
|
147
147
|
size: "md",
|
|
@@ -149,12 +149,12 @@ function M({ workspace: i }) {
|
|
|
149
149
|
children: re(e.id)
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
|
-
}, e.id)),
|
|
152
|
+
}, e.id)), s.length === 0 && /* @__PURE__ */ w("li", {
|
|
153
153
|
className: "px-3 py-2 text-sm text-muted-foreground",
|
|
154
|
-
children:
|
|
154
|
+
children: c("none")
|
|
155
155
|
})]
|
|
156
156
|
}), /* @__PURE__ */ T("form", {
|
|
157
|
-
className: `${
|
|
157
|
+
className: `${u} flex-wrap`,
|
|
158
158
|
onSubmit: (e) => {
|
|
159
159
|
e.preventDefault(), Y.mutate();
|
|
160
160
|
},
|
|
@@ -165,7 +165,7 @@ function M({ workspace: i }) {
|
|
|
165
165
|
value: P,
|
|
166
166
|
onChange: (e) => F(e.target.value),
|
|
167
167
|
placeholder: "https://example.com/tandem",
|
|
168
|
-
"aria-label":
|
|
168
|
+
"aria-label": c("url"),
|
|
169
169
|
"aria-describedby": $ ? "webhook-add-error" : void 0,
|
|
170
170
|
className: "min-w-0 basis-full"
|
|
171
171
|
}),
|
|
@@ -174,42 +174,42 @@ function M({ workspace: i }) {
|
|
|
174
174
|
children: [
|
|
175
175
|
/* @__PURE__ */ w("legend", {
|
|
176
176
|
className: "sr-only",
|
|
177
|
-
children:
|
|
177
|
+
children: c("events")
|
|
178
178
|
}),
|
|
179
179
|
Object.keys(A).map((e) => /* @__PURE__ */ T("label", {
|
|
180
180
|
className: "flex items-center gap-1.5",
|
|
181
181
|
children: [/* @__PURE__ */ w(h, {
|
|
182
182
|
checked: I.includes(e),
|
|
183
183
|
onCheckedChange: (t) => L((n) => t ? [...n, e] : n.filter((t) => t !== e))
|
|
184
|
-
}),
|
|
184
|
+
}), c(`groups.${e}`)]
|
|
185
185
|
}, e)),
|
|
186
186
|
/* @__PURE__ */ w("span", {
|
|
187
187
|
className: "text-xs text-muted-foreground",
|
|
188
|
-
children:
|
|
188
|
+
children: c("noneChosen")
|
|
189
189
|
})
|
|
190
190
|
]
|
|
191
191
|
}),
|
|
192
192
|
/* @__PURE__ */ w(_, {
|
|
193
|
-
"aria-label":
|
|
193
|
+
"aria-label": c("format"),
|
|
194
194
|
value: R,
|
|
195
195
|
onValueChange: (e) => e && z(e),
|
|
196
196
|
items: [{
|
|
197
197
|
value: "json",
|
|
198
|
-
label:
|
|
198
|
+
label: c("formats.json")
|
|
199
199
|
}, {
|
|
200
200
|
value: "chat",
|
|
201
|
-
label:
|
|
201
|
+
label: c("formats.chat")
|
|
202
202
|
}],
|
|
203
203
|
size: "sm",
|
|
204
204
|
width: "content"
|
|
205
205
|
}),
|
|
206
206
|
/* @__PURE__ */ w(_, {
|
|
207
|
-
"aria-label":
|
|
207
|
+
"aria-label": c("team"),
|
|
208
208
|
value: B,
|
|
209
209
|
onValueChange: (e) => V(e ?? ""),
|
|
210
210
|
items: [{
|
|
211
211
|
value: "",
|
|
212
|
-
label:
|
|
212
|
+
label: c("allTeams")
|
|
213
213
|
}, ...H.filter((e) => !e.archivedAt).map((e) => ({
|
|
214
214
|
value: e.id,
|
|
215
215
|
label: e.name
|
|
@@ -221,7 +221,7 @@ function M({ workspace: i }) {
|
|
|
221
221
|
type: "submit",
|
|
222
222
|
variant: "primary",
|
|
223
223
|
loading: Y.isPending,
|
|
224
|
-
children:
|
|
224
|
+
children: c("add")
|
|
225
225
|
}),
|
|
226
226
|
/* @__PURE__ */ w(g, {
|
|
227
227
|
id: "webhook-add-error",
|
|
@@ -233,11 +233,11 @@ function M({ workspace: i }) {
|
|
|
233
233
|
})] }),
|
|
234
234
|
/* @__PURE__ */ w("p", {
|
|
235
235
|
className: "mt-3 text-xs text-muted-foreground",
|
|
236
|
-
children:
|
|
236
|
+
children: c("verify")
|
|
237
237
|
}),
|
|
238
238
|
/* @__PURE__ */ w("p", {
|
|
239
239
|
className: "mt-1 text-xs text-muted-foreground",
|
|
240
|
-
children:
|
|
240
|
+
children: c("chatHelp")
|
|
241
241
|
}),
|
|
242
242
|
ne
|
|
243
243
|
] });
|