@nivaro/react 0.3.29 → 0.3.30
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 +59 -47
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/ItemEditForm.js +11 -10
- package/dist/shared/components/item-edit/CatalogPickerField.js +816 -776
- package/dist/shared/components/item-edit/HeaderFreshness.js +58 -57
- package/dist/shared/components/layout-editor/inspector/HeaderItemInspector.js +56 -46
- package/dist/shared/components/panels/PipelinePanel.js +313 -282
- package/package.json +1 -1
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import { jsxs as t, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useState as a, useRef as E, useEffect as g, useCallback as
|
|
3
|
-
import { get as
|
|
4
|
-
import { initials as
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { useState as a, useRef as E, useEffect as g, useCallback as U } from "react";
|
|
3
|
+
import { get as A, del as W, post as F } from "../../../lib/commands.js";
|
|
4
|
+
import { initials as H } from "./HistoryTimeline.js";
|
|
5
|
+
import { UserChip as N } from "../../../shared/components/item-edit/UserChip.js";
|
|
6
|
+
import { userErrorMessage as I } from "../../../shared/lib/safe-error.js";
|
|
7
|
+
function Q({
|
|
7
8
|
collection: l,
|
|
8
9
|
itemId: u,
|
|
9
10
|
states: c,
|
|
10
11
|
client: r
|
|
11
12
|
}) {
|
|
12
|
-
const [f,
|
|
13
|
+
const [f, b] = a([]), [L, B] = a([]), [k, S] = a(!0), [x, h] = a(!1), [s, p] = a(""), [C, m] = a(""), [w, _] = a(!1), [O, $] = a(!1), [j, v] = a(null), i = E(!0);
|
|
13
14
|
g(() => (i.current = !0, () => {
|
|
14
15
|
i.current = !1;
|
|
15
16
|
}), []);
|
|
16
|
-
const
|
|
17
|
+
const d = U(async () => {
|
|
17
18
|
var e;
|
|
18
19
|
if (r)
|
|
19
20
|
try {
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const o = await r.request(
|
|
22
|
+
A(`/pipelines/instance/${l}/${u}/owners`)
|
|
22
23
|
);
|
|
23
|
-
i.current && (
|
|
24
|
+
i.current && (b(o.data ?? []), $(((e = o.meta) == null ? void 0 : e.can_add) === !0));
|
|
24
25
|
} catch {
|
|
25
|
-
i.current &&
|
|
26
|
+
i.current && b([]);
|
|
26
27
|
} finally {
|
|
27
|
-
i.current &&
|
|
28
|
+
i.current && S(!1);
|
|
28
29
|
}
|
|
29
30
|
}, [r, l, u]);
|
|
30
31
|
g(() => {
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
r && r.request(
|
|
34
|
-
i.current &&
|
|
32
|
+
d();
|
|
33
|
+
}, [d]), g(() => {
|
|
34
|
+
r && r.request(A("/users", { limit: 200, sort: "first_name" })).then((e) => {
|
|
35
|
+
i.current && B(e.data ?? []);
|
|
35
36
|
}).catch(() => {
|
|
36
37
|
});
|
|
37
38
|
}, [r]);
|
|
38
|
-
const
|
|
39
|
+
const M = (e) => {
|
|
39
40
|
if (!e) return null;
|
|
40
|
-
const
|
|
41
|
-
return (
|
|
41
|
+
const o = c.find((y) => y.id === e) ?? c.find((y) => y.key === e);
|
|
42
|
+
return (o == null ? void 0 : o.label) ?? e;
|
|
42
43
|
};
|
|
43
|
-
async function
|
|
44
|
-
if (!(!r || !
|
|
45
|
-
|
|
44
|
+
async function R() {
|
|
45
|
+
if (!(!r || !s || w)) {
|
|
46
|
+
_(!0), v(null);
|
|
46
47
|
try {
|
|
47
48
|
await r.request(
|
|
48
|
-
|
|
49
|
-
user:
|
|
49
|
+
F(`/pipelines/instance/${l}/${u}/owners`, {
|
|
50
|
+
user: s,
|
|
50
51
|
state: C || void 0
|
|
51
52
|
})
|
|
52
|
-
), h(!1), p(""),
|
|
53
|
+
), h(!1), p(""), m(""), await d();
|
|
53
54
|
} catch (e) {
|
|
54
|
-
i.current && v(
|
|
55
|
+
i.current && v(I(e, "Failed to add owner"));
|
|
55
56
|
} finally {
|
|
56
|
-
i.current &&
|
|
57
|
+
i.current && _(!1);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
async function q(e) {
|
|
61
62
|
if (r)
|
|
62
63
|
try {
|
|
63
|
-
await r.request(
|
|
64
|
+
await r.request(W(`/pipelines/instance-owners/${e}`)), await d();
|
|
64
65
|
} catch {
|
|
65
66
|
}
|
|
66
67
|
}
|
|
@@ -88,7 +89,7 @@ function K({
|
|
|
88
89
|
}
|
|
89
90
|
),
|
|
90
91
|
"Owners",
|
|
91
|
-
|
|
92
|
+
k ? /* @__PURE__ */ n("span", { "data-nf-skeleton": !0, style: { display: "inline-block", width: 16, height: 10 } }) : /* @__PURE__ */ t("span", { "data-nf-owners-count": !0, children: [
|
|
92
93
|
"(",
|
|
93
94
|
f.length,
|
|
94
95
|
")"
|
|
@@ -118,7 +119,7 @@ function K({
|
|
|
118
119
|
"Add"
|
|
119
120
|
] })
|
|
120
121
|
] }),
|
|
121
|
-
|
|
122
|
+
k ? /* @__PURE__ */ t("div", { "data-nf-owners-loading": !0, children: [
|
|
122
123
|
/* @__PURE__ */ n(
|
|
123
124
|
"span",
|
|
124
125
|
{
|
|
@@ -134,12 +135,23 @@ function K({
|
|
|
134
135
|
}
|
|
135
136
|
)
|
|
136
137
|
] }) : f.length === 0 ? /* @__PURE__ */ n("p", { "data-nf-empty": !0, children: "No owners assigned." }) : /* @__PURE__ */ n("div", { "data-nf-owner-list": !0, children: f.map((e) => /* @__PURE__ */ t("div", { "data-nf-owner-row": !0, children: [
|
|
137
|
-
/* @__PURE__ */ n(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
/* @__PURE__ */ n(N, { userId: e.user, children: /* @__PURE__ */ t(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
"data-nf-owner-person": !0,
|
|
143
|
+
"aria-label": `${[e.first_name, e.last_name].filter(Boolean).join(" ") || e.email} — profile`,
|
|
144
|
+
className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md border-0 bg-transparent p-0 text-left text-inherit [font:inherit] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan",
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ n("span", { "data-nf-owner-avatar": !0, children: H(e.first_name, e.last_name, e.email) }),
|
|
147
|
+
/* @__PURE__ */ t("span", { "data-nf-owner-info": !0, children: [
|
|
148
|
+
/* @__PURE__ */ n("span", { "data-nf-owner-name": !0, children: [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email }),
|
|
149
|
+
/* @__PURE__ */ n("span", { "data-nf-owner-email": !0, children: e.email })
|
|
150
|
+
] })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
) }),
|
|
154
|
+
/* @__PURE__ */ n("span", { "data-nf-owner-scope": !0, children: e.state ? M(e.state) : "all states" }),
|
|
143
155
|
/* @__PURE__ */ n(
|
|
144
156
|
"button",
|
|
145
157
|
{
|
|
@@ -171,18 +183,18 @@ function K({
|
|
|
171
183
|
] }, e.id)) }),
|
|
172
184
|
x && /* @__PURE__ */ t("div", { "data-nf-owners-form": !0, children: [
|
|
173
185
|
/* @__PURE__ */ n("p", { "data-nf-owners-form-title": !0, children: "Add owner" }),
|
|
174
|
-
/* @__PURE__ */ t("select", { value:
|
|
186
|
+
/* @__PURE__ */ t("select", { value: s, onChange: (e) => p(e.target.value), "data-nf-task-input": !0, children: [
|
|
175
187
|
/* @__PURE__ */ n("option", { value: "", children: "Select a user…" }),
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
return /* @__PURE__ */ n("option", { value: e.id, children:
|
|
188
|
+
L.map((e) => {
|
|
189
|
+
const o = [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email;
|
|
190
|
+
return /* @__PURE__ */ n("option", { value: e.id, children: o }, e.id);
|
|
179
191
|
})
|
|
180
192
|
] }),
|
|
181
193
|
/* @__PURE__ */ t(
|
|
182
194
|
"select",
|
|
183
195
|
{
|
|
184
196
|
value: C,
|
|
185
|
-
onChange: (e) =>
|
|
197
|
+
onChange: (e) => m(e.target.value),
|
|
186
198
|
"data-nf-task-input": !0,
|
|
187
199
|
children: [
|
|
188
200
|
/* @__PURE__ */ n("option", { value: "", children: "All states" }),
|
|
@@ -190,7 +202,7 @@ function K({
|
|
|
190
202
|
]
|
|
191
203
|
}
|
|
192
204
|
),
|
|
193
|
-
|
|
205
|
+
j ? /* @__PURE__ */ n("span", { role: "alert", "data-nf-owners-error": !0, children: j }) : null,
|
|
194
206
|
/* @__PURE__ */ t("div", { "data-nf-confirm-actions": !0, children: [
|
|
195
207
|
/* @__PURE__ */ n(
|
|
196
208
|
"button",
|
|
@@ -198,7 +210,7 @@ function K({
|
|
|
198
210
|
type: "button",
|
|
199
211
|
"data-nf-btn-ghost": !0,
|
|
200
212
|
onClick: () => {
|
|
201
|
-
h(!1), p(""),
|
|
213
|
+
h(!1), p(""), m(""), v(null);
|
|
202
214
|
},
|
|
203
215
|
children: "Cancel"
|
|
204
216
|
}
|
|
@@ -208,9 +220,9 @@ function K({
|
|
|
208
220
|
{
|
|
209
221
|
type: "button",
|
|
210
222
|
"data-nf-btn-primary": !0,
|
|
211
|
-
disabled: !
|
|
212
|
-
onClick: () => void
|
|
213
|
-
children:
|
|
223
|
+
disabled: !s || w,
|
|
224
|
+
onClick: () => void R(),
|
|
225
|
+
children: w ? "…" : "Add"
|
|
214
226
|
}
|
|
215
227
|
)
|
|
216
228
|
] })
|
|
@@ -218,5 +230,5 @@ function K({
|
|
|
218
230
|
] });
|
|
219
231
|
}
|
|
220
232
|
export {
|
|
221
|
-
|
|
233
|
+
Q as OwnersSection
|
|
222
234
|
};
|