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