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