@parallelworks/tandem-web 0.194.2 → 0.194.3

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,1030 +1,27 @@
1
- import { api as e, unwrap as t } from "../../../../api/client.js";
2
- import { invalidateIssueLists as n } from "../../../../api/mutations.js";
3
- import { agentsQuery as r, meQuery as i, teamAccessQuery as a, teamMembersQuery as o, teamsQuery as s } from "../../../../api/queries.js";
4
- import { AccessGrants as c } from "../../../../components/AccessGrants.js";
5
- import { BugRotation as l } from "../../../../components/BugRotation.js";
6
- import { FieldSettings as u } from "../../../../components/CustomFields.js";
7
- import { FavoriteStar as d } from "../../../../components/FavoriteStar.js";
8
- import { IconUpload as f } from "../../../../components/IconUpload.js";
9
- import { TeamImportExport as p } from "../../../../components/IssueImport.js";
10
- import { IssueTemplates as m } from "../../../../components/IssueTemplates.js";
11
- import { AddIcon as h, ShieldIcon as g, UsersIcon as _ } from "../../../../components/icons.js";
12
- import { PersonHoverCard as v } from "../../../../components/PersonHoverCard.js";
13
- import { StatusRules as y } from "../../../../components/StatusRules.js";
14
- import { TeamRepositories as b } from "../../../../components/TeamRepositories.js";
15
- import { TeamWorkflow as x } from "../../../../components/TeamWorkflow.js";
16
- import { useConfirm as S } from "../../../../lib/confirm.js";
17
- import { copyItem as C } from "../../../../lib/menus.js";
18
- import { usePageTitle as w } from "../../../../lib/pageTitle.js";
19
- import { usePeople as T } from "../../../../lib/people.js";
20
- import { usePermissions as E } from "../../../../lib/roles.js";
21
- import { useNavigate as D } from "../../../../lib/router.js";
22
- import { withSubTeams as O } from "../../../../lib/teamTree.js";
23
- import { Route as k } from "./settings.js";
24
- import { Avatar as A, Button as j, Card as M, Combobox as N, ConfirmModal as P, ErrorText as F, Input as I, PageHeader as ee, Section as L, Select as R, SettingRow as z, SettingsCard as B, Switch as V, menuDivider as H, useOpenMenu as U } from "@parallelworks/ui";
25
- import { useState as W } from "react";
26
- import { useErrorMessage as G } from "@parallelworks/problem/react";
27
- import { useTranslations as K } from "use-intl";
28
- import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
29
- import { useMutation as X, useQuery as te, useQueryClient as Z, useSuspenseQuery as Q } from "@tanstack/react-query";
30
- // src/routes/$workspace/teams/$key/settings.tsx?tsr-split=component
31
- function ne() {
32
- let { workspace: n, key: r } = k.useParams(), { data: i } = Q(s(n)), a = E(n, { team: r }), o = a.has("manage_teams"), c = K("settingsNav"), h = Z(), g = X({
33
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
34
- params: { path: {
35
- workspace: n,
36
- key: r
37
- } },
38
- body: i
39
- })),
40
- onSettled: () => h.invalidateQueries({ queryKey: s(n).queryKey })
41
- }), _ = i.find((e) => e.key === r);
42
- return w(_?.name), _ ? /* @__PURE__ */ Y("div", {
43
- className: "flex h-full min-h-0 flex-col",
44
- children: [/* @__PURE__ */ J(ee, {
45
- heading: !1,
46
- breadcrumbs: [
47
- {
48
- label: c("label"),
49
- href: `/${n}/settings`
50
- },
51
- {
52
- label: c("teams"),
53
- href: `/${n}/settings/teams`
54
- },
55
- { label: _.name }
56
- ]
57
- }), /* @__PURE__ */ J("div", {
58
- className: "min-h-0 flex-1 overflow-y-auto",
59
- children: /* @__PURE__ */ Y("div", {
60
- className: "w-full space-y-12 px-4 py-6 md:px-8 md:py-8",
61
- children: [
62
- /* @__PURE__ */ Y("div", {
63
- className: "flex items-center gap-3",
64
- children: [
65
- /* @__PURE__ */ J(f, {
66
- workspace: n,
67
- icon: _.icon,
68
- name: _.name,
69
- onChange: (e) => g.mutateAsync({
70
- icon: e,
71
- color: ""
72
- }),
73
- disabled: !o,
74
- size: 40
75
- }),
76
- /* @__PURE__ */ Y("h1", {
77
- className: "text-xl font-semibold tracking-tight",
78
- children: [
79
- _.name,
80
- " ",
81
- /* @__PURE__ */ J("span", {
82
- className: "font-normal text-muted-foreground",
83
- children: _.key
84
- })
85
- ]
86
- }),
87
- /* @__PURE__ */ J(d, {
88
- workspace: n,
89
- kind: "team",
90
- target: _.id
91
- })
92
- ]
93
- }),
94
- /* @__PURE__ */ J(ae, {
95
- workspace: n,
96
- team: _,
97
- teams: i,
98
- isAdmin: o
99
- }),
100
- _.sidebarHidden && /* @__PURE__ */ J(ie, {
101
- workspace: n,
102
- team: _,
103
- isAdmin: o
104
- }),
105
- /* @__PURE__ */ J(de, {
106
- workspace: n,
107
- teamKey: r,
108
- isAdmin: a.has("manage_members")
109
- }),
110
- /* @__PURE__ */ J(x, {
111
- workspace: n,
112
- teamKey: r,
113
- isAdmin: a.has("manage_labels")
114
- }),
115
- a.has("manage_labels") && /* @__PURE__ */ J(u, {
116
- workspace: n,
117
- target: "issue",
118
- team: {
119
- key: r,
120
- id: _.id
121
- }
122
- }),
123
- /* @__PURE__ */ J(y, {
124
- workspace: n,
125
- team: _,
126
- isAdmin: o
127
- }),
128
- /* @__PURE__ */ J(se, {
129
- workspace: n,
130
- team: _,
131
- isAdmin: o
132
- }),
133
- /* @__PURE__ */ J(oe, {
134
- workspace: n,
135
- team: _,
136
- isAdmin: o
137
- }),
138
- /* @__PURE__ */ J(l, {
139
- workspace: n,
140
- teamKey: r,
141
- isAdmin: o
142
- }),
143
- /* @__PURE__ */ J(m, {
144
- workspace: n,
145
- teamKey: r,
146
- isAdmin: a.has("manage_templates")
147
- }),
148
- /* @__PURE__ */ J(ce, {
149
- workspace: n,
150
- team: _,
151
- isAdmin: o
152
- }),
153
- /* @__PURE__ */ J(ue, {
154
- workspace: n,
155
- team: _,
156
- isAdmin: o
157
- }),
158
- /* @__PURE__ */ J(b, {
159
- workspace: n,
160
- team: _,
161
- isAdmin: o
162
- }),
163
- /* @__PURE__ */ J(p, {
164
- workspace: n,
165
- team: r,
166
- canImport: a.has("create_issues")
167
- }),
168
- /* @__PURE__ */ J(fe, {
169
- workspace: n,
170
- teamKey: r
171
- }),
172
- o && /* @__PURE__ */ J(pe, {
173
- workspace: n,
174
- team: _
175
- })
176
- ]
177
- })
178
- })]
179
- }) : null;
180
- }
181
- var re = [
182
- "issues",
183
- "projects",
184
- "areas",
185
- "decisions",
186
- "docs"
187
- ];
188
- function ie({ workspace: n, team: r, isAdmin: i }) {
189
- let a = K("teamSidebar"), o = K("workspace"), c = G(), l = Z(), u = X({
190
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
191
- params: { path: {
192
- workspace: n,
193
- key: r.key
194
- } },
195
- body: { sidebarHidden: i }
196
- })),
197
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
198
- }), d = u.isPending && u.variables ? u.variables : r.sidebarHidden ?? [], f = re.filter((e) => !d.includes(e)), p = [
199
- {
200
- page: "triage",
201
- help: a("triageHelp"),
202
- available: r.triageEnabled
203
- },
204
- {
205
- page: "issues",
206
- available: !0
207
- },
208
- {
209
- page: "projects",
210
- available: !0
211
- },
212
- {
213
- page: "areas",
214
- available: !0
215
- },
216
- {
217
- page: "decisions",
218
- help: a("decisionsHelp"),
219
- available: !0
220
- },
221
- {
222
- page: "docs",
223
- available: !0
224
- },
225
- {
226
- page: "cycles",
227
- available: r.cyclesEnabled
228
- }
229
- ];
230
- return /* @__PURE__ */ Y(B, {
231
- title: a("title"),
232
- description: a("description"),
233
- children: [p.filter((e) => e.available).map(({ page: e, help: t }) => {
234
- let n = !d.includes(e), r = n && f.length === 1 && f[0] === e;
235
- return /* @__PURE__ */ J(z, {
236
- label: o(e),
237
- helpText: r ? a("keepOne") : t,
238
- children: /* @__PURE__ */ J(V, {
239
- "aria-label": o(e),
240
- checked: n,
241
- disabled: !i || r || u.isPending,
242
- onCheckedChange: (t) => u.mutate(t ? d.filter((t) => t !== e) : [...d, e])
243
- })
244
- }, e);
245
- }), u.isError && /* @__PURE__ */ J(F, { children: c(u.error) })]
246
- });
247
- }
248
- function ae({ workspace: n, team: r, teams: i, isAdmin: a }) {
249
- let o = K("teamParent"), c = G(), l = Z(), u = X({
250
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
251
- params: { path: {
252
- workspace: n,
253
- key: r.key
254
- } },
255
- body: { parent: i }
256
- })),
257
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
258
- }), d = O(i, r.id), f = i.find((e) => e.id === r.parentId), p = i.filter((e) => e.parentId === r.id && !e.archivedAt);
259
- return /* @__PURE__ */ Y(B, {
260
- title: o("title"),
261
- description: o("description"),
262
- children: [
263
- /* @__PURE__ */ J(z, {
264
- label: o("parent"),
265
- children: /* @__PURE__ */ J("div", {
266
- className: "w-56",
267
- children: /* @__PURE__ */ J(R, {
268
- width: "fill",
269
- "aria-label": o("parent"),
270
- value: f?.key ?? "",
271
- disabled: !a || u.isPending,
272
- onValueChange: (e) => u.mutate(e),
273
- items: [{
274
- value: "",
275
- label: o("none")
276
- }, ...i.filter((e) => !e.archivedAt && !d.has(e.id)).map((e) => ({
277
- value: e.key,
278
- label: e.name
279
- }))]
280
- })
281
- })
282
- }),
283
- p.length > 0 && /* @__PURE__ */ J(z, {
284
- label: o("subTeams"),
285
- children: /* @__PURE__ */ J("span", {
286
- className: "text-sm",
287
- children: p.map((e) => e.name).join(", ")
288
- })
289
- }),
290
- u.error && /* @__PURE__ */ J(F, { children: c(u.error) })
291
- ]
292
- });
293
- }
294
- function oe({ workspace: n, team: r, isAdmin: i }) {
295
- let a = K("planning.sla"), o = K("priority"), c = G(), l = Z(), u = X({
296
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
297
- params: { path: {
298
- workspace: n,
299
- key: r.key
300
- } },
301
- body: { slaHours: i }
302
- })),
303
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
304
- }), d = [
305
- 0,
306
- 4,
307
- 8,
308
- 24,
309
- 48,
310
- 72,
311
- 168,
312
- 336
313
- ], f = (e) => e === 0 ? a("none") : e < 24 ? a("hours", { count: e }) : e % 168 == 0 ? a("weeks", { count: e / 168 }) : a("days", { count: e / 24 });
314
- return /* @__PURE__ */ Y(B, {
315
- title: a("title"),
316
- description: a("description"),
317
- children: [[
318
- "urgent",
319
- "high",
320
- "medium",
321
- "low"
322
- ].map((e) => /* @__PURE__ */ J(z, {
323
- label: o(e),
324
- children: /* @__PURE__ */ J("div", {
325
- className: "w-40",
326
- children: /* @__PURE__ */ J(R, {
327
- width: "fill",
328
- "aria-label": a("target", { priority: o(e) }),
329
- value: String(r.slaHours[e]),
330
- disabled: !i || u.isPending,
331
- onValueChange: (t) => t && u.mutate({
332
- ...r.slaHours,
333
- [e]: Number(t)
334
- }),
335
- items: d.map((e) => ({
336
- value: String(e),
337
- label: f(e)
338
- }))
339
- })
340
- })
341
- }, e)), u.isError && /* @__PURE__ */ J(F, { children: c(u.error) })]
342
- });
343
- }
344
- function se({ workspace: n, team: r, isAdmin: i }) {
345
- let a = K("planning.settings"), o = G(), c = Z(), l = X({
346
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
347
- params: { path: {
348
- workspace: n,
349
- key: r.key
350
- } },
351
- body: i
352
- })),
353
- onSettled: () => {
354
- c.invalidateQueries({ queryKey: s(n).queryKey }), c.invalidateQueries({ queryKey: [
355
- "workspace",
356
- n,
357
- "cycles",
358
- r.key
359
- ] });
360
- }
361
- }), u = !i || l.isPending, d = (e) => l.isError && l.variables && e in l.variables ? o(l.error) : null;
362
- return /* @__PURE__ */ Y(B, {
363
- title: a("title"),
364
- description: a("description"),
365
- children: [
366
- /* @__PURE__ */ J(z, {
367
- label: a("triage"),
368
- helpText: a("triageHelp"),
369
- error: d("triageEnabled"),
370
- children: /* @__PURE__ */ J(V, {
371
- "aria-label": a("triage"),
372
- checked: r.triageEnabled,
373
- disabled: u,
374
- onCheckedChange: (e) => l.mutate({ triageEnabled: e })
375
- })
376
- }),
377
- /* @__PURE__ */ J(z, {
378
- label: a("customerRequests"),
379
- helpText: a("customerRequestsHelp"),
380
- error: d("customerRequestsEnabled"),
381
- children: /* @__PURE__ */ J(V, {
382
- "aria-label": a("customerRequests"),
383
- checked: r.customerRequestsEnabled,
384
- disabled: u,
385
- onCheckedChange: (e) => l.mutate({ customerRequestsEnabled: e })
386
- })
387
- }),
388
- /* @__PURE__ */ J(z, {
389
- label: a("autoClose"),
390
- helpText: a("autoCloseHelp"),
391
- error: d("autoCloseDays"),
392
- children: /* @__PURE__ */ J("div", {
393
- className: "w-40",
394
- children: /* @__PURE__ */ J(R, {
395
- width: "fill",
396
- "aria-label": a("autoClose"),
397
- value: String(r.autoCloseDays),
398
- disabled: u,
399
- onValueChange: (e) => e && l.mutate({ autoCloseDays: Number(e) }),
400
- items: [
401
- 0,
402
- 30,
403
- 60,
404
- 90,
405
- 180,
406
- 365
407
- ].map((e) => ({
408
- value: String(e),
409
- label: a("afterDays", { count: e })
410
- }))
411
- })
412
- })
413
- }),
414
- /* @__PURE__ */ J(z, {
415
- label: a("autoArchive"),
416
- helpText: a("autoArchiveHelp"),
417
- error: d("autoArchiveDays"),
418
- children: /* @__PURE__ */ J("div", {
419
- className: "w-40",
420
- children: /* @__PURE__ */ J(R, {
421
- width: "fill",
422
- "aria-label": a("autoArchive"),
423
- value: String(r.autoArchiveDays),
424
- disabled: u,
425
- onValueChange: (e) => e && l.mutate({ autoArchiveDays: Number(e) }),
426
- items: [
427
- 0,
428
- 1,
429
- 7,
430
- 30,
431
- 90,
432
- 180
433
- ].map((e) => ({
434
- value: String(e),
435
- label: a("afterDays", { count: e })
436
- }))
437
- })
438
- })
439
- }),
440
- /* @__PURE__ */ J(z, {
441
- label: a("cycles"),
442
- helpText: a("cyclesHelp"),
443
- error: d("cyclesEnabled"),
444
- children: /* @__PURE__ */ J(V, {
445
- "aria-label": a("cycles"),
446
- checked: r.cyclesEnabled,
447
- disabled: u,
448
- onCheckedChange: (e) => l.mutate({ cyclesEnabled: e })
449
- })
450
- }),
451
- /* @__PURE__ */ J(z, {
452
- label: a("cycleLength"),
453
- helpText: a("cycleLengthHelp"),
454
- error: d("cycleWeeks"),
455
- children: /* @__PURE__ */ J("div", {
456
- className: "w-36",
457
- children: /* @__PURE__ */ J(R, {
458
- width: "fill",
459
- "aria-label": a("cycleLength"),
460
- value: r.cycleWeeks,
461
- disabled: u,
462
- onValueChange: (e) => e && l.mutate({ cycleWeeks: e }),
463
- items: [
464
- 1,
465
- 2,
466
- 4
467
- ].map((e) => ({
468
- value: e,
469
- label: a("weeks", { count: e })
470
- }))
471
- })
472
- })
473
- }),
474
- /* @__PURE__ */ J(z, {
475
- label: a("upcomingCycles"),
476
- helpText: a("upcomingCyclesHelp"),
477
- error: d("cycleUpcoming"),
478
- children: /* @__PURE__ */ J("div", {
479
- className: "w-36",
480
- children: /* @__PURE__ */ J(R, {
481
- width: "fill",
482
- "aria-label": a("upcomingCycles"),
483
- value: r.cycleUpcoming,
484
- disabled: u,
485
- onValueChange: (e) => e !== null && l.mutate({ cycleUpcoming: e }),
486
- items: [
487
- 0,
488
- 1,
489
- 2,
490
- 3,
491
- 4,
492
- 6,
493
- 8,
494
- 15
495
- ].map((e) => ({
496
- value: e,
497
- label: a("cycleCount", { count: e })
498
- }))
499
- })
500
- })
501
- }),
502
- /* @__PURE__ */ J(z, {
503
- label: a("autoAdd"),
504
- helpText: a("autoAddHelp"),
505
- error: d("cycleAutoAdd"),
506
- children: /* @__PURE__ */ J(V, {
507
- "aria-label": a("autoAdd"),
508
- checked: r.cycleAutoAdd,
509
- disabled: u,
510
- onCheckedChange: (e) => l.mutate({ cycleAutoAdd: e })
511
- })
512
- }),
513
- /* @__PURE__ */ J(z, {
514
- label: a("estimates"),
515
- helpText: a("estimatesHelp"),
516
- error: d("estimateScale"),
517
- children: /* @__PURE__ */ J("div", {
518
- className: "w-44",
519
- children: /* @__PURE__ */ J(R, {
520
- width: "fill",
521
- "aria-label": a("estimates"),
522
- value: r.estimateScale,
523
- disabled: u,
524
- onValueChange: (e) => e && l.mutate({ estimateScale: e }),
525
- items: [
526
- "none",
527
- "fibonacci",
528
- "linear",
529
- "tshirt"
530
- ].map((e) => ({
531
- value: e,
532
- label: a(`scales.${e}`),
533
- description: a(`scaleHints.${e}`)
534
- }))
535
- })
536
- })
537
- })
538
- ]
539
- });
540
- }
541
- var $ = [
542
- "plan",
543
- "implement",
544
- "review",
545
- "verify",
546
- "merge",
547
- "release"
548
- ];
549
- function ce({ workspace: n, team: i, isAdmin: a }) {
550
- let o = K("flow"), c = G(), l = Z(), { data: u = [] } = te(r(n)), d = X({
551
- mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
552
- params: { path: {
553
- workspace: n,
554
- key: i.key
555
- } },
556
- body: { flow: r }
557
- })),
558
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
559
- }), f = X({
560
- mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
561
- params: { path: {
562
- workspace: n,
563
- key: i.key
564
- } },
565
- body: { autoMerge: r }
566
- })),
567
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
568
- }), p = X({
569
- mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
570
- params: { path: {
571
- workspace: n,
572
- key: i.key
573
- } },
574
- body: { draftPullRequests: r }
575
- })),
576
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
577
- }), m = X({
578
- mutationFn: async (r) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
579
- params: { path: {
580
- workspace: n,
581
- key: i.key
582
- } },
583
- body: { pullRequestsAsAssigner: r }
584
- })),
585
- onSettled: () => l.invalidateQueries({ queryKey: s(n).queryKey })
586
- }), h = (e) => i.flow.find((t) => t.stage === e), [g, _] = W(null), v = (e, t) => {
587
- _(e), d.mutate($.flatMap((n) => {
588
- let r = h(n);
589
- return n === e ? t.on ? [{
590
- stage: n,
591
- ...t.agentId && { agentId: t.agentId }
592
- }] : [] : r ? [r] : [];
593
- }));
594
- }, y = !a || d.isPending;
595
- return /* @__PURE__ */ Y(B, {
596
- title: o("title"),
597
- description: o("description"),
598
- children: [
599
- $.map((e) => {
600
- let t = h(e), n = u.filter((t) => !t.archivedAt && (e !== "review" || t.maxRole === "viewer"));
601
- return /* @__PURE__ */ J(z, {
602
- label: o(`stages.${e}`),
603
- helpText: o(`help.${e}`),
604
- error: d.isError && g === e ? c(d.error) : null,
605
- children: /* @__PURE__ */ Y("div", {
606
- className: "flex items-center gap-3",
607
- children: [t && /* @__PURE__ */ J("div", {
608
- className: "w-44",
609
- children: /* @__PURE__ */ J(R, {
610
- width: "fill",
611
- "aria-label": o("agentFor", { stage: o(`stages.${e}`) }),
612
- value: t.agentId ?? "",
613
- disabled: y,
614
- onValueChange: (t) => v(e, {
615
- on: !0,
616
- agentId: t ?? ""
617
- }),
618
- items: [{
619
- value: "",
620
- label: o("noAgent")
621
- }, ...n.map((e) => ({
622
- value: e.id,
623
- label: e.name
624
- }))]
625
- })
626
- }), /* @__PURE__ */ J(V, {
627
- "aria-label": o(`stages.${e}`),
628
- checked: !!t,
629
- disabled: y,
630
- onCheckedChange: (t) => v(e, { on: t })
631
- })]
632
- })
633
- }, e);
634
- }),
635
- h("release") && /* @__PURE__ */ J(z, {
636
- label: o("releaseTargets"),
637
- helpText: o("releaseTargetsHelp"),
638
- children: /* @__PURE__ */ J(le, {
639
- workspace: n,
640
- team: i,
641
- disabled: !a
642
- })
643
- }),
644
- /* @__PURE__ */ J(z, {
645
- label: o("autoMerge"),
646
- helpText: o("autoMergeHelp"),
647
- error: f.isError ? c(f.error) : null,
648
- children: /* @__PURE__ */ J(V, {
649
- "aria-label": o("autoMerge"),
650
- checked: i.autoMerge,
651
- disabled: !a || f.isPending,
652
- onCheckedChange: (e) => f.mutate(e)
653
- })
654
- }),
655
- /* @__PURE__ */ J(z, {
656
- label: o("draftPullRequests"),
657
- helpText: o("draftPullRequestsHelp"),
658
- error: p.isError ? c(p.error) : null,
659
- children: /* @__PURE__ */ J(V, {
660
- "aria-label": o("draftPullRequests"),
661
- checked: i.draftPullRequests,
662
- disabled: !a || p.isPending,
663
- onCheckedChange: (e) => p.mutate(e)
664
- })
665
- }),
666
- /* @__PURE__ */ J(z, {
667
- label: o("pullRequestsAsAssigner"),
668
- helpText: o("pullRequestsAsAssignerHelp"),
669
- error: m.isError ? c(m.error) : null,
670
- children: /* @__PURE__ */ J(V, {
671
- "aria-label": o("pullRequestsAsAssigner"),
672
- checked: i.pullRequestsAsAssigner,
673
- disabled: !a || m.isPending,
674
- onCheckedChange: (e) => m.mutate(e)
675
- })
676
- })
677
- ]
678
- });
679
- }
680
- function le({ workspace: n, team: r, disabled: i }) {
681
- let a = K("flow"), o = G(), c = Z(), [l, u] = W(r.releaseTargets.join(", ")), d = X({
682
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
683
- params: { path: {
684
- workspace: n,
685
- key: r.key
686
- } },
687
- body: { releaseTargets: i }
688
- })),
689
- onSettled: () => c.invalidateQueries({ queryKey: s(n).queryKey })
690
- }), f = () => {
691
- let e = l.split(",").map((e) => e.trim()).filter(Boolean);
692
- e.join(",") !== r.releaseTargets.join(",") && d.mutate(e);
693
- };
694
- return /* @__PURE__ */ J("div", {
695
- className: "w-64",
696
- children: /* @__PURE__ */ J(I, {
697
- "aria-label": a("releaseTargets"),
698
- value: l,
699
- disabled: i,
700
- onChange: (e) => u(e.target.value),
701
- onBlur: f,
702
- onKeyDown: (e) => e.key === "Enter" && f(),
703
- placeholder: a("releaseTargetsPlaceholder"),
704
- error: d.isError ? o(d.error) : void 0
705
- })
706
- });
707
- }
708
- function ue({ workspace: n, team: r, isAdmin: i }) {
709
- let a = K("team"), o = G(), c = Z(), l = X({
710
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
711
- params: { path: {
712
- workspace: n,
713
- key: r.key
714
- } },
715
- body: { requireKnownTerms: i }
716
- })),
717
- onSettled: () => c.invalidateQueries({ queryKey: s(n).queryKey })
718
- });
719
- return /* @__PURE__ */ J(B, {
720
- title: a("agentQuestions"),
721
- description: a("agentQuestionsDescription"),
722
- children: /* @__PURE__ */ J(z, {
723
- label: a("requireKnownTerms"),
724
- helpText: a("requireKnownTermsHelp"),
725
- error: l.isError ? o(l.error) : null,
726
- children: /* @__PURE__ */ J(V, {
727
- "aria-label": a("requireKnownTerms"),
728
- checked: r.requireKnownTerms,
729
- disabled: !i || l.isPending,
730
- onCheckedChange: (e) => l.mutate(e)
731
- })
732
- })
733
- });
734
- }
735
- function de({ workspace: n, teamKey: r, isAdmin: a }) {
736
- let { data: s } = Q(o(n, r)), { data: c } = Q(i), { members: l, person: u } = T(n), d = Z(), f = U(), p = D(), [m, g] = W(null), _ = K("team"), y = G(), b = K("common"), x = X({
737
- mutationFn: async (i) => {
738
- for (let { username: a, add: o } of i) {
739
- let i = { params: { path: {
740
- workspace: n,
741
- key: r,
742
- username: a
743
- } } };
744
- t(o ? await e.PUT("/api/v1/workspaces/{workspace}/teams/{key}/members/{username}", i) : await e.DELETE("/api/v1/workspaces/{workspace}/teams/{key}/members/{username}", i));
745
- }
746
- },
747
- onMutate: () => g(null),
748
- onError: (e) => g(y(e)),
749
- onSettled: () => d.invalidateQueries({ queryKey: o(n, r).queryKey })
750
- }), S = (e) => x.mutate([...e.filter((e) => !s.includes(e)).map((e) => ({
751
- username: e,
752
- add: !0
753
- })), ...s.filter((t) => !e.includes(t)).map((e) => ({
754
- username: e,
755
- add: !1
756
- }))]), w = c?.user.username ?? "", E = s.includes(w);
757
- return /* @__PURE__ */ Y(L, {
758
- variant: "bare",
759
- headingLevel: 2,
760
- collapsible: !1,
761
- title: _("members"),
762
- description: _("membersDescription"),
763
- actions: /* @__PURE__ */ Y(q, { children: [!E && /* @__PURE__ */ J(j, {
764
- type: "button",
765
- size: "sm",
766
- variant: "primary",
767
- onClick: () => x.mutate([{
768
- username: w,
769
- add: !0
770
- }]),
771
- children: _("join")
772
- }), a && /* @__PURE__ */ J(N, {
773
- multiple: !0,
774
- items: l.map((e) => ({
775
- value: e.user.username,
776
- label: e.user.name,
777
- hint: e.user.email,
778
- icon: /* @__PURE__ */ J(A, {
779
- name: e.user.name,
780
- src: e.user.avatarUrl,
781
- size: "xs",
782
- decorative: !0
783
- })
784
- })),
785
- value: s,
786
- onValueChange: S,
787
- align: "end",
788
- placeholder: _("addPlaceholder"),
789
- "aria-label": _("addMember"),
790
- trigger: /* @__PURE__ */ Y(j, {
791
- type: "button",
792
- size: "sm",
793
- loading: x.isPending,
794
- children: [
795
- /* @__PURE__ */ J(h, { className: "size-3.5" }),
796
- " ",
797
- _("addMember")
798
- ]
799
- })
800
- })] }),
801
- children: [/* @__PURE__ */ Y(M, {
802
- size: "fill",
803
- padding: "none",
804
- divided: !0,
805
- interactive: !1,
806
- render: /* @__PURE__ */ J("ul", {}),
807
- children: [s.map((e) => /* @__PURE__ */ Y("li", {
808
- onContextMenu: (t) => f(t, [
809
- {
810
- label: _("viewIssues"),
811
- onClick: () => p({
812
- to: "/$workspace/teams/$key/issues",
813
- params: {
814
- workspace: n,
815
- key: r
816
- },
817
- search: { assignee: e }
818
- })
819
- },
820
- C(b("copyEmail"), u(e).email ?? ""),
821
- ...a || e === w ? [H, {
822
- label: _(e === w ? "leaveTeam" : "removeFromTeam"),
823
- destructive: !0,
824
- onClick: () => x.mutate([{
825
- username: e,
826
- add: !1
827
- }])
828
- }] : []
829
- ]),
830
- className: "flex items-center gap-3 px-3 py-2 text-sm",
831
- children: [
832
- /* @__PURE__ */ J(v, {
833
- workspace: n,
834
- handle: e,
835
- children: /* @__PURE__ */ J(A, {
836
- name: u(e).name,
837
- src: u(e).avatarUrl,
838
- size: "md"
839
- })
840
- }),
841
- /* @__PURE__ */ Y("span", {
842
- className: "flex-1",
843
- children: [u(e).name, e === w && /* @__PURE__ */ Y("span", {
844
- className: "text-muted-foreground",
845
- children: [" ", _("you")]
846
- })]
847
- }),
848
- (a || e === w) && /* @__PURE__ */ J("button", {
849
- type: "button",
850
- onClick: () => x.mutate([{
851
- username: e,
852
- add: !1
853
- }]),
854
- className: "text-xs text-muted-foreground hover:text-danger",
855
- children: e === w ? _("leave") : b("remove")
856
- })
857
- ]
858
- }, e)), s.length === 0 && /* @__PURE__ */ J("li", {
859
- className: "px-3 py-2 text-sm text-muted-foreground",
860
- children: _("noMembers")
861
- })]
862
- }), /* @__PURE__ */ J(F, {
863
- size: "md",
864
- className: "mt-2",
865
- children: m
866
- })]
867
- });
868
- }
869
- function fe({ workspace: r, teamKey: i }) {
870
- let { data: o } = Q(a(r, i)), { data: l } = Q(s(r)), u = Z(), d = K("team"), f = X({
871
- mutationFn: async (n) => t(await e.PUT("/api/v1/workspaces/{workspace}/teams/{key}/access", {
872
- params: { path: {
873
- workspace: r,
874
- key: i
875
- } },
876
- body: {
877
- restricted: !!n.restricted,
878
- grants: n.grants.map((e) => ({
879
- principal: {
880
- kind: e.principal.kind,
881
- handle: e.principal.handle
882
- },
883
- role: e.role
884
- }))
885
- }
886
- })),
887
- onSuccess: (e) => u.setQueryData(a(r, i).queryKey, e),
888
- onSettled: () => {
889
- u.invalidateQueries({ queryKey: a(r, i).queryKey }), u.invalidateQueries({ queryKey: s(r).queryKey }), n(u, r);
890
- }
891
- });
892
- return /* @__PURE__ */ J(L, {
893
- variant: "bare",
894
- headingLevel: 2,
895
- collapsible: !1,
896
- title: d("access"),
897
- description: d("accessDescription"),
898
- children: /* @__PURE__ */ J(c, {
899
- workspace: r,
900
- resourceName: l.find((e) => e.key === i)?.name ?? i,
901
- access: o,
902
- save: (e) => f.mutateAsync(e),
903
- openLabel: d("everyone"),
904
- rules: [{
905
- id: "admins",
906
- icon: /* @__PURE__ */ J(g, { className: "size-4" }),
907
- title: d("admins"),
908
- detail: d("adminsDetail"),
909
- roleId: "admin"
910
- }, ...o.restricted ? [] : [{
911
- id: "everyone",
912
- icon: /* @__PURE__ */ J(_, { className: "size-4" }),
913
- title: d("everyone"),
914
- detail: d("everyoneDetail")
915
- }]]
916
- })
917
- });
918
- }
919
- function pe({ workspace: n, team: r }) {
920
- let i = K("team"), a = Z(), o = G(), { confirm: c, dialog: l } = S(), u = !!r.archivedAt, d = X({
921
- mutationFn: async (i) => t(await e.PATCH("/api/v1/workspaces/{workspace}/teams/{key}", {
922
- params: { path: {
923
- workspace: n,
924
- key: r.key
925
- } },
926
- body: { archived: i }
927
- })),
928
- onSettled: () => a.invalidateQueries({ queryKey: s(n).queryKey })
929
- }), f = () => c({
930
- title: i("archiveConfirm", { name: r.name }),
931
- description: i("archiveDetail"),
932
- confirmLabel: i("archive"),
933
- onConfirm: () => d.mutateAsync(!0)
934
- });
935
- return /* @__PURE__ */ Y(L, {
936
- variant: "card",
937
- ...!u && { tone: "error" },
938
- collapsible: !1,
939
- headingLevel: 2,
940
- title: i(u ? "archived" : "dangerZone"),
941
- description: i(u ? "archivedDetail" : "archiveDetail"),
942
- children: [
943
- u ? /* @__PURE__ */ J(j, {
944
- onClick: () => d.mutate(!1),
945
- loading: d.isPending,
946
- children: i("restore")
947
- }) : /* @__PURE__ */ J(j, {
948
- variant: "danger",
949
- onClick: f,
950
- loading: d.isPending,
951
- children: i("archive")
952
- }),
953
- d.error && !d.variables && /* @__PURE__ */ J(F, {
954
- size: "md",
955
- className: "mt-3",
956
- children: o(d.error)
957
- }),
958
- l,
959
- /* @__PURE__ */ J(me, {
960
- workspace: n,
961
- team: r
962
- })
963
- ]
964
- });
965
- }
966
- function me({ workspace: n, team: r }) {
967
- let i = K("team"), a = Z(), o = D(), c = G(), [l, u] = W(!1), [d, f] = W(""), [p, m] = W(null), h = X({
968
- mutationFn: async () => t(await e.DELETE("/api/v1/workspaces/{workspace}/teams/{key}", { params: { path: {
969
- workspace: n,
970
- key: r.key
971
- } } })),
972
- onSuccess: async () => {
973
- a.setQueryData(s(n).queryKey, (e) => e?.filter((e) => e.id !== r.id)), await o({
974
- to: "/$workspace",
975
- params: { workspace: n },
976
- replace: !0
977
- }), await a.invalidateQueries({ queryKey: s(n).queryKey });
978
- }
979
- });
980
- return /* @__PURE__ */ Y("div", {
981
- className: "mt-6 border-t border-border pt-6",
982
- children: [
983
- /* @__PURE__ */ J("h3", {
984
- className: "text-sm font-medium",
985
- children: i("delete")
986
- }),
987
- /* @__PURE__ */ J("p", {
988
- className: "mt-1 text-sm text-muted-foreground",
989
- children: i("deleteDetail")
990
- }),
991
- /* @__PURE__ */ J(j, {
992
- variant: "danger",
993
- className: "mt-3",
994
- onClick: () => u(!0),
995
- children: i("delete")
996
- }),
997
- /* @__PURE__ */ J(P, {
998
- open: l,
999
- onClose: () => {
1000
- u(!1), f(""), m(null);
1001
- },
1002
- title: i("deleteConfirm", { name: r.name }),
1003
- description: i("deleteConfirmDetail"),
1004
- confirmLabel: i("delete"),
1005
- destructive: !0,
1006
- initialFocus: "first-control",
1007
- confirmDisabled: d.trim() !== r.key,
1008
- pending: h.isPending,
1009
- error: p ? c(p) : void 0,
1010
- onConfirm: () => h.mutateAsync().catch((e) => {
1011
- throw m(e), e;
1012
- }),
1013
- children: /* @__PURE__ */ Y("label", {
1014
- className: "mt-3 block text-sm",
1015
- children: [i.rich("deleteTypeKey", { key: () => /* @__PURE__ */ J("code", {
1016
- className: "font-mono",
1017
- children: r.key
1018
- }) }), /* @__PURE__ */ J(I, {
1019
- value: d,
1020
- onChange: (e) => f(e.target.value),
1021
- autoComplete: "off",
1022
- spellCheck: !1,
1023
- className: "mt-1.5 w-full"
1024
- })]
1025
- })
1026
- })
1027
- ]
1028
- });
1029
- }
1030
- export { ne as component };
1
+ import { settingsTabs as e } from "./settings.js";
2
+ import { createFileRoute as t, lazyFn as n, lazyRouteComponent as r } from "@tanstack/react-router";
3
+ // src/routes/$workspace/teams/$key/settings.tsx
4
+ var i = () => import("./settings3.js"), a = () => import("./settings4.js"), o = {
5
+ ...Object.fromEntries(e.map((e) => [e, e])),
6
+ access: "members",
7
+ statuses: "workflow",
8
+ "status-rules": "workflow",
9
+ triage: "planning",
10
+ cycles: "planning",
11
+ sla: "planning",
12
+ rotation: "planning",
13
+ fields: "issues",
14
+ templates: "issues",
15
+ flow: "agents",
16
+ repos: "repositories",
17
+ integrations: "repositories",
18
+ export: "import"
19
+ }, s = t("/$workspace/teams/$key/settings")({
20
+ validateSearch: (e) => {
21
+ let t = typeof e.tab == "string" && Object.hasOwn(o, e.tab) ? o[e.tab] : void 0;
22
+ return t && t !== "general" ? { tab: t } : {};
23
+ },
24
+ loader: n(a, "loader"),
25
+ component: r(i, "component")
26
+ });
27
+ export { s as Route };