@burdenoff/microfe-bigconsole 2026.1012.6 → 2026.1012.8
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/bigconsole/assistant/assistantRunPersistence.d.ts +1 -5
- package/dist/bigconsole/assistant/assistantRunPersistence.js +2 -1
- package/dist/bigconsole/assistant/assistantRunStore.d.ts +9 -6
- package/dist/bigconsole/assistant/assistantRunStore.js +17 -1
- package/dist/bigconsole/assistant/usePreviewWidgetDashboard.d.ts +9 -0
- package/dist/bigconsole/assistant/usePreviewWidgetDashboard.js +75 -0
- package/dist/bigconsole/components/preview/AiPreviewPanel.js +111 -94
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +1 -1
- package/dist/bigconsole/customWidget/CustomWidgetProposalPanel.js +198 -196
- package/dist/bigconsole/customWidget/proposalSource.d.ts +3 -1
- package/dist/bigconsole/customWidget/proposalSource.js +42 -28
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { Section as e, SectionStack as t } from "../components/common/Section.js";
|
|
2
2
|
import "../components/common/index.js";
|
|
3
3
|
import n from "../components/widgets/WidgetErrorBoundary.js";
|
|
4
|
-
import
|
|
5
|
-
import { PROPOSABLE_WIDGET_TYPES as
|
|
6
|
-
import { localProposalSource as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { AlertTriangle as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useI18n as
|
|
11
|
-
import { Fragment as
|
|
4
|
+
import r from "../renderers/adapters/BigConsoleRenderer.js";
|
|
5
|
+
import { PROPOSABLE_WIDGET_TYPES as ee, derivePreviewState as i, isProposableWidgetType as a, validateProposal as o } from "./proposalContract.js";
|
|
6
|
+
import { changeProposalWidgetType as s, localProposalSource as c } from "./proposalSource.js";
|
|
7
|
+
import { memo as l, useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
|
|
8
|
+
import { AlertTriangle as m, Check as h, Loader2 as g, RefreshCw as te, Sparkles as ne, X as _ } from "lucide-react";
|
|
9
|
+
import { Button as v, Input as y, Label as b, Textarea as re } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { Fragment as ae, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
12
12
|
//#region src/bigconsole/customWidget/CustomWidgetProposalPanel.tsx
|
|
13
|
-
var
|
|
13
|
+
var oe = "w-full", se = {
|
|
14
14
|
loading: "neutral",
|
|
15
15
|
valid: "neutral",
|
|
16
16
|
"no-data": "warning",
|
|
17
17
|
"field-mismatch": "warning",
|
|
18
18
|
"access-error": "danger"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function ce(e, t) {
|
|
21
21
|
let n = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
22
22
|
return {
|
|
23
23
|
id: `preview-${e.id}`,
|
|
@@ -45,14 +45,14 @@ function b(e, t) {
|
|
|
45
45
|
updatedAt: n
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function le(e) {
|
|
49
49
|
if (Array.isArray(e)) {
|
|
50
50
|
let t = e.find((e) => e && typeof e == "object");
|
|
51
51
|
return t ? Object.keys(t) : [];
|
|
52
52
|
}
|
|
53
53
|
if (e && typeof e == "object") return Object.keys(e);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function C(e) {
|
|
56
56
|
if (Array.isArray(e)) return e.length;
|
|
57
57
|
if (e && typeof e == "object") {
|
|
58
58
|
let t = e.cells;
|
|
@@ -60,247 +60,247 @@ function S(e) {
|
|
|
60
60
|
}
|
|
61
61
|
return 0;
|
|
62
62
|
}
|
|
63
|
-
var
|
|
64
|
-
let { t:
|
|
63
|
+
var w = l(function({ sinks: l, parsers: w, resolvePreviewData: T, onApprove: E, onClose: D, source: O = c }) {
|
|
64
|
+
let { t: k } = ie(), A = f(() => ({
|
|
65
65
|
loading: {
|
|
66
|
-
title:
|
|
67
|
-
body:
|
|
66
|
+
title: k("bigconsole.widget.customWidget.preview.loading.title", "Building preview…"),
|
|
67
|
+
body: k("bigconsole.widget.customWidget.preview.loading.body", "Reading the selected data binding.")
|
|
68
68
|
},
|
|
69
69
|
valid: {
|
|
70
|
-
title:
|
|
70
|
+
title: k("bigconsole.widget.customWidget.preview.valid.title", "Preview"),
|
|
71
71
|
body: ""
|
|
72
72
|
},
|
|
73
73
|
"no-data": {
|
|
74
|
-
title:
|
|
75
|
-
body:
|
|
74
|
+
title: k("bigconsole.widget.customWidget.preview.noData.title", "No data returned"),
|
|
75
|
+
body: k("bigconsole.widget.customWidget.preview.noData.body", "The binding is valid but the data source returned no rows. The widget will render empty until the sink has data.")
|
|
76
76
|
},
|
|
77
77
|
"field-mismatch": {
|
|
78
|
-
title:
|
|
79
|
-
body:
|
|
78
|
+
title: k("bigconsole.widget.customWidget.preview.fieldMismatch.title", "Field mismatch"),
|
|
79
|
+
body: k("bigconsole.widget.customWidget.preview.fieldMismatch.body", "Some mapped fields are not present in the parser output. Fix the mapping below before approving.")
|
|
80
80
|
},
|
|
81
81
|
"access-error": {
|
|
82
|
-
title:
|
|
83
|
-
body:
|
|
82
|
+
title: k("bigconsole.widget.customWidget.preview.accessError.title", "Cannot read this data"),
|
|
83
|
+
body: k("bigconsole.widget.customWidget.preview.accessError.body", "You do not have access to the proposed DataSink or parser in this workspace.")
|
|
84
84
|
}
|
|
85
|
-
}), [
|
|
86
|
-
permittedDataSinkIds:
|
|
87
|
-
permittedParserIds:
|
|
88
|
-
availableFields:
|
|
85
|
+
}), [k]), [j, ue] = p(""), [M, N] = p(null), [P, F] = p(!1), [I, L] = p(!1), [R, z] = p(null), [B, V] = p(void 0), [H, U] = p(!1), [W, G] = p(!1), K = f(() => l.map((e) => e.id), [l]), q = f(() => w.map((e) => e.id), [w]), J = f(() => le(B), [B]), Y = f(() => M ? o(M, {
|
|
86
|
+
permittedDataSinkIds: K,
|
|
87
|
+
permittedParserIds: q,
|
|
88
|
+
availableFields: J
|
|
89
89
|
}) : {
|
|
90
90
|
issues: [],
|
|
91
91
|
canApprove: !1
|
|
92
92
|
}, [
|
|
93
|
-
|
|
94
|
-
G,
|
|
93
|
+
M,
|
|
95
94
|
K,
|
|
96
|
-
q
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
q,
|
|
96
|
+
J
|
|
97
|
+
]), X = f(() => i(Y, {
|
|
98
|
+
loading: H,
|
|
99
|
+
accessError: W,
|
|
100
|
+
rowCount: C(B)
|
|
101
101
|
}), [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
Y,
|
|
103
|
+
H,
|
|
104
|
+
W,
|
|
105
|
+
B
|
|
106
106
|
]);
|
|
107
|
-
|
|
108
|
-
if (!
|
|
109
|
-
|
|
107
|
+
d(() => {
|
|
108
|
+
if (!M || !M.binding.dataSinkId) {
|
|
109
|
+
V(void 0);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
let e = !1;
|
|
113
|
-
return
|
|
114
|
-
e ||
|
|
113
|
+
return U(!0), G(!1), T(M).then((t) => {
|
|
114
|
+
e || V(t);
|
|
115
115
|
}).catch(() => {
|
|
116
|
-
e || (
|
|
116
|
+
e || (V(void 0), G(!0));
|
|
117
117
|
}).finally(() => {
|
|
118
|
-
e ||
|
|
118
|
+
e || U(!1);
|
|
119
119
|
}), () => {
|
|
120
120
|
e = !0;
|
|
121
121
|
};
|
|
122
|
-
}, [
|
|
123
|
-
let
|
|
124
|
-
if (
|
|
125
|
-
|
|
122
|
+
}, [M ? `${M.binding.dataSinkId}|${M.binding.parserId ?? ""}|${M.binding.dataPath ?? ""}` : "", T]);
|
|
123
|
+
let de = u(async () => {
|
|
124
|
+
if (j.trim()) {
|
|
125
|
+
F(!0), z(null);
|
|
126
126
|
try {
|
|
127
|
-
|
|
128
|
-
prompt:
|
|
129
|
-
sinks:
|
|
130
|
-
parsers:
|
|
127
|
+
N(await O.propose({
|
|
128
|
+
prompt: j.trim(),
|
|
129
|
+
sinks: l,
|
|
130
|
+
parsers: w
|
|
131
131
|
}));
|
|
132
132
|
} finally {
|
|
133
|
-
|
|
133
|
+
F(!1);
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
]),
|
|
142
|
-
|
|
143
|
-
}, []),
|
|
144
|
-
|
|
145
|
-
}, []),
|
|
146
|
-
if (!(!
|
|
147
|
-
|
|
137
|
+
j,
|
|
138
|
+
O,
|
|
139
|
+
l,
|
|
140
|
+
w
|
|
141
|
+
]), Z = u((e) => {
|
|
142
|
+
N((t) => t && e(t));
|
|
143
|
+
}, []), fe = u(() => {
|
|
144
|
+
N(null), V(void 0), G(!1), z(null);
|
|
145
|
+
}, []), pe = u(async () => {
|
|
146
|
+
if (!(!M || !Y.canApprove || H || W)) {
|
|
147
|
+
L(!0), z(null);
|
|
148
148
|
try {
|
|
149
|
-
await
|
|
149
|
+
await E(M), D();
|
|
150
150
|
} catch (e) {
|
|
151
|
-
|
|
151
|
+
z(e instanceof Error ? e.message : k("bigconsole.widget.customWidget.error.couldNotSaveWidget", "Could not save the widget."));
|
|
152
152
|
} finally {
|
|
153
|
-
|
|
153
|
+
L(!1);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
}, [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
T,
|
|
157
|
+
M,
|
|
158
|
+
Y.canApprove,
|
|
159
|
+
H,
|
|
160
|
+
W,
|
|
162
161
|
E,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
D,
|
|
163
|
+
k
|
|
164
|
+
]), Q = Y.issues.filter((e) => e.severity === "error"), $ = Y.issues.filter((e) => e.severity === "warning");
|
|
165
|
+
return /* @__PURE__ */ x("section", {
|
|
166
166
|
"data-testid": "custom-widget-proposal-panel",
|
|
167
|
-
"aria-label":
|
|
167
|
+
"aria-label": k("bigconsole.widget.customWidget.panel.ariaLabel", "AI custom widget builder"),
|
|
168
168
|
className: "flex h-full w-full min-w-0 flex-col overflow-y-auto p-4",
|
|
169
|
-
children: /* @__PURE__ */
|
|
170
|
-
title:
|
|
169
|
+
children: /* @__PURE__ */ S(t, { children: [/* @__PURE__ */ x(e, {
|
|
170
|
+
title: k("bigconsole.widget.customWidget.prompt.label", "Describe the widget you need"),
|
|
171
171
|
description: "Plain English. The assistant proposes a typed widget you can edit before anything is saved.",
|
|
172
|
-
icon: /* @__PURE__ */
|
|
172
|
+
icon: /* @__PURE__ */ x(ne, {
|
|
173
173
|
className: "size-4",
|
|
174
174
|
"aria-hidden": "true"
|
|
175
175
|
}),
|
|
176
|
-
actions: /* @__PURE__ */
|
|
176
|
+
actions: /* @__PURE__ */ S("div", {
|
|
177
177
|
className: "flex flex-wrap gap-2",
|
|
178
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ S(v, {
|
|
179
179
|
"data-testid": "custom-widget-generate",
|
|
180
|
-
onClick:
|
|
181
|
-
disabled: !
|
|
182
|
-
children: [
|
|
180
|
+
onClick: de,
|
|
181
|
+
disabled: !j.trim() || P,
|
|
182
|
+
children: [P ? /* @__PURE__ */ x(g, {
|
|
183
183
|
className: "mr-2 size-4 animate-spin",
|
|
184
184
|
"aria-hidden": "true"
|
|
185
|
-
}) : null,
|
|
186
|
-
}),
|
|
185
|
+
}) : null, M ? k("bigconsole.widget.customWidget.action.regenerate", "Regenerate") : k("bigconsole.widget.customWidget.action.generateProposal", "Generate proposal")]
|
|
186
|
+
}), M ? /* @__PURE__ */ S(v, {
|
|
187
187
|
variant: "outline",
|
|
188
188
|
"data-testid": "custom-widget-reject",
|
|
189
|
-
onClick:
|
|
190
|
-
children: [/* @__PURE__ */
|
|
189
|
+
onClick: fe,
|
|
190
|
+
children: [/* @__PURE__ */ x(_, {
|
|
191
191
|
className: "mr-1 size-4",
|
|
192
192
|
"aria-hidden": "true"
|
|
193
|
-
}),
|
|
193
|
+
}), k("bigconsole.widget.customWidget.action.reject", "Reject")]
|
|
194
194
|
}) : null]
|
|
195
195
|
}),
|
|
196
|
-
children: /* @__PURE__ */
|
|
196
|
+
children: /* @__PURE__ */ S("div", {
|
|
197
197
|
className: "flex flex-col gap-2",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ x(b, {
|
|
199
199
|
htmlFor: "custom-widget-prompt",
|
|
200
200
|
children: "What should it show?"
|
|
201
|
-
}), /* @__PURE__ */
|
|
201
|
+
}), /* @__PURE__ */ x(re, {
|
|
202
202
|
id: "custom-widget-prompt",
|
|
203
203
|
"data-testid": "custom-widget-prompt",
|
|
204
|
-
value:
|
|
205
|
-
onChange: (e) =>
|
|
206
|
-
placeholder:
|
|
204
|
+
value: j,
|
|
205
|
+
onChange: (e) => ue(e.target.value),
|
|
206
|
+
placeholder: k("bigconsole.widget.customWidget.prompt.placeholder", "e.g. a funnel of signup conversion stages"),
|
|
207
207
|
rows: 3
|
|
208
208
|
})]
|
|
209
209
|
})
|
|
210
|
-
}),
|
|
211
|
-
/* @__PURE__ */
|
|
210
|
+
}), M ? /* @__PURE__ */ S(ae, { children: [
|
|
211
|
+
/* @__PURE__ */ S(e, {
|
|
212
212
|
emphasis: "primary",
|
|
213
|
-
tone:
|
|
214
|
-
title:
|
|
215
|
-
description:
|
|
216
|
-
meta: /* @__PURE__ */
|
|
213
|
+
tone: se[X],
|
|
214
|
+
title: A[X].title,
|
|
215
|
+
description: M.binding.parserId ? k("bigconsole.widget.customWidget.preview.parserDescription", "Rendered using the saved parser output.") : k("bigconsole.widget.customWidget.preview.sourceDescription", "Rendered using up to 50 source rows. Full data may differ."),
|
|
216
|
+
meta: /* @__PURE__ */ x("span", {
|
|
217
217
|
"data-testid": "custom-widget-preview-state",
|
|
218
|
-
"data-state":
|
|
218
|
+
"data-state": X,
|
|
219
219
|
className: "rounded-pill bg-bg-sunken px-2 py-0.5 text-xs text-text-secondary",
|
|
220
|
-
children:
|
|
220
|
+
children: X
|
|
221
221
|
}),
|
|
222
|
-
children: [/* @__PURE__ */
|
|
222
|
+
children: [/* @__PURE__ */ x("div", {
|
|
223
223
|
"data-testid": "custom-widget-preview",
|
|
224
224
|
className: "min-h-[220px] min-w-0 rounded-card border border-[var(--color-border-subtle)] bg-bg-surface p-2",
|
|
225
|
-
children:
|
|
225
|
+
children: X === "loading" ? /* @__PURE__ */ S("div", {
|
|
226
226
|
className: "flex h-[200px] items-center justify-center text-text-secondary",
|
|
227
|
-
children: [/* @__PURE__ */ g
|
|
227
|
+
children: [/* @__PURE__ */ x(g, {
|
|
228
228
|
className: "mr-2 size-4 animate-spin",
|
|
229
229
|
"aria-hidden": "true"
|
|
230
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ x("span", {
|
|
231
231
|
className: "text-sm",
|
|
232
|
-
children:
|
|
232
|
+
children: A.loading.body
|
|
233
233
|
})]
|
|
234
|
-
}) :
|
|
234
|
+
}) : X === "valid" ? /* @__PURE__ */ x("div", {
|
|
235
235
|
className: "h-[200px]",
|
|
236
|
-
children: /* @__PURE__ */
|
|
237
|
-
widgetId: `preview-${
|
|
238
|
-
children: /* @__PURE__ */
|
|
239
|
-
widget:
|
|
240
|
-
data:
|
|
236
|
+
children: /* @__PURE__ */ x(n, {
|
|
237
|
+
widgetId: `preview-${M.id}`,
|
|
238
|
+
children: /* @__PURE__ */ x(r, {
|
|
239
|
+
widget: ce(M, k("bigconsole.widget.customWidget.untitledWidget", "Untitled widget")),
|
|
240
|
+
data: B
|
|
241
241
|
})
|
|
242
242
|
})
|
|
243
|
-
}) : /* @__PURE__ */
|
|
243
|
+
}) : /* @__PURE__ */ S("div", {
|
|
244
244
|
className: "flex h-[200px] flex-col items-center justify-center gap-2 px-4 text-center",
|
|
245
245
|
children: [
|
|
246
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ x(m, {
|
|
247
247
|
className: "size-5 text-[var(--color-status-warning-text)]",
|
|
248
248
|
"aria-hidden": "true"
|
|
249
249
|
}),
|
|
250
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ x("p", {
|
|
251
251
|
className: "text-sm text-text-secondary",
|
|
252
|
-
children:
|
|
252
|
+
children: A[X].body
|
|
253
253
|
}),
|
|
254
|
-
|
|
254
|
+
X === "access-error" ? /* @__PURE__ */ S(v, {
|
|
255
255
|
size: "sm",
|
|
256
256
|
variant: "outline",
|
|
257
|
-
onClick: () =>
|
|
258
|
-
children: [/* @__PURE__ */
|
|
257
|
+
onClick: () => Z((e) => ({ ...e })),
|
|
258
|
+
children: [/* @__PURE__ */ x(te, {
|
|
259
259
|
className: "mr-1 size-3.5",
|
|
260
260
|
"aria-hidden": "true"
|
|
261
|
-
}),
|
|
261
|
+
}), k("bigconsole.widget.customWidget.action.retry", "Retry")]
|
|
262
262
|
}) : null
|
|
263
263
|
]
|
|
264
264
|
})
|
|
265
|
-
}),
|
|
265
|
+
}), M.rationale ? /* @__PURE__ */ x("p", {
|
|
266
266
|
className: "mt-2 text-xs text-text-secondary",
|
|
267
267
|
"data-testid": "custom-widget-rationale",
|
|
268
|
-
children:
|
|
268
|
+
children: M.rationale
|
|
269
269
|
}) : null]
|
|
270
270
|
}),
|
|
271
|
-
Q.length > 0 || $.length > 0 ? /* @__PURE__ */
|
|
271
|
+
Q.length > 0 || $.length > 0 ? /* @__PURE__ */ x(e, {
|
|
272
272
|
tone: Q.length > 0 ? "danger" : "warning",
|
|
273
273
|
padding: "compact",
|
|
274
274
|
headingLevel: 3,
|
|
275
275
|
title: Q.length > 0 ? `${Q.length} ${Q.length === 1 ? "problem" : "problems"} to fix before approving` : `${$.length} ${$.length === 1 ? "warning" : "warnings"}`,
|
|
276
|
-
children: /* @__PURE__ */
|
|
276
|
+
children: /* @__PURE__ */ x("ul", {
|
|
277
277
|
"data-testid": "custom-widget-issues",
|
|
278
278
|
className: "flex min-w-0 flex-col gap-1",
|
|
279
|
-
children: [...Q, ...$].map((e) => /* @__PURE__ */
|
|
279
|
+
children: [...Q, ...$].map((e) => /* @__PURE__ */ x("li", {
|
|
280
280
|
"data-severity": e.severity,
|
|
281
281
|
className: `break-words text-xs ${e.severity === "error" ? "text-[var(--color-status-error-text)]" : "text-[var(--color-status-warning-text)]"}`,
|
|
282
282
|
children: e.message
|
|
283
283
|
}, `${e.code}-${e.path ?? ""}`))
|
|
284
284
|
})
|
|
285
285
|
}) : null,
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
title:
|
|
286
|
+
/* @__PURE__ */ x(e, {
|
|
287
|
+
title: k("bigconsole.widget.customWidget.proposal.heading", "Proposal"),
|
|
288
288
|
description: "Every field is editable — the assistant proposes, you dispose.",
|
|
289
289
|
"data-testid": "custom-widget-proposal-fields",
|
|
290
|
-
children: /* @__PURE__ */
|
|
290
|
+
children: /* @__PURE__ */ S("div", {
|
|
291
291
|
className: "flex flex-col gap-3",
|
|
292
292
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ S("div", {
|
|
294
294
|
className: "flex flex-col gap-1",
|
|
295
|
-
children: [/* @__PURE__ */
|
|
295
|
+
children: [/* @__PURE__ */ x(b, {
|
|
296
296
|
htmlFor: "custom-widget-title",
|
|
297
|
-
children:
|
|
298
|
-
}), /* @__PURE__ */
|
|
297
|
+
children: k("bigconsole.widget.customWidget.field.title", "Title")
|
|
298
|
+
}), /* @__PURE__ */ x(y, {
|
|
299
299
|
id: "custom-widget-title",
|
|
300
300
|
"data-testid": "custom-widget-title",
|
|
301
|
-
className:
|
|
302
|
-
value:
|
|
303
|
-
onChange: (e) =>
|
|
301
|
+
className: oe,
|
|
302
|
+
value: M.presentation.title,
|
|
303
|
+
onChange: (e) => Z((t) => ({
|
|
304
304
|
...t,
|
|
305
305
|
presentation: {
|
|
306
306
|
...t.presentation,
|
|
@@ -309,104 +309,106 @@ var C = a(function({ sinks: a, parsers: C, resolvePreviewData: w, onApprove: T,
|
|
|
309
309
|
}))
|
|
310
310
|
})]
|
|
311
311
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ S("div", {
|
|
313
313
|
className: "flex flex-col gap-1",
|
|
314
|
-
children: [/* @__PURE__ */
|
|
314
|
+
children: [/* @__PURE__ */ x(b, {
|
|
315
315
|
htmlFor: "custom-widget-type",
|
|
316
|
-
children:
|
|
317
|
-
}), /* @__PURE__ */
|
|
316
|
+
children: k("bigconsole.widget.customWidget.field.widgetType", "Widget type")
|
|
317
|
+
}), /* @__PURE__ */ x("select", {
|
|
318
318
|
id: "custom-widget-type",
|
|
319
319
|
"data-testid": "custom-widget-type",
|
|
320
|
-
value:
|
|
321
|
-
onChange: (e) =>
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
320
|
+
value: M.widgetType,
|
|
321
|
+
onChange: (e) => {
|
|
322
|
+
let t = e.target.value;
|
|
323
|
+
a(t) && Z((e) => s(e, t));
|
|
324
|
+
},
|
|
325
325
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
326
|
-
children:
|
|
326
|
+
children: ee.map((e) => /* @__PURE__ */ x("option", {
|
|
327
327
|
value: e,
|
|
328
328
|
children: e
|
|
329
329
|
}, e))
|
|
330
330
|
})]
|
|
331
331
|
}),
|
|
332
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ S("div", {
|
|
333
333
|
className: "flex flex-col gap-1",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ x(b, {
|
|
335
335
|
htmlFor: "custom-widget-sink",
|
|
336
|
-
children:
|
|
337
|
-
}), /* @__PURE__ */
|
|
336
|
+
children: k("bigconsole.widget.customWidget.field.dataSink", "DataSink")
|
|
337
|
+
}), /* @__PURE__ */ S("select", {
|
|
338
338
|
id: "custom-widget-sink",
|
|
339
339
|
"data-testid": "custom-widget-sink",
|
|
340
|
-
value:
|
|
340
|
+
value: M.binding.dataSinkId,
|
|
341
341
|
onChange: (e) => {
|
|
342
|
-
let t =
|
|
343
|
-
|
|
342
|
+
let t = l.find((t) => t.id === e.target.value);
|
|
343
|
+
Z((n) => ({
|
|
344
344
|
...n,
|
|
345
345
|
binding: {
|
|
346
346
|
...n.binding,
|
|
347
347
|
dataSinkId: e.target.value,
|
|
348
348
|
dataSinkKey: t?.key
|
|
349
|
-
}
|
|
349
|
+
},
|
|
350
|
+
rationale: void 0
|
|
350
351
|
}));
|
|
351
352
|
},
|
|
352
353
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
353
|
-
children: [/* @__PURE__ */
|
|
354
|
+
children: [/* @__PURE__ */ x("option", {
|
|
354
355
|
value: "",
|
|
355
|
-
children:
|
|
356
|
-
}),
|
|
356
|
+
children: k("bigconsole.widget.customWidget.field.selectDataSink", "Select a DataSink…")
|
|
357
|
+
}), l.map((e) => /* @__PURE__ */ x("option", {
|
|
357
358
|
value: e.id,
|
|
358
359
|
children: e.name || e.key
|
|
359
360
|
}, e.id))]
|
|
360
361
|
})]
|
|
361
362
|
}),
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
+
/* @__PURE__ */ S("div", {
|
|
363
364
|
className: "flex flex-col gap-1",
|
|
364
|
-
children: [/* @__PURE__ */
|
|
365
|
+
children: [/* @__PURE__ */ x(b, {
|
|
365
366
|
htmlFor: "custom-widget-parser",
|
|
366
|
-
children:
|
|
367
|
-
}), /* @__PURE__ */
|
|
367
|
+
children: k("bigconsole.widget.customWidget.field.parser", "Parser")
|
|
368
|
+
}), /* @__PURE__ */ S("select", {
|
|
368
369
|
id: "custom-widget-parser",
|
|
369
370
|
"data-testid": "custom-widget-parser",
|
|
370
|
-
value:
|
|
371
|
+
value: M.binding.parserId ?? "",
|
|
371
372
|
onChange: (e) => {
|
|
372
|
-
let t =
|
|
373
|
-
|
|
373
|
+
let t = w.find((t) => t.id === e.target.value);
|
|
374
|
+
Z((n) => ({
|
|
374
375
|
...n,
|
|
375
376
|
binding: {
|
|
376
377
|
...n.binding,
|
|
377
378
|
parserId: e.target.value || void 0,
|
|
378
379
|
parserName: t?.name
|
|
379
|
-
}
|
|
380
|
+
},
|
|
381
|
+
rationale: void 0
|
|
380
382
|
}));
|
|
381
383
|
},
|
|
382
384
|
className: "w-full rounded-md border border-[var(--color-border-default)] bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-action-primary-bg",
|
|
383
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ x("option", {
|
|
384
386
|
value: "",
|
|
385
|
-
children:
|
|
386
|
-
}),
|
|
387
|
+
children: k("bigconsole.widget.customWidget.field.noParser", "No parser")
|
|
388
|
+
}), w.map((e) => /* @__PURE__ */ x("option", {
|
|
387
389
|
value: e.id,
|
|
388
390
|
children: e.name
|
|
389
391
|
}, e.id))]
|
|
390
392
|
})]
|
|
391
393
|
}),
|
|
392
|
-
Object.keys(
|
|
394
|
+
Object.keys(M.fieldMapping).length > 0 ? /* @__PURE__ */ S("fieldset", {
|
|
393
395
|
className: "flex flex-col gap-2",
|
|
394
396
|
"data-testid": "custom-widget-field-mapping",
|
|
395
397
|
children: [
|
|
396
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ x("legend", {
|
|
397
399
|
className: "text-sm font-medium text-text-primary",
|
|
398
|
-
children:
|
|
400
|
+
children: k("bigconsole.widget.customWidget.fieldMapping.legend", "Field mapping")
|
|
399
401
|
}),
|
|
400
|
-
Object.entries(
|
|
402
|
+
Object.entries(M.fieldMapping).map(([e, t]) => /* @__PURE__ */ S("div", {
|
|
401
403
|
className: "flex flex-col gap-1",
|
|
402
|
-
children: [/* @__PURE__ */
|
|
404
|
+
children: [/* @__PURE__ */ x(b, {
|
|
403
405
|
htmlFor: `custom-widget-field-${e}`,
|
|
404
406
|
children: e
|
|
405
|
-
}), /* @__PURE__ */
|
|
407
|
+
}), /* @__PURE__ */ x(y, {
|
|
406
408
|
id: `custom-widget-field-${e}`,
|
|
407
409
|
"data-testid": `custom-widget-field-${e}`,
|
|
408
410
|
value: t,
|
|
409
|
-
onChange: (t) =>
|
|
411
|
+
onChange: (t) => Z((n) => ({
|
|
410
412
|
...n,
|
|
411
413
|
fieldMapping: {
|
|
412
414
|
...n.fieldMapping,
|
|
@@ -415,59 +417,59 @@ var C = a(function({ sinks: a, parsers: C, resolvePreviewData: w, onApprove: T,
|
|
|
415
417
|
}))
|
|
416
418
|
})]
|
|
417
419
|
}, e)),
|
|
418
|
-
|
|
420
|
+
J?.length ? /* @__PURE__ */ x("p", {
|
|
419
421
|
className: "break-words text-xs text-text-secondary",
|
|
420
|
-
children:
|
|
422
|
+
children: k("bigconsole.widget.customWidget.fieldMapping.available", "Available: {{fields}}", { fields: J.join(", ") })
|
|
421
423
|
}) : null
|
|
422
424
|
]
|
|
423
425
|
}) : null
|
|
424
426
|
]
|
|
425
427
|
})
|
|
426
428
|
}),
|
|
427
|
-
|
|
429
|
+
R ? /* @__PURE__ */ x(e, {
|
|
428
430
|
tone: "danger",
|
|
429
431
|
padding: "compact",
|
|
430
432
|
headingLevel: 3,
|
|
431
433
|
title: "Could not add the widget",
|
|
432
|
-
children: /* @__PURE__ */
|
|
434
|
+
children: /* @__PURE__ */ x("p", {
|
|
433
435
|
role: "alert",
|
|
434
436
|
className: "break-words text-xs text-[var(--color-status-error-text)]",
|
|
435
437
|
"data-testid": "custom-widget-approve-error",
|
|
436
|
-
children:
|
|
438
|
+
children: R
|
|
437
439
|
})
|
|
438
440
|
}) : null,
|
|
439
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ S("div", {
|
|
440
442
|
className: "flex flex-wrap gap-2 border-t border-[var(--color-border-subtle)] pt-3",
|
|
441
|
-
children: [/* @__PURE__ */
|
|
443
|
+
children: [/* @__PURE__ */ S(v, {
|
|
442
444
|
"data-testid": "custom-widget-approve",
|
|
443
|
-
onClick:
|
|
444
|
-
disabled: !
|
|
445
|
-
children: [
|
|
445
|
+
onClick: pe,
|
|
446
|
+
disabled: !Y.canApprove || H || W || I,
|
|
447
|
+
children: [I ? /* @__PURE__ */ x(g, {
|
|
446
448
|
className: "mr-2 size-4 animate-spin",
|
|
447
449
|
"aria-hidden": "true"
|
|
448
|
-
}) : /* @__PURE__ */
|
|
450
|
+
}) : /* @__PURE__ */ x(h, {
|
|
449
451
|
className: "mr-1 size-4",
|
|
450
452
|
"aria-hidden": "true"
|
|
451
|
-
}),
|
|
452
|
-
}), /* @__PURE__ */
|
|
453
|
+
}), k("bigconsole.widget.customWidget.action.approveAndAdd", "Approve & add to dashboard")]
|
|
454
|
+
}), /* @__PURE__ */ x(v, {
|
|
453
455
|
variant: "outline",
|
|
454
|
-
onClick:
|
|
456
|
+
onClick: D,
|
|
455
457
|
"data-testid": "custom-widget-cancel",
|
|
456
|
-
children:
|
|
458
|
+
children: k("bigconsole.widget.customWidget.action.cancel", "Cancel")
|
|
457
459
|
})]
|
|
458
460
|
})
|
|
459
|
-
] }) : /* @__PURE__ */
|
|
461
|
+
] }) : /* @__PURE__ */ x(e, {
|
|
460
462
|
emphasis: "muted",
|
|
461
463
|
padding: "compact",
|
|
462
464
|
title: "No proposal yet",
|
|
463
465
|
headingLevel: 3,
|
|
464
|
-
children: /* @__PURE__ */
|
|
466
|
+
children: /* @__PURE__ */ x("p", {
|
|
465
467
|
className: "text-sm text-text-secondary",
|
|
466
468
|
"data-testid": "custom-widget-empty",
|
|
467
|
-
children:
|
|
469
|
+
children: k("bigconsole.widget.customWidget.empty", "No proposal yet. Describe a widget and the assistant will propose one for you to review — nothing is added to the dashboard until you approve it.")
|
|
468
470
|
})
|
|
469
471
|
})] })
|
|
470
472
|
});
|
|
471
473
|
});
|
|
472
474
|
//#endregion
|
|
473
|
-
export {
|
|
475
|
+
export { w as default };
|