@nivaro/react 0.3.15 → 0.3.16
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +127 -6
- package/dist/index.js +736 -734
- package/dist/shared/components/CollectionBrowserView.js +2344 -2309
- package/dist/shared/components/ItemEditForm.js +3773 -3604
- package/dist/shared/components/RecordGridEditor.js +319 -282
- package/dist/shared/components/RecordReadView.js +202 -200
- package/dist/shared/components/cbv/unknown-fields.js +18 -8
- package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
- package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
- package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
- package/dist/shared/components/item-edit/FieldRow.js +198 -184
- package/dist/shared/components/item-edit/HeaderTools.js +107 -99
- package/dist/shared/components/item-edit/InlineTableField.js +138 -136
- package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
- package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
- package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
- package/dist/shared/components/item-edit/column-length.js +12 -0
- package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
- package/dist/shared/components/panels/ItemLockBanner.js +307 -285
- package/dist/shared/components/panels/PipelinePanel.js +486 -465
- package/dist/shared/components/panels/RevisionsPanel.js +210 -204
- package/dist/shared/components/profile/DelegationCard.js +178 -121
- package/dist/shared/components/profile/PersonActivity.js +152 -139
- package/dist/shared/components/queue/QueueWorklist.js +668 -659
- package/dist/shared/components/queue/transition-note.js +90 -0
- package/dist/shared/components/support/SupportRequestDialog.js +100 -89
- package/dist/shared/components/support/TicketDetailSheet.js +104 -91
- package/dist/shared/lib/autofill-runs.js +33 -26
- package/dist/shared/lib/draft-store.js +40 -24
- package/dist/shared/lib/live-queries.js +10 -9
- package/dist/shared/lib/restore-skipped.js +10 -0
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as de } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as Oe, useQuery as te, useMutation as
|
|
3
|
-
import { ArrowRight as
|
|
2
|
+
import { useQueryClient as Oe, useQuery as te, useMutation as xe } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowRight as Fe, Loader2 as se, Check as Ce, GitBranch as Te, AlertTriangle as wt, ChevronDown as me, Users as st, Minus as vt, UserPlus as Nt, X as it, Zap as lt, Search as kt } from "lucide-react";
|
|
4
4
|
import { useState as K, useRef as ne, useEffect as ue, useMemo as et, Suspense as ot, lazy as _t } from "react";
|
|
5
5
|
import { toast as ee } from "sonner";
|
|
6
6
|
import { useNivaroClient as fe, useItemEditAuth as Ct } from "../../context.js";
|
|
7
|
-
import { get as ie, post as
|
|
7
|
+
import { get as ie, post as be, del as St } from "../../lib/commands.js";
|
|
8
8
|
import { useRecordSignalWhile as dt, useRecordSignalPeers as $t, signalSentence as Tt } from "../../lib/presence-signals.js";
|
|
9
9
|
import { RUN_TRANSITION_EVENT as Ne } from "../../lib/run-transition.js";
|
|
10
|
-
import { userErrorMessage as
|
|
10
|
+
import { userErrorMessage as he } from "../../lib/safe-error.js";
|
|
11
11
|
import { serverNow as qt } from "../../lib/server-clock.js";
|
|
12
|
-
import { userCardQuery as
|
|
13
|
-
import { cn as
|
|
12
|
+
import { userCardQuery as Pt } from "../../lib/user-cards.js";
|
|
13
|
+
import { cn as ge, formatRelative as ct, humanHours as At } from "../../lib/utils.js";
|
|
14
14
|
import { PushReadinessChip as Rt } from "../integrations/RecordIntegrationPreview.js";
|
|
15
15
|
import { useHeaderFold as Dt } from "../item-edit/HeaderTools.js";
|
|
16
|
-
import { invalidateRecordInsights as
|
|
17
|
-
import { OwnerAvatars as
|
|
18
|
-
import { UserAvatar as
|
|
16
|
+
import { invalidateRecordInsights as ke, invalidateRecordData as _e } from "../item-edit/RecordInsights.js";
|
|
17
|
+
import { OwnerAvatars as jt } from "../queue/OwnerAvatars.js";
|
|
18
|
+
import { UserAvatar as Mt } from "../UserAvatar.js";
|
|
19
19
|
import { Button as Y } from "../ui/button.js";
|
|
20
|
-
import { DropdownMenu as
|
|
20
|
+
import { DropdownMenu as Pe, DropdownMenuTrigger as Ae, DropdownMenuContent as Re, DropdownMenuGroup as tt, DropdownMenuSeparator as nt, DropdownMenuItem as we, DropdownMenuLabel as Bt } from "../ui/dropdown-menu.js";
|
|
21
21
|
import { Popover as Ee, PopoverTrigger as Ie, PopoverContent as Ue } from "../ui/popover.js";
|
|
22
22
|
import { Skeleton as le } from "../ui/skeleton.js";
|
|
23
|
-
import { TooltipProvider as mt, Tooltip as
|
|
24
|
-
import { isAccessRefusal as ut, deniedToastAction as pt, WhyOwnersButton as
|
|
25
|
-
import { BranchLanes as
|
|
23
|
+
import { TooltipProvider as mt, Tooltip as De, TooltipTrigger as je, TooltipContent as Me } from "../ui/tooltip.js";
|
|
24
|
+
import { isAccessRefusal as ut, deniedToastAction as pt, WhyOwnersButton as Lt } from "./AccessInsights.js";
|
|
25
|
+
import { BranchLanes as Ot } from "./BranchLanes.js";
|
|
26
26
|
import { SlaClockLine as Ft } from "./SlaClock.js";
|
|
27
27
|
const ft = _t(
|
|
28
28
|
() => import("./TransitionRequirementsDialog.js").then((r) => ({
|
|
@@ -47,10 +47,10 @@ function Et(r) {
|
|
|
47
47
|
}
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ve(r) {
|
|
51
51
|
return !(r.first_name || r.last_name || r.user_email);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Be(r) {
|
|
54
54
|
const t = (r.comment ?? "").trim().toLowerCase();
|
|
55
55
|
return r.origin === "import" || t.startsWith("import:") ? "Imported" : r.origin === "integration" ? "By an integration" : /-state-sync$/.test(t) || t.startsWith("legacy-") ? "Synced from another system" : t === "state-merge" || t === "instance-migration" ? "Moved by an admin script" : "Moved automatically";
|
|
56
56
|
}
|
|
@@ -79,13 +79,13 @@ function Ut({ held: r }) {
|
|
|
79
79
|
className: "space-y-2 border-b border-amber-100 bg-amber-50 px-5 py-3 dark:border-amber-500/20 dark:bg-amber-500/10",
|
|
80
80
|
"data-pipeline-auto-held": !0,
|
|
81
81
|
children: r.map((t) => {
|
|
82
|
-
const u = t.transition_label ?? "An automatic move",
|
|
82
|
+
const u = t.transition_label ?? "An automatic move", l = rt[t.error_class ?? "unknown"] ?? rt.unknown;
|
|
83
83
|
return /* @__PURE__ */ n("div", { className: "text-[12px] text-amber-800 dark:text-amber-300", children: [
|
|
84
84
|
/* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
85
85
|
"Needs a person: ",
|
|
86
86
|
u,
|
|
87
87
|
" stopped retrying — ",
|
|
88
|
-
|
|
88
|
+
l,
|
|
89
89
|
"."
|
|
90
90
|
] }),
|
|
91
91
|
t.error && /* @__PURE__ */ e(
|
|
@@ -135,55 +135,55 @@ function oe({
|
|
|
135
135
|
r
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function qe(r) {
|
|
139
139
|
const t = Math.floor(r / 6e4);
|
|
140
|
-
return t < 60 ? `${Math.max(1, t)}m` :
|
|
140
|
+
return t < 60 ? `${Math.max(1, t)}m` : At(r / 36e5);
|
|
141
141
|
}
|
|
142
142
|
function Qt({
|
|
143
143
|
history: r,
|
|
144
144
|
completedAt: t
|
|
145
145
|
}) {
|
|
146
146
|
const u = [...r].sort(
|
|
147
|
-
(f,
|
|
147
|
+
(f, N) => new Date(f.timestamp).getTime() - new Date(N.timestamp).getTime()
|
|
148
148
|
);
|
|
149
149
|
if (u.length === 0) return null;
|
|
150
|
-
const
|
|
151
|
-
const
|
|
150
|
+
const l = t ? new Date(t).getTime() : Date.now(), q = u.map((f, N) => {
|
|
151
|
+
const P = new Date(f.timestamp).getTime(), j = N + 1 < u.length ? new Date(u[N + 1].timestamp).getTime() : l;
|
|
152
152
|
return {
|
|
153
153
|
key: f.id,
|
|
154
154
|
label: f.to_state_label,
|
|
155
155
|
color: f.to_state_color,
|
|
156
|
-
ms: Math.max(0,
|
|
157
|
-
current:
|
|
156
|
+
ms: Math.max(0, j - P),
|
|
157
|
+
current: N === u.length - 1 && !t
|
|
158
158
|
};
|
|
159
159
|
}).filter((f) => f.ms > 0 || f.current);
|
|
160
|
-
if (
|
|
161
|
-
const p =
|
|
160
|
+
if (q.length < 2) return null;
|
|
161
|
+
const p = q.reduce((f, N) => f + N.ms, 0);
|
|
162
162
|
return p <= 0 ? null : /* @__PURE__ */ n("div", { "data-state-timeline": !0, children: [
|
|
163
163
|
/* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between", children: [
|
|
164
164
|
/* @__PURE__ */ e("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:text-slate-500", children: "Time in step" }),
|
|
165
165
|
/* @__PURE__ */ n("p", { className: "text-[10px] tabular-nums text-slate-400 dark:text-slate-500", children: [
|
|
166
|
-
|
|
166
|
+
qe(p),
|
|
167
167
|
" total",
|
|
168
168
|
t ? "" : " · so far"
|
|
169
169
|
] })
|
|
170
170
|
] }),
|
|
171
|
-
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children:
|
|
172
|
-
const
|
|
171
|
+
/* @__PURE__ */ e("div", { className: "flex h-4 w-full overflow-hidden rounded", children: q.map((f) => {
|
|
172
|
+
const N = f.ms / p * 100;
|
|
173
173
|
return /* @__PURE__ */ n(
|
|
174
174
|
"div",
|
|
175
175
|
{
|
|
176
|
-
"data-tip": `${f.label} — ${
|
|
176
|
+
"data-tip": `${f.label} — ${qe(f.ms)}${f.current ? " (current)" : ""}`,
|
|
177
177
|
className: "relative flex min-w-[8px] items-center overflow-hidden border-r border-white/60 last:border-r-0 dark:border-black/30",
|
|
178
178
|
style: {
|
|
179
|
-
width: `${
|
|
179
|
+
width: `${N}%`,
|
|
180
180
|
backgroundColor: f.color ? `${f.color}55` : "rgba(100,116,139,.25)"
|
|
181
181
|
},
|
|
182
182
|
children: [
|
|
183
|
-
|
|
183
|
+
N >= 14 && /* @__PURE__ */ n("span", { className: "truncate px-1.5 text-[9.5px] font-medium leading-none text-slate-700 dark:text-slate-200", children: [
|
|
184
184
|
f.label,
|
|
185
185
|
" · ",
|
|
186
|
-
|
|
186
|
+
qe(f.ms)
|
|
187
187
|
] }),
|
|
188
188
|
f.current && /* @__PURE__ */ e(
|
|
189
189
|
"span",
|
|
@@ -203,47 +203,47 @@ function zt({
|
|
|
203
203
|
states: r,
|
|
204
204
|
allTransitions: t,
|
|
205
205
|
availableTransitions: u,
|
|
206
|
-
currentStateId:
|
|
207
|
-
history:
|
|
206
|
+
currentStateId: l,
|
|
207
|
+
history: q,
|
|
208
208
|
onPathIds: p,
|
|
209
209
|
skippedStates: f
|
|
210
210
|
}) {
|
|
211
211
|
var S;
|
|
212
|
-
const
|
|
212
|
+
const N = ne(null);
|
|
213
213
|
ue(() => {
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
216
|
-
const w =
|
|
214
|
+
const i = N.current;
|
|
215
|
+
if (!i || i.scrollWidth <= i.clientWidth) return;
|
|
216
|
+
const w = i.querySelector("[data-track-current]");
|
|
217
217
|
if (!w) return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
}, [
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
const x = (S =
|
|
224
|
-
x && x !==
|
|
218
|
+
const s = i.getBoundingClientRect(), v = w.getBoundingClientRect();
|
|
219
|
+
i.scrollLeft += v.left + v.width / 2 - (s.left + s.width / 2);
|
|
220
|
+
}, [l]);
|
|
221
|
+
const P = new Set(q.map((i) => i.to_state)), j = r.find((i) => i.is_initial);
|
|
222
|
+
j && j.id !== l && P.add(j.id);
|
|
223
|
+
const x = (S = q[0]) == null ? void 0 : S.from_state;
|
|
224
|
+
x && x !== l && P.add(x);
|
|
225
225
|
const R = (() => {
|
|
226
226
|
if (p)
|
|
227
|
-
return r.filter((c) => p.has(c.id) ||
|
|
227
|
+
return r.filter((c) => p.has(c.id) || P.has(c.id) || c.id === l).filter((c) => {
|
|
228
228
|
const y = c.stage_visibility ?? "always";
|
|
229
|
-
return y === "hide" ? !1 : y === "hide_unless_active" ?
|
|
229
|
+
return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === l : !0;
|
|
230
230
|
}).sort((c, y) => c.sort - y.sort);
|
|
231
231
|
if (t.length === 0) {
|
|
232
|
-
const c = /* @__PURE__ */ new Set([...
|
|
233
|
-
return
|
|
232
|
+
const c = /* @__PURE__ */ new Set([...P]);
|
|
233
|
+
return l && c.add(l), r.filter((y) => c.has(y.id)).sort((y, d) => y.sort - d.sort);
|
|
234
234
|
}
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
), w = new Set(
|
|
238
|
-
for (const c of
|
|
235
|
+
const i = new Set(
|
|
236
|
+
q.filter((c) => c.from_state).map((c) => `${c.from_state}:${c.to_state}`)
|
|
237
|
+
), w = new Set(q.map((c) => c.from_state).filter(Boolean)), s = t.filter((c) => c.from_state !== null), v = /* @__PURE__ */ new Map();
|
|
238
|
+
for (const c of s) {
|
|
239
239
|
const y = c.from_state;
|
|
240
|
-
if (w.has(y) && !
|
|
241
|
-
const d =
|
|
242
|
-
d.push(c.to_state),
|
|
240
|
+
if (w.has(y) && !i.has(`${y}:${c.to_state}`)) continue;
|
|
241
|
+
const d = v.get(y) ?? [];
|
|
242
|
+
d.push(c.to_state), v.set(y, d);
|
|
243
243
|
}
|
|
244
|
-
if (
|
|
245
|
-
const c =
|
|
246
|
-
|
|
244
|
+
if (l) {
|
|
245
|
+
const c = s.filter((y) => y.from_state === l).map((y) => y.to_state);
|
|
246
|
+
v.set(l, [
|
|
247
247
|
.../* @__PURE__ */ new Set([...u.map((y) => y.to_state), ...c])
|
|
248
248
|
]);
|
|
249
249
|
}
|
|
@@ -252,69 +252,69 @@ function zt({
|
|
|
252
252
|
const c = A.shift();
|
|
253
253
|
if (!k.has(c)) {
|
|
254
254
|
k.add(c);
|
|
255
|
-
for (const y of
|
|
255
|
+
for (const y of v.get(c) ?? []) k.has(y) || A.push(y);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
-
const W = /* @__PURE__ */ new Set([...k, ...
|
|
259
|
-
return
|
|
258
|
+
const W = /* @__PURE__ */ new Set([...k, ...P]);
|
|
259
|
+
return l && W.add(l), r.filter((c) => W.has(c.id)).filter((c) => {
|
|
260
260
|
const y = c.stage_visibility ?? "always";
|
|
261
|
-
return y === "hide" ? !1 : y === "hide_unless_active" ?
|
|
261
|
+
return y === "hide" ? !1 : y === "hide_unless_active" ? P.has(c.id) || c.id === l : !0;
|
|
262
262
|
}).sort((c, y) => c.sort - y.sort);
|
|
263
263
|
})();
|
|
264
264
|
if (R.length < 2) return null;
|
|
265
|
-
const
|
|
266
|
-
function L(
|
|
267
|
-
const
|
|
268
|
-
return
|
|
269
|
-
if (!
|
|
270
|
-
const k =
|
|
271
|
-
return k == null || A == null ? !1 : k ===
|
|
272
|
-
}).sort((
|
|
265
|
+
const C = new Map(R.map((i, w) => [i.id, w])), I = new Map(r.map((i) => [i.id, i.label]));
|
|
266
|
+
function L(i, w) {
|
|
267
|
+
const s = C.get(i);
|
|
268
|
+
return s == null ? [] : [...q].filter((v) => {
|
|
269
|
+
if (!v.from_state) return !1;
|
|
270
|
+
const k = C.get(v.from_state), A = C.get(v.to_state);
|
|
271
|
+
return k == null || A == null ? !1 : k === s && A > s || A === s && k > s;
|
|
272
|
+
}).sort((v, k) => new Date(v.timestamp).getTime() - new Date(k.timestamp).getTime());
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
var w,
|
|
276
|
-
return
|
|
274
|
+
function B(i) {
|
|
275
|
+
var w, s, v, k;
|
|
276
|
+
return ve(i) ? /* @__PURE__ */ e(lt, { className: "inline h-2.5 w-2.5", "aria-label": Be(i) }) : ((((w = i.first_name) == null ? void 0 : w[0]) ?? "") + (((s = i.last_name) == null ? void 0 : s[0]) ?? "")).toUpperCase() || ((k = (v = i.user_email) == null ? void 0 : v[0]) == null ? void 0 : k.toUpperCase()) || "?";
|
|
277
277
|
}
|
|
278
|
-
function M(
|
|
279
|
-
return ht([
|
|
278
|
+
function M(i) {
|
|
279
|
+
return ht([i.first_name, i.last_name].filter(Boolean).join(" ") || i.user_email, i);
|
|
280
280
|
}
|
|
281
281
|
const U = /* @__PURE__ */ new Map();
|
|
282
|
-
for (const
|
|
283
|
-
(w,
|
|
282
|
+
for (const i of [...q].sort(
|
|
283
|
+
(w, s) => new Date(w.timestamp).getTime() - new Date(s.timestamp).getTime()
|
|
284
284
|
)) {
|
|
285
|
-
if (!
|
|
286
|
-
const w =
|
|
287
|
-
if (!(w == null ||
|
|
288
|
-
for (let
|
|
289
|
-
const k = R[
|
|
290
|
-
!
|
|
285
|
+
if (!i.from_state) continue;
|
|
286
|
+
const w = C.get(i.from_state), s = C.get(i.to_state);
|
|
287
|
+
if (!(w == null || s == null || s <= w + 1))
|
|
288
|
+
for (let v = w + 1; v < s; v++) {
|
|
289
|
+
const k = R[v].id;
|
|
290
|
+
!P.has(k) && !U.has(k) && U.set(k, i);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
function b(
|
|
294
|
-
const w = I.get(
|
|
295
|
-
return `Passed over on ${new Date(
|
|
293
|
+
function b(i) {
|
|
294
|
+
const w = I.get(i.from_state ?? "") ?? "the previous step", s = I.get(i.to_state) ?? "the next step", v = ve(i) ? "it moved automatically" : `${M(i)} moved it`;
|
|
295
|
+
return `Passed over on ${new Date(i.timestamp).toLocaleString()} — ${v} straight from ${w} to ${s}`;
|
|
296
296
|
}
|
|
297
|
-
return /* @__PURE__ */ e(mt, { delayDuration: 200, children: /* @__PURE__ */ e("div", { ref:
|
|
298
|
-
const
|
|
297
|
+
return /* @__PURE__ */ e(mt, { delayDuration: 200, children: /* @__PURE__ */ e("div", { ref: N, className: "overflow-x-auto pt-1.5 pb-1", "data-state-track": !0, children: /* @__PURE__ */ e("div", { className: "flex w-full items-start", children: R.map((i, w) => {
|
|
298
|
+
const s = i.id === l, v = P.has(i.id), k = v && !s, A = !v && !s ? U.get(i.id) : void 0, W = !v && !s ? f == null ? void 0 : f.get(i.id) : void 0, c = A || W ? [...A ? [b(A)] : [], ...W ?? []] : void 0, y = c !== void 0, d = i.color ?? "#94a3b8", m = w === R.length - 1, g = m ? null : R[w + 1], _ = g ? L(i.id, g.id) : [];
|
|
299
299
|
return /* @__PURE__ */ n("div", { className: "flex flex-1 items-start", children: [
|
|
300
300
|
/* @__PURE__ */ n("div", { className: "flex min-w-[76px] flex-1 flex-col items-center gap-1.5 px-1", children: [
|
|
301
301
|
/* @__PURE__ */ e(
|
|
302
302
|
"div",
|
|
303
303
|
{
|
|
304
|
-
"data-track-current":
|
|
305
|
-
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${
|
|
306
|
-
"data-tip":
|
|
304
|
+
"data-track-current": s || void 0,
|
|
305
|
+
className: `flex h-7 w-7 shrink-0 items-center justify-center rounded-full ${s || k ? "nvr-fill-sweep" : ""}`,
|
|
306
|
+
"data-tip": i.description || void 0,
|
|
307
307
|
style: {
|
|
308
|
-
backgroundColor:
|
|
309
|
-
border:
|
|
310
|
-
boxShadow:
|
|
308
|
+
backgroundColor: s || k ? d : y ? "transparent" : "#f1f5f9",
|
|
309
|
+
border: s || k ? "none" : y ? "1.5px dashed #cbd5e1" : "1.5px solid #e2e8f0",
|
|
310
|
+
boxShadow: s ? `0 0 0 3px white, 0 0 0 5px ${d}` : void 0
|
|
311
311
|
},
|
|
312
|
-
children: k ? /* @__PURE__ */ e(
|
|
312
|
+
children: k ? /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5 text-white", strokeWidth: 2.5 }) : s ? /* @__PURE__ */ e("div", { className: "h-2.5 w-2.5 rounded-full bg-white/80" }) : y ? /* @__PURE__ */ e(vt, { className: "h-3 w-3 text-slate-400", strokeWidth: 2.5 }) : /* @__PURE__ */ e("div", { className: "h-2 w-2 rounded-full bg-slate-300" })
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
s ? "cur" : k ? "done" : y ? "skip" : "todo"
|
|
315
315
|
),
|
|
316
|
-
y ? /* @__PURE__ */ n(
|
|
317
|
-
/* @__PURE__ */ e(
|
|
316
|
+
y ? /* @__PURE__ */ n(De, { children: [
|
|
317
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
|
|
318
318
|
"span",
|
|
319
319
|
{
|
|
320
320
|
className: "w-full cursor-help break-words text-center leading-snug",
|
|
@@ -326,7 +326,7 @@ function zt({
|
|
|
326
326
|
textDecoration: "line-through",
|
|
327
327
|
textDecorationColor: "#cbd5e1"
|
|
328
328
|
},
|
|
329
|
-
children:
|
|
329
|
+
children: i.label
|
|
330
330
|
}
|
|
331
331
|
) }),
|
|
332
332
|
/* @__PURE__ */ n(Me, { className: "max-w-[260px]", children: [
|
|
@@ -339,11 +339,11 @@ function zt({
|
|
|
339
339
|
className: "w-full break-words text-center leading-snug",
|
|
340
340
|
style: {
|
|
341
341
|
fontSize: "11px",
|
|
342
|
-
color:
|
|
343
|
-
fontWeight:
|
|
342
|
+
color: s ? d : k ? "#475569" : "#94a3b8",
|
|
343
|
+
fontWeight: s ? 600 : k ? 500 : 400,
|
|
344
344
|
wordBreak: "break-word"
|
|
345
345
|
},
|
|
346
|
-
children:
|
|
346
|
+
children: i.label
|
|
347
347
|
}
|
|
348
348
|
)
|
|
349
349
|
] }),
|
|
@@ -372,34 +372,34 @@ function zt({
|
|
|
372
372
|
)
|
|
373
373
|
] });
|
|
374
374
|
})(),
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
(
|
|
375
|
+
_.map((h) => {
|
|
376
|
+
const $ = h.from_state !== i.id, Q = Math.abs(
|
|
377
|
+
(C.get(h.to_state) ?? 0) - (C.get(h.from_state ?? "") ?? 0)
|
|
378
378
|
) > 1 ? I.get(h.to_state) ?? "" : null;
|
|
379
|
-
return /* @__PURE__ */ n(
|
|
380
|
-
/* @__PURE__ */ e(
|
|
379
|
+
return /* @__PURE__ */ n(De, { children: [
|
|
380
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex w-full cursor-default flex-col items-center gap-0.5", children: [
|
|
381
381
|
/* @__PURE__ */ n(
|
|
382
382
|
"span",
|
|
383
383
|
{
|
|
384
384
|
className: "text-center font-mono text-[9px] font-semibold leading-none",
|
|
385
|
-
style: { color:
|
|
385
|
+
style: { color: $ ? "#d97706" : "#475569" },
|
|
386
386
|
children: [
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
$ && "↩ ",
|
|
388
|
+
B(h)
|
|
389
389
|
]
|
|
390
390
|
}
|
|
391
391
|
),
|
|
392
392
|
/* @__PURE__ */ e("span", { className: "text-[8.5px] leading-none text-slate-400", children: ct(h.timestamp) })
|
|
393
393
|
] }) }),
|
|
394
394
|
/* @__PURE__ */ n(Me, { side: "top", className: "space-y-0.5 text-[12px]", children: [
|
|
395
|
-
|
|
395
|
+
ve(h) ? /* @__PURE__ */ n(de, { children: [
|
|
396
396
|
/* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
$ ? "↩ Sent back · " : "",
|
|
398
|
+
Be(h)
|
|
399
399
|
] }),
|
|
400
400
|
Le(h) && /* @__PURE__ */ e("p", { className: "max-w-[280px] text-muted-foreground", children: Le(h) })
|
|
401
401
|
] }) : /* @__PURE__ */ n("p", { className: "font-medium", children: [
|
|
402
|
-
|
|
402
|
+
$ ? "↩ Sent back by" : "Approved by",
|
|
403
403
|
" ",
|
|
404
404
|
M(h)
|
|
405
405
|
] }),
|
|
@@ -412,18 +412,18 @@ function zt({
|
|
|
412
412
|
] }, h.id);
|
|
413
413
|
})
|
|
414
414
|
] })
|
|
415
|
-
] },
|
|
415
|
+
] }, i.id);
|
|
416
416
|
}) }) }) });
|
|
417
417
|
}
|
|
418
418
|
function Kt({ history: r }) {
|
|
419
419
|
return r.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400 italic", children: "No transitions yet." }) : /* @__PURE__ */ e("div", { className: "space-y-3", children: r.map((t) => {
|
|
420
|
-
const u =
|
|
420
|
+
const u = ve(t), l = u ? Be(t) : ht([t.first_name, t.last_name].filter(Boolean).join(" ") || t.user_email, t), q = Et(t), p = t.comment && !u && !q ? t.comment : null, f = q ?? (u ? Le(t) : null);
|
|
421
421
|
return /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 text-[12px]", children: [
|
|
422
422
|
/* @__PURE__ */ e("div", { className: "mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full bg-slate-200" }),
|
|
423
423
|
/* @__PURE__ */ n("div", { className: "flex-1 min-w-0", children: [
|
|
424
424
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
425
425
|
t.from_state_label ? /* @__PURE__ */ e(oe, { label: t.from_state_label, color: t.from_state_color, small: !0 }) : /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400 italic", children: "started" }),
|
|
426
|
-
/* @__PURE__ */ e(
|
|
426
|
+
/* @__PURE__ */ e(Fe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
427
427
|
/* @__PURE__ */ e(oe, { label: t.to_state_label, color: t.to_state_color, small: !0 })
|
|
428
428
|
] }),
|
|
429
429
|
p && /* @__PURE__ */ n("p", { className: "mt-1 text-slate-500 italic", children: [
|
|
@@ -438,7 +438,7 @@ function Kt({ history: r }) {
|
|
|
438
438
|
"data-history-on-behalf": t.on_behalf_of_name ? t.on_behalf_of ?? "" : void 0,
|
|
439
439
|
children: [
|
|
440
440
|
u && /* @__PURE__ */ e(lt, { className: "mr-1 inline h-3 w-3", "aria-hidden": !0 }),
|
|
441
|
-
|
|
441
|
+
l,
|
|
442
442
|
f ? ` · ${f}` : "",
|
|
443
443
|
" · ",
|
|
444
444
|
ct(t.timestamp)
|
|
@@ -450,32 +450,32 @@ function Kt({ history: r }) {
|
|
|
450
450
|
}) });
|
|
451
451
|
}
|
|
452
452
|
function Wt({ value: r, onChange: t }) {
|
|
453
|
-
const u = fe(), [
|
|
453
|
+
const u = fe(), [l, q] = K(!1), [p, f] = K(""), [N, P] = K(""), j = ne(null), x = ne(null);
|
|
454
454
|
ue(() => {
|
|
455
|
-
|
|
455
|
+
l ? setTimeout(() => {
|
|
456
456
|
var b;
|
|
457
|
-
return (b =
|
|
457
|
+
return (b = j.current) == null ? void 0 : b.focus();
|
|
458
458
|
}, 50) : f("");
|
|
459
|
-
}, [
|
|
459
|
+
}, [l]), ue(() => (x.current && clearTimeout(x.current), x.current = setTimeout(() => P(p), 250), () => {
|
|
460
460
|
x.current && clearTimeout(x.current);
|
|
461
461
|
}), [p]);
|
|
462
|
-
const { data: R, isLoading:
|
|
463
|
-
queryKey: ["users", "async-search",
|
|
462
|
+
const { data: R, isLoading: C } = te({
|
|
463
|
+
queryKey: ["users", "async-search", N],
|
|
464
464
|
queryFn: () => u.request(
|
|
465
465
|
ie("/users", {
|
|
466
466
|
limit: 50,
|
|
467
467
|
sort: "first_name",
|
|
468
|
-
...
|
|
468
|
+
...N ? { search: N } : {}
|
|
469
469
|
})
|
|
470
470
|
).then((b) => b.data),
|
|
471
|
-
enabled:
|
|
471
|
+
enabled: l,
|
|
472
472
|
staleTime: 3e4
|
|
473
473
|
}), { data: I } = te({
|
|
474
|
-
...
|
|
474
|
+
...Pt(u, r),
|
|
475
475
|
enabled: !!r,
|
|
476
476
|
staleTime: 5 * 6e4
|
|
477
|
-
}), L = R ?? [],
|
|
478
|
-
return /* @__PURE__ */ n(Ee, { open:
|
|
477
|
+
}), L = R ?? [], B = I ?? L.find((b) => b.id === r) ?? null, M = B ? [B.first_name, B.last_name].filter(Boolean).join(" ").trim() || B.email : r ? "Selected person" : null, U = (b) => [b.first_name, b.last_name].filter(Boolean).join(" ").trim();
|
|
478
|
+
return /* @__PURE__ */ n(Ee, { open: l, onOpenChange: q, children: [
|
|
479
479
|
/* @__PURE__ */ n("div", { className: "relative flex h-8 w-full", children: [
|
|
480
480
|
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
481
481
|
"button",
|
|
@@ -506,7 +506,7 @@ function Wt({ value: r, onChange: t }) {
|
|
|
506
506
|
/* @__PURE__ */ e(
|
|
507
507
|
"input",
|
|
508
508
|
{
|
|
509
|
-
ref:
|
|
509
|
+
ref: j,
|
|
510
510
|
value: p,
|
|
511
511
|
onChange: (b) => f(b.target.value),
|
|
512
512
|
placeholder: "Search users…",
|
|
@@ -514,27 +514,27 @@ function Wt({ value: r, onChange: t }) {
|
|
|
514
514
|
}
|
|
515
515
|
)
|
|
516
516
|
] }) }),
|
|
517
|
-
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children:
|
|
517
|
+
/* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto py-1", children: C ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 px-3 py-2 text-[12px] text-slate-400", children: [
|
|
518
518
|
/* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
519
519
|
"Loading…"
|
|
520
520
|
] }) : L.length === 0 ? /* @__PURE__ */ e("div", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No results" }) : L.map((b) => {
|
|
521
|
-
const S = U(b),
|
|
521
|
+
const S = U(b), i = S ? `${S} (${b.email})` : b.email, w = b.id === r;
|
|
522
522
|
return /* @__PURE__ */ n(
|
|
523
523
|
"button",
|
|
524
524
|
{
|
|
525
525
|
type: "button",
|
|
526
526
|
onClick: () => {
|
|
527
|
-
t(b.id),
|
|
527
|
+
t(b.id), q(!1);
|
|
528
528
|
},
|
|
529
529
|
className: `flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px] hover:bg-slate-50 ${w ? "font-medium text-slate-800" : "text-slate-600"}`,
|
|
530
530
|
children: [
|
|
531
531
|
/* @__PURE__ */ e(
|
|
532
|
-
|
|
532
|
+
Ce,
|
|
533
533
|
{
|
|
534
534
|
className: `h-3.5 w-3.5 shrink-0 ${w ? "text-nvr-cyan" : "opacity-0"}`
|
|
535
535
|
}
|
|
536
536
|
),
|
|
537
|
-
|
|
537
|
+
i
|
|
538
538
|
]
|
|
539
539
|
},
|
|
540
540
|
b.id
|
|
@@ -547,188 +547,209 @@ function Ht({
|
|
|
547
547
|
collection: r,
|
|
548
548
|
item: t,
|
|
549
549
|
states: u,
|
|
550
|
-
currentStateId:
|
|
551
|
-
returned:
|
|
550
|
+
currentStateId: l,
|
|
551
|
+
returned: q = !1
|
|
552
552
|
}) {
|
|
553
553
|
var O, re, F;
|
|
554
|
-
const p = fe(), f = Oe(), { isAdmin:
|
|
554
|
+
const p = fe(), f = Oe(), { isAdmin: N } = Ct(), [P, j] = K(!1), [x, R] = K(""), [C, I] = K(""), [L, B] = K(!1), M = ["pipeline-instance-owners", r, t], U = ["pipeline-owners-can-add", r, t], b = () => p.request(
|
|
555
555
|
ie(`/pipelines/instance/${r}/${t}/owners`)
|
|
556
|
-
).then((
|
|
557
|
-
var
|
|
558
|
-
return f.setQueryData(U, ((
|
|
559
|
-
}), { data: S, isLoading:
|
|
556
|
+
).then((a) => {
|
|
557
|
+
var D;
|
|
558
|
+
return f.setQueryData(U, ((D = a.meta) == null ? void 0 : D.can_add) ?? null), a;
|
|
559
|
+
}), { data: S, isLoading: i } = te({
|
|
560
560
|
queryKey: M,
|
|
561
|
-
queryFn: () => b().then((
|
|
561
|
+
queryFn: () => b().then((a) => a.data)
|
|
562
562
|
}), { data: w } = te({
|
|
563
563
|
queryKey: U,
|
|
564
|
-
queryFn: () => b().then((
|
|
565
|
-
var
|
|
566
|
-
return ((
|
|
564
|
+
queryFn: () => b().then((a) => {
|
|
565
|
+
var D;
|
|
566
|
+
return ((D = a.meta) == null ? void 0 : D.can_add) ?? null;
|
|
567
567
|
}),
|
|
568
|
-
enabled: !
|
|
568
|
+
enabled: !i,
|
|
569
569
|
staleTime: 3e4
|
|
570
|
-
}),
|
|
570
|
+
}), s = typeof w == "boolean" ? w : N, { data: v, isLoading: k } = te({
|
|
571
571
|
queryKey: ["pipeline-all-owners", r, t],
|
|
572
572
|
queryFn: () => p.request(
|
|
573
573
|
ie(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
574
|
-
).then((
|
|
575
|
-
enabled: !!
|
|
574
|
+
).then((a) => a.data ?? null),
|
|
575
|
+
enabled: !!l,
|
|
576
576
|
staleTime: 3e4
|
|
577
|
-
}), A = new Set((S ?? []).map((
|
|
577
|
+
}), A = new Set((S ?? []).map((a) => a.user)), W = l ? (((O = v == null ? void 0 : v[l]) == null ? void 0 : O.owners) ?? []).filter((a) => !A.has(a.id)) : [], c = W.length + ((S == null ? void 0 : S.length) ?? 0), y = !!((re = u.find((a) => a.id === l)) != null && re.is_initial), d = !i && !k, { data: m } = te({
|
|
578
578
|
queryKey: ["pipeline-record-creator", r, t],
|
|
579
579
|
queryFn: () => p.request(
|
|
580
580
|
ie(`/pipelines/instance/${r}/${t}/creator`)
|
|
581
|
-
).then((
|
|
581
|
+
).then((a) => a.data ?? null),
|
|
582
582
|
enabled: y && d && c === 0,
|
|
583
583
|
staleTime: 6e4
|
|
584
|
-
}), g = y && c === 0 && (m != null && m.name) ? m : null,
|
|
584
|
+
}), g = y && c === 0 && (m != null && m.name) ? m : null, _ = () => {
|
|
585
585
|
f.invalidateQueries({ queryKey: M }), f.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
|
|
586
|
-
}, h =
|
|
586
|
+
}, h = xe({
|
|
587
587
|
mutationFn: () => p.request(
|
|
588
|
-
|
|
588
|
+
be(`/pipelines/instance/${r}/${t}/owners`, {
|
|
589
589
|
user: x,
|
|
590
|
-
state:
|
|
590
|
+
state: C || void 0
|
|
591
591
|
})
|
|
592
592
|
),
|
|
593
593
|
onSuccess: () => {
|
|
594
|
-
|
|
594
|
+
_(), R(""), I(""), j(!1), ee.success("Owner added");
|
|
595
595
|
},
|
|
596
596
|
// The server's reason (a 403 says why), not a bare status phrase.
|
|
597
|
-
onError: (
|
|
598
|
-
}),
|
|
599
|
-
mutationFn: (
|
|
600
|
-
onSuccess: () => {
|
|
601
|
-
|
|
597
|
+
onError: (a) => ee.error(he(a, "Failed to add owner"))
|
|
598
|
+
}), $ = xe({
|
|
599
|
+
mutationFn: (a) => p.request(St(`/pipelines/instance-owners/${a.id}`)),
|
|
600
|
+
onSuccess: (a, D) => {
|
|
601
|
+
_();
|
|
602
|
+
const H = [D.first_name, D.last_name].filter(Boolean).join(" ") || D.email;
|
|
603
|
+
ee.success(`${H} removed as an owner`, {
|
|
604
|
+
action: {
|
|
605
|
+
label: "Undo",
|
|
606
|
+
onClick: () => void p.request(
|
|
607
|
+
be(`/pipelines/instance/${r}/${t}/owners`, {
|
|
608
|
+
user: D.user,
|
|
609
|
+
state: D.state || void 0
|
|
610
|
+
})
|
|
611
|
+
).then(() => _()).catch((V) => ee.error(he(V, "Could not add the owner back")))
|
|
612
|
+
}
|
|
613
|
+
});
|
|
602
614
|
},
|
|
603
|
-
onError: () => ee.error("Failed to remove owner")
|
|
604
|
-
}), Q = (
|
|
605
|
-
var
|
|
606
|
-
const
|
|
607
|
-
return (`${
|
|
608
|
-
},
|
|
609
|
-
var
|
|
610
|
-
return
|
|
615
|
+
onError: (a) => ee.error(he(a, "Failed to remove owner"))
|
|
616
|
+
}), Q = (a) => {
|
|
617
|
+
var V, Z;
|
|
618
|
+
const D = ((V = a.first_name) == null ? void 0 : V[0]) ?? "", H = ((Z = a.last_name) == null ? void 0 : Z[0]) ?? "";
|
|
619
|
+
return (`${D}${H}`.trim() || a.email[0] || "?").toUpperCase();
|
|
620
|
+
}, J = (a) => {
|
|
621
|
+
var D;
|
|
622
|
+
return a ? ((D = u.find((H) => H.id === a || H.key === a)) == null ? void 0 : D.label) ?? a : null;
|
|
611
623
|
};
|
|
612
624
|
return /* @__PURE__ */ n("div", { children: [
|
|
613
625
|
/* @__PURE__ */ n("div", { className: "mb-3 flex items-center justify-between", children: [
|
|
614
626
|
/* @__PURE__ */ n("span", { className: "flex items-center gap-1.5 text-[11px] font-medium text-slate-400", children: [
|
|
615
627
|
/* @__PURE__ */ e(st, { className: "h-3.5 w-3.5" }),
|
|
616
628
|
"Owners",
|
|
617
|
-
|
|
629
|
+
i || k ? /* @__PURE__ */ e("span", { className: "inline-block h-3 w-4 animate-pulse rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : g ? null : /* @__PURE__ */ n("span", { className: "text-slate-300", children: [
|
|
618
630
|
"(",
|
|
619
631
|
c,
|
|
620
632
|
")"
|
|
621
633
|
] })
|
|
622
634
|
] }),
|
|
623
635
|
/* @__PURE__ */ n("span", { className: "flex items-center gap-3", children: [
|
|
624
|
-
|
|
625
|
-
!
|
|
636
|
+
l && /* @__PURE__ */ e(Lt, { collection: r, itemId: String(t) }),
|
|
637
|
+
!P && s && /* @__PURE__ */ n(
|
|
626
638
|
"button",
|
|
627
639
|
{
|
|
628
640
|
type: "button",
|
|
629
|
-
onClick: () =>
|
|
641
|
+
onClick: () => j(!0),
|
|
630
642
|
className: "flex items-center gap-1 text-[11px] text-slate-400 transition-colors hover:text-nvr-cyan",
|
|
631
643
|
children: [
|
|
632
|
-
/* @__PURE__ */ e(
|
|
644
|
+
/* @__PURE__ */ e(Nt, { className: "h-3 w-3" }),
|
|
633
645
|
"Add"
|
|
634
646
|
]
|
|
635
647
|
}
|
|
636
648
|
)
|
|
637
649
|
] })
|
|
638
650
|
] }),
|
|
639
|
-
|
|
651
|
+
i || k ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-1.5 text-[12px] text-slate-400", children: [
|
|
640
652
|
/* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
641
653
|
"Resolving owners…"
|
|
642
654
|
] }) : g ? /* @__PURE__ */ n("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
643
|
-
|
|
655
|
+
q ? "Back with" : "With",
|
|
644
656
|
" ",
|
|
645
657
|
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: g.name })
|
|
646
658
|
] }) : c === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No owners assigned." }) : /* @__PURE__ */ n("div", { className: "space-y-px", children: [
|
|
647
|
-
W.map((
|
|
648
|
-
var
|
|
649
|
-
const
|
|
659
|
+
W.map((a) => {
|
|
660
|
+
var V, Z;
|
|
661
|
+
const D = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email, H = (`${((V = a.first_name) == null ? void 0 : V[0]) ?? ""}${((Z = a.last_name) == null ? void 0 : Z[0]) ?? ""}`.trim() || a.email[0] || "?").toUpperCase();
|
|
650
662
|
return /* @__PURE__ */ n(
|
|
651
663
|
"div",
|
|
652
664
|
{
|
|
653
665
|
className: "-mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
|
|
654
666
|
children: [
|
|
655
667
|
/* @__PURE__ */ e(
|
|
656
|
-
|
|
668
|
+
Mt,
|
|
657
669
|
{
|
|
658
|
-
userId:
|
|
659
|
-
alt:
|
|
670
|
+
userId: a.id,
|
|
671
|
+
alt: D,
|
|
660
672
|
className: "h-6 w-6",
|
|
661
|
-
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children:
|
|
673
|
+
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: H })
|
|
662
674
|
}
|
|
663
675
|
),
|
|
664
676
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
665
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children:
|
|
666
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children:
|
|
677
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: D }),
|
|
678
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: a.email })
|
|
667
679
|
] }),
|
|
668
|
-
/* @__PURE__ */ e(
|
|
680
|
+
a.queue_only ? /* @__PURE__ */ e(
|
|
681
|
+
"span",
|
|
682
|
+
{
|
|
683
|
+
className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:bg-slate-800 dark:text-slate-400",
|
|
684
|
+
"data-tip": "The record is in their queue, but only the step’s owners can move it",
|
|
685
|
+
children: "in their queue"
|
|
686
|
+
}
|
|
687
|
+
) : /* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-navy/70 dark:text-nvr-cyan", children: "owner group" })
|
|
669
688
|
]
|
|
670
689
|
},
|
|
671
|
-
`group-${
|
|
690
|
+
`group-${a.id}`
|
|
672
691
|
);
|
|
673
692
|
}),
|
|
674
|
-
(S ?? []).map((
|
|
693
|
+
(S ?? []).map((a) => /* @__PURE__ */ n(
|
|
675
694
|
"div",
|
|
676
695
|
{
|
|
677
696
|
className: "group -mx-2 flex items-center gap-2.5 rounded-md px-2 py-1.5 transition-colors hover:bg-slate-50",
|
|
678
697
|
children: [
|
|
679
|
-
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: Q(
|
|
698
|
+
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 select-none items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-semibold text-nvr-navy/80", children: Q(a) }),
|
|
680
699
|
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
681
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: [
|
|
682
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children:
|
|
700
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700", children: [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email }),
|
|
701
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[11px] text-slate-400", children: a.email })
|
|
683
702
|
] }),
|
|
684
703
|
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-amber-50 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400", children: "manual" }),
|
|
685
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children:
|
|
704
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 rounded-full bg-slate-100 px-1.5 py-0.5 text-[10px] text-slate-500", children: a.state ? J(a.state) : "all states" }),
|
|
686
705
|
/* @__PURE__ */ e(
|
|
687
706
|
"button",
|
|
688
707
|
{
|
|
689
708
|
type: "button",
|
|
690
|
-
|
|
691
|
-
|
|
709
|
+
"aria-label": `Remove ${[a.first_name, a.last_name].filter(Boolean).join(" ") || a.email} as an owner`,
|
|
710
|
+
disabled: $.isPending,
|
|
711
|
+
onClick: () => $.mutate(a),
|
|
712
|
+
className: "shrink-0 rounded p-0.5 text-slate-300 opacity-0 transition-all hover:text-red-500 focus-visible:opacity-100 group-hover:opacity-100",
|
|
692
713
|
children: /* @__PURE__ */ e(it, { className: "h-3 w-3" })
|
|
693
714
|
}
|
|
694
715
|
)
|
|
695
716
|
]
|
|
696
717
|
},
|
|
697
|
-
|
|
718
|
+
a.id
|
|
698
719
|
))
|
|
699
720
|
] }),
|
|
700
|
-
|
|
721
|
+
P && /* @__PURE__ */ n("div", { className: "mt-3 space-y-2 rounded-lg border border-slate-200 bg-slate-50 dark:bg-slate-900/30 dark:border-border p-3", children: [
|
|
701
722
|
/* @__PURE__ */ e("p", { className: "text-[11px] font-semibold text-slate-500", children: "Add owner" }),
|
|
702
723
|
/* @__PURE__ */ e(Wt, { value: x, onChange: R }),
|
|
703
|
-
|
|
724
|
+
N ? /* @__PURE__ */ n(Ee, { open: L, onOpenChange: B, children: [
|
|
704
725
|
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
705
726
|
"button",
|
|
706
727
|
{
|
|
707
728
|
type: "button",
|
|
708
729
|
className: "flex h-8 w-full items-center justify-between rounded-md border border-slate-200 bg-white px-2.5 text-left text-[13px] text-slate-700 transition-colors hover:border-slate-300 dark:border-border dark:bg-transparent dark:text-slate-300",
|
|
709
730
|
children: [
|
|
710
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
731
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: C ? ((F = u.find((a) => a.id === C)) == null ? void 0 : F.label) ?? C : "All states" }),
|
|
711
732
|
/* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
|
|
712
733
|
]
|
|
713
734
|
}
|
|
714
735
|
) }),
|
|
715
|
-
/* @__PURE__ */ e(Ue, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...u.map((
|
|
716
|
-
var
|
|
717
|
-
const
|
|
736
|
+
/* @__PURE__ */ e(Ue, { align: "start", sideOffset: 4, className: "w-52 p-1", children: ["", ...u.map((a) => a.id)].map((a) => {
|
|
737
|
+
var V;
|
|
738
|
+
const D = a === "" ? "All states" : ((V = u.find((Z) => Z.id === a)) == null ? void 0 : V.label) ?? a;
|
|
718
739
|
return /* @__PURE__ */ e(
|
|
719
740
|
"button",
|
|
720
741
|
{
|
|
721
742
|
type: "button",
|
|
722
|
-
className:
|
|
743
|
+
className: ge(
|
|
723
744
|
"flex w-full rounded px-2.5 py-1.5 text-left text-[13px] transition-colors hover:bg-slate-50 dark:hover:bg-white/5",
|
|
724
|
-
|
|
745
|
+
C === a && "font-medium text-slate-800 dark:text-slate-200"
|
|
725
746
|
),
|
|
726
747
|
onClick: () => {
|
|
727
|
-
I(
|
|
748
|
+
I(a), B(!1);
|
|
728
749
|
},
|
|
729
|
-
children:
|
|
750
|
+
children: D
|
|
730
751
|
},
|
|
731
|
-
|
|
752
|
+
a
|
|
732
753
|
);
|
|
733
754
|
}) })
|
|
734
755
|
] }) : /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Hands off the current step." }),
|
|
@@ -741,7 +762,7 @@ function Ht({
|
|
|
741
762
|
variant: "ghost",
|
|
742
763
|
className: "h-7 text-[12px]",
|
|
743
764
|
onClick: () => {
|
|
744
|
-
|
|
765
|
+
j(!1), R(""), I("");
|
|
745
766
|
},
|
|
746
767
|
children: "Cancel"
|
|
747
768
|
}
|
|
@@ -770,18 +791,18 @@ function Vt({
|
|
|
770
791
|
collection: r,
|
|
771
792
|
item: t,
|
|
772
793
|
states: u,
|
|
773
|
-
currentStateId:
|
|
794
|
+
currentStateId: l
|
|
774
795
|
}) {
|
|
775
|
-
const
|
|
796
|
+
const q = fe(), [p, f] = K(!1), { data: N, isLoading: P } = te({
|
|
776
797
|
queryKey: ["pipeline-all-owners", r, t],
|
|
777
|
-
queryFn: () =>
|
|
798
|
+
queryFn: () => q.request(
|
|
778
799
|
ie(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
779
800
|
).then((x) => x.data ?? null),
|
|
780
801
|
enabled: p,
|
|
781
802
|
staleTime: 3e4
|
|
782
|
-
}),
|
|
803
|
+
}), j = [...u].filter((x) => {
|
|
783
804
|
var R;
|
|
784
|
-
return !
|
|
805
|
+
return !N || ((R = N[x.id]) == null ? void 0 : R.on_path) !== !1;
|
|
785
806
|
}).sort((x, R) => x.sort - R.sort);
|
|
786
807
|
return /* @__PURE__ */ n(Ee, { open: p, onOpenChange: f, children: [
|
|
787
808
|
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ e(
|
|
@@ -799,22 +820,22 @@ function Vt({
|
|
|
799
820
|
/* @__PURE__ */ e("p", { className: "text-[12px] font-semibold text-slate-700", children: "Approval Chain" }),
|
|
800
821
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400 mt-0.5", children: "Owners per pipeline state" })
|
|
801
822
|
] }),
|
|
802
|
-
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children:
|
|
803
|
-
var U, b, S,
|
|
804
|
-
const R = (((U =
|
|
805
|
-
id:
|
|
806
|
-
name: [
|
|
807
|
-
})),
|
|
823
|
+
/* @__PURE__ */ e("div", { className: "max-h-[504px] overflow-y-auto", children: P ? /* @__PURE__ */ e("div", { className: "space-y-px p-3", children: [1, 2, 3].map((x) => /* @__PURE__ */ e(le, { className: "h-10 w-full" }, x)) }) : N ? /* @__PURE__ */ e("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: j.map((x) => {
|
|
824
|
+
var U, b, S, i, w;
|
|
825
|
+
const R = (((U = N[x.id]) == null ? void 0 : U.owners) ?? []).map((s) => ({
|
|
826
|
+
id: s.id,
|
|
827
|
+
name: [s.first_name, s.last_name].filter(Boolean).join(" ") || s.email
|
|
828
|
+
})), C = x.id === l, I = ((b = N[x.id]) == null ? void 0 : b.skipped) === !0 && !C, L = (((S = N[x.id]) == null ? void 0 : S.skip_reasons) ?? []).filter(Boolean), B = ((i = N[x.id]) == null ? void 0 : i.unavailable) ?? [], M = ((w = N[x.id]) == null ? void 0 : w.blocked) === !0 && !I;
|
|
808
829
|
return /* @__PURE__ */ n(
|
|
809
830
|
"div",
|
|
810
831
|
{
|
|
811
|
-
className:
|
|
832
|
+
className: ge(
|
|
812
833
|
"flex items-center gap-3 px-4 py-2.5",
|
|
813
834
|
// Hex-with-alpha rather than bg-nvr-cyan/N — the
|
|
814
835
|
// nvr-cyan token is an opaque var() so Tailwind silently
|
|
815
836
|
// drops opacity modifiers on it. Kept very light so the
|
|
816
837
|
// tint doesn't clash with the state badge's own color.
|
|
817
|
-
|
|
838
|
+
C && "bg-nvr-cyan/[0.06] dark:bg-nvr-cyan/[0.11]",
|
|
818
839
|
I && "opacity-60",
|
|
819
840
|
M && "bg-red-50 dark:bg-red-500/10"
|
|
820
841
|
),
|
|
@@ -825,8 +846,8 @@ function Vt({
|
|
|
825
846
|
// Radix tooltip with zero delay — native `title` waits on
|
|
826
847
|
// the OS hover timer, and a truncated reason needs its
|
|
827
848
|
// full text the moment the cursor lands on it.
|
|
828
|
-
/* @__PURE__ */ e(mt, { delayDuration: 0, children: /* @__PURE__ */ n(
|
|
829
|
-
/* @__PURE__ */ e(
|
|
849
|
+
/* @__PURE__ */ e(mt, { delayDuration: 0, children: /* @__PURE__ */ n(De, { children: [
|
|
850
|
+
/* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 cursor-default items-center gap-2", children: [
|
|
830
851
|
/* @__PURE__ */ e("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-dashed border-slate-300 px-2 py-0.5 text-[10.5px] font-medium text-slate-400 dark:border-slate-600 dark:text-slate-500", children: "Skipped" }),
|
|
831
852
|
L.length > 0 && /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[11px] text-slate-400 dark:text-slate-500", children: L.join(" · ") })
|
|
832
853
|
] }) }),
|
|
@@ -838,30 +859,30 @@ function Vt({
|
|
|
838
859
|
className: "max-w-[420px] space-y-0.5 text-[11.5px] leading-snug",
|
|
839
860
|
children: [
|
|
840
861
|
/* @__PURE__ */ e("p", { className: "text-slate-500 dark:text-slate-400", children: "The pipeline will pass through this state without stopping:" }),
|
|
841
|
-
L.length > 0 ? L.map((
|
|
862
|
+
L.length > 0 ? L.map((s) => /* @__PURE__ */ e("p", { children: s }, s)) : /* @__PURE__ */ e("p", { children: "Skip criteria currently match" })
|
|
842
863
|
]
|
|
843
864
|
}
|
|
844
865
|
)
|
|
845
866
|
] }) })
|
|
846
867
|
) : /* @__PURE__ */ n(de, { children: [
|
|
847
|
-
/* @__PURE__ */ e(
|
|
848
|
-
|
|
868
|
+
/* @__PURE__ */ e(jt, { owners: R, max: 10, emptyLabel: "—" }),
|
|
869
|
+
B.map((s) => /* @__PURE__ */ n(
|
|
849
870
|
"span",
|
|
850
871
|
{
|
|
851
|
-
"data-tip": `${
|
|
852
|
-
className:
|
|
872
|
+
"data-tip": `${s.name} is ${at[s.reason] ?? s.reason}${s.delegate ? ` — ${s.delegate.name} covers${s.delegate.expires_at ? ` until ${new Date(s.delegate.expires_at).toLocaleDateString()}` : ""}` : " and nobody is covering"}`,
|
|
873
|
+
className: ge(
|
|
853
874
|
"inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10.5px] font-medium",
|
|
854
|
-
|
|
875
|
+
s.delegate ? "border-amber-200 bg-amber-50 text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
855
876
|
),
|
|
856
877
|
children: [
|
|
857
|
-
|
|
858
|
-
|
|
878
|
+
s.name,
|
|
879
|
+
s.delegate ? /* @__PURE__ */ n(de, { children: [
|
|
859
880
|
" → ",
|
|
860
|
-
|
|
861
|
-
|
|
881
|
+
s.delegate.name,
|
|
882
|
+
s.delegate.expires_at && /* @__PURE__ */ n("span", { className: "opacity-70", children: [
|
|
862
883
|
", until",
|
|
863
884
|
" ",
|
|
864
|
-
new Date(
|
|
885
|
+
new Date(s.delegate.expires_at).toLocaleDateString(
|
|
865
886
|
void 0,
|
|
866
887
|
{
|
|
867
888
|
month: "short",
|
|
@@ -872,11 +893,11 @@ function Vt({
|
|
|
872
893
|
] }) : /* @__PURE__ */ n("span", { className: "opacity-80", children: [
|
|
873
894
|
" ",
|
|
874
895
|
"· ",
|
|
875
|
-
at[
|
|
896
|
+
at[s.reason] ?? s.reason
|
|
876
897
|
] })
|
|
877
898
|
]
|
|
878
899
|
},
|
|
879
|
-
|
|
900
|
+
s.id
|
|
880
901
|
)),
|
|
881
902
|
M && /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-600 px-2 py-0.5 text-[10.5px] font-semibold text-white", children: "No one can act here" })
|
|
882
903
|
] }) })
|
|
@@ -892,13 +913,13 @@ function _n({
|
|
|
892
913
|
collection: r,
|
|
893
914
|
item: t,
|
|
894
915
|
defaultExpanded: u,
|
|
895
|
-
title:
|
|
896
|
-
showApprovalChain:
|
|
916
|
+
title: l,
|
|
917
|
+
showApprovalChain: q,
|
|
897
918
|
hideActionsCollapsed: p,
|
|
898
919
|
hideActionsExpanded: f,
|
|
899
|
-
onBeforeTransition:
|
|
900
|
-
addendumPending:
|
|
901
|
-
addendumView:
|
|
920
|
+
onBeforeTransition: N,
|
|
921
|
+
addendumPending: P,
|
|
922
|
+
addendumView: j,
|
|
902
923
|
asRole: x
|
|
903
924
|
}) {
|
|
904
925
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
@@ -907,27 +928,27 @@ function _n({
|
|
|
907
928
|
collection: r,
|
|
908
929
|
item: t,
|
|
909
930
|
defaultExpanded: u,
|
|
910
|
-
title:
|
|
911
|
-
showApprovalChain:
|
|
931
|
+
title: l,
|
|
932
|
+
showApprovalChain: q,
|
|
912
933
|
hideActionsCollapsed: p,
|
|
913
934
|
hideActionsExpanded: f,
|
|
914
|
-
onBeforeTransition:
|
|
915
|
-
addendumPending:
|
|
916
|
-
addendumView:
|
|
935
|
+
onBeforeTransition: N,
|
|
936
|
+
addendumPending: P,
|
|
937
|
+
addendumView: j,
|
|
917
938
|
asRole: x
|
|
918
939
|
},
|
|
919
940
|
`${r}:${t}`
|
|
920
941
|
);
|
|
921
942
|
}
|
|
922
943
|
function gt({ collection: r, item: t }) {
|
|
923
|
-
const u = fe(), { data:
|
|
944
|
+
const u = fe(), { data: l } = te({
|
|
924
945
|
queryKey: ["approval-brief", r, String(t)],
|
|
925
946
|
queryFn: () => u.request(ie(`/pipelines/instance/${r}/${t}/approval-brief`)).then((p) => p.data),
|
|
926
947
|
staleTime: 3e4,
|
|
927
948
|
retry: !1
|
|
928
949
|
});
|
|
929
|
-
if (!
|
|
930
|
-
const
|
|
950
|
+
if (!l) return null;
|
|
951
|
+
const q = (p) => {
|
|
931
952
|
if (p == null || p === "") return "—";
|
|
932
953
|
const f = String(p);
|
|
933
954
|
return f.length > 36 ? `${f.slice(0, 36)}…` : f;
|
|
@@ -937,34 +958,34 @@ function gt({ collection: r, item: t }) {
|
|
|
937
958
|
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-foreground", children: "Since entering this state" }),
|
|
938
959
|
" ",
|
|
939
960
|
"(",
|
|
940
|
-
|
|
961
|
+
l.days_in_state,
|
|
941
962
|
"d ago):",
|
|
942
963
|
" ",
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
964
|
+
l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ n(de, { children: [
|
|
965
|
+
l.changed_total > 0 && /* @__PURE__ */ n("span", { children: [
|
|
966
|
+
l.changed_total,
|
|
946
967
|
" field",
|
|
947
|
-
|
|
968
|
+
l.changed_total === 1 ? "" : "s",
|
|
948
969
|
" changed",
|
|
949
|
-
|
|
970
|
+
l.edited_by.length > 0 ? ` by ${l.edited_by.join(", ")}` : ""
|
|
950
971
|
] }),
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
972
|
+
l.comments > 0 && /* @__PURE__ */ n("span", { children: [
|
|
973
|
+
l.changed_total > 0 ? " · " : "",
|
|
974
|
+
l.comments,
|
|
954
975
|
" comment",
|
|
955
|
-
|
|
976
|
+
l.comments === 1 ? "" : "s"
|
|
956
977
|
] }),
|
|
957
|
-
|
|
978
|
+
l.addendums.count > 0 && /* @__PURE__ */ n("span", { children: [
|
|
958
979
|
" · ",
|
|
959
|
-
|
|
980
|
+
l.addendums.count,
|
|
960
981
|
" addendum",
|
|
961
|
-
|
|
962
|
-
|
|
982
|
+
l.addendums.count === 1 ? "" : "s",
|
|
983
|
+
l.addendums.cost_impact !== 0 ? ` (${l.addendums.cost_impact > 0 ? "+" : ""}$${Math.abs(l.addendums.cost_impact).toLocaleString()})` : ""
|
|
963
984
|
] })
|
|
964
985
|
] })
|
|
965
986
|
] }),
|
|
966
|
-
|
|
967
|
-
|
|
987
|
+
l.field_changes.length > 0 && /* @__PURE__ */ n("div", { className: "mt-1 space-y-0.5", children: [
|
|
988
|
+
l.field_changes.slice(0, 5).map((p) => /* @__PURE__ */ n(
|
|
968
989
|
"p",
|
|
969
990
|
{
|
|
970
991
|
className: "font-mono text-[10.5px] text-slate-500 dark:text-muted-foreground",
|
|
@@ -973,21 +994,21 @@ function gt({ collection: r, item: t }) {
|
|
|
973
994
|
":",
|
|
974
995
|
" ",
|
|
975
996
|
p.old !== void 0 && /* @__PURE__ */ n(de, { children: [
|
|
976
|
-
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children:
|
|
997
|
+
/* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: q(p.old) }),
|
|
977
998
|
" "
|
|
978
999
|
] }),
|
|
979
|
-
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children:
|
|
1000
|
+
/* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: q(p.new) })
|
|
980
1001
|
]
|
|
981
1002
|
},
|
|
982
1003
|
p.field
|
|
983
1004
|
)),
|
|
984
|
-
|
|
1005
|
+
l.field_changes.length > 5 && /* @__PURE__ */ n("p", { className: "text-[10.5px] text-slate-400", children: [
|
|
985
1006
|
"+",
|
|
986
|
-
|
|
1007
|
+
l.field_changes.length - 5,
|
|
987
1008
|
" more — see History for the full trail"
|
|
988
1009
|
] })
|
|
989
1010
|
] }),
|
|
990
|
-
(
|
|
1011
|
+
(l.lines ?? []).map((p) => /* @__PURE__ */ n(
|
|
991
1012
|
"p",
|
|
992
1013
|
{
|
|
993
1014
|
"data-brief-line": p.label,
|
|
@@ -1012,45 +1033,45 @@ function Gt({
|
|
|
1012
1033
|
collection: r,
|
|
1013
1034
|
item: t,
|
|
1014
1035
|
defaultExpanded: u,
|
|
1015
|
-
title:
|
|
1016
|
-
showApprovalChain:
|
|
1036
|
+
title: l,
|
|
1037
|
+
showApprovalChain: q,
|
|
1017
1038
|
hideActionsCollapsed: p,
|
|
1018
1039
|
hideActionsExpanded: f,
|
|
1019
|
-
onBeforeTransition:
|
|
1020
|
-
addendumPending:
|
|
1021
|
-
addendumView:
|
|
1040
|
+
onBeforeTransition: N,
|
|
1041
|
+
addendumPending: P,
|
|
1042
|
+
addendumView: j,
|
|
1022
1043
|
asRole: x
|
|
1023
1044
|
}) {
|
|
1024
1045
|
var We, He, Ve;
|
|
1025
|
-
const R = fe(),
|
|
1026
|
-
dt(r, t, "transition", !!
|
|
1027
|
-
const
|
|
1046
|
+
const R = fe(), C = Oe(), [I, L] = K(""), [B, M] = K(null), [U, b] = K(!1), [S, i] = K(!1), [w, s] = K(null);
|
|
1047
|
+
dt(r, t, "transition", !!B || !!w);
|
|
1048
|
+
const v = $t(r, t, "transition"), k = ne(!1);
|
|
1028
1049
|
ue(() => {
|
|
1029
|
-
!k.current && u !== void 0 && (k.current = !0,
|
|
1050
|
+
!k.current && u !== void 0 && (k.current = !0, i(u));
|
|
1030
1051
|
}, [u]);
|
|
1031
1052
|
const A = ne(!1), W = (o) => {
|
|
1032
|
-
A.current || (A.current = !0,
|
|
1053
|
+
A.current || (A.current = !0, J.mutate(o, {
|
|
1033
1054
|
onSettled: () => {
|
|
1034
1055
|
A.current = !1;
|
|
1035
1056
|
}
|
|
1036
1057
|
}));
|
|
1037
1058
|
}, c = async (o) => {
|
|
1038
1059
|
if (A.current) return;
|
|
1039
|
-
if (
|
|
1060
|
+
if (B === o) {
|
|
1040
1061
|
M(null);
|
|
1041
1062
|
return;
|
|
1042
1063
|
}
|
|
1043
|
-
if (
|
|
1064
|
+
if (N) {
|
|
1044
1065
|
A.current = !0;
|
|
1045
1066
|
let z = !1;
|
|
1046
1067
|
try {
|
|
1047
|
-
z = await
|
|
1068
|
+
z = await N();
|
|
1048
1069
|
} finally {
|
|
1049
1070
|
A.current = !1;
|
|
1050
1071
|
}
|
|
1051
1072
|
if (!z) return;
|
|
1052
1073
|
}
|
|
1053
|
-
const
|
|
1074
|
+
const T = (a ?? []).find((z) => z.id === o), E = String((T == null ? void 0 : T.comment_mode) ?? "none");
|
|
1054
1075
|
if (E !== "optional" && E !== "required") {
|
|
1055
1076
|
W({ transition_id: o });
|
|
1056
1077
|
return;
|
|
@@ -1075,14 +1096,14 @@ function Gt({
|
|
|
1075
1096
|
staleTime: 1e4
|
|
1076
1097
|
});
|
|
1077
1098
|
ue(
|
|
1078
|
-
() =>
|
|
1099
|
+
() => C.getQueryCache().subscribe((o) => {
|
|
1079
1100
|
if (o.type !== "updated" || o.action.type !== "success") return;
|
|
1080
|
-
const
|
|
1081
|
-
Array.isArray(
|
|
1101
|
+
const T = o.query.queryKey;
|
|
1102
|
+
Array.isArray(T) && T[0] === "item" && T[1] === r && String(T[2]) === t && C.invalidateQueries({ queryKey: ["pipeline-instance", r, t] });
|
|
1082
1103
|
}),
|
|
1083
|
-
[
|
|
1104
|
+
[C, r, t]
|
|
1084
1105
|
);
|
|
1085
|
-
const { data: g, isLoading:
|
|
1106
|
+
const { data: g, isLoading: _ } = te({
|
|
1086
1107
|
queryKey: ["pipeline-all-owners", r, t],
|
|
1087
1108
|
queryFn: () => R.request(
|
|
1088
1109
|
ie(`/pipelines/instance/${r}/${t}/owners/all`)
|
|
@@ -1092,51 +1113,51 @@ function Gt({
|
|
|
1092
1113
|
}), h = et(() => {
|
|
1093
1114
|
if (!g) return null;
|
|
1094
1115
|
const o = Object.entries(g);
|
|
1095
|
-
return o.length === 0 || o.every(([,
|
|
1096
|
-
}, [g]),
|
|
1116
|
+
return o.length === 0 || o.every(([, T]) => T.on_path === void 0) ? null : new Set(o.filter(([, T]) => T.on_path !== !1).map(([T]) => T));
|
|
1117
|
+
}, [g]), $ = et(() => {
|
|
1097
1118
|
if (!g) return null;
|
|
1098
1119
|
const o = /* @__PURE__ */ new Map();
|
|
1099
|
-
for (const [
|
|
1100
|
-
E.skipped && o.set(
|
|
1120
|
+
for (const [T, E] of Object.entries(g))
|
|
1121
|
+
E.skipped && o.set(T, E.skip_reasons ?? []);
|
|
1101
1122
|
return o;
|
|
1102
|
-
}, [g]), Q =
|
|
1103
|
-
mutationFn: () => R.request(
|
|
1123
|
+
}, [g]), Q = xe({
|
|
1124
|
+
mutationFn: () => R.request(be(`/pipelines/instance/${r}/${t}/start`, {})),
|
|
1104
1125
|
onSuccess: () => {
|
|
1105
|
-
|
|
1126
|
+
C.invalidateQueries({ queryKey: y }), ee.success("Pipeline started");
|
|
1106
1127
|
},
|
|
1107
1128
|
onError: () => ee.error("Failed to start pipeline")
|
|
1108
|
-
}),
|
|
1129
|
+
}), J = xe({
|
|
1109
1130
|
mutationFn: ({
|
|
1110
1131
|
transition_id: o,
|
|
1111
|
-
comment:
|
|
1132
|
+
comment: T,
|
|
1112
1133
|
reviewed: E
|
|
1113
1134
|
}) => R.request(
|
|
1114
|
-
|
|
1135
|
+
be(`/pipelines/instance/${r}/${t}/transition`, {
|
|
1115
1136
|
transition_id: o,
|
|
1116
|
-
comment:
|
|
1137
|
+
comment: T,
|
|
1117
1138
|
...E ? { reviewed: !0 } : {}
|
|
1118
1139
|
})
|
|
1119
1140
|
),
|
|
1120
1141
|
onSuccess: () => {
|
|
1121
|
-
|
|
1142
|
+
C.invalidateQueries({ queryKey: y }), r === "nivaro_addendums" && C.invalidateQueries({ queryKey: ["addendums"] }), ke(C, r, String(t)), _e(C, r, String(t)), L(""), M(null), s(null), ee.success("Transition executed");
|
|
1122
1143
|
},
|
|
1123
|
-
onError: (o,
|
|
1144
|
+
onError: (o, T) => {
|
|
1124
1145
|
if (xt(o)) {
|
|
1125
|
-
|
|
1146
|
+
C.invalidateQueries({ queryKey: y });
|
|
1126
1147
|
return;
|
|
1127
1148
|
}
|
|
1128
1149
|
const E = bt(o);
|
|
1129
1150
|
if (E) {
|
|
1130
|
-
|
|
1151
|
+
s((G) => ({
|
|
1131
1152
|
payload: E,
|
|
1132
|
-
transitionId:
|
|
1133
|
-
comment:
|
|
1134
|
-
revision: ((
|
|
1153
|
+
transitionId: T.transition_id,
|
|
1154
|
+
comment: T.comment,
|
|
1155
|
+
revision: ((G == null ? void 0 : G.revision) ?? 0) + 1
|
|
1135
1156
|
}));
|
|
1136
1157
|
return;
|
|
1137
1158
|
}
|
|
1138
1159
|
const z = o == null ? void 0 : o.response;
|
|
1139
|
-
ee.error(
|
|
1160
|
+
ee.error(he(o, "Failed to execute transition"), {
|
|
1140
1161
|
duration: 12e3,
|
|
1141
1162
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1142
1163
|
// that stopped it, and who can change it.
|
|
@@ -1145,25 +1166,25 @@ function Gt({
|
|
|
1145
1166
|
collection: r,
|
|
1146
1167
|
itemId: String(t),
|
|
1147
1168
|
action: "transition",
|
|
1148
|
-
transitionId:
|
|
1169
|
+
transitionId: T.transition_id
|
|
1149
1170
|
})
|
|
1150
1171
|
} : {}
|
|
1151
|
-
}),
|
|
1172
|
+
}), s(null), M(null), ke(C, r, String(t)), _e(C, r, String(t)), (z == null ? void 0 : z.status) === 409 && C.invalidateQueries({ queryKey: y });
|
|
1152
1173
|
}
|
|
1153
1174
|
}), O = ne(c);
|
|
1154
1175
|
O.current = c;
|
|
1155
1176
|
const re = ne((d == null ? void 0 : d.available_transitions) ?? []);
|
|
1156
1177
|
if (re.current = (d == null ? void 0 : d.available_transitions) ?? [], ue(() => {
|
|
1157
|
-
const o = (
|
|
1158
|
-
const E =
|
|
1178
|
+
const o = (T) => {
|
|
1179
|
+
const E = T.detail;
|
|
1159
1180
|
if (!E || E.claimed || E.collection !== r || String(E.item) !== String(t)) return;
|
|
1160
1181
|
E.claimed = !0;
|
|
1161
|
-
const z = String(E.transition_id).toUpperCase(),
|
|
1162
|
-
if (!
|
|
1182
|
+
const z = String(E.transition_id).toUpperCase(), G = re.current.find((ce) => String(ce.id).toUpperCase() === z);
|
|
1183
|
+
if (!G) {
|
|
1163
1184
|
ee.error("That step is not available from where the record is now");
|
|
1164
1185
|
return;
|
|
1165
1186
|
}
|
|
1166
|
-
O.current(
|
|
1187
|
+
O.current(G.id);
|
|
1167
1188
|
};
|
|
1168
1189
|
return window.addEventListener(Ne, o), () => window.removeEventListener(Ne, o);
|
|
1169
1190
|
}, [r, t]), m)
|
|
@@ -1174,28 +1195,28 @@ function Gt({
|
|
|
1174
1195
|
/* @__PURE__ */ e(le, { className: "ml-auto h-3.5 w-3.5 rounded" })
|
|
1175
1196
|
] }) });
|
|
1176
1197
|
if (!(d != null && d.binding)) return null;
|
|
1177
|
-
const { instance: F, available_transitions:
|
|
1198
|
+
const { instance: F, available_transitions: a, history: D, states: H } = d, V = new Map((H ?? []).map((o) => [o.id, o])), Z = (F == null ? void 0 : F.current_state_obj) ?? null, ae = B ? (a ?? []).find((o) => o.id === B) : null, Se = ae ? V.get(ae.to_state) : null, yt = F != null && F.completed_at && a ? a.filter(
|
|
1178
1199
|
(o) => o.from_state && String(o.from_state).toUpperCase() === String(F.current_state).toUpperCase()
|
|
1179
|
-
) : null,
|
|
1200
|
+
) : null, $e = F != null && F.completed_at ? yt ?? [] : a ?? [], Qe = $e.length > 0, ze = (o, T = !1) => {
|
|
1180
1201
|
const E = /* @__PURE__ */ new Map();
|
|
1181
1202
|
for (const z of o) {
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1203
|
+
const G = E.get(z.label) ?? [];
|
|
1204
|
+
G.push(z), E.set(z.label, G);
|
|
1184
1205
|
}
|
|
1185
|
-
return Array.from(E.entries()).map(([z,
|
|
1206
|
+
return Array.from(E.entries()).map(([z, G]) => {
|
|
1186
1207
|
var Xe, Je;
|
|
1187
|
-
const ce = ((Xe =
|
|
1188
|
-
if (
|
|
1189
|
-
const
|
|
1208
|
+
const ce = ((Xe = G[0]) == null ? void 0 : Xe.color) ?? null, ye = G.some((X) => X.id === B), Ge = (X) => ce ? X ? { backgroundColor: ce, borderColor: ce } : { borderColor: ce, color: ce } : void 0;
|
|
1209
|
+
if (G.length === 1) {
|
|
1210
|
+
const X = G[0], pe = J.isPending && ((Je = J.variables) == null ? void 0 : Je.transition_id) === X.id;
|
|
1190
1211
|
return /* @__PURE__ */ n(
|
|
1191
1212
|
Y,
|
|
1192
1213
|
{
|
|
1193
1214
|
size: "sm",
|
|
1194
|
-
variant:
|
|
1195
|
-
className: `${
|
|
1196
|
-
style: Ge(
|
|
1197
|
-
disabled:
|
|
1198
|
-
onClick: () => c(
|
|
1215
|
+
variant: ye ? "default" : "outline",
|
|
1216
|
+
className: `${T ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1217
|
+
style: Ge(ye),
|
|
1218
|
+
disabled: J.isPending,
|
|
1219
|
+
onClick: () => c(X.id),
|
|
1199
1220
|
children: [
|
|
1200
1221
|
pe && /* @__PURE__ */ e(se, { className: "h-3 w-3 animate-spin" }),
|
|
1201
1222
|
z
|
|
@@ -1204,38 +1225,38 @@ function Gt({
|
|
|
1204
1225
|
z
|
|
1205
1226
|
);
|
|
1206
1227
|
}
|
|
1207
|
-
return /* @__PURE__ */ n(
|
|
1228
|
+
return /* @__PURE__ */ n(Pe, { children: [
|
|
1208
1229
|
/* @__PURE__ */ e(Ae, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1209
1230
|
Y,
|
|
1210
1231
|
{
|
|
1211
1232
|
size: "sm",
|
|
1212
|
-
variant:
|
|
1213
|
-
className: `${
|
|
1214
|
-
style: Ge(
|
|
1215
|
-
disabled:
|
|
1233
|
+
variant: ye ? "default" : "outline",
|
|
1234
|
+
className: `${T ? "h-7 text-[11px]" : "text-[12px]"} gap-1.5`,
|
|
1235
|
+
style: Ge(ye),
|
|
1236
|
+
disabled: J.isPending,
|
|
1216
1237
|
children: [
|
|
1217
1238
|
z,
|
|
1218
1239
|
/* @__PURE__ */ e(me, { className: "h-3 w-3" })
|
|
1219
1240
|
]
|
|
1220
1241
|
}
|
|
1221
1242
|
) }),
|
|
1222
|
-
/* @__PURE__ */ e(
|
|
1223
|
-
(
|
|
1243
|
+
/* @__PURE__ */ e(Re, { align: "start", children: [...G].sort(
|
|
1244
|
+
(X, pe) => {
|
|
1224
1245
|
var Ze, Ye;
|
|
1225
|
-
return (((Ze =
|
|
1246
|
+
return (((Ze = V.get(X.to_state)) == null ? void 0 : Ze.sort) ?? 999) - (((Ye = V.get(pe.to_state)) == null ? void 0 : Ye.sort) ?? 999);
|
|
1226
1247
|
}
|
|
1227
|
-
).map((
|
|
1248
|
+
).map((X) => {
|
|
1228
1249
|
var pe;
|
|
1229
|
-
return /* @__PURE__ */ n(
|
|
1230
|
-
|
|
1250
|
+
return /* @__PURE__ */ n(we, { onSelect: () => c(X.id), children: [
|
|
1251
|
+
X.color && /* @__PURE__ */ e(
|
|
1231
1252
|
"span",
|
|
1232
1253
|
{
|
|
1233
1254
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1234
|
-
style: { backgroundColor:
|
|
1255
|
+
style: { backgroundColor: X.color }
|
|
1235
1256
|
}
|
|
1236
1257
|
),
|
|
1237
|
-
((pe =
|
|
1238
|
-
] },
|
|
1258
|
+
((pe = V.get(X.to_state)) == null ? void 0 : pe.label) ?? X.to_state
|
|
1259
|
+
] }, X.id);
|
|
1239
1260
|
}) })
|
|
1240
1261
|
] }, z);
|
|
1241
1262
|
});
|
|
@@ -1243,10 +1264,10 @@ function Gt({
|
|
|
1243
1264
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1244
1265
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-400", children: "Confirming" }),
|
|
1245
1266
|
ae && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: ae.label }),
|
|
1246
|
-
|
|
1247
|
-
/* @__PURE__ */ e(oe, { label:
|
|
1248
|
-
/* @__PURE__ */ e(
|
|
1249
|
-
/* @__PURE__ */ e(oe, { label:
|
|
1267
|
+
Z && Se && /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
1268
|
+
/* @__PURE__ */ e(oe, { label: Z.label, color: Z.color, small: !0 }),
|
|
1269
|
+
/* @__PURE__ */ e(Fe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1270
|
+
/* @__PURE__ */ e(oe, { label: Se.label, color: Se.color, small: !0 })
|
|
1250
1271
|
] })
|
|
1251
1272
|
] }),
|
|
1252
1273
|
/* @__PURE__ */ e(gt, { collection: r, item: t }),
|
|
@@ -1278,14 +1299,14 @@ function Gt({
|
|
|
1278
1299
|
type: "button",
|
|
1279
1300
|
size: "sm",
|
|
1280
1301
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1281
|
-
disabled:
|
|
1302
|
+
disabled: J.isPending || String((ae == null ? void 0 : ae.comment_mode) ?? "") === "required" && I.trim() === "",
|
|
1282
1303
|
onClick: () => W({
|
|
1283
|
-
transition_id:
|
|
1304
|
+
transition_id: B,
|
|
1284
1305
|
comment: I.trim() || void 0
|
|
1285
1306
|
}),
|
|
1286
|
-
children:
|
|
1307
|
+
children: J.isPending ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(de, { children: [
|
|
1287
1308
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1288
|
-
/* @__PURE__ */ e(
|
|
1309
|
+
/* @__PURE__ */ e(Ce, { className: "h-3 w-3" })
|
|
1289
1310
|
] })
|
|
1290
1311
|
}
|
|
1291
1312
|
)
|
|
@@ -1295,22 +1316,22 @@ function Gt({
|
|
|
1295
1316
|
/* @__PURE__ */ n(
|
|
1296
1317
|
"div",
|
|
1297
1318
|
{
|
|
1298
|
-
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${
|
|
1319
|
+
className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${j ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`,
|
|
1299
1320
|
children: [
|
|
1300
1321
|
/* @__PURE__ */ n(
|
|
1301
1322
|
"div",
|
|
1302
1323
|
{
|
|
1303
1324
|
role: "button",
|
|
1304
1325
|
tabIndex: 0,
|
|
1305
|
-
onClick: () =>
|
|
1306
|
-
onKeyDown: (o) => (o.key === "Enter" || o.key === " ") &&
|
|
1326
|
+
onClick: () => i((o) => !o),
|
|
1327
|
+
onKeyDown: (o) => (o.key === "Enter" || o.key === " ") && i((T) => !T),
|
|
1307
1328
|
className: "flex w-full cursor-pointer items-center gap-2.5 px-5 py-3.5 transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
1308
1329
|
children: [
|
|
1309
|
-
/* @__PURE__ */ e(
|
|
1310
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children:
|
|
1330
|
+
/* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
1331
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: l || "Pipeline" }),
|
|
1311
1332
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
|
|
1312
|
-
|
|
1313
|
-
|
|
1333
|
+
j && /* @__PURE__ */ e("span", { className: "flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 dark:border-amber-500/20 dark:bg-amber-500/10 dark:text-amber-400", children: "Addendum workflow" }),
|
|
1334
|
+
Z && /* @__PURE__ */ e(oe, { label: Z.label, color: Z.color }),
|
|
1314
1335
|
(((We = d == null ? void 0 : d.auto_held) == null ? void 0 : We.length) ?? 0) > 0 && /* @__PURE__ */ n(
|
|
1315
1336
|
"span",
|
|
1316
1337
|
{
|
|
@@ -1324,24 +1345,24 @@ function Gt({
|
|
|
1324
1345
|
]
|
|
1325
1346
|
}
|
|
1326
1347
|
),
|
|
1327
|
-
|
|
1348
|
+
P && /* @__PURE__ */ n("span", { className: "flex items-center gap-1 rounded-full bg-amber-50 px-2 py-0.5 text-[11px] font-medium text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-400 dark:border-amber-500/20", children: [
|
|
1328
1349
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse shrink-0" }),
|
|
1329
1350
|
"Addendum in review"
|
|
1330
1351
|
] }),
|
|
1331
|
-
|
|
1352
|
+
v.length > 0 && /* @__PURE__ */ n(
|
|
1332
1353
|
"span",
|
|
1333
1354
|
{
|
|
1334
1355
|
className: "flex items-center gap-1 rounded-full border border-sky-200 bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:border-sky-500/20 dark:bg-sky-500/10 dark:text-sky-300",
|
|
1335
1356
|
"data-pipeline-approving": !0,
|
|
1336
1357
|
children: [
|
|
1337
1358
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-sky-400" }),
|
|
1338
|
-
Tt(
|
|
1359
|
+
Tt(v, "approving")
|
|
1339
1360
|
]
|
|
1340
1361
|
}
|
|
1341
1362
|
)
|
|
1342
1363
|
] }),
|
|
1343
1364
|
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", onClick: (o) => o.stopPropagation(), children: [
|
|
1344
|
-
!S && Qe && !p && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5", children: ze(
|
|
1365
|
+
!S && Qe && !p && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1.5", children: ze($e, !0) }),
|
|
1345
1366
|
!S && !F && (d == null ? void 0 : d.binding) && /* @__PURE__ */ n(
|
|
1346
1367
|
Y,
|
|
1347
1368
|
{
|
|
@@ -1353,17 +1374,17 @@ function Gt({
|
|
|
1353
1374
|
},
|
|
1354
1375
|
disabled: Q.isPending,
|
|
1355
1376
|
children: [
|
|
1356
|
-
Q.isPending ? /* @__PURE__ */ e(se, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(
|
|
1377
|
+
Q.isPending ? /* @__PURE__ */ e(se, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e(Te, { className: "h-3 w-3" }),
|
|
1357
1378
|
"Start"
|
|
1358
1379
|
]
|
|
1359
1380
|
}
|
|
1360
1381
|
),
|
|
1361
|
-
|
|
1382
|
+
q && ((d == null ? void 0 : d.binding) || (d == null ? void 0 : d.instance)) && /* @__PURE__ */ e(
|
|
1362
1383
|
Vt,
|
|
1363
1384
|
{
|
|
1364
1385
|
collection: r,
|
|
1365
1386
|
item: t,
|
|
1366
|
-
states:
|
|
1387
|
+
states: H ?? [],
|
|
1367
1388
|
currentStateId: ((He = d == null ? void 0 : d.instance) == null ? void 0 : He.current_state) ?? null
|
|
1368
1389
|
}
|
|
1369
1390
|
)
|
|
@@ -1371,7 +1392,7 @@ function Gt({
|
|
|
1371
1392
|
/* @__PURE__ */ e(
|
|
1372
1393
|
me,
|
|
1373
1394
|
{
|
|
1374
|
-
className:
|
|
1395
|
+
className: ge(
|
|
1375
1396
|
"h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150",
|
|
1376
1397
|
S && "rotate-180"
|
|
1377
1398
|
)
|
|
@@ -1380,16 +1401,16 @@ function Gt({
|
|
|
1380
1401
|
]
|
|
1381
1402
|
}
|
|
1382
1403
|
),
|
|
1383
|
-
!S &&
|
|
1404
|
+
!S && B && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 dark:border-border/60 px-4 py-3", children: Ke }),
|
|
1384
1405
|
S && /* @__PURE__ */ n("div", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
1385
1406
|
/* @__PURE__ */ e(Ut, { held: (d == null ? void 0 : d.auto_held) ?? [] }),
|
|
1386
|
-
|
|
1407
|
+
P && /* @__PURE__ */ n("div", { className: "flex items-center gap-2 border-b border-amber-100 bg-amber-50 px-5 py-2.5 dark:border-amber-500/20 dark:bg-amber-500/10", children: [
|
|
1387
1408
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-400 shrink-0" }),
|
|
1388
1409
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "An addendum is in review — coordinate transitions carefully." })
|
|
1389
1410
|
] }),
|
|
1390
1411
|
F ? /* @__PURE__ */ n("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: [
|
|
1391
|
-
(
|
|
1392
|
-
|
|
1412
|
+
(H ?? []).length > 1 && /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1413
|
+
_ ? (
|
|
1393
1414
|
// Path pruning arrives with the owners query — rendering
|
|
1394
1415
|
// the UNPRUNED track first meant every state briefly
|
|
1395
1416
|
// showed, then snapped into formation. Hold a same-height
|
|
@@ -1404,20 +1425,20 @@ function Gt({
|
|
|
1404
1425
|
) : /* @__PURE__ */ e(
|
|
1405
1426
|
zt,
|
|
1406
1427
|
{
|
|
1407
|
-
states:
|
|
1428
|
+
states: H,
|
|
1408
1429
|
allTransitions: (d == null ? void 0 : d.all_transitions) ?? [],
|
|
1409
|
-
availableTransitions:
|
|
1430
|
+
availableTransitions: a ?? [],
|
|
1410
1431
|
currentStateId: F.current_state,
|
|
1411
|
-
history:
|
|
1432
|
+
history: D ?? [],
|
|
1412
1433
|
onPathIds: h,
|
|
1413
|
-
skippedStates:
|
|
1434
|
+
skippedStates: $
|
|
1414
1435
|
}
|
|
1415
1436
|
),
|
|
1416
|
-
(d == null ? void 0 : d.branches) && /* @__PURE__ */ e(
|
|
1437
|
+
(d == null ? void 0 : d.branches) && /* @__PURE__ */ e(Ot, { data: d.branches }),
|
|
1417
1438
|
/* @__PURE__ */ e(
|
|
1418
1439
|
Qt,
|
|
1419
1440
|
{
|
|
1420
|
-
history:
|
|
1441
|
+
history: D ?? [],
|
|
1421
1442
|
completedAt: F.completed_at
|
|
1422
1443
|
}
|
|
1423
1444
|
)
|
|
@@ -1429,20 +1450,20 @@ function Gt({
|
|
|
1429
1450
|
{
|
|
1430
1451
|
collection: r,
|
|
1431
1452
|
item: t,
|
|
1432
|
-
states:
|
|
1453
|
+
states: H ?? [],
|
|
1433
1454
|
currentStateId: ((Ve = d == null ? void 0 : d.instance) == null ? void 0 : Ve.current_state) ?? null,
|
|
1434
1455
|
returned: ((d == null ? void 0 : d.history) ?? []).some(
|
|
1435
1456
|
(o) => {
|
|
1436
|
-
var
|
|
1437
|
-
return !!o.from_state && o.to_state === ((
|
|
1457
|
+
var T;
|
|
1458
|
+
return !!o.from_state && o.to_state === ((T = d == null ? void 0 : d.instance) == null ? void 0 : T.current_state);
|
|
1438
1459
|
}
|
|
1439
1460
|
)
|
|
1440
1461
|
}
|
|
1441
1462
|
)
|
|
1442
1463
|
] }),
|
|
1443
1464
|
Qe && !f && /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-4", children: [
|
|
1444
|
-
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: ze(
|
|
1445
|
-
|
|
1465
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap justify-end gap-2", children: ze($e) }),
|
|
1466
|
+
B && Ke
|
|
1446
1467
|
] }),
|
|
1447
1468
|
/* @__PURE__ */ n("div", { className: "px-5 py-3", children: [
|
|
1448
1469
|
/* @__PURE__ */ n(
|
|
@@ -1455,7 +1476,7 @@ function Gt({
|
|
|
1455
1476
|
/* @__PURE__ */ e(
|
|
1456
1477
|
me,
|
|
1457
1478
|
{
|
|
1458
|
-
className:
|
|
1479
|
+
className: ge(
|
|
1459
1480
|
"h-3.5 w-3.5 transition-transform duration-200",
|
|
1460
1481
|
U && "rotate-180"
|
|
1461
1482
|
)
|
|
@@ -1465,13 +1486,13 @@ function Gt({
|
|
|
1465
1486
|
" ",
|
|
1466
1487
|
/* @__PURE__ */ n("span", { className: "tabular-nums", children: [
|
|
1467
1488
|
"(",
|
|
1468
|
-
(
|
|
1489
|
+
(D == null ? void 0 : D.length) ?? 0,
|
|
1469
1490
|
")"
|
|
1470
1491
|
] })
|
|
1471
1492
|
]
|
|
1472
1493
|
}
|
|
1473
1494
|
),
|
|
1474
|
-
U && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(Kt, { history:
|
|
1495
|
+
U && /* @__PURE__ */ e("div", { className: "mt-3", children: /* @__PURE__ */ e(Kt, { history: D ?? [] }) })
|
|
1475
1496
|
] })
|
|
1476
1497
|
] }) : /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-4 px-5 py-4", children: [
|
|
1477
1498
|
/* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500", children: "Pipeline not started for this record." }),
|
|
@@ -1484,7 +1505,7 @@ function Gt({
|
|
|
1484
1505
|
onClick: () => Q.mutate(),
|
|
1485
1506
|
disabled: Q.isPending,
|
|
1486
1507
|
children: [
|
|
1487
|
-
Q.isPending ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(
|
|
1508
|
+
Q.isPending ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5" }),
|
|
1488
1509
|
"Start Pipeline"
|
|
1489
1510
|
]
|
|
1490
1511
|
}
|
|
@@ -1502,15 +1523,15 @@ function Gt({
|
|
|
1502
1523
|
onSubmitted: () => (
|
|
1503
1524
|
// mutateAsync so the dialog can stay busy until the transition
|
|
1504
1525
|
// settles; the mutation's own onError/onSuccess handle the outcome.
|
|
1505
|
-
|
|
1526
|
+
J.mutateAsync({
|
|
1506
1527
|
transition_id: w.transitionId,
|
|
1507
1528
|
comment: w.comment,
|
|
1508
1529
|
reviewed: !0
|
|
1509
1530
|
}).catch(() => {
|
|
1510
1531
|
})
|
|
1511
1532
|
),
|
|
1512
|
-
executing:
|
|
1513
|
-
onClose: () =>
|
|
1533
|
+
executing: J.isPending,
|
|
1534
|
+
onClose: () => s(null)
|
|
1514
1535
|
},
|
|
1515
1536
|
w.revision
|
|
1516
1537
|
) })
|
|
@@ -1520,7 +1541,7 @@ function Cn({
|
|
|
1520
1541
|
collection: r,
|
|
1521
1542
|
item: t,
|
|
1522
1543
|
onBeforeTransition: u,
|
|
1523
|
-
wrap:
|
|
1544
|
+
wrap: l = !0
|
|
1524
1545
|
}) {
|
|
1525
1546
|
return t === "new" ? null : /* @__PURE__ */ e(
|
|
1526
1547
|
Xt,
|
|
@@ -1528,7 +1549,7 @@ function Cn({
|
|
|
1528
1549
|
collection: r,
|
|
1529
1550
|
item: t,
|
|
1530
1551
|
onBeforeTransition: u,
|
|
1531
|
-
wrap:
|
|
1552
|
+
wrap: l
|
|
1532
1553
|
}
|
|
1533
1554
|
);
|
|
1534
1555
|
}
|
|
@@ -1536,11 +1557,11 @@ function Xt({
|
|
|
1536
1557
|
collection: r,
|
|
1537
1558
|
item: t,
|
|
1538
1559
|
onBeforeTransition: u,
|
|
1539
|
-
wrap:
|
|
1560
|
+
wrap: l = !0
|
|
1540
1561
|
}) {
|
|
1541
|
-
const
|
|
1542
|
-
dt(r, t, "transition", !!
|
|
1543
|
-
const
|
|
1562
|
+
const q = fe(), p = Oe(), [f, N] = K(""), [P, j] = K(null), [x, R] = K(null);
|
|
1563
|
+
dt(r, t, "transition", !!P || !!x);
|
|
1564
|
+
const C = ne(null), I = Dt(C, !l), L = ne(!1), B = (m) => {
|
|
1544
1565
|
L.current || (L.current = !0, S.mutate(m, {
|
|
1545
1566
|
onSettled: () => {
|
|
1546
1567
|
L.current = !1;
|
|
@@ -1548,8 +1569,8 @@ function Xt({
|
|
|
1548
1569
|
}));
|
|
1549
1570
|
}, M = async (m) => {
|
|
1550
1571
|
if (L.current) return;
|
|
1551
|
-
if (
|
|
1552
|
-
|
|
1572
|
+
if (P === m) {
|
|
1573
|
+
j(null);
|
|
1553
1574
|
return;
|
|
1554
1575
|
}
|
|
1555
1576
|
if (u) {
|
|
@@ -1562,15 +1583,15 @@ function Xt({
|
|
|
1562
1583
|
}
|
|
1563
1584
|
if (!h) return;
|
|
1564
1585
|
}
|
|
1565
|
-
const g = (
|
|
1566
|
-
if (
|
|
1567
|
-
|
|
1586
|
+
const g = (s ?? []).find((h) => h.id === m), _ = String((g == null ? void 0 : g.comment_mode) ?? "none");
|
|
1587
|
+
if (_ !== "optional" && _ !== "required") {
|
|
1588
|
+
B({ transition_id: m });
|
|
1568
1589
|
return;
|
|
1569
1590
|
}
|
|
1570
|
-
|
|
1591
|
+
j(m);
|
|
1571
1592
|
}, U = ["pipeline-instance", r, t], { data: b } = te({
|
|
1572
1593
|
queryKey: U,
|
|
1573
|
-
queryFn: () =>
|
|
1594
|
+
queryFn: () => q.request(
|
|
1574
1595
|
ie(`/pipelines/instance/${r}/${t}`)
|
|
1575
1596
|
).then(
|
|
1576
1597
|
(m) => m.data ?? {
|
|
@@ -1583,91 +1604,91 @@ function Xt({
|
|
|
1583
1604
|
}
|
|
1584
1605
|
),
|
|
1585
1606
|
staleTime: 1e4
|
|
1586
|
-
}), S =
|
|
1607
|
+
}), S = xe({
|
|
1587
1608
|
mutationFn: ({
|
|
1588
1609
|
transition_id: m,
|
|
1589
1610
|
comment: g,
|
|
1590
|
-
reviewed:
|
|
1591
|
-
}) =>
|
|
1592
|
-
|
|
1611
|
+
reviewed: _
|
|
1612
|
+
}) => q.request(
|
|
1613
|
+
be(`/pipelines/instance/${r}/${t}/transition`, {
|
|
1593
1614
|
transition_id: m,
|
|
1594
1615
|
comment: g,
|
|
1595
|
-
...
|
|
1616
|
+
..._ ? { reviewed: !0 } : {}
|
|
1596
1617
|
})
|
|
1597
1618
|
),
|
|
1598
1619
|
onSuccess: () => {
|
|
1599
|
-
p.invalidateQueries({ queryKey: U }), r === "nivaro_addendums" && p.invalidateQueries({ queryKey: ["addendums"] }),
|
|
1620
|
+
p.invalidateQueries({ queryKey: U }), r === "nivaro_addendums" && p.invalidateQueries({ queryKey: ["addendums"] }), ke(p, r, String(t)), _e(p, r, String(t)), N(""), j(null), R(null), ee.success("Transition executed");
|
|
1600
1621
|
},
|
|
1601
1622
|
onError: (m, g) => {
|
|
1602
1623
|
if (xt(m)) {
|
|
1603
1624
|
p.invalidateQueries({ queryKey: U });
|
|
1604
1625
|
return;
|
|
1605
1626
|
}
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1608
|
-
R((
|
|
1609
|
-
payload:
|
|
1627
|
+
const _ = bt(m);
|
|
1628
|
+
if (_) {
|
|
1629
|
+
R(($) => ({
|
|
1630
|
+
payload: _,
|
|
1610
1631
|
transitionId: g.transition_id,
|
|
1611
1632
|
comment: g.comment,
|
|
1612
|
-
revision: ((
|
|
1633
|
+
revision: (($ == null ? void 0 : $.revision) ?? 0) + 1
|
|
1613
1634
|
}));
|
|
1614
1635
|
return;
|
|
1615
1636
|
}
|
|
1616
1637
|
const h = m == null ? void 0 : m.response;
|
|
1617
|
-
ee.error(
|
|
1638
|
+
ee.error(he(m, "Failed to execute transition"), {
|
|
1618
1639
|
duration: 12e3,
|
|
1619
1640
|
// #1867: a refusal carries "Why?" — the role, owner or access rule
|
|
1620
1641
|
// that stopped it, and who can change it.
|
|
1621
1642
|
...ut(m) ? {
|
|
1622
|
-
action: pt(
|
|
1643
|
+
action: pt(q, {
|
|
1623
1644
|
collection: r,
|
|
1624
1645
|
itemId: String(t),
|
|
1625
1646
|
action: "transition",
|
|
1626
1647
|
transitionId: g.transition_id
|
|
1627
1648
|
})
|
|
1628
1649
|
} : {}
|
|
1629
|
-
}), R(null),
|
|
1650
|
+
}), R(null), j(null), ke(p, r, String(t)), _e(p, r, String(t)), (h == null ? void 0 : h.status) === 409 && p.invalidateQueries({ queryKey: U });
|
|
1630
1651
|
}
|
|
1631
|
-
}),
|
|
1632
|
-
|
|
1652
|
+
}), i = ne(M);
|
|
1653
|
+
i.current = M;
|
|
1633
1654
|
const w = ne((b == null ? void 0 : b.available_transitions) ?? []);
|
|
1634
1655
|
if (w.current = (b == null ? void 0 : b.available_transitions) ?? [], ue(() => {
|
|
1635
1656
|
const m = (g) => {
|
|
1636
|
-
const
|
|
1637
|
-
if (!
|
|
1638
|
-
|
|
1639
|
-
const h = String(
|
|
1640
|
-
if (
|
|
1657
|
+
const _ = g.detail;
|
|
1658
|
+
if (!_ || _.claimed || _.collection !== r || String(_.item) !== String(t)) return;
|
|
1659
|
+
_.claimed = !0;
|
|
1660
|
+
const h = String(_.transition_id).toUpperCase(), $ = w.current.find((Q) => String(Q.id).toUpperCase() === h);
|
|
1661
|
+
if (!$) {
|
|
1641
1662
|
ee.error("That step is not available from where the record is now");
|
|
1642
1663
|
return;
|
|
1643
1664
|
}
|
|
1644
|
-
|
|
1665
|
+
i.current($.id);
|
|
1645
1666
|
};
|
|
1646
1667
|
return window.addEventListener(Ne, m), () => window.removeEventListener(Ne, m);
|
|
1647
1668
|
}, [r, t]), !(b != null && b.binding) || !(b != null && b.instance)) return null;
|
|
1648
|
-
const
|
|
1669
|
+
const s = (b.available_transitions ?? []).filter(
|
|
1649
1670
|
(m) => !b.instance.completed_at || m.from_state && String(m.from_state).toUpperCase() === String(b.instance.current_state).toUpperCase()
|
|
1650
1671
|
);
|
|
1651
|
-
if (
|
|
1652
|
-
const
|
|
1653
|
-
for (const m of
|
|
1672
|
+
if (s.length === 0) return null;
|
|
1673
|
+
const v = new Map((b.states ?? []).map((m) => [m.id, m])), k = b.instance.current_state_obj ?? null, A = P ? s.find((m) => m.id === P) : null, W = A ? v.get(A.to_state) : null, c = /* @__PURE__ */ new Map();
|
|
1674
|
+
for (const m of s) {
|
|
1654
1675
|
const g = c.get(m.label) ?? [];
|
|
1655
1676
|
g.push(m), c.set(m.label, g);
|
|
1656
1677
|
}
|
|
1657
1678
|
const y = (m) => [...m].sort(
|
|
1658
|
-
(g,
|
|
1659
|
-
var h,
|
|
1660
|
-
return (((h =
|
|
1679
|
+
(g, _) => {
|
|
1680
|
+
var h, $;
|
|
1681
|
+
return (((h = v.get(g.to_state)) == null ? void 0 : h.sort) ?? 999) - ((($ = v.get(_.to_state)) == null ? void 0 : $.sort) ?? 999);
|
|
1661
1682
|
}
|
|
1662
1683
|
), d = (() => {
|
|
1663
|
-
var
|
|
1664
|
-
const m = (
|
|
1684
|
+
var _, h, $;
|
|
1685
|
+
const m = (_ = C.current) == null ? void 0 : _.getBoundingClientRect();
|
|
1665
1686
|
if (!m) return 600;
|
|
1666
|
-
const g = (
|
|
1687
|
+
const g = ($ = (h = C.current) == null ? void 0 : h.closest('[role="dialog"]')) == null ? void 0 : $.getBoundingClientRect();
|
|
1667
1688
|
return Math.max(260, Math.min(600, m.right - ((g == null ? void 0 : g.left) ?? 0) - 12));
|
|
1668
1689
|
})();
|
|
1669
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
1670
|
-
I ? /* @__PURE__ */ n(
|
|
1690
|
+
return /* @__PURE__ */ n("div", { ref: C, className: "relative", children: [
|
|
1691
|
+
I ? /* @__PURE__ */ n(Pe, { children: [
|
|
1671
1692
|
/* @__PURE__ */ e(Ae, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1672
1693
|
Y,
|
|
1673
1694
|
{
|
|
@@ -1683,10 +1704,10 @@ function Xt({
|
|
|
1683
1704
|
]
|
|
1684
1705
|
}
|
|
1685
1706
|
) }),
|
|
1686
|
-
/* @__PURE__ */ e(
|
|
1687
|
-
([m, g],
|
|
1688
|
-
|
|
1689
|
-
/* @__PURE__ */ n(
|
|
1707
|
+
/* @__PURE__ */ e(Re, { align: "end", className: "min-w-[200px]", children: Array.from(c.entries()).map(
|
|
1708
|
+
([m, g], _, h) => g.length === 1 ? /* @__PURE__ */ n(tt, { children: [
|
|
1709
|
+
_ > 0 && h[_ - 1][1].length > 1 && /* @__PURE__ */ e(nt, {}),
|
|
1710
|
+
/* @__PURE__ */ n(we, { onSelect: () => M(g[0].id), children: [
|
|
1690
1711
|
g[0].color && /* @__PURE__ */ e(
|
|
1691
1712
|
"span",
|
|
1692
1713
|
{
|
|
@@ -1697,38 +1718,38 @@ function Xt({
|
|
|
1697
1718
|
m
|
|
1698
1719
|
] })
|
|
1699
1720
|
] }, m) : /* @__PURE__ */ n(tt, { children: [
|
|
1700
|
-
|
|
1701
|
-
/* @__PURE__ */ e(
|
|
1702
|
-
y(g).map((
|
|
1721
|
+
_ > 0 && /* @__PURE__ */ e(nt, {}),
|
|
1722
|
+
/* @__PURE__ */ e(Bt, { className: "text-[11px] text-muted-foreground", children: m }),
|
|
1723
|
+
y(g).map(($) => {
|
|
1703
1724
|
var Q;
|
|
1704
|
-
return /* @__PURE__ */ n(
|
|
1705
|
-
|
|
1725
|
+
return /* @__PURE__ */ n(we, { onSelect: () => M($.id), children: [
|
|
1726
|
+
$.color && /* @__PURE__ */ e(
|
|
1706
1727
|
"span",
|
|
1707
1728
|
{
|
|
1708
1729
|
className: "mr-2 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
1709
|
-
style: { backgroundColor:
|
|
1730
|
+
style: { backgroundColor: $.color }
|
|
1710
1731
|
}
|
|
1711
1732
|
),
|
|
1712
|
-
((Q =
|
|
1713
|
-
] },
|
|
1733
|
+
((Q = v.get($.to_state)) == null ? void 0 : Q.label) ?? $.to_state
|
|
1734
|
+
] }, $.id);
|
|
1714
1735
|
})
|
|
1715
1736
|
] }, m)
|
|
1716
1737
|
) })
|
|
1717
1738
|
] }) : /* @__PURE__ */ e(
|
|
1718
1739
|
"div",
|
|
1719
1740
|
{
|
|
1720
|
-
className:
|
|
1741
|
+
className: l ? "flex flex-wrap justify-end gap-2" : "flex shrink-0 items-center justify-end gap-2",
|
|
1721
1742
|
children: Array.from(c.entries()).map(([m, g]) => {
|
|
1722
|
-
var Q,
|
|
1723
|
-
const
|
|
1743
|
+
var Q, J;
|
|
1744
|
+
const _ = ((Q = g[0]) == null ? void 0 : Q.color) ?? null, h = g.some((O) => O.id === P), $ = (O) => _ ? O ? { backgroundColor: _, borderColor: _ } : { borderColor: _, color: _ } : void 0;
|
|
1724
1745
|
if (g.length === 1) {
|
|
1725
|
-
const O = g[0], re = S.isPending && ((
|
|
1746
|
+
const O = g[0], re = S.isPending && ((J = S.variables) == null ? void 0 : J.transition_id) === O.id, F = /* @__PURE__ */ n(
|
|
1726
1747
|
Y,
|
|
1727
1748
|
{
|
|
1728
1749
|
size: "sm",
|
|
1729
1750
|
variant: h ? "default" : "outline",
|
|
1730
1751
|
className: "gap-1.5 text-[12px]",
|
|
1731
|
-
style:
|
|
1752
|
+
style: $(h),
|
|
1732
1753
|
disabled: S.isPending,
|
|
1733
1754
|
onClick: () => M(O.id),
|
|
1734
1755
|
children: [
|
|
@@ -1752,14 +1773,14 @@ function Xt({
|
|
|
1752
1773
|
)
|
|
1753
1774
|
] }, m) : F;
|
|
1754
1775
|
}
|
|
1755
|
-
return /* @__PURE__ */ n(
|
|
1776
|
+
return /* @__PURE__ */ n(Pe, { children: [
|
|
1756
1777
|
/* @__PURE__ */ e(Ae, { asChild: !0, children: /* @__PURE__ */ n(
|
|
1757
1778
|
Y,
|
|
1758
1779
|
{
|
|
1759
1780
|
size: "sm",
|
|
1760
1781
|
variant: h ? "default" : "outline",
|
|
1761
1782
|
className: "gap-1.5 text-[12px]",
|
|
1762
|
-
style:
|
|
1783
|
+
style: $(h),
|
|
1763
1784
|
disabled: S.isPending,
|
|
1764
1785
|
children: [
|
|
1765
1786
|
m,
|
|
@@ -1767,9 +1788,9 @@ function Xt({
|
|
|
1767
1788
|
]
|
|
1768
1789
|
}
|
|
1769
1790
|
) }),
|
|
1770
|
-
/* @__PURE__ */ e(
|
|
1791
|
+
/* @__PURE__ */ e(Re, { align: "start", children: y(g).map((O) => {
|
|
1771
1792
|
var re;
|
|
1772
|
-
return /* @__PURE__ */ n(
|
|
1793
|
+
return /* @__PURE__ */ n(we, { onSelect: () => M(O.id), children: [
|
|
1773
1794
|
O.color && /* @__PURE__ */ e(
|
|
1774
1795
|
"span",
|
|
1775
1796
|
{
|
|
@@ -1777,14 +1798,14 @@ function Xt({
|
|
|
1777
1798
|
style: { backgroundColor: O.color }
|
|
1778
1799
|
}
|
|
1779
1800
|
),
|
|
1780
|
-
((re =
|
|
1801
|
+
((re = v.get(O.to_state)) == null ? void 0 : re.label) ?? O.to_state
|
|
1781
1802
|
] }, O.id);
|
|
1782
1803
|
}) })
|
|
1783
1804
|
] }, m);
|
|
1784
1805
|
})
|
|
1785
1806
|
}
|
|
1786
1807
|
),
|
|
1787
|
-
|
|
1808
|
+
P && /* @__PURE__ */ n(
|
|
1788
1809
|
"div",
|
|
1789
1810
|
{
|
|
1790
1811
|
className: "absolute right-0 top-full z-50 mt-1 space-y-3 rounded-lg border border-slate-200 bg-white shadow-lg dark:bg-card dark:border-border p-3.5",
|
|
@@ -1795,7 +1816,7 @@ function Xt({
|
|
|
1795
1816
|
A && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: A.label }),
|
|
1796
1817
|
k && W && /* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
1797
1818
|
/* @__PURE__ */ e(oe, { label: k.label, color: k.color, small: !0 }),
|
|
1798
|
-
/* @__PURE__ */ e(
|
|
1819
|
+
/* @__PURE__ */ e(Fe, { className: "h-3 w-3 shrink-0 text-slate-300" }),
|
|
1799
1820
|
/* @__PURE__ */ e(oe, { label: W.label, color: W.color, small: !0 })
|
|
1800
1821
|
] })
|
|
1801
1822
|
] }),
|
|
@@ -1805,7 +1826,7 @@ function Xt({
|
|
|
1805
1826
|
{
|
|
1806
1827
|
type: "text",
|
|
1807
1828
|
value: f,
|
|
1808
|
-
onChange: (m) =>
|
|
1829
|
+
onChange: (m) => N(m.target.value),
|
|
1809
1830
|
placeholder: String((A == null ? void 0 : A.comment_mode) ?? "") === "required" ? "Add a note (required)" : "Add a comment (optional)",
|
|
1810
1831
|
className: "w-full rounded-md border border-slate-200 bg-white px-3 py-1.5 text-[13px] placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-nvr-cyan/30"
|
|
1811
1832
|
}
|
|
@@ -1818,7 +1839,7 @@ function Xt({
|
|
|
1818
1839
|
size: "sm",
|
|
1819
1840
|
variant: "ghost",
|
|
1820
1841
|
className: "h-7 text-[12px]",
|
|
1821
|
-
onClick: () =>
|
|
1842
|
+
onClick: () => j(null),
|
|
1822
1843
|
children: "Cancel"
|
|
1823
1844
|
}
|
|
1824
1845
|
),
|
|
@@ -1829,13 +1850,13 @@ function Xt({
|
|
|
1829
1850
|
size: "sm",
|
|
1830
1851
|
className: "h-7 gap-1.5 text-[12px]",
|
|
1831
1852
|
disabled: S.isPending || String((A == null ? void 0 : A.comment_mode) ?? "") === "required" && f.trim() === "",
|
|
1832
|
-
onClick: () =>
|
|
1833
|
-
transition_id:
|
|
1853
|
+
onClick: () => B({
|
|
1854
|
+
transition_id: P,
|
|
1834
1855
|
comment: f.trim() || void 0
|
|
1835
1856
|
}),
|
|
1836
1857
|
children: S.isPending ? /* @__PURE__ */ e(se, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ n(de, { children: [
|
|
1837
1858
|
/* @__PURE__ */ e("span", { children: "Confirm" }),
|
|
1838
|
-
/* @__PURE__ */ e(
|
|
1859
|
+
/* @__PURE__ */ e(Ce, { className: "h-3 w-3" })
|
|
1839
1860
|
] })
|
|
1840
1861
|
}
|
|
1841
1862
|
)
|