@nivaro/react 0.3.94 → 0.3.96
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/shared/components/NotificationBell.js +1 -1
- package/dist/shared/components/chat/ChatMessageToast.js +248 -0
- package/dist/shared/components/chat/chat-core.js +415 -381
- package/dist/shared/components/item-edit/FieldAffordances.js +285 -278
- package/dist/shared/components/item-edit/FieldRow.js +53 -52
- package/dist/shared/components/item-edit/InlineTableField.js +1 -0
- package/dist/shared/components/item-edit/RuleProvenancePopover.js +61 -53
- package/dist/shared/components/item-edit/useRecordLabels.js +44 -0
- package/dist/shared/components/notifications/NotificationDetailBits.js +55 -55
- package/dist/shared/components/ops-report/SettingsPanel.js +44 -41
- package/dist/shared/components/ops-report/drill.js +263 -177
- package/dist/shared/components/panels/PipelinePanel.js +175 -178
- package/dist/shared/components/support/ReportProblem.js +10 -10
- package/dist/shared/components/support/SupportRequestDialog.js +11 -11
- package/dist/shared/components/support/TicketDetailSheet.js +114 -109
- package/dist/shared/components/support/support-context.js +14 -9
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as s, jsx as a, Fragment as k } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as y } from "@tanstack/react-query";
|
|
3
3
|
import { ChevronDown as v, HelpCircle as L } from "lucide-react";
|
|
4
4
|
import { useState as C } from "react";
|
|
@@ -8,8 +8,8 @@ import { cn as f } from "../../lib/utils.js";
|
|
|
8
8
|
import { changeLines as $ } from "./changes-lines.js";
|
|
9
9
|
import { describeDelivery as q } from "./DeliveryChips.js";
|
|
10
10
|
import { WHY_KIND_LABELS as _, whyLines as S, whyChangeLinks as W, WHY_LAYER_LABELS as D } from "./why-lines.js";
|
|
11
|
-
function E({ layer: t, role:
|
|
12
|
-
return /* @__PURE__ */
|
|
11
|
+
function E({ layer: t, role: d }) {
|
|
12
|
+
return /* @__PURE__ */ s(
|
|
13
13
|
"span",
|
|
14
14
|
{
|
|
15
15
|
"data-why-layer": t,
|
|
@@ -21,26 +21,26 @@ function E({ layer: t, role: i }) {
|
|
|
21
21
|
),
|
|
22
22
|
children: [
|
|
23
23
|
D[t],
|
|
24
|
-
t === "role" &&
|
|
24
|
+
t === "role" && d ? ` · ${d}` : ""
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
function P({ c: t }) {
|
|
30
|
-
return /* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ s(
|
|
31
31
|
"li",
|
|
32
32
|
{
|
|
33
33
|
className: "flex flex-wrap items-baseline gap-x-1.5 text-[11px] leading-snug",
|
|
34
34
|
"data-change-field": t.field,
|
|
35
35
|
children: [
|
|
36
36
|
/* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: t.label }),
|
|
37
|
-
t.diff ? /* @__PURE__ */
|
|
37
|
+
t.diff ? /* @__PURE__ */ s("span", { className: "min-w-0 whitespace-pre-wrap break-words text-slate-600 dark:text-slate-300", children: [
|
|
38
38
|
t.diff.lead,
|
|
39
39
|
t.diff.removed && /* @__PURE__ */ a("span", { className: "rounded-sm bg-red-50 text-red-700 line-through decoration-red-300 dark:bg-red-500/15 dark:text-red-300", children: t.diff.removed }),
|
|
40
40
|
t.diff.added && /* @__PURE__ */ a("span", { className: "rounded-sm bg-emerald-50 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300", children: t.diff.added }),
|
|
41
41
|
t.diff.trail
|
|
42
|
-
] }) : /* @__PURE__ */
|
|
43
|
-
t.old !== "" && /* @__PURE__ */
|
|
42
|
+
] }) : /* @__PURE__ */ s(k, { children: [
|
|
43
|
+
t.old !== "" && /* @__PURE__ */ s(k, { children: [
|
|
44
44
|
/* @__PURE__ */ a("span", { className: "text-slate-400 line-through decoration-slate-300", children: t.old }),
|
|
45
45
|
/* @__PURE__ */ a("span", { className: "text-slate-300", children: "→" })
|
|
46
46
|
] }),
|
|
@@ -52,98 +52,98 @@ function P({ c: t }) {
|
|
|
52
52
|
}
|
|
53
53
|
function T({
|
|
54
54
|
notificationId: t,
|
|
55
|
-
className:
|
|
55
|
+
className: d
|
|
56
56
|
}) {
|
|
57
|
-
const h = N(), { data:
|
|
57
|
+
const h = N(), { data: i, isLoading: x, isError: c } = y({
|
|
58
58
|
queryKey: ["notification-changes", t],
|
|
59
59
|
staleTime: 6e4,
|
|
60
60
|
retry: !1,
|
|
61
61
|
queryFn: () => h.request(
|
|
62
62
|
w(`/notifications/${t}/changes`)
|
|
63
|
-
).then((
|
|
64
|
-
}), m = $(
|
|
65
|
-
return /* @__PURE__ */
|
|
63
|
+
).then((r) => r.data)
|
|
64
|
+
}), m = $(i);
|
|
65
|
+
return /* @__PURE__ */ s(
|
|
66
66
|
"ul",
|
|
67
67
|
{
|
|
68
68
|
className: f(
|
|
69
69
|
"mt-1 space-y-0.5 rounded-md border border-slate-100 bg-slate-50/70 px-2 py-1.5 dark:border-border/60 dark:bg-muted/40",
|
|
70
|
-
|
|
70
|
+
d
|
|
71
71
|
),
|
|
72
72
|
"data-notification-changes-list": !0,
|
|
73
73
|
"data-changes-source": "reader",
|
|
74
74
|
children: [
|
|
75
75
|
x && /* @__PURE__ */ a("li", { className: "text-[10.5px] text-slate-400", children: "Loading what changed…" }),
|
|
76
76
|
c && /* @__PURE__ */ a("li", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children: "You can't open this record now, so its changes are not shown." }),
|
|
77
|
-
|
|
78
|
-
m.map((
|
|
77
|
+
i && m.length === 0 && /* @__PURE__ */ a("li", { className: "text-[10.5px] text-slate-500 dark:text-slate-400", children: i.note ?? (i.first_revision ? "The record was created — there is no earlier version to compare." : "No changes to fields you can see.") }),
|
|
78
|
+
m.map((r) => /* @__PURE__ */ a(P, { c: r }, r.field))
|
|
79
79
|
]
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
function Y({
|
|
84
84
|
notificationId: t,
|
|
85
|
-
why:
|
|
85
|
+
why: d,
|
|
86
86
|
delivery: h,
|
|
87
|
-
subscriptionsPath:
|
|
87
|
+
subscriptionsPath: i,
|
|
88
88
|
rulesPath: x,
|
|
89
89
|
onNavigate: c
|
|
90
90
|
}) {
|
|
91
|
-
var
|
|
92
|
-
const m = N(), { data:
|
|
91
|
+
var p;
|
|
92
|
+
const m = N(), { data: r, isLoading: b } = y({
|
|
93
93
|
queryKey: ["notification-why", t],
|
|
94
94
|
enabled: t != null,
|
|
95
95
|
staleTime: 6e4,
|
|
96
96
|
queryFn: () => m.request(w(`/notifications/${t}/why`)).then((e) => e.data)
|
|
97
|
-
}), l = (
|
|
98
|
-
return /* @__PURE__ */
|
|
97
|
+
}), l = (r == null ? void 0 : r.reason) ?? null, o = (l == null ? void 0 : l.path) ?? (r == null ? void 0 : r.why) ?? d ?? null, n = (o == null ? void 0 : o.kind) ?? "rules", u = ((p = l == null ? void 0 : l.role) == null ? void 0 : p.name) ?? null;
|
|
98
|
+
return /* @__PURE__ */ s(
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
101
101
|
className: "mt-1 rounded-md border border-slate-100 bg-slate-50/70 px-2 py-1.5 text-[11px] leading-snug dark:border-border/60 dark:bg-muted/40",
|
|
102
102
|
"data-notification-why-panel": !0,
|
|
103
|
-
"data-why-recorded":
|
|
103
|
+
"data-why-recorded": r ? String(r.recorded) : void 0,
|
|
104
104
|
children: [
|
|
105
|
-
o && /* @__PURE__ */
|
|
105
|
+
o && /* @__PURE__ */ s("p", { className: "text-slate-700 dark:text-slate-200", children: [
|
|
106
106
|
/* @__PURE__ */ a("span", { className: "mr-1 rounded bg-slate-200/70 px-1 text-[9.5px] font-semibold uppercase tracking-wide text-slate-600 dark:bg-slate-700 dark:text-slate-300", children: _[n] ?? n }),
|
|
107
107
|
o.text,
|
|
108
|
-
o.label && n !== "watch" && n !== "role_default" && /* @__PURE__ */
|
|
108
|
+
o.label && n !== "watch" && n !== "role_default" && /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
109
109
|
" · ",
|
|
110
110
|
o.label
|
|
111
111
|
] })
|
|
112
112
|
] }),
|
|
113
113
|
b && t != null && /* @__PURE__ */ a("p", { className: "mt-1 text-[10.5px] text-slate-400", children: "Looking up why…" }),
|
|
114
|
-
|
|
115
|
-
l ? /* @__PURE__ */
|
|
114
|
+
r && !r.recorded && /* @__PURE__ */ a("p", { className: "mt-1 text-[10.5px] italic text-slate-500 dark:text-slate-400", "data-why-legacy": !0, children: "Sent before reasons were recorded." }),
|
|
115
|
+
l ? /* @__PURE__ */ s(
|
|
116
116
|
"ul",
|
|
117
117
|
{
|
|
118
118
|
className: "mt-1 space-y-px text-[10.5px] text-slate-500 dark:text-slate-400",
|
|
119
119
|
"data-why-rules": !0,
|
|
120
120
|
children: [
|
|
121
|
-
l.critical && /* @__PURE__ */
|
|
121
|
+
l.critical && /* @__PURE__ */ s("li", { children: [
|
|
122
122
|
/* @__PURE__ */ a("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: "Critical:" }),
|
|
123
123
|
" ",
|
|
124
124
|
"mutes, quiet hours and your rules are bypassed."
|
|
125
125
|
] }),
|
|
126
|
-
S(l).map((e) => /* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
126
|
+
S(l).map((e) => /* @__PURE__ */ s("li", { "data-why-channel": e.key, children: [
|
|
127
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: [
|
|
128
128
|
e.label,
|
|
129
129
|
":"
|
|
130
130
|
] }),
|
|
131
131
|
" ",
|
|
132
132
|
e.outcome,
|
|
133
133
|
e.rule ? ` — ${e.rule}` : "",
|
|
134
|
-
e.layer && /* @__PURE__ */ a(E, { layer: e.layer, role:
|
|
134
|
+
e.layer && /* @__PURE__ */ a(E, { layer: e.layer, role: u })
|
|
135
135
|
] }, e.key))
|
|
136
136
|
]
|
|
137
137
|
}
|
|
138
|
-
) : /* @__PURE__ */ a("ul", { className: "mt-1 space-y-px text-[10.5px] text-slate-500 dark:text-slate-400", children: q((
|
|
139
|
-
/* @__PURE__ */
|
|
138
|
+
) : /* @__PURE__ */ a("ul", { className: "mt-1 space-y-px text-[10.5px] text-slate-500 dark:text-slate-400", children: q((r == null ? void 0 : r.delivery) ?? h).map((e) => /* @__PURE__ */ s("li", { children: [
|
|
139
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: [
|
|
140
140
|
e.label,
|
|
141
141
|
":"
|
|
142
142
|
] }),
|
|
143
143
|
" ",
|
|
144
144
|
e.tip
|
|
145
145
|
] }, e.key)) }),
|
|
146
|
-
/* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-x-3", children: c && W(n, { subscriptionsPath:
|
|
146
|
+
/* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-x-3", children: c && W(n, { subscriptionsPath: i, rulesPath: x }).map((e) => /* @__PURE__ */ a(
|
|
147
147
|
"button",
|
|
148
148
|
{
|
|
149
149
|
type: "button",
|
|
@@ -162,28 +162,28 @@ function Y({
|
|
|
162
162
|
}
|
|
163
163
|
function G({
|
|
164
164
|
detail: t,
|
|
165
|
-
why:
|
|
165
|
+
why: d,
|
|
166
166
|
delivery: h,
|
|
167
|
-
notificationId:
|
|
167
|
+
notificationId: i,
|
|
168
168
|
recordChanges: x,
|
|
169
169
|
subscriptionsPath: c,
|
|
170
170
|
rulesPath: m,
|
|
171
|
-
onNavigate:
|
|
171
|
+
onNavigate: r,
|
|
172
172
|
className: b
|
|
173
173
|
}) {
|
|
174
|
-
const [l, o] = C(null), n = (t == null ? void 0 : t.changes) ?? [],
|
|
175
|
-
return /* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
(n.length > 0 ||
|
|
174
|
+
const [l, o] = C(null), n = (t == null ? void 0 : t.changes) ?? [], u = !!x && i != null, p = (e) => o((g) => g === e ? null : e);
|
|
175
|
+
return /* @__PURE__ */ s("div", { className: f("text-[10.5px]", b), "data-notification-bits": !0, children: [
|
|
176
|
+
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
177
|
+
(n.length > 0 || u) && /* @__PURE__ */ s(
|
|
178
178
|
"button",
|
|
179
179
|
{
|
|
180
180
|
type: "button",
|
|
181
181
|
onClick: (e) => {
|
|
182
|
-
e.stopPropagation(),
|
|
182
|
+
e.stopPropagation(), p("changes");
|
|
183
183
|
},
|
|
184
184
|
"aria-expanded": l === "changes",
|
|
185
185
|
"data-notification-changes": !0,
|
|
186
|
-
className: "inline-flex items-center gap-
|
|
186
|
+
className: "-ml-1.5 inline-flex h-6 items-center gap-1 rounded-md px-1.5 font-medium text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:text-slate-400 dark:hover:bg-muted dark:hover:text-slate-100",
|
|
187
187
|
children: [
|
|
188
188
|
n.length > 0 ? `${n.length} change${n.length === 1 ? "" : "s"}` : "What changed",
|
|
189
189
|
/* @__PURE__ */ a(
|
|
@@ -195,37 +195,37 @@ function G({
|
|
|
195
195
|
]
|
|
196
196
|
}
|
|
197
197
|
),
|
|
198
|
-
(
|
|
198
|
+
(d || i != null) && /* @__PURE__ */ s(
|
|
199
199
|
"button",
|
|
200
200
|
{
|
|
201
201
|
type: "button",
|
|
202
202
|
onClick: (e) => {
|
|
203
|
-
e.stopPropagation(),
|
|
203
|
+
e.stopPropagation(), p("why");
|
|
204
204
|
},
|
|
205
205
|
"aria-expanded": l === "why",
|
|
206
206
|
"data-notification-why": !0,
|
|
207
|
-
className: "inline-flex items-center gap-
|
|
207
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md px-1.5 font-medium text-slate-500 transition-colors first:-ml-1.5 hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:text-slate-400 dark:hover:bg-muted dark:hover:text-slate-100",
|
|
208
208
|
children: [
|
|
209
|
-
/* @__PURE__ */ a(L, { className: "h-3 w-3" }),
|
|
209
|
+
/* @__PURE__ */ a(L, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
210
210
|
"Why?"
|
|
211
211
|
]
|
|
212
212
|
}
|
|
213
213
|
)
|
|
214
214
|
] }),
|
|
215
|
-
l === "changes" &&
|
|
216
|
-
l === "changes" && !
|
|
215
|
+
l === "changes" && u && i != null && /* @__PURE__ */ a(T, { notificationId: i }),
|
|
216
|
+
l === "changes" && !u && /* @__PURE__ */ s(
|
|
217
217
|
"ul",
|
|
218
218
|
{
|
|
219
219
|
className: "mt-1 space-y-0.5 rounded-md border border-slate-100 bg-slate-50/70 px-2 py-1.5 dark:border-border/60 dark:bg-muted/40",
|
|
220
220
|
"data-notification-changes-list": !0,
|
|
221
221
|
children: [
|
|
222
|
-
n.slice(0, 20).map((e, g) => /* @__PURE__ */
|
|
222
|
+
n.slice(0, 20).map((e, g) => /* @__PURE__ */ s(
|
|
223
223
|
"li",
|
|
224
224
|
{
|
|
225
225
|
className: "flex flex-wrap items-baseline gap-x-1.5 text-[11px] leading-snug",
|
|
226
226
|
children: [
|
|
227
227
|
/* @__PURE__ */ a("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: e.label }),
|
|
228
|
-
e.old !== "" && /* @__PURE__ */
|
|
228
|
+
e.old !== "" && /* @__PURE__ */ s(k, { children: [
|
|
229
229
|
/* @__PURE__ */ a("span", { className: "text-slate-400 line-through decoration-slate-300", children: e.old }),
|
|
230
230
|
/* @__PURE__ */ a("span", { className: "text-slate-300", children: "→" })
|
|
231
231
|
] }),
|
|
@@ -234,7 +234,7 @@ function G({
|
|
|
234
234
|
},
|
|
235
235
|
`${e.field}-${g}`
|
|
236
236
|
)),
|
|
237
|
-
n.length > 20 && /* @__PURE__ */
|
|
237
|
+
n.length > 20 && /* @__PURE__ */ s("li", { className: "text-[10.5px] text-slate-400", children: [
|
|
238
238
|
"+",
|
|
239
239
|
n.length - 20,
|
|
240
240
|
" more"
|
|
@@ -245,12 +245,12 @@ function G({
|
|
|
245
245
|
l === "why" && /* @__PURE__ */ a(
|
|
246
246
|
Y,
|
|
247
247
|
{
|
|
248
|
-
notificationId:
|
|
249
|
-
why:
|
|
248
|
+
notificationId: i,
|
|
249
|
+
why: d,
|
|
250
250
|
delivery: h,
|
|
251
251
|
subscriptionsPath: c,
|
|
252
252
|
rulesPath: m,
|
|
253
|
-
onNavigate:
|
|
253
|
+
onNavigate: r
|
|
254
254
|
}
|
|
255
255
|
)
|
|
256
256
|
] });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as h, jsx as t, Fragment as E } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as T, useQuery as j, useMutation as O } from "@tanstack/react-query";
|
|
3
3
|
import { Settings2 as W } from "lucide-react";
|
|
4
4
|
import { useState as w, useEffect as q } from "react";
|
|
@@ -20,18 +20,18 @@ const S = [
|
|
|
20
20
|
"model",
|
|
21
21
|
"token_cap"
|
|
22
22
|
];
|
|
23
|
-
function Q(
|
|
24
|
-
var x,
|
|
25
|
-
const r =
|
|
26
|
-
if (
|
|
23
|
+
function Q(c) {
|
|
24
|
+
var x, b, o, g, y, p;
|
|
25
|
+
const r = c, d = ((x = r == null ? void 0 : r.response) == null ? void 0 : x.fields) ?? ((b = r == null ? void 0 : r.body) == null ? void 0 : b.fields);
|
|
26
|
+
if (d && typeof d == "object") {
|
|
27
27
|
const a = {}, n = [];
|
|
28
|
-
for (const [e,
|
|
29
|
-
S.includes(e) ? a[e] = String(
|
|
28
|
+
for (const [e, l] of Object.entries(d))
|
|
29
|
+
S.includes(e) ? a[e] = String(l) : n.push(String(l));
|
|
30
30
|
return { byField: a, rest: n };
|
|
31
31
|
}
|
|
32
32
|
const i = [
|
|
33
33
|
(o = r == null ? void 0 : r.response) == null ? void 0 : o.message,
|
|
34
|
-
(
|
|
34
|
+
(g = r == null ? void 0 : r.body) == null ? void 0 : g.message,
|
|
35
35
|
(y = r == null ? void 0 : r.response) == null ? void 0 : y.error,
|
|
36
36
|
(p = r == null ? void 0 : r.body) == null ? void 0 : p.error,
|
|
37
37
|
r == null ? void 0 : r.message
|
|
@@ -42,7 +42,7 @@ function Q(d) {
|
|
|
42
42
|
}
|
|
43
43
|
return { byField: s, rest: f };
|
|
44
44
|
}
|
|
45
|
-
function R(
|
|
45
|
+
function R(c) {
|
|
46
46
|
return {
|
|
47
47
|
enabled: "The nightly report",
|
|
48
48
|
window_start_hour: "Window start",
|
|
@@ -51,46 +51,46 @@ function R(d) {
|
|
|
51
51
|
notify: "Notification",
|
|
52
52
|
model: "Model",
|
|
53
53
|
token_cap: "Token cap"
|
|
54
|
-
}[
|
|
54
|
+
}[c];
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
label:
|
|
56
|
+
function m({
|
|
57
|
+
label: c,
|
|
58
58
|
hint: r,
|
|
59
|
-
error:
|
|
59
|
+
error: d,
|
|
60
60
|
children: u
|
|
61
61
|
}) {
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */ t("div", { className: "text-[12.5px] font-medium text-slate-800 dark:text-foreground", children:
|
|
62
|
+
return /* @__PURE__ */ h("div", { className: "space-y-1", children: [
|
|
63
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-between gap-3", children: [
|
|
64
|
+
/* @__PURE__ */ h("div", { className: "min-w-0", children: [
|
|
65
|
+
/* @__PURE__ */ t("div", { className: "text-[12.5px] font-medium text-slate-800 dark:text-foreground", children: c }),
|
|
66
66
|
r && /* @__PURE__ */ t("div", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: r })
|
|
67
67
|
] }),
|
|
68
68
|
u
|
|
69
69
|
] }),
|
|
70
|
-
|
|
70
|
+
d && /* @__PURE__ */ t("p", { role: "alert", className: "text-[11.5px] text-red-600 dark:text-red-400", children: d })
|
|
71
71
|
] });
|
|
72
72
|
}
|
|
73
73
|
function re() {
|
|
74
|
-
const
|
|
74
|
+
const c = P(), r = T(), [d, u] = w(!1), i = j({
|
|
75
75
|
queryKey: ["ops-report-settings"],
|
|
76
|
-
enabled:
|
|
77
|
-
queryFn: () =>
|
|
78
|
-
}), [s, f] = w(null), [x,
|
|
76
|
+
enabled: d,
|
|
77
|
+
queryFn: () => c.request(M("/ops-reports/settings")).then((e) => e.data)
|
|
78
|
+
}), [s, f] = w(null), [x, b] = w(""), [o, g] = w({ byField: {}, rest: [] }), [y, p] = w(null);
|
|
79
79
|
q(() => {
|
|
80
|
-
i.data && (f(i.data),
|
|
80
|
+
i.data && (f(i.data), b(String(i.data.token_cap)));
|
|
81
81
|
}, [i.data]);
|
|
82
82
|
const a = O({
|
|
83
|
-
mutationFn: (e) =>
|
|
83
|
+
mutationFn: (e) => c.request(B("/ops-reports/settings", e)),
|
|
84
84
|
onSuccess: (e) => {
|
|
85
|
-
|
|
85
|
+
g({ byField: {}, rest: [] }), p(null), r.setQueryData(["ops-report-settings"], e.data), u(!1);
|
|
86
86
|
},
|
|
87
87
|
onError: (e) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const l = Q(e);
|
|
89
|
+
g(l), e.status === 400 && (Object.keys(l.byField).length || l.rest.length) ? p(null) : (p(e), z(e, "Could not save the settings"));
|
|
90
90
|
}
|
|
91
|
-
}), n = (e,
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */ t(I, { asChild: !0, children: /* @__PURE__ */
|
|
91
|
+
}), n = (e, l) => f((_) => _ && { ..._, [e]: l });
|
|
92
|
+
return /* @__PURE__ */ h(D, { open: d, onOpenChange: u, children: [
|
|
93
|
+
/* @__PURE__ */ t(I, { asChild: !0, children: /* @__PURE__ */ h(
|
|
94
94
|
k,
|
|
95
95
|
{
|
|
96
96
|
variant: "outline",
|
|
@@ -104,8 +104,8 @@ function re() {
|
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
) }),
|
|
107
|
-
/* @__PURE__ */ t(L, { align: "end", className: "w-[340px] space-y-3 p-4", children: i.isLoading || !s ? i.error ? /* @__PURE__ */ t(C, { error: i.error, what: "the settings", onRetry: () => void i.refetch() }) : /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500", children: "Loading…" }) : /* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */ t(
|
|
107
|
+
/* @__PURE__ */ t(L, { align: "end", className: "w-[340px] space-y-3 p-4", children: i.isLoading || !s ? i.error ? /* @__PURE__ */ t(C, { error: i.error, what: "the settings", onRetry: () => void i.refetch() }) : /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500", children: "Loading…" }) : /* @__PURE__ */ h(E, { children: [
|
|
108
|
+
/* @__PURE__ */ t(m, { label: "Nightly report", hint: "Run now always works.", error: o.byField.enabled, children: /* @__PURE__ */ t(
|
|
109
109
|
F,
|
|
110
110
|
{
|
|
111
111
|
checked: s.enabled,
|
|
@@ -114,7 +114,7 @@ function re() {
|
|
|
114
114
|
}
|
|
115
115
|
) }),
|
|
116
116
|
/* @__PURE__ */ t(
|
|
117
|
-
|
|
117
|
+
m,
|
|
118
118
|
{
|
|
119
119
|
label: "Window starts (hour)",
|
|
120
120
|
hint: "0 to 23, instance time",
|
|
@@ -137,7 +137,7 @@ function re() {
|
|
|
137
137
|
}
|
|
138
138
|
),
|
|
139
139
|
/* @__PURE__ */ t(
|
|
140
|
-
|
|
140
|
+
m,
|
|
141
141
|
{
|
|
142
142
|
label: "Window ends (hour)",
|
|
143
143
|
hint: "1 to 24, after the start",
|
|
@@ -159,7 +159,7 @@ function re() {
|
|
|
159
159
|
)
|
|
160
160
|
}
|
|
161
161
|
),
|
|
162
|
-
/* @__PURE__ */ t(
|
|
162
|
+
/* @__PURE__ */ t(m, { label: "Email administrators", error: o.byField.email, children: /* @__PURE__ */ t(
|
|
163
163
|
F,
|
|
164
164
|
{
|
|
165
165
|
checked: s.email,
|
|
@@ -168,7 +168,7 @@ function re() {
|
|
|
168
168
|
}
|
|
169
169
|
) }),
|
|
170
170
|
/* @__PURE__ */ t(
|
|
171
|
-
|
|
171
|
+
m,
|
|
172
172
|
{
|
|
173
173
|
label: "Notify administrators",
|
|
174
174
|
hint: "Off = this page only",
|
|
@@ -184,7 +184,7 @@ function re() {
|
|
|
184
184
|
}
|
|
185
185
|
),
|
|
186
186
|
/* @__PURE__ */ t(
|
|
187
|
-
|
|
187
|
+
m,
|
|
188
188
|
{
|
|
189
189
|
label: "Model",
|
|
190
190
|
hint: "Blank = the AI settings’ chat model",
|
|
@@ -202,7 +202,7 @@ function re() {
|
|
|
202
202
|
}
|
|
203
203
|
),
|
|
204
204
|
/* @__PURE__ */ t(
|
|
205
|
-
|
|
205
|
+
m,
|
|
206
206
|
{
|
|
207
207
|
label: "Token cap",
|
|
208
208
|
hint: "20,000 to 5,000,000 per run",
|
|
@@ -213,7 +213,7 @@ function re() {
|
|
|
213
213
|
inputMode: "numeric",
|
|
214
214
|
value: x,
|
|
215
215
|
onChange: (e) => {
|
|
216
|
-
|
|
216
|
+
b(e.target.value), n("token_cap", Number(e.target.value.replace(/[^\d]/g, "")));
|
|
217
217
|
},
|
|
218
218
|
"aria-label": "Token cap",
|
|
219
219
|
className: v(
|
|
@@ -226,7 +226,7 @@ function re() {
|
|
|
226
226
|
),
|
|
227
227
|
o.rest.length > 0 && /* @__PURE__ */ t("ul", { role: "alert", className: "space-y-0.5 text-[11.5px] text-red-600 dark:text-red-400", children: o.rest.map((e) => /* @__PURE__ */ t("li", { children: e }, e)) }),
|
|
228
228
|
y != null && /* @__PURE__ */ t(C, { error: y, fallback: "Could not save" }),
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ h("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
230
230
|
/* @__PURE__ */ t(k, { variant: "ghost", size: "sm", className: "h-8", onClick: () => u(!1), children: "Cancel" }),
|
|
231
231
|
/* @__PURE__ */ t(
|
|
232
232
|
k,
|
|
@@ -234,7 +234,10 @@ function re() {
|
|
|
234
234
|
size: "sm",
|
|
235
235
|
className: "h-8",
|
|
236
236
|
disabled: a.isPending,
|
|
237
|
-
onClick: () =>
|
|
237
|
+
onClick: () => {
|
|
238
|
+
const { email_me: e, ...l } = s;
|
|
239
|
+
a.mutate(l);
|
|
240
|
+
},
|
|
238
241
|
children: a.isPending ? "Saving…" : "Save"
|
|
239
242
|
}
|
|
240
243
|
)
|