@nivaro/react 0.3.128 → 0.3.129
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/dist/components/slots/CommentsSlot.js +124 -95
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/shared/components/ItemEditForm.js +2187 -2158
- package/dist/shared/components/ai/AiMarkdown.js +215 -196
- package/dist/shared/components/item-edit/HeaderTools.js +216 -210
- package/dist/shared/components/panels/CommentPanel.js +345 -327
- package/dist/shared/components/support/TicketDetailSheet.js +161 -139
- package/dist/shared/components/trackers/MirroredText.js +40 -0
- package/dist/shared/components/trackers/SourceTracker.js +168 -0
- package/dist/shared/components/trackers/TrackerChip.js +71 -0
- package/dist/shared/components/trackers/TrackerLinkPanel.js +1039 -0
- package/dist/shared/components/trackers/TrackerPickers.js +245 -0
- package/dist/shared/components/trackers/tracker-model.js +126 -0
- package/dist/shared/components/trackers/use-tracker-link.js +159 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1039 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as ue } from "react/jsx-runtime";
|
|
2
|
+
import { useMutation as y, useQuery as F, keepPreviousData as de } from "@tanstack/react-query";
|
|
3
|
+
import { RefreshCw as A, ExternalLink as me, Sparkles as Me, Gitlab as Te, Link2 as Ae } from "lucide-react";
|
|
4
|
+
import { useState as N, useEffect as pe, useMemo as De } from "react";
|
|
5
|
+
import { toast as L } from "sonner";
|
|
6
|
+
import { useNivaroClient as G, useNavigation as Re } from "../../context.js";
|
|
7
|
+
import { useDebounced as ce } from "../../hooks/useDebounced.js";
|
|
8
|
+
import { post as _, del as he, get as R } from "../../lib/commands.js";
|
|
9
|
+
import { toastError as C } from "../../lib/error-toast.js";
|
|
10
|
+
import { useUnsavedWork as be } from "../../lib/unsaved-work.js";
|
|
11
|
+
import { formatRelative as fe, cn as Z } from "../../lib/utils.js";
|
|
12
|
+
import { AiMarkdown as Ue } from "../ai/AiMarkdown.js";
|
|
13
|
+
import { ErrorNotice as Ie } from "../ErrorNotice.js";
|
|
14
|
+
import { ConfirmButton as I } from "../profile/primitives.js";
|
|
15
|
+
import { Button as w } from "../ui/button.js";
|
|
16
|
+
import { Input as te } from "../ui/input.js";
|
|
17
|
+
import { Skeleton as U } from "../ui/skeleton.js";
|
|
18
|
+
import { TrackerChip as Ke } from "./TrackerChip.js";
|
|
19
|
+
import { PickList as ee, LabelPicker as xe } from "./TrackerPickers.js";
|
|
20
|
+
import { safeHref as ae, stateWord as Oe, sourceBody as T, percent as ge, connectionForUrl as ze, OP_WORDS as Be, memberName as Qe, joinedViaLabel as He, alwaysLabels as We } from "./tracker-model.js";
|
|
21
|
+
import { trackerQueryKeys as M } from "./use-tracker-link.js";
|
|
22
|
+
const K = "h-7 gap-1.5 bg-nvr-cyan text-[12px] text-white hover:bg-nvr-cyan/90", j = "inline-flex h-7 items-center gap-1 rounded-md border border-slate-200 bg-white px-2 text-[12px] font-medium text-slate-700 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-50 dark:border-border dark:bg-card dark:text-foreground dark:hover:bg-muted", O = "border-red-300 text-red-700 dark:border-red-500/50 dark:text-red-300", v = "text-[11.5px] text-slate-600 dark:text-muted-foreground", Ye = "min-h-[72px] w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-[12.5px] text-slate-900 outline-none placeholder:text-slate-400 focus:border-nvr-cyan focus:ring-2 focus:ring-nvr-cyan/20 dark:text-slate-100", ke = "flex flex-wrap items-start gap-2 rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200", z = {
|
|
23
|
+
issue: "issue-log entry",
|
|
24
|
+
ticket: "request",
|
|
25
|
+
record: "record"
|
|
26
|
+
};
|
|
27
|
+
function Pt(t) {
|
|
28
|
+
const { admin: n, link: i, chip: d, pending: p = [], onChanged: x } = t, [l, b] = N(t.initialMode ?? "idle"), r = p.find((h) => h.op === "create" && h.status !== "dead"), g = (h) => () => {
|
|
29
|
+
t.initialMode && t.initialMode !== "idle" && t.onClose ? t.onClose() : b(h);
|
|
30
|
+
}, c = (h) => () => {
|
|
31
|
+
var o;
|
|
32
|
+
h && ((o = t.onCreated) == null || o.call(t)), x(), t.initialMode && t.initialMode !== "idle" && t.onClose ? t.onClose() : b("idle");
|
|
33
|
+
};
|
|
34
|
+
return /* @__PURE__ */ a("div", { "data-tracker-panel": i || d ? "linked" : "unlinked", className: "space-y-3", children: [
|
|
35
|
+
n && i ? /* @__PURE__ */ e(it, { ...t, link: i }) : d ? /* @__PURE__ */ e(Xe, { chip: d }) : r || t.creating ? /* @__PURE__ */ a(
|
|
36
|
+
"p",
|
|
37
|
+
{
|
|
38
|
+
className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-700 dark:text-foreground",
|
|
39
|
+
role: "status",
|
|
40
|
+
"data-gitlab-creating": !0,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ e(A, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground", "aria-hidden": !0 }),
|
|
43
|
+
"Creating the GitLab issue…",
|
|
44
|
+
r && r.attempts > 0 && r.last_error && /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: [
|
|
45
|
+
"Trying again ",
|
|
46
|
+
fe(r.next_attempt_at ?? "")
|
|
47
|
+
] })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
) : l === "create" ? /* @__PURE__ */ e(Ze, { ...t, onCancel: g("idle"), onDone: c(!0) }) : l === "link" ? /* @__PURE__ */ e(st, { ...t, onCancel: g("idle"), onDone: c(!1) }) : /* @__PURE__ */ a(ue, { children: [
|
|
51
|
+
t.slow && /* @__PURE__ */ e(Ve, { onCheckAgain: t.onCheckAgain }),
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
Je,
|
|
54
|
+
{
|
|
55
|
+
...t,
|
|
56
|
+
onCreate: () => b("create"),
|
|
57
|
+
onLink: () => b("link"),
|
|
58
|
+
onQuickCreated: c(!0)
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
] }),
|
|
62
|
+
n && /* @__PURE__ */ e(ot, { pending: p, onChanged: x })
|
|
63
|
+
] });
|
|
64
|
+
}
|
|
65
|
+
function Ve({ onCheckAgain: t }) {
|
|
66
|
+
return /* @__PURE__ */ a(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
role: "status",
|
|
70
|
+
"data-gitlab-stalled": !0,
|
|
71
|
+
className: "flex flex-wrap items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: "GitLab has not answered yet. The issue shows here once it is made; if it does not, create it again." }),
|
|
74
|
+
t && /* @__PURE__ */ a("button", { type: "button", className: j, onClick: t, children: [
|
|
75
|
+
/* @__PURE__ */ e(A, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
76
|
+
"Check again"
|
|
77
|
+
] })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
function Xe({ chip: t }) {
|
|
83
|
+
const n = ae(t.web_url);
|
|
84
|
+
return /* @__PURE__ */ a("p", { className: "flex flex-wrap items-center gap-2 text-[12.5px] text-slate-700 dark:text-foreground", children: [
|
|
85
|
+
/* @__PURE__ */ e(Ke, { tracker: t }),
|
|
86
|
+
/* @__PURE__ */ a("span", { children: [
|
|
87
|
+
"In GitLab as issue #",
|
|
88
|
+
t.iid,
|
|
89
|
+
"."
|
|
90
|
+
] }),
|
|
91
|
+
n && /* @__PURE__ */ a(
|
|
92
|
+
"a",
|
|
93
|
+
{
|
|
94
|
+
href: n,
|
|
95
|
+
target: "_blank",
|
|
96
|
+
rel: "noreferrer noopener",
|
|
97
|
+
className: "inline-flex items-center gap-1 font-medium text-nvr-navy hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-nvr-cyan",
|
|
98
|
+
children: [
|
|
99
|
+
"Open in GitLab",
|
|
100
|
+
/* @__PURE__ */ e(me, { className: "h-3 w-3", "aria-hidden": !0 })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
function Je({
|
|
107
|
+
source: t,
|
|
108
|
+
admin: n,
|
|
109
|
+
connections: i,
|
|
110
|
+
suggestedRule: d,
|
|
111
|
+
onCreate: p,
|
|
112
|
+
onLink: x,
|
|
113
|
+
onQuickCreated: l
|
|
114
|
+
}) {
|
|
115
|
+
var s;
|
|
116
|
+
const b = G(), r = n ? d ?? null : null, c = (s = F({
|
|
117
|
+
queryKey: M.rules(),
|
|
118
|
+
queryFn: () => b.request(
|
|
119
|
+
R("/trackers/rules")
|
|
120
|
+
).then((u) => u.data ?? []),
|
|
121
|
+
enabled: r != null,
|
|
122
|
+
staleTime: 6e4
|
|
123
|
+
}).data) == null ? void 0 : s.find((u) => u.id === r), h = c ? i.find((u) => u.id === c.connection) : void 0, o = y({
|
|
124
|
+
mutationFn: () => b.request(
|
|
125
|
+
_("/trackers/links", {
|
|
126
|
+
...T(t),
|
|
127
|
+
connection: (h == null ? void 0 : h.id) ?? 0,
|
|
128
|
+
rule: r
|
|
129
|
+
})
|
|
130
|
+
),
|
|
131
|
+
onSuccess: () => {
|
|
132
|
+
L.success("Sending to GitLab"), l();
|
|
133
|
+
},
|
|
134
|
+
onError: (u) => C(u, "Could not create the GitLab issue")
|
|
135
|
+
});
|
|
136
|
+
return /* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
137
|
+
r != null && /* @__PURE__ */ a(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
className: "flex flex-wrap items-center gap-2 rounded-md border border-nvr-cyan/30 bg-nvr-cyan/[0.06] px-3 py-2 text-[12.5px] text-slate-800 dark:text-foreground",
|
|
141
|
+
"data-gitlab-suggested": !0,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5 shrink-0 text-nvr-navy dark:text-nvr-cyan", "aria-hidden": !0 }),
|
|
144
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
145
|
+
"Suggested for GitLab",
|
|
146
|
+
c != null && c.name ? /* @__PURE__ */ a(ue, { children: [
|
|
147
|
+
" ",
|
|
148
|
+
"by the rule ",
|
|
149
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: c.name })
|
|
150
|
+
] }) : null,
|
|
151
|
+
"."
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ e(
|
|
154
|
+
w,
|
|
155
|
+
{
|
|
156
|
+
size: "sm",
|
|
157
|
+
className: K,
|
|
158
|
+
disabled: o.isPending || o.isSuccess || !h,
|
|
159
|
+
"data-tip": c && !h ? "The rule's connection is paused or no longer takes issue-log entries" : void 0,
|
|
160
|
+
onClick: () => o.mutate(),
|
|
161
|
+
children: o.isPending ? "Sending…" : "Create it"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ a("p", { className: "text-[12.5px] text-muted-foreground", children: [
|
|
168
|
+
"Not in GitLab yet. Create a GitLab issue from this ",
|
|
169
|
+
z[t.kind],
|
|
170
|
+
", or link one that already exists."
|
|
171
|
+
] }),
|
|
172
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: [
|
|
173
|
+
/* @__PURE__ */ a(
|
|
174
|
+
w,
|
|
175
|
+
{
|
|
176
|
+
size: "sm",
|
|
177
|
+
className: r != null ? "h-7 gap-1.5 text-[12px]" : K,
|
|
178
|
+
variant: r != null ? "outline" : "default",
|
|
179
|
+
onClick: p,
|
|
180
|
+
"aria-label": "Create GitLab issue",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
183
|
+
"Create GitLab issue"
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ a(w, { size: "sm", variant: "outline", className: "h-7 gap-1.5 text-[12px]", onClick: x, children: [
|
|
188
|
+
/* @__PURE__ */ e(Ae, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
189
|
+
"Link existing"
|
|
190
|
+
] })
|
|
191
|
+
] })
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
function Ne({
|
|
195
|
+
connections: t,
|
|
196
|
+
value: n,
|
|
197
|
+
onChange: i
|
|
198
|
+
}) {
|
|
199
|
+
return t.length < 2 ? null : /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
200
|
+
/* @__PURE__ */ e("p", { className: v, children: "Connection" }),
|
|
201
|
+
/* @__PURE__ */ e(
|
|
202
|
+
ee,
|
|
203
|
+
{
|
|
204
|
+
ariaLabel: "GitLab connection",
|
|
205
|
+
placeholder: "Choose a connection",
|
|
206
|
+
value: [n],
|
|
207
|
+
options: t.map((d) => ({ value: d.id, label: d.name })),
|
|
208
|
+
onChange: (d) => d[0] && i(d[0])
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] });
|
|
212
|
+
}
|
|
213
|
+
function Ze(t) {
|
|
214
|
+
var k;
|
|
215
|
+
const { source: n, admin: i, connections: d, onCancel: p } = t, x = G(), [l, b] = N(((k = d[0]) == null ? void 0 : k.id) ?? 0), r = d.find((f) => f.id === l) ?? d[0], [g, c] = N(!1), h = F({
|
|
216
|
+
queryKey: M.similar(n.kind, n.id, (r == null ? void 0 : r.id) ?? 0),
|
|
217
|
+
queryFn: () => x.request(
|
|
218
|
+
_("/trackers/links/similar", { ...T(n), connection: (r == null ? void 0 : r.id) ?? 0 })
|
|
219
|
+
).then((f) => f.data ?? []),
|
|
220
|
+
enabled: i && !!r,
|
|
221
|
+
retry: !1,
|
|
222
|
+
staleTime: 6e4
|
|
223
|
+
}), o = y({
|
|
224
|
+
mutationFn: (f) => x.request(
|
|
225
|
+
_("/trackers/links/join", {
|
|
226
|
+
...T(n),
|
|
227
|
+
connection: (r == null ? void 0 : r.id) ?? 0,
|
|
228
|
+
...f.link_id ? { link: f.link_id } : { project_id: f.project_id, iid: f.iid },
|
|
229
|
+
score: f.score
|
|
230
|
+
})
|
|
231
|
+
),
|
|
232
|
+
onSuccess: (f, $) => {
|
|
233
|
+
L.success(`Added as an example of #${$.iid}`), t.onChanged(), p();
|
|
234
|
+
},
|
|
235
|
+
onError: (f) => C(f, "Could not add it to that GitLab issue")
|
|
236
|
+
}), s = h.data ?? [], u = i && !g && s.length > 0;
|
|
237
|
+
return /* @__PURE__ */ a("div", { className: "space-y-3", "data-gitlab-create": !0, children: [
|
|
238
|
+
/* @__PURE__ */ e(
|
|
239
|
+
Ne,
|
|
240
|
+
{
|
|
241
|
+
connections: d,
|
|
242
|
+
value: l,
|
|
243
|
+
onChange: (f) => {
|
|
244
|
+
b(f), c(!1);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
i && h.isLoading ? /* @__PURE__ */ a("div", { className: "space-y-2", "aria-live": "polite", children: [
|
|
249
|
+
/* @__PURE__ */ e("p", { className: "text-[12px] text-muted-foreground", children: "Looking for GitLab issues like this one…" }),
|
|
250
|
+
/* @__PURE__ */ e(U, { className: "h-9 w-full" })
|
|
251
|
+
] }) : u ? /* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
252
|
+
/* @__PURE__ */ e("ul", { className: "space-y-1.5", "aria-label": "GitLab issues like this one", children: s.map((f) => {
|
|
253
|
+
const $ = ae(f.web_url);
|
|
254
|
+
return /* @__PURE__ */ a(
|
|
255
|
+
"li",
|
|
256
|
+
{
|
|
257
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1.5 rounded-md border border-slate-200 bg-slate-50 px-3 py-2 dark:border-border dark:bg-muted/30",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ a("p", { className: "min-w-0 flex-1 text-[12.5px] text-slate-800 dark:text-foreground", children: [
|
|
260
|
+
"Looks like",
|
|
261
|
+
" ",
|
|
262
|
+
$ ? /* @__PURE__ */ a(
|
|
263
|
+
"a",
|
|
264
|
+
{
|
|
265
|
+
href: $,
|
|
266
|
+
target: "_blank",
|
|
267
|
+
rel: "noreferrer noopener",
|
|
268
|
+
className: "font-medium tabular-nums text-nvr-navy hover:underline dark:text-nvr-cyan",
|
|
269
|
+
children: [
|
|
270
|
+
"#",
|
|
271
|
+
f.iid
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
) : /* @__PURE__ */ a("span", { className: "font-medium tabular-nums", children: [
|
|
275
|
+
"#",
|
|
276
|
+
f.iid
|
|
277
|
+
] }),
|
|
278
|
+
" ",
|
|
279
|
+
"(",
|
|
280
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: ge(f.score) }),
|
|
281
|
+
")",
|
|
282
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] text-muted-foreground", children: f.title })
|
|
283
|
+
] }),
|
|
284
|
+
/* @__PURE__ */ e(
|
|
285
|
+
w,
|
|
286
|
+
{
|
|
287
|
+
size: "sm",
|
|
288
|
+
variant: "outline",
|
|
289
|
+
className: "h-7 text-[12px]",
|
|
290
|
+
disabled: o.isPending,
|
|
291
|
+
onClick: () => o.mutate(f),
|
|
292
|
+
"aria-label": `Add as example of #${f.iid}`,
|
|
293
|
+
children: "Add as example"
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
]
|
|
297
|
+
},
|
|
298
|
+
`${f.project_id}:${f.iid}`
|
|
299
|
+
);
|
|
300
|
+
}) }),
|
|
301
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap justify-end gap-2", children: [
|
|
302
|
+
/* @__PURE__ */ e(w, { variant: "ghost", size: "sm", className: "h-7 text-[12px]", onClick: p, children: "Cancel" }),
|
|
303
|
+
/* @__PURE__ */ e(
|
|
304
|
+
w,
|
|
305
|
+
{
|
|
306
|
+
variant: "outline",
|
|
307
|
+
size: "sm",
|
|
308
|
+
className: "h-7 text-[12px]",
|
|
309
|
+
onClick: () => c(!0),
|
|
310
|
+
children: "Create new anyway"
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] })
|
|
314
|
+
] }) : r ? i ? /* @__PURE__ */ e(at, { ...t, conn: r }, r.id) : /* @__PURE__ */ e(nt, { ...t, conn: r }, r.id) : null
|
|
315
|
+
] });
|
|
316
|
+
}
|
|
317
|
+
function et({ labels: t }) {
|
|
318
|
+
return t.length ? /* @__PURE__ */ a("p", { className: "flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
319
|
+
/* @__PURE__ */ e("span", { className: "mr-0.5", children: "Always added by the connection:" }),
|
|
320
|
+
t.map((n) => /* @__PURE__ */ e(
|
|
321
|
+
"span",
|
|
322
|
+
{
|
|
323
|
+
className: "rounded border border-slate-200 bg-slate-50 px-1.5 py-px text-[11px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200",
|
|
324
|
+
children: n
|
|
325
|
+
},
|
|
326
|
+
n
|
|
327
|
+
))
|
|
328
|
+
] }) : null;
|
|
329
|
+
}
|
|
330
|
+
function ve({
|
|
331
|
+
pending: t,
|
|
332
|
+
onCancel: n,
|
|
333
|
+
label: i
|
|
334
|
+
}) {
|
|
335
|
+
return /* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
336
|
+
/* @__PURE__ */ e(
|
|
337
|
+
w,
|
|
338
|
+
{
|
|
339
|
+
type: "button",
|
|
340
|
+
variant: "ghost",
|
|
341
|
+
size: "sm",
|
|
342
|
+
className: "h-7 text-[12px]",
|
|
343
|
+
onClick: n,
|
|
344
|
+
children: "Cancel"
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ e(w, { type: "submit", size: "sm", className: K, disabled: t, children: t ? "Sending…" : i })
|
|
348
|
+
] });
|
|
349
|
+
}
|
|
350
|
+
const tt = /* @__PURE__ */ new Set(["issue", "ticket"]);
|
|
351
|
+
function at({
|
|
352
|
+
source: t,
|
|
353
|
+
conn: n,
|
|
354
|
+
fixedLabels: i,
|
|
355
|
+
sourceTitle: d,
|
|
356
|
+
onCancel: p,
|
|
357
|
+
onDone: x
|
|
358
|
+
}) {
|
|
359
|
+
var le, oe;
|
|
360
|
+
const l = G(), b = tt.has(t.kind), r = F({
|
|
361
|
+
queryKey: M.sample(t.kind, t.id),
|
|
362
|
+
queryFn: () => l.request(
|
|
363
|
+
_("/trackers/rules/sample", { applies_to: t.kind, source_id: t.id })
|
|
364
|
+
).then((m) => m.data),
|
|
365
|
+
enabled: b,
|
|
366
|
+
retry: !1,
|
|
367
|
+
staleTime: 6e4
|
|
368
|
+
}), [g, c] = N(null), h = g ?? ((le = r.data) == null ? void 0 : le.title) ?? (r.isError ? d ?? "" : ""), [o, s] = N("");
|
|
369
|
+
be(o.trim() !== "", "GitLab issue description");
|
|
370
|
+
const [u, k] = N(0), [f, $] = N([]), [B, ne] = N([]), Ce = De(
|
|
371
|
+
() => i ? i(n.sync) : We(n.sync),
|
|
372
|
+
[i, n.sync]
|
|
373
|
+
), Q = n.token_set !== !1, [we, _e] = N(""), se = ce(we, 250), H = F({
|
|
374
|
+
queryKey: M.projects(n.id, se),
|
|
375
|
+
queryFn: () => l.request(
|
|
376
|
+
R(`/trackers/${n.id}/projects`, { search: se })
|
|
377
|
+
).then((m) => m.data),
|
|
378
|
+
enabled: Q,
|
|
379
|
+
placeholderData: de,
|
|
380
|
+
staleTime: 6e4
|
|
381
|
+
}), [je, Ge] = N(() => /* @__PURE__ */ new Map()), W = [
|
|
382
|
+
{
|
|
383
|
+
value: 0,
|
|
384
|
+
label: n.default_project_path ? `Default project (${n.default_project_path})` : "Default project"
|
|
385
|
+
},
|
|
386
|
+
...(H.data ?? []).map((m) => ({ value: m.id, label: m.path_with_namespace }))
|
|
387
|
+
];
|
|
388
|
+
u && !W.some((m) => m.value === u) && W.push({ value: u, label: je.get(u) ?? `Project ${u}` });
|
|
389
|
+
const Y = u || n.default_project_id || null, ie = F({
|
|
390
|
+
queryKey: M.labels(n.id, Y),
|
|
391
|
+
queryFn: () => l.request(
|
|
392
|
+
R(`/trackers/${n.id}/labels`, u ? { project: u } : void 0)
|
|
393
|
+
).then((m) => m.data),
|
|
394
|
+
enabled: Q && Y != null,
|
|
395
|
+
staleTime: 6e4,
|
|
396
|
+
retry: !1
|
|
397
|
+
}), D = u || n.default_project_id || 0, [$e, Pe] = N(""), re = ce($e, 250), P = F({
|
|
398
|
+
queryKey: M.users(n.id, D, re),
|
|
399
|
+
queryFn: () => l.request(
|
|
400
|
+
R(`/trackers/${n.id}/users`, { search: re, project: D })
|
|
401
|
+
).then((m) => m.data),
|
|
402
|
+
enabled: Q && D > 0,
|
|
403
|
+
placeholderData: de,
|
|
404
|
+
staleTime: 6e4
|
|
405
|
+
}), [Se, qe] = N(() => /* @__PURE__ */ new Map());
|
|
406
|
+
pe(() => {
|
|
407
|
+
var m;
|
|
408
|
+
(m = P.data) != null && m.length && qe((S) => {
|
|
409
|
+
const q = new Map(S);
|
|
410
|
+
for (const E of P.data) q.set(E.id, `${E.name} (@${E.username})`);
|
|
411
|
+
return q;
|
|
412
|
+
});
|
|
413
|
+
}, [P.data]);
|
|
414
|
+
const Ee = [
|
|
415
|
+
...(P.data ?? []).map((m) => ({ value: m.id, label: `${m.name} (@${m.username})` })),
|
|
416
|
+
...B.filter((m) => !(P.data ?? []).some((S) => S.id === m)).map((m) => ({ value: m, label: Se.get(m) ?? `User ${m}` }))
|
|
417
|
+
], V = y({
|
|
418
|
+
mutationFn: () => l.request(
|
|
419
|
+
_("/trackers/links", {
|
|
420
|
+
...T(t),
|
|
421
|
+
connection: n.id,
|
|
422
|
+
...u ? { project_id: u } : {},
|
|
423
|
+
overrides: {
|
|
424
|
+
...h.trim() ? { title: h.trim() } : {},
|
|
425
|
+
...!b && o.trim() ? { description: o.trim() } : {},
|
|
426
|
+
labels: f,
|
|
427
|
+
assignee_ids: B
|
|
428
|
+
}
|
|
429
|
+
})
|
|
430
|
+
),
|
|
431
|
+
onSuccess: () => {
|
|
432
|
+
L.success("Sending to GitLab"), x();
|
|
433
|
+
},
|
|
434
|
+
onError: (m) => C(m, "Could not create the GitLab issue")
|
|
435
|
+
}), Fe = Y ? ie.isError ? "GitLab did not list the labels. You can still type one." : null : "Pick a project, or set a default one on the connection, to list its labels. You can still type one.", X = `gitlab-${t.kind}-${t.id}`;
|
|
436
|
+
return /* @__PURE__ */ a(
|
|
437
|
+
"form",
|
|
438
|
+
{
|
|
439
|
+
className: "space-y-3",
|
|
440
|
+
onSubmit: (m) => {
|
|
441
|
+
m.preventDefault(), V.isPending || V.mutate();
|
|
442
|
+
},
|
|
443
|
+
children: [
|
|
444
|
+
/* @__PURE__ */ a("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
445
|
+
/* @__PURE__ */ a("div", { className: "space-y-1 sm:col-span-2", children: [
|
|
446
|
+
/* @__PURE__ */ e("label", { htmlFor: `${X}-title`, className: v, children: "Title" }),
|
|
447
|
+
b && r.isLoading && g === null ? /* @__PURE__ */ e(U, { className: "h-8 w-full" }) : /* @__PURE__ */ e(
|
|
448
|
+
te,
|
|
449
|
+
{
|
|
450
|
+
id: `${X}-title`,
|
|
451
|
+
"aria-label": "GitLab issue title",
|
|
452
|
+
value: h,
|
|
453
|
+
onChange: (m) => c(m.target.value),
|
|
454
|
+
placeholder: b ? void 0 : "Leave empty for the standard title",
|
|
455
|
+
maxLength: 255,
|
|
456
|
+
className: "h-8 text-[12.5px]"
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] }),
|
|
460
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
461
|
+
/* @__PURE__ */ e("p", { className: v, children: "Project" }),
|
|
462
|
+
/* @__PURE__ */ e(
|
|
463
|
+
ee,
|
|
464
|
+
{
|
|
465
|
+
ariaLabel: "GitLab project",
|
|
466
|
+
placeholder: "Default project",
|
|
467
|
+
value: [u],
|
|
468
|
+
options: W,
|
|
469
|
+
onSearch: _e,
|
|
470
|
+
loading: H.isFetching,
|
|
471
|
+
emptyText: "No project matches.",
|
|
472
|
+
onChange: (m) => {
|
|
473
|
+
var E;
|
|
474
|
+
const S = m[0] ?? 0, q = (E = H.data) == null ? void 0 : E.find((J) => J.id === S);
|
|
475
|
+
q && Ge((J) => new Map(J).set(q.id, q.path_with_namespace)), k(S), ne([]);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
)
|
|
479
|
+
] }),
|
|
480
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
481
|
+
/* @__PURE__ */ e("p", { className: v, children: "Assignees" }),
|
|
482
|
+
/* @__PURE__ */ e(
|
|
483
|
+
ee,
|
|
484
|
+
{
|
|
485
|
+
multi: !0,
|
|
486
|
+
ariaLabel: "GitLab assignees",
|
|
487
|
+
placeholder: "No one",
|
|
488
|
+
value: B,
|
|
489
|
+
options: Ee,
|
|
490
|
+
onSearch: Pe,
|
|
491
|
+
loading: P.isFetching,
|
|
492
|
+
emptyText: D ? "No one matches." : "Choose a project first.",
|
|
493
|
+
onChange: ne
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] }),
|
|
497
|
+
/* @__PURE__ */ a("div", { className: "space-y-1 sm:col-span-2", children: [
|
|
498
|
+
/* @__PURE__ */ e("p", { className: v, children: "Labels" }),
|
|
499
|
+
/* @__PURE__ */ e(et, { labels: Ce }),
|
|
500
|
+
/* @__PURE__ */ e(
|
|
501
|
+
xe,
|
|
502
|
+
{
|
|
503
|
+
multi: !0,
|
|
504
|
+
labels: ie.data,
|
|
505
|
+
unavailable: Fe,
|
|
506
|
+
ariaLabel: "More GitLab labels",
|
|
507
|
+
placeholder: "Add labels",
|
|
508
|
+
value: f,
|
|
509
|
+
onChange: $
|
|
510
|
+
}
|
|
511
|
+
)
|
|
512
|
+
] })
|
|
513
|
+
] }),
|
|
514
|
+
b ? /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
515
|
+
/* @__PURE__ */ a("p", { className: v, children: [
|
|
516
|
+
"Description (made from the ",
|
|
517
|
+
z[t.kind],
|
|
518
|
+
")"
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-auto rounded-md border border-slate-200 bg-slate-50 px-3 py-2 dark:border-border dark:bg-muted/30", children: r.isLoading ? /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
|
|
521
|
+
/* @__PURE__ */ e(U, { className: "h-3 w-4/5" }),
|
|
522
|
+
/* @__PURE__ */ e(U, { className: "h-3 w-3/5" })
|
|
523
|
+
] }) : r.isError ? /* @__PURE__ */ e(Ie, { error: r.error, what: "the description preview" }) : /* @__PURE__ */ e(
|
|
524
|
+
Ue,
|
|
525
|
+
{
|
|
526
|
+
content: ((oe = r.data) == null ? void 0 : oe.body) ?? "",
|
|
527
|
+
autolink: !1,
|
|
528
|
+
className: "text-[12px] text-slate-800 dark:text-slate-100"
|
|
529
|
+
}
|
|
530
|
+
) })
|
|
531
|
+
] }) : /* @__PURE__ */ e(
|
|
532
|
+
ye,
|
|
533
|
+
{
|
|
534
|
+
id: `${X}-description`,
|
|
535
|
+
value: o,
|
|
536
|
+
onChange: s,
|
|
537
|
+
noun: z[t.kind]
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
/* @__PURE__ */ e(ve, { pending: V.isPending, onCancel: p, label: "Create in GitLab" })
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
function ye({
|
|
546
|
+
id: t,
|
|
547
|
+
value: n,
|
|
548
|
+
onChange: i,
|
|
549
|
+
noun: d
|
|
550
|
+
}) {
|
|
551
|
+
return /* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
552
|
+
/* @__PURE__ */ e("label", { htmlFor: t, className: v, children: "Description" }),
|
|
553
|
+
/* @__PURE__ */ e(
|
|
554
|
+
"textarea",
|
|
555
|
+
{
|
|
556
|
+
id: t,
|
|
557
|
+
value: n,
|
|
558
|
+
onChange: (p) => i(p.target.value),
|
|
559
|
+
rows: 3,
|
|
560
|
+
maxLength: 2e4,
|
|
561
|
+
placeholder: `Leave empty to send the ${d}'s details`,
|
|
562
|
+
className: Ye
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
/* @__PURE__ */ a("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
566
|
+
"A link back to this ",
|
|
567
|
+
d,
|
|
568
|
+
" is always added."
|
|
569
|
+
] })
|
|
570
|
+
] });
|
|
571
|
+
}
|
|
572
|
+
function nt({
|
|
573
|
+
source: t,
|
|
574
|
+
conn: n,
|
|
575
|
+
onCancel: i,
|
|
576
|
+
onDone: d
|
|
577
|
+
}) {
|
|
578
|
+
const p = G(), [x, l] = N(""), [b, r] = N(""), [g, c] = N([]);
|
|
579
|
+
be(
|
|
580
|
+
x.trim() !== "" || b.trim() !== "",
|
|
581
|
+
"GitLab issue title and description"
|
|
582
|
+
);
|
|
583
|
+
const h = y({
|
|
584
|
+
mutationFn: () => {
|
|
585
|
+
const s = {};
|
|
586
|
+
return x.trim() && (s.title = x.trim()), b.trim() && (s.description = b.trim()), g.length && (s.labels = g), p.request(
|
|
587
|
+
_("/trackers/links", {
|
|
588
|
+
...T(t),
|
|
589
|
+
connection: n.id,
|
|
590
|
+
...Object.keys(s).length ? { overrides: s } : {}
|
|
591
|
+
})
|
|
592
|
+
);
|
|
593
|
+
},
|
|
594
|
+
onSuccess: () => {
|
|
595
|
+
L.success("Sending to GitLab"), d();
|
|
596
|
+
},
|
|
597
|
+
onError: (s) => C(s, "Could not create the GitLab issue")
|
|
598
|
+
}), o = `gitlab-${t.kind}-${t.id}`;
|
|
599
|
+
return /* @__PURE__ */ a(
|
|
600
|
+
"form",
|
|
601
|
+
{
|
|
602
|
+
className: "space-y-3",
|
|
603
|
+
onSubmit: (s) => {
|
|
604
|
+
s.preventDefault(), h.isPending || h.mutate();
|
|
605
|
+
},
|
|
606
|
+
children: [
|
|
607
|
+
n.default_project_path && /* @__PURE__ */ a("p", { className: "text-[12px] text-muted-foreground", children: [
|
|
608
|
+
"Goes to ",
|
|
609
|
+
/* @__PURE__ */ e("span", { className: "font-mono text-[11.5px]", children: n.default_project_path }),
|
|
610
|
+
"."
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
613
|
+
/* @__PURE__ */ e("label", { htmlFor: `${o}-title`, className: v, children: "Title" }),
|
|
614
|
+
/* @__PURE__ */ e(
|
|
615
|
+
te,
|
|
616
|
+
{
|
|
617
|
+
id: `${o}-title`,
|
|
618
|
+
"aria-label": "GitLab issue title",
|
|
619
|
+
value: x,
|
|
620
|
+
onChange: (s) => l(s.target.value),
|
|
621
|
+
placeholder: "Leave empty for the standard title",
|
|
622
|
+
maxLength: 255,
|
|
623
|
+
className: "h-8 text-[12.5px]"
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
] }),
|
|
627
|
+
/* @__PURE__ */ e(
|
|
628
|
+
ye,
|
|
629
|
+
{
|
|
630
|
+
id: `${o}-description`,
|
|
631
|
+
value: b,
|
|
632
|
+
onChange: r,
|
|
633
|
+
noun: z[t.kind]
|
|
634
|
+
}
|
|
635
|
+
),
|
|
636
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
637
|
+
/* @__PURE__ */ e("p", { className: v, children: "Labels (optional)" }),
|
|
638
|
+
/* @__PURE__ */ e(
|
|
639
|
+
xe,
|
|
640
|
+
{
|
|
641
|
+
multi: !0,
|
|
642
|
+
labels: void 0,
|
|
643
|
+
unavailable: "Type a label name. The connection adds its own labels too.",
|
|
644
|
+
ariaLabel: "GitLab labels",
|
|
645
|
+
placeholder: "Add labels",
|
|
646
|
+
value: g,
|
|
647
|
+
onChange: c
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
] }),
|
|
651
|
+
/* @__PURE__ */ e(ve, { pending: h.isPending, onCancel: i, label: "Create in GitLab" })
|
|
652
|
+
]
|
|
653
|
+
}
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
function st({
|
|
657
|
+
source: t,
|
|
658
|
+
admin: n,
|
|
659
|
+
connections: i,
|
|
660
|
+
onCancel: d,
|
|
661
|
+
onDone: p
|
|
662
|
+
}) {
|
|
663
|
+
var u;
|
|
664
|
+
const x = G(), [l, b] = N(""), [r, g] = N(((u = i[0]) == null ? void 0 : u.id) ?? 0);
|
|
665
|
+
pe(() => {
|
|
666
|
+
const k = ze(l, i);
|
|
667
|
+
k && g(k.id);
|
|
668
|
+
}, [l, i]);
|
|
669
|
+
const c = i.find((k) => k.id === r) ?? i[0], h = y({
|
|
670
|
+
mutationFn: () => x.request(
|
|
671
|
+
_("/trackers/links/existing", {
|
|
672
|
+
...T(t),
|
|
673
|
+
connection: r,
|
|
674
|
+
url: l.trim()
|
|
675
|
+
})
|
|
676
|
+
),
|
|
677
|
+
onSuccess: () => {
|
|
678
|
+
L.success("Linked to GitLab"), p();
|
|
679
|
+
},
|
|
680
|
+
onError: (k) => C(k, "Could not link that GitLab issue")
|
|
681
|
+
}), o = `gitlab-url-${t.kind}-${t.id}`, s = n ? `${(c == null ? void 0 : c.base_url) ?? "https://gitlab.example.com"}/group/project/-/issues/482` : `https://…/${(c == null ? void 0 : c.default_project_path) ?? "group/project"}/-/issues/482`;
|
|
682
|
+
return /* @__PURE__ */ a(
|
|
683
|
+
"form",
|
|
684
|
+
{
|
|
685
|
+
className: "space-y-2",
|
|
686
|
+
onSubmit: (k) => {
|
|
687
|
+
k.preventDefault(), l.trim() && !h.isPending && h.mutate();
|
|
688
|
+
},
|
|
689
|
+
children: [
|
|
690
|
+
/* @__PURE__ */ e("label", { htmlFor: o, className: v, children: "Link of the GitLab issue" }),
|
|
691
|
+
/* @__PURE__ */ e(
|
|
692
|
+
te,
|
|
693
|
+
{
|
|
694
|
+
id: o,
|
|
695
|
+
autoFocus: !0,
|
|
696
|
+
value: l,
|
|
697
|
+
onChange: (k) => b(k.target.value),
|
|
698
|
+
placeholder: s,
|
|
699
|
+
className: "h-8 font-mono text-[12px]"
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
!n && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: c != null && c.default_project_path ? `An issue in ${c.default_project_path} that is not confidential.` : "An issue in the connection's project that is not confidential." }),
|
|
703
|
+
/* @__PURE__ */ e(Ne, { connections: i, value: r, onChange: g }),
|
|
704
|
+
/* @__PURE__ */ a("div", { className: "flex justify-end gap-2", children: [
|
|
705
|
+
/* @__PURE__ */ e(
|
|
706
|
+
w,
|
|
707
|
+
{
|
|
708
|
+
type: "button",
|
|
709
|
+
variant: "ghost",
|
|
710
|
+
size: "sm",
|
|
711
|
+
className: "h-7 text-[12px]",
|
|
712
|
+
onClick: d,
|
|
713
|
+
children: "Cancel"
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
/* @__PURE__ */ e(
|
|
717
|
+
w,
|
|
718
|
+
{
|
|
719
|
+
type: "submit",
|
|
720
|
+
size: "sm",
|
|
721
|
+
className: K,
|
|
722
|
+
disabled: !l.trim() || h.isPending,
|
|
723
|
+
children: h.isPending ? "Linking…" : "Link"
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] })
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
const Le = (t, n) => t === "issue" ? `/trackers/links/issue/${encodeURIComponent(n)}` : `/trackers/links/source/${t}/${encodeURIComponent(n)}`;
|
|
732
|
+
function it(t) {
|
|
733
|
+
const { source: n, link: i, onChanged: d } = t, p = G(), x = ae(i.web_url), l = y({
|
|
734
|
+
mutationFn: () => p.request(_(`/trackers/links/${i.id}/resync`)),
|
|
735
|
+
onSuccess: () => {
|
|
736
|
+
L.success("Read again from GitLab"), d();
|
|
737
|
+
},
|
|
738
|
+
onError: (o) => {
|
|
739
|
+
C(o, "GitLab did not answer"), d();
|
|
740
|
+
}
|
|
741
|
+
}), b = y({
|
|
742
|
+
mutationFn: () => p.request(he(Le(n.kind, n.id))),
|
|
743
|
+
onSuccess: () => {
|
|
744
|
+
L.success("Unlinked from GitLab"), d();
|
|
745
|
+
},
|
|
746
|
+
onError: (o) => C(o, "Could not unlink it")
|
|
747
|
+
}), r = y({
|
|
748
|
+
mutationFn: (o) => p.request(
|
|
749
|
+
_("/trackers/links/move-to-new", { issue: o, connection: i.connection })
|
|
750
|
+
),
|
|
751
|
+
onSuccess: () => {
|
|
752
|
+
L.success("Opening a new GitLab issue for it"), d();
|
|
753
|
+
},
|
|
754
|
+
onError: (o) => C(o, "Could not move it to a new GitLab issue")
|
|
755
|
+
}), g = l.isPending || b.isPending || r.isPending, c = i.remote_state === "closed", h = n.kind === "issue" && i.sources.length > 1;
|
|
756
|
+
return /* @__PURE__ */ a("div", { className: "space-y-3", children: [
|
|
757
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
758
|
+
/* @__PURE__ */ e("p", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5", children: x ? /* @__PURE__ */ a(
|
|
759
|
+
"a",
|
|
760
|
+
{
|
|
761
|
+
href: x,
|
|
762
|
+
target: "_blank",
|
|
763
|
+
rel: "noreferrer noopener",
|
|
764
|
+
className: "inline-flex min-w-0 items-baseline gap-1.5 text-[13px] font-medium text-slate-900 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-foreground",
|
|
765
|
+
children: [
|
|
766
|
+
/* @__PURE__ */ a("span", { className: "tabular-nums text-muted-foreground", children: [
|
|
767
|
+
"#",
|
|
768
|
+
i.iid
|
|
769
|
+
] }),
|
|
770
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 [text-wrap:pretty]", children: i.remote_title }),
|
|
771
|
+
/* @__PURE__ */ e(me, { className: "h-3 w-3 shrink-0 self-center text-muted-foreground" })
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
) : /* @__PURE__ */ a("span", { className: "text-[13px] font-medium", children: [
|
|
775
|
+
"#",
|
|
776
|
+
i.iid,
|
|
777
|
+
" ",
|
|
778
|
+
i.remote_title
|
|
779
|
+
] }) }),
|
|
780
|
+
/* @__PURE__ */ a("p", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[11.5px] text-muted-foreground", children: [
|
|
781
|
+
/* @__PURE__ */ e(
|
|
782
|
+
"span",
|
|
783
|
+
{
|
|
784
|
+
className: Z(
|
|
785
|
+
"rounded border px-1.5 py-px text-[10.5px] font-medium",
|
|
786
|
+
c ? "border-slate-300 text-slate-600 dark:border-border dark:text-muted-foreground" : "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"
|
|
787
|
+
),
|
|
788
|
+
children: Oe(i.remote_state)
|
|
789
|
+
}
|
|
790
|
+
),
|
|
791
|
+
/* @__PURE__ */ e("span", { className: "font-mono", children: i.project_path }),
|
|
792
|
+
i.milestone && /* @__PURE__ */ a("span", { children: [
|
|
793
|
+
"Milestone ",
|
|
794
|
+
i.milestone
|
|
795
|
+
] }),
|
|
796
|
+
i.assignees.map((o) => /* @__PURE__ */ a("span", { children: [
|
|
797
|
+
"@",
|
|
798
|
+
o
|
|
799
|
+
] }, o))
|
|
800
|
+
] }),
|
|
801
|
+
i.labels.length > 0 && /* @__PURE__ */ e("p", { className: "flex flex-wrap gap-1 pt-0.5", children: i.labels.map((o) => /* @__PURE__ */ e(
|
|
802
|
+
"span",
|
|
803
|
+
{
|
|
804
|
+
className: "rounded border border-slate-200 bg-slate-50 px-1.5 py-px text-[11px] text-slate-700 dark:border-border dark:bg-muted/40 dark:text-slate-200",
|
|
805
|
+
children: o
|
|
806
|
+
},
|
|
807
|
+
o
|
|
808
|
+
)) })
|
|
809
|
+
] }),
|
|
810
|
+
i.sync_error && /* @__PURE__ */ a("div", { role: "alert", className: ke, children: [
|
|
811
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
812
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: "Could not read it from GitLab. " }),
|
|
813
|
+
/* @__PURE__ */ e("span", { className: "break-words", children: i.sync_error })
|
|
814
|
+
] }),
|
|
815
|
+
/* @__PURE__ */ a(
|
|
816
|
+
"button",
|
|
817
|
+
{
|
|
818
|
+
type: "button",
|
|
819
|
+
className: j,
|
|
820
|
+
disabled: g,
|
|
821
|
+
onClick: () => l.mutate(),
|
|
822
|
+
children: [
|
|
823
|
+
/* @__PURE__ */ e(A, { className: Z("h-3 w-3", l.isPending && "animate-spin") }),
|
|
824
|
+
"Retry"
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
)
|
|
828
|
+
] }),
|
|
829
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: [
|
|
830
|
+
!i.sync_error && /* @__PURE__ */ a(
|
|
831
|
+
"button",
|
|
832
|
+
{
|
|
833
|
+
type: "button",
|
|
834
|
+
className: j,
|
|
835
|
+
disabled: g,
|
|
836
|
+
onClick: () => l.mutate(),
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ e(A, { className: Z("h-3 w-3", l.isPending && "animate-spin") }),
|
|
839
|
+
"Resync"
|
|
840
|
+
]
|
|
841
|
+
}
|
|
842
|
+
),
|
|
843
|
+
h && /* @__PURE__ */ e(
|
|
844
|
+
I,
|
|
845
|
+
{
|
|
846
|
+
className: j,
|
|
847
|
+
armedClassName: O,
|
|
848
|
+
disabled: g,
|
|
849
|
+
onConfirm: () => r.mutate(Number(n.id)),
|
|
850
|
+
title: "Move to a new GitLab issue",
|
|
851
|
+
confirmLabel: "Open a new one for it?",
|
|
852
|
+
children: "Move to a new GitLab issue"
|
|
853
|
+
}
|
|
854
|
+
),
|
|
855
|
+
/* @__PURE__ */ e(
|
|
856
|
+
I,
|
|
857
|
+
{
|
|
858
|
+
className: j,
|
|
859
|
+
armedClassName: O,
|
|
860
|
+
disabled: g,
|
|
861
|
+
onConfirm: () => b.mutate(),
|
|
862
|
+
title: "Unlink from GitLab",
|
|
863
|
+
confirmLabel: "Unlink? GitLab keeps its issue",
|
|
864
|
+
children: "Unlink"
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
] }),
|
|
868
|
+
/* @__PURE__ */ e(lt, { ...t, onMove: (o) => r.mutate(o) })
|
|
869
|
+
] });
|
|
870
|
+
}
|
|
871
|
+
function rt(t, n, i) {
|
|
872
|
+
return (i ?? n.sources.map((p) => ({
|
|
873
|
+
kind: p.kind,
|
|
874
|
+
id: p.id,
|
|
875
|
+
title: null,
|
|
876
|
+
status: null,
|
|
877
|
+
joined_via: "",
|
|
878
|
+
joined_at: null
|
|
879
|
+
}))).filter((p) => !(p.kind === t.kind && String(p.id) === String(t.id)));
|
|
880
|
+
}
|
|
881
|
+
function lt({
|
|
882
|
+
source: t,
|
|
883
|
+
link: n,
|
|
884
|
+
members: i,
|
|
885
|
+
membersTotal: d,
|
|
886
|
+
onChanged: p,
|
|
887
|
+
onMove: x
|
|
888
|
+
}) {
|
|
889
|
+
const l = G(), b = Re(), r = rt(t, n, i), g = Math.max(
|
|
890
|
+
r.length,
|
|
891
|
+
d != null ? d - 1 : n.sources.length - 1
|
|
892
|
+
), c = y({
|
|
893
|
+
mutationFn: (s) => l.request(he(Le(s.kind, s.id))),
|
|
894
|
+
onSuccess: () => {
|
|
895
|
+
L.success("Removed from this GitLab issue"), p();
|
|
896
|
+
},
|
|
897
|
+
onError: (s) => C(s, "Could not remove it")
|
|
898
|
+
});
|
|
899
|
+
if (!r.length) return null;
|
|
900
|
+
const h = (s) => {
|
|
901
|
+
const u = `/issues/${encodeURIComponent(s)}`;
|
|
902
|
+
return b.consoleUrl ? b.consoleUrl(u) : u;
|
|
903
|
+
}, o = (s, u) => {
|
|
904
|
+
b.consoleUrl || s.metaKey || s.ctrlKey || s.shiftKey || s.button !== 0 || (s.preventDefault(), b.navigate(`/issues/${encodeURIComponent(u)}`));
|
|
905
|
+
};
|
|
906
|
+
return /* @__PURE__ */ a("div", { className: "space-y-1.5 border-t border-slate-100 pt-3 dark:border-border/60", children: [
|
|
907
|
+
/* @__PURE__ */ a("p", { className: "text-[12px] font-medium text-slate-700 dark:text-foreground", children: [
|
|
908
|
+
"Examples on this GitLab issue",
|
|
909
|
+
/* @__PURE__ */ e("span", { className: "ml-1 font-normal tabular-nums text-muted-foreground", children: g })
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ e(
|
|
912
|
+
"ul",
|
|
913
|
+
{
|
|
914
|
+
"aria-label": "Examples on this GitLab issue",
|
|
915
|
+
className: "divide-y divide-slate-100 rounded-md border border-slate-200 dark:divide-border/60 dark:border-border",
|
|
916
|
+
children: r.map((s) => {
|
|
917
|
+
const u = Qe(s), k = s.kind === "issue" ? h(s.id) : null;
|
|
918
|
+
return /* @__PURE__ */ a(
|
|
919
|
+
"li",
|
|
920
|
+
{
|
|
921
|
+
className: "group flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-1.5 text-[12px]",
|
|
922
|
+
children: [
|
|
923
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
924
|
+
k ? /* @__PURE__ */ a(
|
|
925
|
+
"a",
|
|
926
|
+
{
|
|
927
|
+
href: k,
|
|
928
|
+
onClick: (f) => o(f, s.id),
|
|
929
|
+
className: "block truncate text-slate-800 hover:underline dark:text-foreground",
|
|
930
|
+
children: [
|
|
931
|
+
/* @__PURE__ */ a("span", { className: "mr-1 font-mono text-[11px] text-muted-foreground", children: [
|
|
932
|
+
"#",
|
|
933
|
+
s.id
|
|
934
|
+
] }),
|
|
935
|
+
u
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
) : /* @__PURE__ */ e("span", { className: "block truncate text-slate-800 dark:text-foreground", children: u }),
|
|
939
|
+
(s.joined_via || s.score != null || s.joined_at) && /* @__PURE__ */ a("span", { className: "text-[11px] text-muted-foreground", children: [
|
|
940
|
+
s.joined_via ? He(s.joined_via) : "",
|
|
941
|
+
s.score != null && /* @__PURE__ */ a("span", { className: "tabular-nums", children: [
|
|
942
|
+
s.joined_via ? " · " : "",
|
|
943
|
+
ge(s.score),
|
|
944
|
+
" match"
|
|
945
|
+
] }),
|
|
946
|
+
s.joined_at ? ` · ${fe(s.joined_at)}` : ""
|
|
947
|
+
] })
|
|
948
|
+
] }),
|
|
949
|
+
/* @__PURE__ */ a("span", { className: "flex shrink-0 gap-1", children: [
|
|
950
|
+
s.kind === "issue" && /* @__PURE__ */ e(
|
|
951
|
+
I,
|
|
952
|
+
{
|
|
953
|
+
className: j,
|
|
954
|
+
armedClassName: O,
|
|
955
|
+
disabled: c.isPending,
|
|
956
|
+
onConfirm: () => x(Number(s.id)),
|
|
957
|
+
title: `Move #${s.id} to a new GitLab issue`,
|
|
958
|
+
confirmLabel: "Open a new one?",
|
|
959
|
+
children: "Move to new"
|
|
960
|
+
}
|
|
961
|
+
),
|
|
962
|
+
/* @__PURE__ */ e(
|
|
963
|
+
I,
|
|
964
|
+
{
|
|
965
|
+
className: j,
|
|
966
|
+
armedClassName: O,
|
|
967
|
+
disabled: c.isPending,
|
|
968
|
+
onConfirm: () => c.mutate(s),
|
|
969
|
+
title: `Remove ${u} from this GitLab issue`,
|
|
970
|
+
confirmLabel: "Remove?",
|
|
971
|
+
children: "Remove"
|
|
972
|
+
}
|
|
973
|
+
)
|
|
974
|
+
] })
|
|
975
|
+
]
|
|
976
|
+
},
|
|
977
|
+
`${s.kind}:${s.id}`
|
|
978
|
+
);
|
|
979
|
+
})
|
|
980
|
+
}
|
|
981
|
+
),
|
|
982
|
+
g > r.length && /* @__PURE__ */ a("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
983
|
+
"Showing the newest ",
|
|
984
|
+
r.length,
|
|
985
|
+
" of ",
|
|
986
|
+
g,
|
|
987
|
+
"."
|
|
988
|
+
] })
|
|
989
|
+
] });
|
|
990
|
+
}
|
|
991
|
+
function ot({
|
|
992
|
+
pending: t,
|
|
993
|
+
onChanged: n
|
|
994
|
+
}) {
|
|
995
|
+
const i = G(), d = t.filter((l) => l.status === "dead"), p = t.filter((l) => l.status !== "dead" && l.op !== "create"), x = y({
|
|
996
|
+
mutationFn: (l) => i.request(_(`/trackers/outbox/${l}/retry`)),
|
|
997
|
+
onSuccess: () => {
|
|
998
|
+
L.success("Trying again"), n();
|
|
999
|
+
},
|
|
1000
|
+
onError: (l) => C(l, "Could not try it again")
|
|
1001
|
+
});
|
|
1002
|
+
return !d.length && !p.length ? null : /* @__PURE__ */ a("div", { className: "space-y-1.5 border-t border-slate-100 pt-3 dark:border-border/60", children: [
|
|
1003
|
+
p.length > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px] text-muted-foreground", children: [
|
|
1004
|
+
p.length,
|
|
1005
|
+
" change",
|
|
1006
|
+
p.length === 1 ? "" : "s",
|
|
1007
|
+
" waiting to be sent to GitLab."
|
|
1008
|
+
] }),
|
|
1009
|
+
d.map((l) => /* @__PURE__ */ a("div", { role: "alert", className: ke, children: [
|
|
1010
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
1011
|
+
/* @__PURE__ */ a("span", { className: "font-medium", children: [
|
|
1012
|
+
"Gave up: ",
|
|
1013
|
+
Be[l.op] ?? l.op,
|
|
1014
|
+
" (",
|
|
1015
|
+
l.attempts,
|
|
1016
|
+
" tries).",
|
|
1017
|
+
" "
|
|
1018
|
+
] }),
|
|
1019
|
+
l.last_error && /* @__PURE__ */ e("span", { className: "break-words", children: l.last_error })
|
|
1020
|
+
] }),
|
|
1021
|
+
/* @__PURE__ */ a(
|
|
1022
|
+
"button",
|
|
1023
|
+
{
|
|
1024
|
+
type: "button",
|
|
1025
|
+
className: j,
|
|
1026
|
+
disabled: x.isPending,
|
|
1027
|
+
onClick: () => x.mutate(l.id),
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ e(A, { className: "h-3 w-3" }),
|
|
1030
|
+
"Retry"
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
)
|
|
1034
|
+
] }, l.id))
|
|
1035
|
+
] });
|
|
1036
|
+
}
|
|
1037
|
+
export {
|
|
1038
|
+
Pt as TrackerLinkPanel
|
|
1039
|
+
};
|