@nivaro/react 0.3.111 → 0.3.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +207 -3
- package/dist/index.js +745 -728
- package/dist/shared/components/CollectionBrowserView.js +3133 -2954
- package/dist/shared/components/CollectionImportBanner.js +135 -0
- package/dist/shared/components/ItemEditForm.js +2235 -2218
- package/dist/shared/components/JobsTray.js +54 -47
- package/dist/shared/components/ViewAsPersonButton.js +109 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
- package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
- package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
- package/dist/shared/components/bulk/bulk-field-options.js +20 -19
- package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
- package/dist/shared/components/cbv/ColumnHeaderMenu.js +130 -0
- package/dist/shared/components/cbv/column-totals.js +163 -0
- package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
- package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
- package/dist/shared/components/collections-directory/directory-data.js +70 -58
- package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
- package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
- package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
- package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
- package/dist/shared/components/item-edit/FieldRow.js +248 -246
- package/dist/shared/components/item-edit/InlineGridField.js +34 -33
- package/dist/shared/components/item-edit/InlineTableField.js +3002 -2825
- package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
- package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
- package/dist/shared/components/item-edit/PlanGrid.js +2 -1
- package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
- package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
- package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
- package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
- package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
- package/dist/shared/components/item-edit/UserChip.js +262 -239
- package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
- package/dist/shared/components/item-edit/grid-search.js +375 -0
- package/dist/shared/components/item-edit/render-stability.js +61 -54
- package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
- package/dist/shared/components/ops-report/DigestSections.js +163 -144
- package/dist/shared/components/ops-report/drill.js +97 -97
- package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
- package/dist/shared/components/panels/AddendumPanel.js +92 -91
- package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
- package/dist/shared/components/panels/CommentPanel.js +265 -252
- package/dist/shared/components/panels/OwnersSlot.js +47 -35
- package/dist/shared/components/panels/PipelineInsight.js +186 -0
- package/dist/shared/components/panels/PipelinePanel.js +1440 -1397
- package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
- package/dist/shared/components/panels/RevisionsPanel.js +261 -260
- package/dist/shared/components/panels/StandInReason.js +69 -0
- package/dist/shared/components/pipeline/FieldPicker.js +41 -40
- package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
- package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
- package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
- package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
- package/dist/shared/components/profile/PersonHeader.js +29 -29
- package/dist/shared/components/profile/PersonProfile.js +30 -28
- package/dist/shared/components/profile/SlowScreensCard.js +286 -0
- package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
- package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
- package/dist/shared/components/support/TicketDetailSheet.js +25 -16
- package/dist/shared/components/support/TicketSlowScreens.js +32 -0
- package/dist/shared/lib/activity-sentence.js +224 -178
- package/dist/shared/lib/collection-import-banner.js +27 -0
- package/dist/shared/lib/crash-report.js +112 -0
- package/dist/shared/lib/export-runs.js +99 -0
- package/dist/shared/lib/jobs-tray.js +89 -67
- package/dist/shared/lib/list-link.js +76 -69
- package/dist/shared/lib/nav-trail.js +180 -76
- package/dist/shared/lib/query-keys.js +26 -0
- package/dist/shared/lib/view-as.js +16 -11
- package/package.json +1 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Settings as
|
|
4
|
-
import { useState as h, useRef as
|
|
2
|
+
import { useQueryClient as ke, useQuery as F, useMutation as I } from "@tanstack/react-query";
|
|
3
|
+
import { Settings as qe, Trash2 as xe, Plus as V, X as Ce, UserPlus as Fe, Loader2 as Y } from "lucide-react";
|
|
4
|
+
import { useState as h, useRef as Ge, useEffect as Se } from "react";
|
|
5
5
|
import { toast as w } from "sonner";
|
|
6
6
|
import { useNivaroClient as fe } from "../../context.js";
|
|
7
|
-
import { get as G, post as W, patch as
|
|
8
|
-
import { describeOwnerGroup as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { get as G, post as W, patch as _e, del as oe } from "../../lib/commands.js";
|
|
8
|
+
import { describeOwnerGroup as $e, sentenceLabelsFromFields as Ie } from "../../lib/config-sentences.js";
|
|
9
|
+
import { queryKeys as ve } from "../../lib/query-keys.js";
|
|
10
|
+
import { useRecordReader as Le } from "../../lib/record-loader.js";
|
|
11
|
+
import { ConfigReadBack as Ee } from "../ConfigReadBack.js";
|
|
12
|
+
import { ConfirmButton as je } from "../profile/primitives.js";
|
|
12
13
|
import { UserAvatar as de } from "../UserAvatar.js";
|
|
13
14
|
import { Button as k } from "../ui/button.js";
|
|
14
|
-
import { Command as
|
|
15
|
+
import { Command as Pe, CommandInput as Oe, CommandList as De, CommandEmpty as Ue, CommandGroup as ze, CommandItem as Ae } from "../ui/command.js";
|
|
15
16
|
import { Input as S } from "../ui/input.js";
|
|
16
17
|
import { Label as C } from "../ui/label.js";
|
|
17
|
-
import { Popover as
|
|
18
|
+
import { Popover as Ke, PopoverTrigger as Re, PopoverContent as Be } from "../ui/popover.js";
|
|
18
19
|
import { SimpleSelect as ce } from "../ui/SimpleSelect.js";
|
|
19
|
-
import { FieldPicker as
|
|
20
|
-
import { findM2ORelation as
|
|
20
|
+
import { FieldPicker as Te } from "./FieldPicker.js";
|
|
21
|
+
import { findM2ORelation as Me, findO2MRelation as Qe, renderDisplayTemplate as Ve } from "./relations.js";
|
|
21
22
|
const ue = {
|
|
22
23
|
string: [
|
|
23
24
|
{ label: "=", value: "eq" },
|
|
@@ -75,22 +76,22 @@ const ue = {
|
|
|
75
76
|
{ label: "≠", value: "neq" }
|
|
76
77
|
]
|
|
77
78
|
};
|
|
78
|
-
function
|
|
79
|
+
function We(t) {
|
|
79
80
|
return ue[t] ?? ue.string;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function Ye({
|
|
82
83
|
relatedCollection: t,
|
|
83
84
|
value: o,
|
|
84
85
|
onChange: x
|
|
85
86
|
}) {
|
|
86
87
|
const d = fe();
|
|
87
|
-
|
|
88
|
-
const [n, f] = h(""), [c, r] = h(!1), [b, g] = h(""), v =
|
|
89
|
-
queryKey:
|
|
88
|
+
Le();
|
|
89
|
+
const [n, f] = h(""), [c, r] = h(!1), [b, g] = h(""), v = Ge(null), { data: m } = F({
|
|
90
|
+
queryKey: ve.collectionMeta(t),
|
|
90
91
|
queryFn: () => d.request(G(`/collections/${t}`)).then((u) => u.data)
|
|
91
92
|
}), s = (m == null ? void 0 : m.display_template) ?? null;
|
|
92
93
|
function N(u) {
|
|
93
|
-
return
|
|
94
|
+
return Ve(s, u);
|
|
94
95
|
}
|
|
95
96
|
const { data: E, isLoading: j } = F({
|
|
96
97
|
queryKey: ["items-picker", t, n],
|
|
@@ -103,7 +104,7 @@ function We({
|
|
|
103
104
|
queryFn: () => d.request(G(`/items/${t}/${o}`)).then((u) => u.data),
|
|
104
105
|
enabled: !!o
|
|
105
106
|
});
|
|
106
|
-
return
|
|
107
|
+
return Se(() => {
|
|
107
108
|
if (!c) return;
|
|
108
109
|
function u(P) {
|
|
109
110
|
v.current && !v.current.contains(P.target) && r(!1);
|
|
@@ -146,12 +147,12 @@ function pe({
|
|
|
146
147
|
onChange: n,
|
|
147
148
|
onRemove: f
|
|
148
149
|
}) {
|
|
149
|
-
const c = o.find((s) => s.field === t.field), r = t.field && d ?
|
|
150
|
+
const c = o.find((s) => s.field === t.field), r = t.field && d ? Me(x, d, t.field) ?? null : null, b = !r && t.field && d ? x.find(
|
|
150
151
|
(s) => s.many_collection === d && s.many_field === t.field && s.junction_field !== null
|
|
151
|
-
) ?? null : null, g = !r && !b && t.field && d ?
|
|
152
|
+
) ?? null : null, g = !r && !b && t.field && d ? Qe(x, d, t.field) ?? null : null, v = (r == null ? void 0 : r.one_collection) ?? (b == null ? void 0 : b.one_collection) ?? (g == null ? void 0 : g.many_collection) ?? null, m = v ? "uuid" : (c == null ? void 0 : c.type) ?? "string";
|
|
152
153
|
return /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
153
154
|
/* @__PURE__ */ e(
|
|
154
|
-
|
|
155
|
+
Te,
|
|
155
156
|
{
|
|
156
157
|
collection: d,
|
|
157
158
|
fields: o,
|
|
@@ -169,7 +170,7 @@ function pe({
|
|
|
169
170
|
value: t.op,
|
|
170
171
|
onChange: (s) => n({ ...t, op: s }),
|
|
171
172
|
className: "h-8 w-[70px] rounded-md border-slate-200 bg-white px-2 text-[13px]",
|
|
172
|
-
options:
|
|
173
|
+
options: We(m).map((s) => ({ value: s.value, label: s.label }))
|
|
173
174
|
}
|
|
174
175
|
),
|
|
175
176
|
m === "boolean" ? /* @__PURE__ */ e(
|
|
@@ -201,7 +202,7 @@ function pe({
|
|
|
201
202
|
className: "h-8 text-[12px] w-[140px]"
|
|
202
203
|
}
|
|
203
204
|
) : v ? /* @__PURE__ */ e(
|
|
204
|
-
|
|
205
|
+
Ye,
|
|
205
206
|
{
|
|
206
207
|
relatedCollection: v,
|
|
207
208
|
value: t.value,
|
|
@@ -227,7 +228,7 @@ function pe({
|
|
|
227
228
|
)
|
|
228
229
|
] });
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function Xe(t) {
|
|
231
232
|
return [t.first_name, t.last_name].filter(Boolean).join(" ").trim() || t.email;
|
|
232
233
|
}
|
|
233
234
|
function L(t) {
|
|
@@ -241,7 +242,7 @@ function me({
|
|
|
241
242
|
placeholder: d = "Select a user…"
|
|
242
243
|
}) {
|
|
243
244
|
const [n, f] = h(!1), c = x.find((r) => r.id === t);
|
|
244
|
-
return /* @__PURE__ */ l(
|
|
245
|
+
return /* @__PURE__ */ l(Ke, { open: n, onOpenChange: f, children: [
|
|
245
246
|
/* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ l(
|
|
246
247
|
"button",
|
|
247
248
|
{
|
|
@@ -277,12 +278,12 @@ function me({
|
|
|
277
278
|
]
|
|
278
279
|
}
|
|
279
280
|
) }),
|
|
280
|
-
/* @__PURE__ */ e(Be, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ l(
|
|
281
|
-
/* @__PURE__ */ e(
|
|
282
|
-
/* @__PURE__ */ l(
|
|
283
|
-
/* @__PURE__ */ e(
|
|
284
|
-
/* @__PURE__ */ e(
|
|
285
|
-
|
|
281
|
+
/* @__PURE__ */ e(Be, { className: "w-[280px] p-0", align: "start", children: /* @__PURE__ */ l(Pe, { children: [
|
|
282
|
+
/* @__PURE__ */ e(Oe, { placeholder: "Search users…", className: "h-8 text-[12px]" }),
|
|
283
|
+
/* @__PURE__ */ l(De, { children: [
|
|
284
|
+
/* @__PURE__ */ e(Ue, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No users found" }),
|
|
285
|
+
/* @__PURE__ */ e(ze, { children: x.map((r) => /* @__PURE__ */ l(
|
|
286
|
+
Ae,
|
|
286
287
|
{
|
|
287
288
|
value: `${L(r)} ${r.email}`,
|
|
288
289
|
onSelect: () => {
|
|
@@ -323,18 +324,18 @@ function he(t) {
|
|
|
323
324
|
const o = ((n = t.first_name) == null ? void 0 : n[0]) ?? "", x = ((f = t.last_name) == null ? void 0 : f[0]) ?? "";
|
|
324
325
|
return (`${o}${x}`.trim() || t.email[0] || "?").toUpperCase();
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function He(t) {
|
|
327
328
|
return !t || t.length === 0 ? "All records" : t.map((o) => `${o.field} ${o.op} ${String(o.value ?? "")}`).join(", ");
|
|
328
329
|
}
|
|
329
|
-
function
|
|
330
|
+
function gt({
|
|
330
331
|
stateId: t,
|
|
331
332
|
stateName: o,
|
|
332
333
|
templateId: x,
|
|
333
334
|
collection: d
|
|
334
335
|
}) {
|
|
335
336
|
var re;
|
|
336
|
-
const n = fe(), f =
|
|
337
|
-
queryKey:
|
|
337
|
+
const n = fe(), f = ke(), { data: c } = F({
|
|
338
|
+
queryKey: ve.collectionMeta(d),
|
|
338
339
|
queryFn: () => n.request(G(`/collections/${d}`)).then((a) => a.data),
|
|
339
340
|
enabled: !!d
|
|
340
341
|
}), r = ((re = c == null ? void 0 : c.fields) == null ? void 0 : re.filter((a) => !a.hidden)) ?? [], b = (c == null ? void 0 : c.relations) ?? [], g = ["pipeline-owner-groups", t], { data: v, isLoading: m } = F({
|
|
@@ -343,25 +344,25 @@ function vt({
|
|
|
343
344
|
}), { data: s } = F({
|
|
344
345
|
queryKey: ["users", "picker"],
|
|
345
346
|
queryFn: () => n.request(G("/users", { limit: 200 })).then((a) => a.data)
|
|
346
|
-
}), N = () => f.invalidateQueries({ queryKey: g }), [E, j] = h(null), [_, u] = h(""), [P, X] = h(!1), [z, O] = h([]), [A, D] = h(""), [
|
|
347
|
+
}), N = () => f.invalidateQueries({ queryKey: g }), [E, j] = h(null), [_, u] = h(""), [P, X] = h(!1), [z, O] = h([]), [A, D] = h(""), [be, H] = h(!1), [J, Z] = h(""), [ee, te] = h(!1), [K, U] = h([]), [R, ae] = h(""), ge = (a) => {
|
|
347
348
|
j(a.id), u(a.name ?? ""), X(a.is_default), O(
|
|
348
349
|
(a.filters ?? []).map((p) => ({ field: p.field, op: p.op, value: String(p.value ?? "") }))
|
|
349
350
|
), D("");
|
|
350
|
-
},
|
|
351
|
+
}, B = () => {
|
|
351
352
|
j(null), D("");
|
|
352
353
|
}, le = () => {
|
|
353
354
|
Z(""), te(!1), U([]), ae(""), H(!1);
|
|
354
355
|
}, se = (a) => a.filter((p) => p.field.trim()).map((p) => ({ field: p.field.trim(), op: p.op, value: p.value })), T = I({
|
|
355
356
|
mutationFn: async () => {
|
|
356
|
-
const a = se(
|
|
357
|
+
const a = se(K), p = await n.request(
|
|
357
358
|
W(`/pipelines/states/${t}/owner-groups`, {
|
|
358
359
|
name: J.trim() || void 0,
|
|
359
360
|
is_default: ee,
|
|
360
361
|
filters: a.length > 0 ? a : void 0
|
|
361
362
|
})
|
|
362
363
|
).then((y) => y.data);
|
|
363
|
-
|
|
364
|
-
W(`/pipelines/owner-groups/${p.id}/users`, { user:
|
|
364
|
+
R && await n.request(
|
|
365
|
+
W(`/pipelines/owner-groups/${p.id}/users`, { user: R })
|
|
365
366
|
);
|
|
366
367
|
},
|
|
367
368
|
onSuccess: () => {
|
|
@@ -370,7 +371,7 @@ function vt({
|
|
|
370
371
|
onError: () => w.error("Failed to create group")
|
|
371
372
|
}), M = I({
|
|
372
373
|
mutationFn: (a) => n.request(
|
|
373
|
-
|
|
374
|
+
_e(`/pipelines/owner-groups/${a}`, {
|
|
374
375
|
name: _.trim() || null,
|
|
375
376
|
is_default: P,
|
|
376
377
|
filters: se(z)
|
|
@@ -380,10 +381,10 @@ function vt({
|
|
|
380
381
|
N(), w.success("Group updated");
|
|
381
382
|
},
|
|
382
383
|
onError: () => w.error("Failed to update group")
|
|
383
|
-
}),
|
|
384
|
+
}), Ne = I({
|
|
384
385
|
mutationFn: (a) => n.request(oe(`/pipelines/owner-groups/${a}`)),
|
|
385
386
|
onSuccess: () => {
|
|
386
|
-
N(),
|
|
387
|
+
N(), B(), w.success("Group deleted");
|
|
387
388
|
},
|
|
388
389
|
onError: () => w.error("Failed to delete group")
|
|
389
390
|
}), ne = I({
|
|
@@ -392,7 +393,7 @@ function vt({
|
|
|
392
393
|
N(), D("");
|
|
393
394
|
},
|
|
394
395
|
onError: () => w.error("Failed to add user")
|
|
395
|
-
}),
|
|
396
|
+
}), ye = I({
|
|
396
397
|
mutationFn: (a) => n.request(oe(`/pipelines/owner-group-users/${a}`)),
|
|
397
398
|
onSuccess: () => N(),
|
|
398
399
|
onError: () => w.error("Failed to remove user")
|
|
@@ -408,15 +409,15 @@ function vt({
|
|
|
408
409
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: a.name || `Group ${p + 1}` }),
|
|
409
410
|
a.is_default && /* @__PURE__ */ e("span", { className: "rounded-full bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-medium text-nvr-cyan", children: "default" })
|
|
410
411
|
] }),
|
|
411
|
-
/* @__PURE__ */ e("p", { className: "font-mono text-[11px] text-slate-400", children:
|
|
412
|
+
/* @__PURE__ */ e("p", { className: "font-mono text-[11px] text-slate-400", children: He(a.filters) }),
|
|
412
413
|
/* @__PURE__ */ e(
|
|
413
|
-
|
|
414
|
+
Ee,
|
|
414
415
|
{
|
|
415
416
|
kind: "owner-group",
|
|
416
|
-
sentences:
|
|
417
|
+
sentences: $e(
|
|
417
418
|
a,
|
|
418
419
|
{ stateLabel: o },
|
|
419
|
-
|
|
420
|
+
Ie(r, b, d)
|
|
420
421
|
)
|
|
421
422
|
}
|
|
422
423
|
),
|
|
@@ -443,16 +444,16 @@ function vt({
|
|
|
443
444
|
"button",
|
|
444
445
|
{
|
|
445
446
|
type: "button",
|
|
446
|
-
onClick: () => y ?
|
|
447
|
+
onClick: () => y ? B() : ge(a),
|
|
447
448
|
className: "rounded p-1 text-slate-400 hover:text-slate-700",
|
|
448
449
|
title: "Edit group",
|
|
449
|
-
children: /* @__PURE__ */ e(
|
|
450
|
+
children: /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" })
|
|
450
451
|
}
|
|
451
452
|
),
|
|
452
453
|
/* @__PURE__ */ e(
|
|
453
|
-
|
|
454
|
+
je,
|
|
454
455
|
{
|
|
455
|
-
onConfirm: () =>
|
|
456
|
+
onConfirm: () => Ne.mutate(a.id),
|
|
456
457
|
title: "Delete group",
|
|
457
458
|
confirmLabel: "Delete?",
|
|
458
459
|
confirmTitle: `Delete group "${a.name || `Group ${p + 1}`}"?`,
|
|
@@ -514,7 +515,7 @@ function vt({
|
|
|
514
515
|
fields: r,
|
|
515
516
|
relations: b,
|
|
516
517
|
collection: d ?? "",
|
|
517
|
-
onChange: ($) => O((ie) => ie.map((Q,
|
|
518
|
+
onChange: ($) => O((ie) => ie.map((Q, we) => we === q ? $ : Q)),
|
|
518
519
|
onRemove: () => O(($) => $.filter((ie, Q) => Q !== q))
|
|
519
520
|
},
|
|
520
521
|
q
|
|
@@ -535,16 +536,16 @@ function vt({
|
|
|
535
536
|
fallback: /* @__PURE__ */ e("span", { className: "flex h-6 w-6 items-center justify-center rounded-full bg-nvr-cyan/10 text-[10px] font-medium text-nvr-cyan", children: he(i) })
|
|
536
537
|
}
|
|
537
538
|
),
|
|
538
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700", children:
|
|
539
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12px] text-slate-700", children: Xe(i) }),
|
|
539
540
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: i.email }),
|
|
540
541
|
/* @__PURE__ */ e(
|
|
541
542
|
"button",
|
|
542
543
|
{
|
|
543
544
|
type: "button",
|
|
544
|
-
onClick: () =>
|
|
545
|
+
onClick: () => ye.mutate(i.link_id),
|
|
545
546
|
className: "rounded p-0.5 text-slate-400 hover:text-red-500",
|
|
546
547
|
title: "Remove user",
|
|
547
|
-
children: /* @__PURE__ */ e(
|
|
548
|
+
children: /* @__PURE__ */ e(Ce, { className: "h-3.5 w-3.5" })
|
|
548
549
|
}
|
|
549
550
|
)
|
|
550
551
|
]
|
|
@@ -571,7 +572,7 @@ function vt({
|
|
|
571
572
|
disabled: !A || ne.isPending,
|
|
572
573
|
onClick: () => ne.mutate({ groupId: a.id, user: A }),
|
|
573
574
|
children: [
|
|
574
|
-
/* @__PURE__ */ e(
|
|
575
|
+
/* @__PURE__ */ e(Fe, { className: "h-3.5 w-3.5" }),
|
|
575
576
|
"Add"
|
|
576
577
|
]
|
|
577
578
|
}
|
|
@@ -586,7 +587,7 @@ function vt({
|
|
|
586
587
|
size: "sm",
|
|
587
588
|
variant: "ghost",
|
|
588
589
|
className: "text-[12px]",
|
|
589
|
-
onClick:
|
|
590
|
+
onClick: B,
|
|
590
591
|
children: "Cancel"
|
|
591
592
|
}
|
|
592
593
|
),
|
|
@@ -605,7 +606,7 @@ function vt({
|
|
|
605
606
|
] })
|
|
606
607
|
] }, a.id);
|
|
607
608
|
}) }),
|
|
608
|
-
|
|
609
|
+
be ? /* @__PURE__ */ l("div", { className: "space-y-3 rounded-lg border border-slate-200 bg-white p-3", children: [
|
|
609
610
|
/* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500", children: "New owner group" }),
|
|
610
611
|
/* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
|
|
611
612
|
/* @__PURE__ */ e(C, { className: "text-[12px]", children: "Name" }),
|
|
@@ -649,8 +650,8 @@ function vt({
|
|
|
649
650
|
}
|
|
650
651
|
)
|
|
651
652
|
] }),
|
|
652
|
-
|
|
653
|
-
|
|
653
|
+
K.length === 0 && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "No filters — applies to all records." }),
|
|
654
|
+
K.map((a, p) => /* @__PURE__ */ e(
|
|
654
655
|
pe,
|
|
655
656
|
{
|
|
656
657
|
row: a,
|
|
@@ -668,7 +669,7 @@ function vt({
|
|
|
668
669
|
/* @__PURE__ */ e(
|
|
669
670
|
me,
|
|
670
671
|
{
|
|
671
|
-
value:
|
|
672
|
+
value: R,
|
|
672
673
|
onChange: ae,
|
|
673
674
|
users: s ?? [],
|
|
674
675
|
placeholder: "Select a user…"
|
|
@@ -716,5 +717,5 @@ function vt({
|
|
|
716
717
|
] });
|
|
717
718
|
}
|
|
718
719
|
export {
|
|
719
|
-
|
|
720
|
+
gt as PipelineStateOwners
|
|
720
721
|
};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const y = "draft:";
|
|
2
|
+
let h = 0;
|
|
3
|
+
const x = () => `${y}${Date.now().toString(36)}${(++h).toString(36)}`, d = () => -(Date.now() % 1e9) - ++h;
|
|
4
|
+
function U(t) {
|
|
5
|
+
const e = {};
|
|
6
|
+
for (const [n, s] of Object.entries(t ?? {}))
|
|
7
|
+
e[n] = s.map((r) => ({
|
|
8
|
+
...r,
|
|
9
|
+
filters: r.filters ? r.filters.map((o) => ({ ...o })) : r.filters,
|
|
10
|
+
users: [...r.users ?? []],
|
|
11
|
+
teams: [...r.teams ?? []]
|
|
12
|
+
}));
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
function g(t, e) {
|
|
16
|
+
return {
|
|
17
|
+
id: x(),
|
|
18
|
+
template: "",
|
|
19
|
+
state: t,
|
|
20
|
+
name: null,
|
|
21
|
+
filters: e,
|
|
22
|
+
sort: 0,
|
|
23
|
+
is_default: !1,
|
|
24
|
+
priority: 0,
|
|
25
|
+
max_wip: null,
|
|
26
|
+
users: [],
|
|
27
|
+
teams: []
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function f(t, e, n) {
|
|
31
|
+
const s = {};
|
|
32
|
+
for (const [r, o] of Object.entries(t))
|
|
33
|
+
s[r] = o.map((i) => i.id === e ? n(i) : i);
|
|
34
|
+
return s;
|
|
35
|
+
}
|
|
36
|
+
function c(t, e, n, s) {
|
|
37
|
+
if (n && Object.values(t).some((o) => o.some((i) => i.id === n)))
|
|
38
|
+
return { map: t, groupId: n };
|
|
39
|
+
const r = g(e, s);
|
|
40
|
+
return { map: { ...t, [e]: [...t[e] ?? [], r] }, groupId: r.id };
|
|
41
|
+
}
|
|
42
|
+
function v(t, e) {
|
|
43
|
+
const { map: n, groupId: s } = c(t, e.stateId, e.groupId, e.filters);
|
|
44
|
+
return f(
|
|
45
|
+
n,
|
|
46
|
+
s,
|
|
47
|
+
(r) => r.users.some((o) => String(o.user).toUpperCase() === String(e.user.id).toUpperCase()) ? r : {
|
|
48
|
+
...r,
|
|
49
|
+
users: [
|
|
50
|
+
...r.users,
|
|
51
|
+
{
|
|
52
|
+
id: d(),
|
|
53
|
+
link_id: d(),
|
|
54
|
+
group: s,
|
|
55
|
+
user: e.user.id,
|
|
56
|
+
first_name: e.user.first_name,
|
|
57
|
+
last_name: e.user.last_name,
|
|
58
|
+
email: e.user.email
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
function I(t, e) {
|
|
65
|
+
const n = {};
|
|
66
|
+
for (const [s, r] of Object.entries(t))
|
|
67
|
+
n[s] = r.map(
|
|
68
|
+
(o) => o.users.some((i) => i.link_id === e) ? { ...o, users: o.users.filter((i) => i.link_id !== e) } : o
|
|
69
|
+
);
|
|
70
|
+
return n;
|
|
71
|
+
}
|
|
72
|
+
function j(t, e) {
|
|
73
|
+
const { map: n, groupId: s } = c(t, e.stateId, e.groupId, e.filters);
|
|
74
|
+
return f(
|
|
75
|
+
n,
|
|
76
|
+
s,
|
|
77
|
+
(r) => (r.teams ?? []).some((o) => o.id === e.team.id) ? r : {
|
|
78
|
+
...r,
|
|
79
|
+
teams: [
|
|
80
|
+
...r.teams ?? [],
|
|
81
|
+
{
|
|
82
|
+
link_id: d(),
|
|
83
|
+
id: e.team.id,
|
|
84
|
+
name: e.team.name,
|
|
85
|
+
slug: e.team.slug ?? "",
|
|
86
|
+
member_count: e.team.member_count
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function C(t, e, n) {
|
|
93
|
+
return f(t, e, (s) => ({
|
|
94
|
+
...s,
|
|
95
|
+
teams: (s.teams ?? []).filter((r) => r.id !== n)
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
function D(t, e, n) {
|
|
99
|
+
return c(t, e, null, n).map;
|
|
100
|
+
}
|
|
101
|
+
function N(t, e, n) {
|
|
102
|
+
return f(t, e, (s) => ({ ...s, ...n }));
|
|
103
|
+
}
|
|
104
|
+
const l = (t) => t.users.map((e) => String(e.user).toUpperCase()).sort().join(","), _ = (t) => (t.teams ?? []).map((e) => e.id).sort((e, n) => e - n).join(",");
|
|
105
|
+
function m(t) {
|
|
106
|
+
const e = /* @__PURE__ */ new Map();
|
|
107
|
+
for (const n of Object.values(t)) for (const s of n) e.set(s.id, s);
|
|
108
|
+
return e;
|
|
109
|
+
}
|
|
110
|
+
const p = (t, e = !1) => ({
|
|
111
|
+
id: t.id,
|
|
112
|
+
state: t.state,
|
|
113
|
+
name: t.name ?? null,
|
|
114
|
+
filters: t.filters ?? null,
|
|
115
|
+
is_default: !!t.is_default,
|
|
116
|
+
priority: Number(t.priority ?? 0) || 0,
|
|
117
|
+
users: t.users.map((n) => String(n.user)),
|
|
118
|
+
teams: (t.teams ?? []).map((n) => n.id),
|
|
119
|
+
...e ? { removed: !0 } : {}
|
|
120
|
+
});
|
|
121
|
+
function O(t, e) {
|
|
122
|
+
if (!e) return [];
|
|
123
|
+
const n = m(t ?? {}), s = m(e), r = [];
|
|
124
|
+
for (const [o, i] of s) {
|
|
125
|
+
const a = n.get(o);
|
|
126
|
+
if (!a) {
|
|
127
|
+
r.push(p(i));
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
(l(a) !== l(i) || _(a) !== _(i) || Number(a.priority ?? 0) !== Number(i.priority ?? 0) || (a.max_wip ?? null) !== (i.max_wip ?? null)) && r.push(p(i));
|
|
131
|
+
}
|
|
132
|
+
for (const [o, i] of n) s.has(o) || r.push(p(i, !0));
|
|
133
|
+
return r;
|
|
134
|
+
}
|
|
135
|
+
function G(t, e) {
|
|
136
|
+
if (!e) return [];
|
|
137
|
+
const n = m(t ?? {}), s = [];
|
|
138
|
+
for (const [r, o] of m(e)) {
|
|
139
|
+
const i = n.get(r);
|
|
140
|
+
if (!i) {
|
|
141
|
+
s.push({
|
|
142
|
+
kind: "create",
|
|
143
|
+
draftId: r,
|
|
144
|
+
stateId: o.state,
|
|
145
|
+
filters: o.filters ?? null,
|
|
146
|
+
priority: Number(o.priority ?? 0) || 0
|
|
147
|
+
}), o.max_wip != null && s.push({ kind: "patch", group: r, body: { max_wip: o.max_wip } });
|
|
148
|
+
for (const u of o.users) s.push({ kind: "add-user", group: r, user: String(u.user) });
|
|
149
|
+
for (const u of o.teams ?? []) s.push({ kind: "add-team", group: r, team: u.id });
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
const a = {};
|
|
153
|
+
Number(i.priority ?? 0) !== Number(o.priority ?? 0) && (a.priority = Number(o.priority ?? 0)), (i.max_wip ?? null) !== (o.max_wip ?? null) && (a.max_wip = o.max_wip ?? null), Object.keys(a).length > 0 && s.push({ kind: "patch", group: r, body: a });
|
|
154
|
+
const b = new Set(i.users.map((u) => String(u.user).toUpperCase())), w = new Set(o.users.map((u) => String(u.user).toUpperCase()));
|
|
155
|
+
for (const u of i.users)
|
|
156
|
+
w.has(String(u.user).toUpperCase()) || s.push({ kind: "remove-user", linkId: u.link_id });
|
|
157
|
+
for (const u of o.users)
|
|
158
|
+
b.has(String(u.user).toUpperCase()) || s.push({ kind: "add-user", group: r, user: String(u.user) });
|
|
159
|
+
const S = new Set((i.teams ?? []).map((u) => u.id)), k = new Set((o.teams ?? []).map((u) => u.id));
|
|
160
|
+
for (const u of i.teams ?? [])
|
|
161
|
+
k.has(u.id) || s.push({ kind: "remove-team", group: r, team: u.id });
|
|
162
|
+
for (const u of o.teams ?? [])
|
|
163
|
+
S.has(u.id) || s.push({ kind: "add-team", group: r, team: u.id });
|
|
164
|
+
}
|
|
165
|
+
return s;
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
y as DRAFT_ID_PREFIX,
|
|
169
|
+
U as cloneGroupsMap,
|
|
170
|
+
j as draftAddTeam,
|
|
171
|
+
v as draftAddUser,
|
|
172
|
+
D as draftCreateGroup,
|
|
173
|
+
O as draftDelta,
|
|
174
|
+
N as draftPatchGroup,
|
|
175
|
+
C as draftRemoveTeam,
|
|
176
|
+
I as draftRemoveUser,
|
|
177
|
+
G as draftSaveOps
|
|
178
|
+
};
|