@burdenoff/microfe-bigconsole 2026.1110.7 → 2026.1110.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/components/parser/ExpressionEditor.js +1 -0
- package/dist/bigconsole/components/parser/ParserCard.d.ts +12 -1
- package/dist/bigconsole/components/parser/ParserCard.js +218 -232
- package/dist/bigconsole/pages/DataParsersPage.js +153 -122
- package/dist/bigconsole/pages/ParserBuilderPage.js +559 -508
- package/dist/bigconsole/pages/ParserViewPage.js +324 -309
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.js +7 -0
- package/package.json +1 -1
|
@@ -7,29 +7,30 @@ import oe from "../hooks/useParserOperations.js";
|
|
|
7
7
|
import se from "../hooks/useDataSinkOperations.js";
|
|
8
8
|
import ce from "../hooks/useDashboardOperations.js";
|
|
9
9
|
import { CacheTTLSelector as le } from "../components/datasink/CacheTTLSelector.js";
|
|
10
|
+
import { ExpressionEditor as ue } from "../components/parser/ExpressionEditor.js";
|
|
10
11
|
import "../components/common/index.js";
|
|
11
12
|
import { BIGCONSOLE_PERMISSIONS as r } from "../../constants/permissions.js";
|
|
12
|
-
import { memo as i, useCallback as a, useEffect as o, useMemo as s, useRef as
|
|
13
|
-
import { useParams as
|
|
14
|
-
import { AccessDenied as
|
|
15
|
-
import { usePermissions as
|
|
16
|
-
import { AlertCircle as
|
|
17
|
-
import { Button as
|
|
18
|
-
import { useUnsavedChanges as
|
|
19
|
-
import { useI18n as
|
|
20
|
-
import { Fragment as
|
|
13
|
+
import { memo as i, useCallback as a, useEffect as o, useMemo as s, useRef as de, useState as c } from "react";
|
|
14
|
+
import { useParams as fe } from "react-router";
|
|
15
|
+
import { AccessDenied as pe, PermissionButton as me } from "@burdenoff/fe-libs/shared/components";
|
|
16
|
+
import { usePermissions as he } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
17
|
+
import { AlertCircle as l, ArrowLeft as ge, CheckCircle2 as _e, ChevronDown as ve, ChevronRight as ye, Code as be, Download as xe, Eye as Se, FileCode2 as Ce, LayoutDashboard as we, Loader2 as u, Play as Te, Save as Ee, Settings as De, Timer as Oe, X as ke } from "lucide-react";
|
|
18
|
+
import { Button as d, PagePurpose as Ae, Stepper as je } from "@burdenoff/fe-libs/ui";
|
|
19
|
+
import { useUnsavedChanges as Me } from "@burdenoff/fe-libs/shared/hooks";
|
|
20
|
+
import { useI18n as Ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
21
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
21
22
|
// src/bigconsole/pages/ParserBuilderPage.tsx
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
return `${
|
|
23
|
+
var h = "w-full min-w-0 min-h-[44px] rounded-md border bg-bg-surface px-3 py-2.5 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-action-primary-bg motion-safe:transition-colors disabled:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-60";
|
|
24
|
+
function g(e = !1, t = "") {
|
|
25
|
+
return `${h} ${e ? "border-status-error-border" : "border-[var(--color-border-default)]"} ${t}`.trim();
|
|
25
26
|
}
|
|
26
|
-
var
|
|
27
|
+
var _ = "block text-sm font-medium text-text-primary mb-2", v = "text-xs text-text-muted mt-1.5", Pe = "text-xs text-status-error-text mt-1.5", Fe = 1e3, Ie = "220px", y = 25, Le = "default", Re = [
|
|
27
28
|
"details",
|
|
28
29
|
"source",
|
|
29
30
|
"expression",
|
|
30
31
|
"review"
|
|
31
32
|
];
|
|
32
|
-
function
|
|
33
|
+
function ze(e) {
|
|
33
34
|
return [
|
|
34
35
|
{
|
|
35
36
|
key: "details",
|
|
@@ -53,14 +54,14 @@ function Ne(e) {
|
|
|
53
54
|
}
|
|
54
55
|
];
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function Be(e) {
|
|
57
58
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").substring(0, 64);
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function Ve(e, t) {
|
|
60
61
|
let n = {};
|
|
61
62
|
return e.name.trim() ? e.name.length < 2 && (n.name = t("bigconsole.parsers.builder.validation.nameMinLength", "Name must be at least 2 characters")) : n.name = t("bigconsole.parsers.builder.validation.nameRequired", "Name is required"), e.outputKey.trim() ? /^[a-z0-9_]+$/.test(e.outputKey) || (n.outputKey = t("bigconsole.parsers.builder.validation.outputKeyInvalid", "Output key can only contain lowercase letters, numbers, and underscores")) : n.outputKey = t("bigconsole.parsers.builder.validation.outputKeyRequired", "Output key is required"), e.expression.trim() || (n.expression = t("bigconsole.parsers.builder.validation.expressionRequired", "Expression is required")), e.inputSinkKey.trim() || (n.inputSinkKey = t("bigconsole.parsers.builder.validation.inputSinkRequired", "Source DataSink is required")), e.ttl != null && e.ttl > 0 && (e.ttl < 30 || e.ttl > 86400) && (n.ttl = t("bigconsole.parsers.builder.validation.cacheDurationRange", "Cache duration must be between 30 and 86400 seconds")), n;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function He(e) {
|
|
64
65
|
return {
|
|
65
66
|
jq: {
|
|
66
67
|
name: e("bigconsole.parsers.builder.parserType.jq.name", "JQ"),
|
|
@@ -76,8 +77,8 @@ function Ie(e) {
|
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
|
-
var
|
|
80
|
-
let { parserId: i, consoleId:
|
|
80
|
+
var b = i(function() {
|
|
81
|
+
let { parserId: i, consoleId: h } = fe(), b = e(), { t: x } = Ne(), Ue = s(() => ze(x), [x]), We = s(() => He(x), [x]), S = Ue.length, [C, w] = c(0), [T, Ge] = c(Le), Ke = h || T || Le, E = i !== "new" && !!i, { hasPermission: qe, isLoading: Je } = he(), Ye = qe(r.PARSER_READ), Xe = qe(E ? r.PARSER_UPDATE : r.PARSER_CREATE), Ze = E ? r.PARSER_UPDATE : r.PARSER_CREATE, Qe = qe(r.PARSER_TEST), D = !h, [O, k] = c({
|
|
81
82
|
name: "",
|
|
82
83
|
outputKey: "",
|
|
83
84
|
description: "",
|
|
@@ -85,545 +86,569 @@ var x = i(function() {
|
|
|
85
86
|
expression: "",
|
|
86
87
|
inputSinkKey: "",
|
|
87
88
|
ttl: 900
|
|
88
|
-
}), [
|
|
89
|
-
|
|
89
|
+
}), [A, $e] = c(() => E ? null : O);
|
|
90
|
+
Me({
|
|
90
91
|
id: "parser-editor",
|
|
91
|
-
label:
|
|
92
|
-
dirty: ee(
|
|
92
|
+
label: x("bigconsole.assistant.unsaved.parserEditor", "the parser editor"),
|
|
93
|
+
dirty: ee(O, A)
|
|
93
94
|
});
|
|
94
|
-
let [
|
|
95
|
+
let [j, M] = c({}), [et, tt] = c(!1), [nt, rt] = c(!1), [it, at] = c(null), [ot, N] = c("{\n \"data\": [\n {\"name\": \"Item 1\", \"count\": 10},\n {\"name\": \"Item 2\", \"count\": 20}\n ]\n}"), [st, P] = c(""), [ct, F] = c(null), [I, L] = c(null), [R, lt] = c(!1), [z, B] = c(null), [ut, dt] = c(null), [ft, pt] = c(null), [mt, V] = c(!1), [H, ht] = c(!1), [U, gt] = c(null), [_t, vt] = c(!1), W = de(O.inputSinkKey);
|
|
95
96
|
o(() => {
|
|
96
|
-
W.current =
|
|
97
|
-
}, [
|
|
98
|
-
let [G,
|
|
99
|
-
consoleId:
|
|
97
|
+
W.current = O.inputSinkKey;
|
|
98
|
+
}, [O.inputSinkKey]);
|
|
99
|
+
let [G, yt] = c(!1), [bt, xt] = c(null), [St, Ct] = c(!1), [wt, K] = c(null), [q, Tt] = c(null), { loading: Et, error: Dt, parsers: Ot, fetchParser: kt, createParser: At, updateParser: jt, testParserExpression: Mt } = oe({
|
|
100
|
+
consoleId: Ke || "",
|
|
100
101
|
skipFetch: !0
|
|
101
|
-
}), { dataSinks: J, fetchDataSinks:
|
|
102
|
+
}), { dataSinks: J, fetchDataSinks: Nt, getDataSinkData: Pt } = se({ skipFetch: !0 }), { dashboards: Ft, fetchDashboards: It, loading: Lt } = ce(), Y = E ? Ot.find((e) => e.id === i) : null;
|
|
102
103
|
o(() => {
|
|
103
|
-
|
|
104
|
+
Nt(), E && i && kt(i), D && It();
|
|
104
105
|
}, [
|
|
105
|
-
|
|
106
|
+
E,
|
|
106
107
|
i,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
kt,
|
|
109
|
+
Nt,
|
|
110
|
+
D,
|
|
111
|
+
It
|
|
111
112
|
]);
|
|
112
|
-
let
|
|
113
|
+
let Rt = de(null), zt = de(O), Bt = de(A);
|
|
113
114
|
o(() => {
|
|
114
|
-
|
|
115
|
-
}, [
|
|
116
|
-
if (
|
|
117
|
-
|
|
115
|
+
zt.current = O, Bt.current = A;
|
|
116
|
+
}, [O, A]), o(() => {
|
|
117
|
+
if (Y && te(Rt.current, Y.id, zt.current, Bt.current)) {
|
|
118
|
+
Rt.current = Y.id;
|
|
118
119
|
let e = {
|
|
119
|
-
name:
|
|
120
|
-
outputKey:
|
|
121
|
-
description:
|
|
122
|
-
type:
|
|
123
|
-
expression:
|
|
124
|
-
inputSinkKey:
|
|
125
|
-
ttl:
|
|
120
|
+
name: Y.name || "",
|
|
121
|
+
outputKey: Y.outputKey || "",
|
|
122
|
+
description: Y.description || "",
|
|
123
|
+
type: Y.type,
|
|
124
|
+
expression: Y.expression || "",
|
|
125
|
+
inputSinkKey: Y.inputSinkKey || "",
|
|
126
|
+
ttl: Y.ttl ?? null
|
|
126
127
|
};
|
|
127
|
-
|
|
128
|
+
k(e), $e(e), tt(!0), dt(e.expression.trim() ? ae(e.type, e.expression) : null), Y.consoleId && Ge(Y.consoleId);
|
|
128
129
|
}
|
|
129
|
-
}, [
|
|
130
|
-
let
|
|
130
|
+
}, [Y]);
|
|
131
|
+
let X = s(() => J.find((e) => e.key === O.inputSinkKey)?.name || O.inputSinkKey, [J, O.inputSinkKey]), Vt = a((e) => {
|
|
131
132
|
let t = e.target.value;
|
|
132
|
-
|
|
133
|
+
k((e) => ({
|
|
133
134
|
...e,
|
|
134
135
|
name: t,
|
|
135
|
-
outputKey:
|
|
136
|
-
})),
|
|
136
|
+
outputKey: et ? e.outputKey : Be(t)
|
|
137
|
+
})), M((e) => ({
|
|
137
138
|
...e,
|
|
138
139
|
name: void 0
|
|
139
140
|
}));
|
|
140
|
-
}, [
|
|
141
|
+
}, [et]), Ht = a((e) => {
|
|
141
142
|
let t = e.target.value.toLowerCase().replace(/[^a-z0-9_]/g, "");
|
|
142
|
-
|
|
143
|
+
k((e) => ({
|
|
143
144
|
...e,
|
|
144
145
|
outputKey: t
|
|
145
|
-
})),
|
|
146
|
+
})), tt(!0), M((e) => ({
|
|
146
147
|
...e,
|
|
147
148
|
outputKey: void 0
|
|
148
149
|
}));
|
|
149
|
-
}, []),
|
|
150
|
-
|
|
150
|
+
}, []), Ut = a((e) => {
|
|
151
|
+
k((t) => ({
|
|
151
152
|
...t,
|
|
152
153
|
description: e.target.value
|
|
153
154
|
}));
|
|
154
|
-
}, []),
|
|
155
|
-
|
|
155
|
+
}, []), Wt = a((e) => {
|
|
156
|
+
k((t) => ({
|
|
156
157
|
...t,
|
|
157
158
|
type: e
|
|
158
|
-
})),
|
|
159
|
-
}, []),
|
|
160
|
-
|
|
159
|
+
})), P(""), L(null), F(null), pt(null);
|
|
160
|
+
}, []), Gt = a((e) => {
|
|
161
|
+
k((t) => ({
|
|
161
162
|
...t,
|
|
162
|
-
expression: e
|
|
163
|
-
})),
|
|
163
|
+
expression: e
|
|
164
|
+
})), M((e) => ({
|
|
164
165
|
...e,
|
|
165
166
|
expression: void 0
|
|
166
167
|
}));
|
|
167
|
-
}, []),
|
|
168
|
-
|
|
168
|
+
}, []), Kt = a((e) => {
|
|
169
|
+
k((t) => ({
|
|
169
170
|
...t,
|
|
170
171
|
inputSinkKey: e.target.value
|
|
171
|
-
})),
|
|
172
|
+
})), M((e) => ({
|
|
172
173
|
...e,
|
|
173
174
|
inputSinkKey: void 0
|
|
174
|
-
})),
|
|
175
|
-
}, [H]),
|
|
176
|
-
|
|
175
|
+
})), yt(!1), xt(null), Tt(null), K(null), H && (N(""), ht(!1), V(!1)), gt(null), P(""), L(null), B(null), F(null);
|
|
176
|
+
}, [H]), qt = a((e) => {
|
|
177
|
+
k((t) => ({
|
|
177
178
|
...t,
|
|
178
179
|
ttl: e
|
|
179
|
-
})),
|
|
180
|
+
})), M((e) => ({
|
|
180
181
|
...e,
|
|
181
182
|
ttl: void 0
|
|
182
183
|
}));
|
|
183
|
-
}, []),
|
|
184
|
-
|
|
185
|
-
}, []),
|
|
186
|
-
|
|
187
|
-
}, []),
|
|
184
|
+
}, []), Jt = a((e) => {
|
|
185
|
+
Ge(e.target.value);
|
|
186
|
+
}, []), Yt = a((e) => {
|
|
187
|
+
N(e);
|
|
188
|
+
}, []), Xt = a((e) => {
|
|
188
189
|
H && ie(e) && V(!0);
|
|
189
|
-
}, [H]),
|
|
190
|
+
}, [H]), Zt = a(() => {
|
|
190
191
|
H && V(!0);
|
|
191
|
-
}, [H]),
|
|
192
|
-
let e =
|
|
192
|
+
}, [H]), Qt = a(async () => {
|
|
193
|
+
let e = O.inputSinkKey;
|
|
193
194
|
if (e) {
|
|
194
|
-
|
|
195
|
+
vt(!0);
|
|
195
196
|
try {
|
|
196
|
-
let t = await
|
|
197
|
+
let t = await Pt({ key: e }, { limit: y });
|
|
197
198
|
if (W.current !== e) return;
|
|
198
|
-
t?.raw !== void 0 && t?.raw !== null ? (
|
|
199
|
+
t?.raw !== void 0 && t?.raw !== null ? (N(JSON.stringify(t.raw, null, 2)), ht(!0), V(!1), gt({
|
|
199
200
|
total: t.totalCount ?? null,
|
|
200
201
|
hasMore: t.hasMore ?? null,
|
|
201
|
-
sinkName:
|
|
202
|
-
}),
|
|
202
|
+
sinkName: X
|
|
203
|
+
}), P(""), L(null), B(null), F(null)) : L(x("bigconsole.parsers.builder.errors.loadSampleFailed", "Could not load a sample from the selected DataSink."));
|
|
203
204
|
} catch (t) {
|
|
204
205
|
if (W.current !== e) return;
|
|
205
|
-
|
|
206
|
+
L(t instanceof Error ? t.message : x("bigconsole.parsers.builder.errors.loadSampleDataFailed", "Failed to load sample data"));
|
|
206
207
|
} finally {
|
|
207
|
-
|
|
208
|
+
vt(!1);
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
}, [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
]),
|
|
216
|
-
|
|
217
|
-
}, []),
|
|
212
|
+
O.inputSinkKey,
|
|
213
|
+
Pt,
|
|
214
|
+
X,
|
|
215
|
+
x
|
|
216
|
+
]), $t = a(() => {
|
|
217
|
+
N(""), ht(!1), V(!1), gt(null), B(null), P(""), L(null), F(null);
|
|
218
|
+
}, []), en = a(async () => {
|
|
218
219
|
if (G) {
|
|
219
|
-
|
|
220
|
+
yt(!1);
|
|
220
221
|
return;
|
|
221
222
|
}
|
|
222
|
-
if (!
|
|
223
|
-
K(
|
|
223
|
+
if (!O.inputSinkKey) {
|
|
224
|
+
K(x("bigconsole.parsers.builder.errors.selectSourceFirst", "Please select a source DataSink first"));
|
|
224
225
|
return;
|
|
225
226
|
}
|
|
226
|
-
|
|
227
|
-
let e =
|
|
227
|
+
yt(!0), Ct(!0), K(null);
|
|
228
|
+
let e = O.inputSinkKey;
|
|
228
229
|
try {
|
|
229
|
-
let t = await
|
|
230
|
+
let t = await Pt({ key: e }, { limit: y });
|
|
230
231
|
if (W.current !== e) return;
|
|
231
|
-
t?.raw !== void 0 && t?.raw !== null ? (
|
|
232
|
+
t?.raw !== void 0 && t?.raw !== null ? (xt(t.raw), Tt({
|
|
232
233
|
total: t.totalCount ?? null,
|
|
233
234
|
hasMore: t.hasMore ?? null,
|
|
234
|
-
sinkName:
|
|
235
|
-
})) : K(
|
|
235
|
+
sinkName: X
|
|
236
|
+
})) : K(x("bigconsole.parsers.builder.errors.noDataInSink", "No data available in selected DataSink"));
|
|
236
237
|
} catch (t) {
|
|
237
238
|
if (W.current !== e) return;
|
|
238
|
-
K(t instanceof Error ? t.message :
|
|
239
|
+
K(t instanceof Error ? t.message : x("bigconsole.parsers.builder.errors.loadDataFailed", "Failed to load data"));
|
|
239
240
|
} finally {
|
|
240
|
-
|
|
241
|
+
Ct(!1);
|
|
241
242
|
}
|
|
242
243
|
}, [
|
|
243
244
|
G,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
]),
|
|
249
|
-
if (!
|
|
250
|
-
|
|
245
|
+
O.inputSinkKey,
|
|
246
|
+
Pt,
|
|
247
|
+
X,
|
|
248
|
+
x
|
|
249
|
+
]), tn = a(async () => {
|
|
250
|
+
if (F(null), !O.expression.trim()) {
|
|
251
|
+
L(x("bigconsole.parsers.builder.validation.expressionRequired", "Expression is required"));
|
|
251
252
|
return;
|
|
252
253
|
}
|
|
253
254
|
let e;
|
|
254
255
|
if (H) e = {
|
|
255
|
-
type:
|
|
256
|
-
expression:
|
|
257
|
-
dataSinkKey:
|
|
258
|
-
sampleLimit:
|
|
256
|
+
type: O.type,
|
|
257
|
+
expression: O.expression,
|
|
258
|
+
dataSinkKey: O.inputSinkKey,
|
|
259
|
+
sampleLimit: y
|
|
259
260
|
};
|
|
260
261
|
else {
|
|
261
262
|
let t;
|
|
262
263
|
try {
|
|
263
|
-
t = JSON.parse(
|
|
264
|
+
t = JSON.parse(ot);
|
|
264
265
|
} catch {
|
|
265
|
-
|
|
266
|
+
L(x("bigconsole.parsers.builder.errors.invalidInputJson", "Input JSON is not valid JSON"));
|
|
266
267
|
return;
|
|
267
268
|
}
|
|
268
269
|
e = {
|
|
269
|
-
type:
|
|
270
|
-
expression:
|
|
270
|
+
type: O.type,
|
|
271
|
+
expression: O.expression,
|
|
271
272
|
sampleData: t
|
|
272
273
|
};
|
|
273
274
|
}
|
|
274
|
-
let t = ae(
|
|
275
|
-
|
|
275
|
+
let t = ae(O.type, O.expression);
|
|
276
|
+
lt(!0), L(null), P(""), B(null), dt(null), pt(t);
|
|
276
277
|
try {
|
|
277
|
-
let n = await
|
|
278
|
-
n ? n.success ? (
|
|
278
|
+
let n = await Mt(e);
|
|
279
|
+
n ? (F(n.executionTimeMs), n.success ? (P(JSON.stringify(n.output, null, 2)), dt(t), n.sampled && B({
|
|
279
280
|
sampledRows: n.sampledRows ?? null,
|
|
280
281
|
totalRows: n.totalRows ?? null
|
|
281
|
-
})) :
|
|
282
|
+
})) : L(n.error || x("bigconsole.parsers.builder.errors.testFailed", "Test failed"))) : L(x("bigconsole.parsers.builder.errors.testRequestFailed", "Test request failed — please try again."));
|
|
282
283
|
} catch (e) {
|
|
283
|
-
|
|
284
|
+
L(e instanceof Error ? e.message : x("bigconsole.parsers.builder.errors.testFailed", "Test failed"));
|
|
284
285
|
} finally {
|
|
285
|
-
|
|
286
|
+
lt(!1);
|
|
286
287
|
}
|
|
287
288
|
}, [
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
289
|
+
O.type,
|
|
290
|
+
O.expression,
|
|
291
|
+
O.inputSinkKey,
|
|
292
|
+
ot,
|
|
292
293
|
H,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
]),
|
|
296
|
-
|
|
297
|
-
}, [
|
|
298
|
-
type:
|
|
299
|
-
expression:
|
|
300
|
-
passedSignature:
|
|
301
|
-
canTest:
|
|
302
|
-
}),
|
|
303
|
-
|
|
304
|
-
let e =
|
|
305
|
-
if (Object.keys(e).length > 0)
|
|
306
|
-
else if (
|
|
294
|
+
Mt,
|
|
295
|
+
x
|
|
296
|
+
]), Z = a(() => {
|
|
297
|
+
b(h ? `/dashboards/${h}/parsers` : "/parsers");
|
|
298
|
+
}, [b, h]), nn = re({
|
|
299
|
+
type: O.type,
|
|
300
|
+
expression: O.expression,
|
|
301
|
+
passedSignature: ut,
|
|
302
|
+
canTest: Qe
|
|
303
|
+
}), Q = ne(nn), rn = ft !== null && ft !== ae(O.type, O.expression), an = a(async () => {
|
|
304
|
+
at(null);
|
|
305
|
+
let e = Ve(O, x);
|
|
306
|
+
if (Object.keys(e).length > 0) M(e), e.name || e.outputKey ? w(0) : e.inputSinkKey ? w(1) : e.expression && w(2);
|
|
307
|
+
else if (!Q) w(2);
|
|
307
308
|
else {
|
|
308
|
-
|
|
309
|
+
rt(!0);
|
|
309
310
|
try {
|
|
310
|
-
if (
|
|
311
|
-
if (!await
|
|
312
|
-
name:
|
|
313
|
-
description:
|
|
314
|
-
expression:
|
|
315
|
-
inputSinkKey:
|
|
316
|
-
outputKey:
|
|
317
|
-
ttl:
|
|
318
|
-
},
|
|
319
|
-
} else if (!await
|
|
320
|
-
consoleId:
|
|
321
|
-
name:
|
|
322
|
-
type:
|
|
323
|
-
expression:
|
|
324
|
-
inputSinkKey:
|
|
325
|
-
outputKey:
|
|
326
|
-
description:
|
|
327
|
-
ttl:
|
|
328
|
-
})) throw Error(
|
|
329
|
-
|
|
311
|
+
if (E && Y) {
|
|
312
|
+
if (!await jt(Y.id, {
|
|
313
|
+
name: O.name,
|
|
314
|
+
description: O.description || void 0,
|
|
315
|
+
expression: O.expression,
|
|
316
|
+
inputSinkKey: O.inputSinkKey,
|
|
317
|
+
outputKey: O.outputKey,
|
|
318
|
+
ttl: O.ttl
|
|
319
|
+
}, Y.version)) throw Error(x("bigconsole.parsers.builder.errors.updateFailed", "Failed to update parser"));
|
|
320
|
+
} else if (!await At({
|
|
321
|
+
consoleId: Ke || "",
|
|
322
|
+
name: O.name,
|
|
323
|
+
type: O.type,
|
|
324
|
+
expression: O.expression,
|
|
325
|
+
inputSinkKey: O.inputSinkKey,
|
|
326
|
+
outputKey: O.outputKey,
|
|
327
|
+
description: O.description || void 0,
|
|
328
|
+
ttl: O.ttl ?? void 0
|
|
329
|
+
})) throw Error(x("bigconsole.parsers.builder.errors.createFailed", "Failed to create parser"));
|
|
330
|
+
$e(O), Z();
|
|
330
331
|
} catch (e) {
|
|
331
|
-
|
|
332
|
+
at(e instanceof Error ? e.message : x("bigconsole.parsers.builder.errors.saveFailed", "Failed to save parser"));
|
|
332
333
|
} finally {
|
|
333
|
-
|
|
334
|
+
rt(!1);
|
|
334
335
|
}
|
|
335
336
|
}
|
|
336
337
|
}, [
|
|
337
|
-
A,
|
|
338
|
-
$,
|
|
339
338
|
O,
|
|
340
|
-
X,
|
|
341
|
-
Ct,
|
|
342
|
-
wt,
|
|
343
|
-
ze,
|
|
344
339
|
Q,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
]),
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
340
|
+
E,
|
|
341
|
+
Y,
|
|
342
|
+
At,
|
|
343
|
+
jt,
|
|
344
|
+
Ke,
|
|
345
|
+
Z,
|
|
346
|
+
x
|
|
347
|
+
]), on = s(() => O.name.trim().length >= 2 && O.expression.trim().length > 0 && Q && O.inputSinkKey.trim().length > 0 && O.outputKey.trim().length > 0 && /^[a-z0-9_]+$/.test(O.outputKey), [
|
|
348
|
+
O.name,
|
|
349
|
+
O.expression,
|
|
350
|
+
Q,
|
|
351
|
+
O.inputSinkKey,
|
|
352
|
+
O.outputKey
|
|
353
|
+
]), $ = a((e) => {
|
|
354
|
+
switch (Re[e]) {
|
|
355
|
+
case "details": return O.name.trim().length >= 2 && O.outputKey.trim().length > 0 && /^[a-z0-9_]+$/.test(O.outputKey);
|
|
356
|
+
case "source": return O.inputSinkKey.trim().length > 0;
|
|
357
|
+
case "expression": return Q;
|
|
357
358
|
default: return !0;
|
|
358
359
|
}
|
|
359
360
|
}, [
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
]),
|
|
365
|
-
let t = Math.max(0, Math.min(e,
|
|
366
|
-
if (t >
|
|
367
|
-
for (let e =
|
|
361
|
+
O.name,
|
|
362
|
+
O.outputKey,
|
|
363
|
+
O.inputSinkKey,
|
|
364
|
+
Q
|
|
365
|
+
]), sn = a((e) => {
|
|
366
|
+
let t = Math.max(0, Math.min(e, S - 1));
|
|
367
|
+
if (t > C) {
|
|
368
|
+
for (let e = C; e < t; e++) if (!$(e)) return;
|
|
368
369
|
}
|
|
369
|
-
|
|
370
|
+
w(t);
|
|
370
371
|
}, [
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
]),
|
|
375
|
-
|
|
376
|
-
}, [
|
|
377
|
-
|
|
372
|
+
C,
|
|
373
|
+
$,
|
|
374
|
+
S
|
|
375
|
+
]), cn = a(() => {
|
|
376
|
+
$(C) && w(Math.min(C + 1, S - 1));
|
|
377
|
+
}, [
|
|
378
|
+
C,
|
|
379
|
+
$,
|
|
380
|
+
S
|
|
381
|
+
]), ln = a(() => {
|
|
382
|
+
w((e) => Math.max(e - 1, 0));
|
|
378
383
|
}, []);
|
|
379
|
-
if (
|
|
384
|
+
if (Et && E || Je) return /* @__PURE__ */ p("div", {
|
|
380
385
|
className: "flex items-center justify-center min-h-[400px]",
|
|
381
|
-
children: /* @__PURE__ */
|
|
386
|
+
children: /* @__PURE__ */ p(u, { className: "w-8 h-8 text-text-secondary animate-spin" })
|
|
382
387
|
});
|
|
383
|
-
if (
|
|
384
|
-
title:
|
|
385
|
-
description:
|
|
388
|
+
if (E && !Ye) return /* @__PURE__ */ p(pe, {
|
|
389
|
+
title: x("bigconsole.parsers.builder.accessDenied.title", "Access Denied"),
|
|
390
|
+
description: x("bigconsole.parsers.builder.accessDenied.description", "You don't have permission to view this parser.")
|
|
386
391
|
});
|
|
387
|
-
if (
|
|
392
|
+
if (Dt) return /* @__PURE__ */ p("div", {
|
|
388
393
|
className: "p-card-padding",
|
|
389
|
-
children: /* @__PURE__ */
|
|
394
|
+
children: /* @__PURE__ */ p(t, {
|
|
390
395
|
tone: "danger",
|
|
391
396
|
headingLevel: 2,
|
|
392
|
-
title:
|
|
397
|
+
title: x("bigconsole.parsers.builder.errors.loadParserFailed", "Failed to load Parser"),
|
|
393
398
|
description: "The parser could not be fetched, so the form cannot be filled in.",
|
|
394
|
-
icon: /* @__PURE__ */
|
|
395
|
-
actions: /* @__PURE__ */
|
|
396
|
-
onClick:
|
|
399
|
+
icon: /* @__PURE__ */ p(l, { className: "h-icon-md w-icon-md text-[var(--color-status-error-text)]" }),
|
|
400
|
+
actions: /* @__PURE__ */ m(d, {
|
|
401
|
+
onClick: Z,
|
|
397
402
|
variant: "secondary",
|
|
398
403
|
size: "sm",
|
|
399
|
-
children: [/* @__PURE__ */
|
|
404
|
+
children: [/* @__PURE__ */ p(ge, { className: "w-4 h-4 mr-2" }), x("bigconsole.parsers.builder.header.backToParsers", "Back to Parsers")]
|
|
400
405
|
}),
|
|
401
406
|
"data-testid": "parser-builder-load-error",
|
|
402
|
-
children: /* @__PURE__ */
|
|
407
|
+
children: /* @__PURE__ */ p("p", {
|
|
403
408
|
className: "font-mono text-xs break-words text-text-secondary",
|
|
404
|
-
children:
|
|
409
|
+
children: Dt.message
|
|
405
410
|
})
|
|
406
411
|
})
|
|
407
412
|
});
|
|
408
|
-
let
|
|
413
|
+
let un = We[O.type], dn = C === S - 1, fn = /* @__PURE__ */ p("span", {
|
|
409
414
|
className: "text-xs font-medium text-text-muted",
|
|
410
|
-
children:
|
|
411
|
-
current:
|
|
412
|
-
total:
|
|
415
|
+
children: x("bigconsole.parsers.builder.header.stepCounter", "Step {{current}} of {{total}}", {
|
|
416
|
+
current: C + 1,
|
|
417
|
+
total: S
|
|
413
418
|
})
|
|
414
419
|
});
|
|
415
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ p("div", {
|
|
416
421
|
"data-tour": "bigconsole-parser-builder",
|
|
417
422
|
className: "min-h-screen bg-bg-canvas",
|
|
418
|
-
children: /* @__PURE__ */
|
|
423
|
+
children: /* @__PURE__ */ p("div", {
|
|
419
424
|
className: "max-w-4xl mx-auto p-card-padding pb-10",
|
|
420
|
-
children: /* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */
|
|
425
|
+
children: /* @__PURE__ */ m(n, { children: [
|
|
426
|
+
/* @__PURE__ */ m("div", {
|
|
422
427
|
className: "border-b border-[var(--color-border-subtle)] pb-form-gap",
|
|
423
428
|
children: [
|
|
424
|
-
/* @__PURE__ */
|
|
425
|
-
onClick:
|
|
429
|
+
/* @__PURE__ */ m(d, {
|
|
430
|
+
onClick: Z,
|
|
426
431
|
variant: "ghost",
|
|
427
432
|
size: "sm",
|
|
428
433
|
className: "mb-4",
|
|
429
|
-
children: [/* @__PURE__ */
|
|
434
|
+
children: [/* @__PURE__ */ p(ge, { className: "w-4 h-4 mr-2" }), x("bigconsole.parsers.builder.header.backToParsers", "Back to Parsers")]
|
|
430
435
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ p("h1", {
|
|
432
437
|
className: "text-2xl font-bold text-text-primary sm:text-3xl",
|
|
433
|
-
children:
|
|
438
|
+
children: E ? x("bigconsole.parsers.builder.header.editTitle", "Edit Parser") : x("bigconsole.parsers.builder.header.createTitle", "Create Parser")
|
|
434
439
|
}),
|
|
435
|
-
/* @__PURE__ */
|
|
440
|
+
/* @__PURE__ */ p("p", {
|
|
436
441
|
className: "text-sm text-text-secondary mt-1",
|
|
437
|
-
children:
|
|
442
|
+
children: x("bigconsole.parsers.builder.header.subtitle", "Transform data using JQ or JSONata expressions.")
|
|
438
443
|
})
|
|
439
444
|
]
|
|
440
445
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ p(Ae, {
|
|
442
447
|
className: "max-w-[80ch]",
|
|
443
|
-
children:
|
|
448
|
+
children: x("bigconsole.parsers.builder.header.purpose", "A parser maps raw input into structured fields using a JQ or JSONata expression. Write the expression, run it against a sample to confirm the output, and save it once it produces the shape you need — then reuse it across pipelines to normalise any source.")
|
|
444
449
|
}),
|
|
445
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ p("div", {
|
|
446
451
|
className: "min-w-0 overflow-x-auto",
|
|
447
|
-
children: /* @__PURE__ */
|
|
448
|
-
steps:
|
|
449
|
-
active:
|
|
450
|
-
onStepClick:
|
|
452
|
+
children: /* @__PURE__ */ p(je, {
|
|
453
|
+
steps: Ue,
|
|
454
|
+
active: C,
|
|
455
|
+
onStepClick: sn
|
|
451
456
|
})
|
|
452
457
|
}),
|
|
453
|
-
|
|
458
|
+
it && /* @__PURE__ */ p(t, {
|
|
454
459
|
tone: "danger",
|
|
455
460
|
headingLevel: 2,
|
|
456
|
-
title:
|
|
457
|
-
icon: /* @__PURE__ */
|
|
461
|
+
title: x("bigconsole.parsers.builder.errors.saveParserFailed", "Failed to save Parser"),
|
|
462
|
+
icon: /* @__PURE__ */ p(l, { className: "h-icon-sm w-icon-sm text-[var(--color-status-error-text)]" }),
|
|
458
463
|
"data-testid": "parser-submit-error",
|
|
459
|
-
children: /* @__PURE__ */
|
|
464
|
+
children: /* @__PURE__ */ p("p", {
|
|
460
465
|
className: "font-mono text-xs break-words text-text-secondary",
|
|
461
|
-
children:
|
|
466
|
+
children: it
|
|
462
467
|
})
|
|
463
468
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
469
|
+
/* @__PURE__ */ m("form", {
|
|
465
470
|
className: "flex flex-col gap-section-gap",
|
|
466
471
|
onSubmit: (e) => {
|
|
467
|
-
e.preventDefault(),
|
|
472
|
+
e.preventDefault(), dn && an();
|
|
468
473
|
},
|
|
469
474
|
children: [
|
|
470
|
-
|
|
475
|
+
C === 0 && /* @__PURE__ */ m(t, {
|
|
471
476
|
emphasis: "primary",
|
|
472
477
|
headingLevel: 2,
|
|
473
478
|
title: "Basic information",
|
|
474
479
|
description: "Essential details for your parser.",
|
|
475
|
-
icon: /* @__PURE__ */
|
|
476
|
-
meta:
|
|
480
|
+
icon: /* @__PURE__ */ p(Ce, { className: "h-icon-sm w-icon-sm" }),
|
|
481
|
+
meta: fn,
|
|
477
482
|
bodyClassName: "space-y-5",
|
|
478
483
|
"data-testid": "parser-basic-information",
|
|
479
484
|
children: [
|
|
480
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ m("div", {
|
|
481
486
|
className: "grid gap-5 sm:grid-cols-2",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
487
|
+
children: [/* @__PURE__ */ m("div", { children: [
|
|
488
|
+
/* @__PURE__ */ m("label", {
|
|
484
489
|
htmlFor: "name",
|
|
485
|
-
className:
|
|
490
|
+
className: _,
|
|
486
491
|
children: [
|
|
487
|
-
|
|
492
|
+
x("bigconsole.parsers.builder.fields.name.label", "Name"),
|
|
488
493
|
" ",
|
|
489
|
-
/* @__PURE__ */
|
|
494
|
+
/* @__PURE__ */ p("span", {
|
|
490
495
|
className: "text-status-error-text",
|
|
491
496
|
children: "*"
|
|
492
497
|
})
|
|
493
498
|
]
|
|
494
499
|
}),
|
|
495
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ p("input", {
|
|
496
501
|
id: "name",
|
|
497
502
|
type: "text",
|
|
498
|
-
value:
|
|
499
|
-
onChange:
|
|
500
|
-
placeholder:
|
|
501
|
-
|
|
503
|
+
value: O.name,
|
|
504
|
+
onChange: Vt,
|
|
505
|
+
placeholder: x("bigconsole.parsers.builder.fields.name.placeholder", "e.g., User Analytics Parser"),
|
|
506
|
+
"aria-invalid": !!j.name,
|
|
507
|
+
"aria-describedby": j.name ? "name-error" : void 0,
|
|
508
|
+
className: g(!!j.name)
|
|
502
509
|
}),
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
510
|
+
j.name && /* @__PURE__ */ p("p", {
|
|
511
|
+
id: "name-error",
|
|
512
|
+
className: Pe,
|
|
513
|
+
children: j.name
|
|
506
514
|
})
|
|
507
|
-
] }), /* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
515
|
+
] }), /* @__PURE__ */ m("div", { children: [
|
|
516
|
+
/* @__PURE__ */ m("label", {
|
|
509
517
|
htmlFor: "outputKey",
|
|
510
|
-
className:
|
|
518
|
+
className: _,
|
|
511
519
|
children: [
|
|
512
|
-
|
|
520
|
+
x("bigconsole.parsers.builder.fields.outputKey.label", "Output Key"),
|
|
513
521
|
" ",
|
|
514
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ p("span", {
|
|
515
523
|
className: "text-status-error-text",
|
|
516
524
|
children: "*"
|
|
517
525
|
})
|
|
518
526
|
]
|
|
519
527
|
}),
|
|
520
|
-
/* @__PURE__ */
|
|
528
|
+
/* @__PURE__ */ p("input", {
|
|
521
529
|
id: "outputKey",
|
|
522
530
|
type: "text",
|
|
523
|
-
value:
|
|
524
|
-
onChange:
|
|
531
|
+
value: O.outputKey,
|
|
532
|
+
onChange: Ht,
|
|
525
533
|
placeholder: "user_analytics_parser",
|
|
526
|
-
disabled:
|
|
527
|
-
|
|
534
|
+
disabled: E,
|
|
535
|
+
"aria-invalid": !!j.outputKey,
|
|
536
|
+
"aria-describedby": [j.outputKey ? "outputKey-error" : "", E ? "" : "outputKey-hint"].filter(Boolean).join(" ") || void 0,
|
|
537
|
+
className: g(!!j.outputKey, "font-mono")
|
|
528
538
|
}),
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
539
|
+
j.outputKey && /* @__PURE__ */ p("p", {
|
|
540
|
+
id: "outputKey-error",
|
|
541
|
+
className: Pe,
|
|
542
|
+
children: j.outputKey
|
|
532
543
|
}),
|
|
533
|
-
!
|
|
534
|
-
|
|
535
|
-
|
|
544
|
+
!E && /* @__PURE__ */ p("p", {
|
|
545
|
+
id: "outputKey-hint",
|
|
546
|
+
className: v,
|
|
547
|
+
children: x("bigconsole.parsers.builder.fields.outputKey.helper", "Auto-generated from name. Customize if needed.")
|
|
536
548
|
})
|
|
537
549
|
] })]
|
|
538
550
|
}),
|
|
539
|
-
/* @__PURE__ */
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
/* @__PURE__ */ m("div", { children: [
|
|
552
|
+
/* @__PURE__ */ p("label", {
|
|
553
|
+
htmlFor: "description",
|
|
554
|
+
className: _,
|
|
555
|
+
children: x("bigconsole.parsers.builder.fields.description.label", "Description")
|
|
556
|
+
}),
|
|
557
|
+
/* @__PURE__ */ p("textarea", {
|
|
558
|
+
id: "description",
|
|
559
|
+
value: O.description,
|
|
560
|
+
onChange: Ut,
|
|
561
|
+
placeholder: x("bigconsole.parsers.builder.fields.description.placeholder", "Describe what this parser does..."),
|
|
562
|
+
rows: 3,
|
|
563
|
+
maxLength: Fe,
|
|
564
|
+
"aria-describedby": "description-count",
|
|
565
|
+
className: g(!1, "resize-y")
|
|
566
|
+
}),
|
|
567
|
+
/* @__PURE__ */ p("p", {
|
|
568
|
+
id: "description-count",
|
|
569
|
+
className: `${v} text-right tabular-nums`,
|
|
570
|
+
children: x("bigconsole.parsers.builder.fields.description.characterCount", "{{current}} / {{max}} characters", {
|
|
571
|
+
current: O.description.length,
|
|
572
|
+
max: Fe
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
] }),
|
|
576
|
+
D && /* @__PURE__ */ m("div", { children: [
|
|
577
|
+
/* @__PURE__ */ m("label", {
|
|
553
578
|
htmlFor: "dashboard",
|
|
554
|
-
className: `${
|
|
555
|
-
children: [/* @__PURE__ */
|
|
579
|
+
className: `${_} flex items-center gap-2`,
|
|
580
|
+
children: [/* @__PURE__ */ p(we, {
|
|
556
581
|
"aria-hidden": "true",
|
|
557
582
|
className: "w-4 h-4"
|
|
558
|
-
}),
|
|
583
|
+
}), x("bigconsole.parsers.builder.fields.dashboard.label", "Dashboard Scope")]
|
|
559
584
|
}),
|
|
560
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ m("select", {
|
|
561
586
|
id: "dashboard",
|
|
562
|
-
value:
|
|
563
|
-
onChange:
|
|
564
|
-
disabled:
|
|
565
|
-
className:
|
|
566
|
-
children: [/* @__PURE__ */
|
|
587
|
+
value: T,
|
|
588
|
+
onChange: Jt,
|
|
589
|
+
disabled: Lt || E,
|
|
590
|
+
className: g(),
|
|
591
|
+
children: [/* @__PURE__ */ p("option", {
|
|
567
592
|
value: "default",
|
|
568
|
-
children:
|
|
569
|
-
}),
|
|
593
|
+
children: x("bigconsole.parsers.builder.fields.dashboard.globalOption", "Global (available everywhere)")
|
|
594
|
+
}), Ft.map((e) => /* @__PURE__ */ p("option", {
|
|
570
595
|
value: e.id,
|
|
571
596
|
children: e.name
|
|
572
597
|
}, e.id))]
|
|
573
598
|
}),
|
|
574
|
-
/* @__PURE__ */
|
|
575
|
-
className:
|
|
576
|
-
children:
|
|
599
|
+
/* @__PURE__ */ p("p", {
|
|
600
|
+
className: v,
|
|
601
|
+
children: E ? x("bigconsole.parsers.builder.fields.dashboard.helperLocked", "Dashboard scope cannot be changed after creation.") : T === "default" ? x("bigconsole.parsers.builder.fields.dashboard.helperGlobal", "Global parsers are available across all dashboards.") : x("bigconsole.parsers.builder.fields.dashboard.helperScoped", "This parser will only be available in the selected dashboard.")
|
|
577
602
|
})
|
|
578
603
|
] })
|
|
579
604
|
]
|
|
580
605
|
}),
|
|
581
|
-
|
|
606
|
+
C === 1 && /* @__PURE__ */ m(t, {
|
|
582
607
|
emphasis: "primary",
|
|
583
608
|
headingLevel: 2,
|
|
584
609
|
title: "Parser configuration",
|
|
585
610
|
description: "Pick the language and point it at a source.",
|
|
586
|
-
icon: /* @__PURE__ */
|
|
587
|
-
meta:
|
|
611
|
+
icon: /* @__PURE__ */ p(be, { className: "h-icon-sm w-icon-sm" }),
|
|
612
|
+
meta: fn,
|
|
588
613
|
bodyClassName: "space-y-5",
|
|
589
614
|
"data-testid": "parser-configuration",
|
|
590
|
-
children: [/* @__PURE__ */
|
|
615
|
+
children: [/* @__PURE__ */ m("fieldset", {
|
|
591
616
|
className: "min-w-0 border-0 p-0 m-0",
|
|
592
|
-
children: [/* @__PURE__ */
|
|
617
|
+
children: [/* @__PURE__ */ m("legend", {
|
|
593
618
|
className: "mb-3 text-sm font-medium text-text-primary",
|
|
594
619
|
children: [
|
|
595
|
-
|
|
620
|
+
x("bigconsole.parsers.builder.fields.parserType.label", "Parser Type"),
|
|
596
621
|
" ",
|
|
597
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ p("span", {
|
|
598
623
|
className: "text-status-error-text",
|
|
599
624
|
children: "*"
|
|
600
625
|
})
|
|
601
626
|
]
|
|
602
|
-
}), /* @__PURE__ */
|
|
627
|
+
}), /* @__PURE__ */ p("div", {
|
|
603
628
|
className: "space-y-2",
|
|
604
|
-
children: Object.keys(
|
|
605
|
-
let t =
|
|
606
|
-
return /* @__PURE__ */
|
|
629
|
+
children: Object.keys(We).map((e) => {
|
|
630
|
+
let t = We[e];
|
|
631
|
+
return /* @__PURE__ */ m("label", {
|
|
607
632
|
className: `
|
|
608
633
|
flex items-start gap-3 p-3
|
|
609
634
|
rounded-md border
|
|
610
635
|
cursor-pointer
|
|
611
636
|
motion-safe:transition-colors
|
|
612
|
-
${
|
|
637
|
+
${O.type === e ? "border-action-primary-bg bg-action-primary-bg/5" : "border-transparent bg-bg-sunken hover:border-[var(--color-border-subtle)]"}
|
|
613
638
|
`,
|
|
614
|
-
children: [/* @__PURE__ */
|
|
639
|
+
children: [/* @__PURE__ */ p("input", {
|
|
615
640
|
type: "radio",
|
|
616
641
|
name: "parserType",
|
|
617
642
|
value: e,
|
|
618
|
-
checked:
|
|
619
|
-
onChange: () =>
|
|
643
|
+
checked: O.type === e,
|
|
644
|
+
onChange: () => Wt(e),
|
|
620
645
|
className: "mt-1 w-4 h-4 text-action-primary-bg"
|
|
621
|
-
}), /* @__PURE__ */
|
|
646
|
+
}), /* @__PURE__ */ m("span", {
|
|
622
647
|
className: "min-w-0",
|
|
623
|
-
children: [/* @__PURE__ */
|
|
648
|
+
children: [/* @__PURE__ */ p("span", {
|
|
624
649
|
className: "block text-sm font-medium text-text-primary",
|
|
625
650
|
children: t.name
|
|
626
|
-
}), /* @__PURE__ */
|
|
651
|
+
}), /* @__PURE__ */ p("span", {
|
|
627
652
|
className: "mt-0.5 block text-xs text-text-secondary",
|
|
628
653
|
children: t.description
|
|
629
654
|
})]
|
|
@@ -631,57 +656,60 @@ var x = i(function() {
|
|
|
631
656
|
}, e);
|
|
632
657
|
})
|
|
633
658
|
})]
|
|
634
|
-
}), /* @__PURE__ */
|
|
635
|
-
/* @__PURE__ */
|
|
659
|
+
}), /* @__PURE__ */ m("div", { children: [
|
|
660
|
+
/* @__PURE__ */ m("label", {
|
|
636
661
|
htmlFor: "inputSinkKey",
|
|
637
|
-
className:
|
|
662
|
+
className: _,
|
|
638
663
|
children: [
|
|
639
|
-
|
|
664
|
+
x("bigconsole.parsers.builder.fields.sourceDataSink.label", "Source DataSink"),
|
|
640
665
|
" ",
|
|
641
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ p("span", {
|
|
642
667
|
className: "text-status-error-text",
|
|
643
668
|
children: "*"
|
|
644
669
|
})
|
|
645
670
|
]
|
|
646
671
|
}),
|
|
647
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ m("select", {
|
|
648
673
|
id: "inputSinkKey",
|
|
649
|
-
value:
|
|
650
|
-
onChange:
|
|
651
|
-
|
|
652
|
-
|
|
674
|
+
value: O.inputSinkKey,
|
|
675
|
+
onChange: Kt,
|
|
676
|
+
"aria-invalid": !!j.inputSinkKey,
|
|
677
|
+
"aria-describedby": j.inputSinkKey ? "inputSinkKey-error" : void 0,
|
|
678
|
+
className: g(!!j.inputSinkKey),
|
|
679
|
+
children: [/* @__PURE__ */ p("option", {
|
|
653
680
|
value: "",
|
|
654
|
-
children:
|
|
655
|
-
}), J.map((e) => /* @__PURE__ */
|
|
681
|
+
children: x("bigconsole.parsers.builder.fields.sourceDataSink.placeholder", "Select a DataSink...")
|
|
682
|
+
}), J.map((e) => /* @__PURE__ */ p("option", {
|
|
656
683
|
value: e.key,
|
|
657
684
|
children: e.name || e.key
|
|
658
685
|
}, e.id))]
|
|
659
686
|
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
687
|
+
j.inputSinkKey && /* @__PURE__ */ p("p", {
|
|
688
|
+
id: "inputSinkKey-error",
|
|
689
|
+
className: Pe,
|
|
690
|
+
children: j.inputSinkKey
|
|
663
691
|
}),
|
|
664
|
-
J.length === 0 ? /* @__PURE__ */
|
|
665
|
-
className:
|
|
666
|
-
children:
|
|
667
|
-
}) : /* @__PURE__ */
|
|
668
|
-
className:
|
|
692
|
+
J.length === 0 ? /* @__PURE__ */ p("p", {
|
|
693
|
+
className: v,
|
|
694
|
+
children: x("bigconsole.parsers.builder.fields.sourceDataSink.emptyState", "No DataSinks yet — create one first, then return here to build a parser for it.")
|
|
695
|
+
}) : /* @__PURE__ */ p("p", {
|
|
696
|
+
className: v,
|
|
669
697
|
children: "Select the data source for this parser to transform."
|
|
670
698
|
}),
|
|
671
|
-
|
|
699
|
+
O.inputSinkKey && /* @__PURE__ */ m("div", {
|
|
672
700
|
className: "mt-3",
|
|
673
|
-
children: [/* @__PURE__ */
|
|
701
|
+
children: [/* @__PURE__ */ m("button", {
|
|
674
702
|
type: "button",
|
|
675
|
-
onClick:
|
|
703
|
+
onClick: en,
|
|
676
704
|
"aria-expanded": G,
|
|
677
705
|
"aria-controls": "parser-data-preview",
|
|
678
|
-
className: "inline-flex min-h-
|
|
706
|
+
className: "inline-flex min-h-[44px] items-center gap-2 rounded-md text-sm text-action-primary-bg hover:text-action-primary-bgHover motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
|
|
679
707
|
children: [
|
|
680
|
-
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
|
|
708
|
+
p(G ? ve : ye, { className: "w-4 h-4" }),
|
|
709
|
+
/* @__PURE__ */ p(Se, { className: "w-4 h-4" }),
|
|
710
|
+
x("bigconsole.parsers.builder.dataPreview.toggle", "Show Data Preview")
|
|
683
711
|
]
|
|
684
|
-
}), G && /* @__PURE__ */
|
|
712
|
+
}), G && /* @__PURE__ */ p(t, {
|
|
685
713
|
id: "parser-data-preview",
|
|
686
714
|
emphasis: "muted",
|
|
687
715
|
padding: "compact",
|
|
@@ -690,301 +718,324 @@ var x = i(function() {
|
|
|
690
718
|
description: "A slice of the payload stored on the selected DataSink.",
|
|
691
719
|
className: "mt-3",
|
|
692
720
|
"data-testid": "parser-data-preview",
|
|
693
|
-
children:
|
|
721
|
+
children: St ? /* @__PURE__ */ m("div", {
|
|
694
722
|
className: "flex items-center justify-center p-4",
|
|
695
|
-
children: [/* @__PURE__ */
|
|
723
|
+
children: [/* @__PURE__ */ p(u, { className: "w-5 h-5 text-text-secondary animate-spin" }), /* @__PURE__ */ p("span", {
|
|
696
724
|
className: "ml-2 text-sm text-text-secondary",
|
|
697
|
-
children:
|
|
725
|
+
children: x("bigconsole.parsers.builder.dataPreview.loading", "Loading sample…")
|
|
698
726
|
})]
|
|
699
|
-
}) :
|
|
727
|
+
}) : wt ? /* @__PURE__ */ p("p", {
|
|
700
728
|
className: "text-sm text-status-error-text",
|
|
701
|
-
children:
|
|
702
|
-
}) :
|
|
729
|
+
children: wt
|
|
730
|
+
}) : bt ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("pre", {
|
|
703
731
|
className: "max-h-48 min-w-0 overflow-auto rounded-md bg-bg-canvas p-3 font-mono text-xs text-text-primary",
|
|
704
|
-
children: JSON.stringify(
|
|
705
|
-
}), q && /* @__PURE__ */
|
|
706
|
-
className:
|
|
732
|
+
children: JSON.stringify(bt, null, 2)
|
|
733
|
+
}), q && /* @__PURE__ */ m("p", {
|
|
734
|
+
className: v,
|
|
707
735
|
children: [
|
|
708
|
-
|
|
709
|
-
q.total == null ? "" :
|
|
710
|
-
shown: Math.min(
|
|
736
|
+
x("bigconsole.parsers.builder.dataPreview.previewingSample", "Previewing a sample"),
|
|
737
|
+
q.total == null ? "" : x("bigconsole.parsers.builder.dataPreview.rowRange", " (first {{shown}} of {{total}} rows)", {
|
|
738
|
+
shown: Math.min(y, q.total),
|
|
711
739
|
total: q.total
|
|
712
740
|
}),
|
|
713
741
|
" · ",
|
|
714
742
|
q.sinkName
|
|
715
743
|
]
|
|
716
|
-
})] }) : /* @__PURE__ */
|
|
744
|
+
})] }) : /* @__PURE__ */ p("p", {
|
|
717
745
|
className: "text-center text-sm text-text-secondary",
|
|
718
|
-
children:
|
|
746
|
+
children: x("bigconsole.parsers.builder.dataPreview.noData", "No data available")
|
|
719
747
|
})
|
|
720
748
|
})]
|
|
721
749
|
})
|
|
722
750
|
] })]
|
|
723
751
|
}),
|
|
724
|
-
|
|
752
|
+
C === 2 && /* @__PURE__ */ m(t, {
|
|
725
753
|
emphasis: "primary",
|
|
726
754
|
headingLevel: 2,
|
|
727
755
|
title: "Test expression",
|
|
728
756
|
description: "Write the expression, then run it against sample data before you save.",
|
|
729
|
-
icon: /* @__PURE__ */
|
|
730
|
-
meta:
|
|
757
|
+
icon: /* @__PURE__ */ p(Te, { className: "h-icon-sm w-icon-sm" }),
|
|
758
|
+
meta: fn,
|
|
731
759
|
bodyClassName: "space-y-5",
|
|
732
760
|
"data-testid": "parser-test-expression",
|
|
733
761
|
children: [
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
|
|
737
|
-
className:
|
|
762
|
+
/* @__PURE__ */ m("div", { children: [
|
|
763
|
+
/* @__PURE__ */ m("p", {
|
|
764
|
+
id: "expression-label",
|
|
765
|
+
className: _,
|
|
738
766
|
children: [
|
|
739
|
-
|
|
767
|
+
x("bigconsole.parsers.builder.fields.expression.label", "Expression"),
|
|
740
768
|
" ",
|
|
741
|
-
/* @__PURE__ */
|
|
769
|
+
/* @__PURE__ */ p("span", {
|
|
742
770
|
className: "text-status-error-text",
|
|
743
771
|
children: "*"
|
|
744
772
|
})
|
|
745
773
|
]
|
|
746
774
|
}),
|
|
747
|
-
/* @__PURE__ */
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
775
|
+
/* @__PURE__ */ p("div", {
|
|
776
|
+
role: "group",
|
|
777
|
+
"aria-labelledby": "expression-label",
|
|
778
|
+
"aria-describedby": "expression-hint",
|
|
779
|
+
children: /* @__PURE__ */ p(ue, {
|
|
780
|
+
value: O.expression,
|
|
781
|
+
type: O.type,
|
|
782
|
+
onChange: Gt,
|
|
783
|
+
height: Ie,
|
|
784
|
+
error: j.expression ?? null
|
|
785
|
+
})
|
|
758
786
|
}),
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
|
|
761
|
-
|
|
787
|
+
/* @__PURE__ */ p("p", {
|
|
788
|
+
id: "expression-hint",
|
|
789
|
+
className: v,
|
|
790
|
+
children: x("bigconsole.parsers.builder.fields.expression.example", "Example: {{example}}", { example: un.example })
|
|
762
791
|
})
|
|
763
792
|
] }),
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ m("div", { children: [
|
|
794
|
+
/* @__PURE__ */ m("div", {
|
|
766
795
|
className: "mb-2 flex flex-wrap items-center justify-between gap-control-gap",
|
|
767
|
-
children: [/* @__PURE__ */
|
|
768
|
-
|
|
769
|
-
className: `${
|
|
770
|
-
children: [
|
|
796
|
+
children: [/* @__PURE__ */ m("p", {
|
|
797
|
+
id: "test-input-label",
|
|
798
|
+
className: `${_} mb-0 flex flex-wrap items-center gap-2`,
|
|
799
|
+
children: [x("bigconsole.parsers.builder.test.inputJsonLabel", "Input JSON"), /* @__PURE__ */ p("span", {
|
|
771
800
|
className: `rounded border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${H ? "text-action-primary-bg bg-action-primary-bg/10 border-action-primary-bg/30" : "text-text-secondary bg-bg-sunken border-[var(--color-border-subtle)]"}`,
|
|
772
|
-
children: H ?
|
|
801
|
+
children: H ? x("bigconsole.parsers.builder.test.referenceMode", "Reference mode") : x("bigconsole.parsers.builder.test.sampleMode", "Sample mode")
|
|
773
802
|
})]
|
|
774
|
-
}), /* @__PURE__ */
|
|
803
|
+
}), /* @__PURE__ */ m("div", {
|
|
775
804
|
className: "flex flex-wrap items-center gap-2",
|
|
776
|
-
children: [
|
|
805
|
+
children: [O.inputSinkKey && !H && /* @__PURE__ */ m("button", {
|
|
777
806
|
type: "button",
|
|
778
|
-
onClick:
|
|
779
|
-
disabled:
|
|
780
|
-
className: "inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-action-primary-bg px-2.5 py-1.5 text-xs font-semibold text-action-primary-bg hover:bg-action-primary-bg/10 motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface disabled:opacity-50 disabled:cursor-not-allowed",
|
|
781
|
-
children: [
|
|
782
|
-
}), H && /* @__PURE__ */
|
|
807
|
+
onClick: Qt,
|
|
808
|
+
disabled: _t,
|
|
809
|
+
className: "inline-flex min-h-[44px] items-center gap-1.5 whitespace-nowrap rounded-md border border-action-primary-bg px-2.5 py-1.5 text-xs font-semibold text-action-primary-bg hover:bg-action-primary-bg/10 motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface disabled:opacity-50 disabled:cursor-not-allowed",
|
|
810
|
+
children: [_t ? /* @__PURE__ */ p(u, { className: "w-3.5 h-3.5 animate-spin" }) : /* @__PURE__ */ p(xe, { className: "w-3.5 h-3.5" }), x("bigconsole.parsers.builder.actions.loadSample", "Load Sample")]
|
|
811
|
+
}), H && /* @__PURE__ */ m("button", {
|
|
783
812
|
type: "button",
|
|
784
|
-
onClick:
|
|
785
|
-
className: "inline-flex items-center gap-1.5 whitespace-nowrap rounded-md border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs font-semibold text-text-primary hover:bg-bg-sunken motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
|
|
786
|
-
children: [/* @__PURE__ */
|
|
813
|
+
onClick: $t,
|
|
814
|
+
className: "inline-flex min-h-[44px] items-center gap-1.5 whitespace-nowrap rounded-md border border-[var(--color-border-default)] px-2.5 py-1.5 text-xs font-semibold text-text-primary hover:bg-bg-sunken motion-safe:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
|
|
815
|
+
children: [/* @__PURE__ */ p(ke, { className: "w-3.5 h-3.5" }), x("bigconsole.parsers.builder.actions.clear", "Clear")]
|
|
787
816
|
})]
|
|
788
817
|
})]
|
|
789
818
|
}),
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
819
|
+
/* @__PURE__ */ p("div", {
|
|
820
|
+
role: "group",
|
|
821
|
+
"aria-labelledby": "test-input-label",
|
|
822
|
+
"aria-describedby": "test-input-hint",
|
|
823
|
+
onKeyDownCapture: Xt,
|
|
824
|
+
onPasteCapture: Zt,
|
|
825
|
+
className: H ? "opacity-80" : void 0,
|
|
826
|
+
children: /* @__PURE__ */ p(ue, {
|
|
827
|
+
value: ot,
|
|
828
|
+
language: "json",
|
|
829
|
+
onChange: Yt,
|
|
830
|
+
readOnly: H,
|
|
831
|
+
height: Ie
|
|
832
|
+
})
|
|
801
833
|
}),
|
|
802
|
-
H &&
|
|
834
|
+
H && mt && /* @__PURE__ */ m("p", {
|
|
803
835
|
role: "status",
|
|
804
836
|
"data-testid": "parser-test-input-locked-notice",
|
|
805
837
|
className: "mt-2 flex items-start gap-1.5 rounded-md border border-[var(--color-status-warning-border)] bg-[var(--color-status-warning-bgSubtle)] px-2.5 py-1.5 text-xs text-[var(--color-status-warning-text)]",
|
|
806
|
-
children: [/* @__PURE__ */
|
|
838
|
+
children: [/* @__PURE__ */ p(l, {
|
|
807
839
|
className: "mt-0.5 h-3.5 w-3.5 shrink-0",
|
|
808
840
|
"aria-hidden": "true"
|
|
809
|
-
}),
|
|
841
|
+
}), x("bigconsole.parsers.builder.test.lockedNotice", "This sample is read-only in Reference mode — tests run against the source sink. Press Clear to type your own test input.")]
|
|
810
842
|
}),
|
|
811
|
-
H && U ? /* @__PURE__ */
|
|
812
|
-
id: "test-input-
|
|
813
|
-
className:
|
|
843
|
+
H && U ? /* @__PURE__ */ m("p", {
|
|
844
|
+
id: "test-input-hint",
|
|
845
|
+
className: v,
|
|
814
846
|
children: [
|
|
815
|
-
|
|
816
|
-
U.total == null ? "" :
|
|
817
|
-
shown: Math.min(
|
|
847
|
+
x("bigconsole.parsers.builder.test.loadedSample", "Loaded a small sample"),
|
|
848
|
+
U.total == null ? "" : x("bigconsole.parsers.builder.dataPreview.rowRange", " (first {{shown}} of {{total}} rows)", {
|
|
849
|
+
shown: Math.min(y, U.total),
|
|
818
850
|
total: U.total
|
|
819
851
|
}),
|
|
820
852
|
" ",
|
|
821
|
-
|
|
853
|
+
x("bigconsole.parsers.builder.test.loadedSampleFrom", "from {{sinkName}} · locked — press Clear to edit.", { sinkName: U.sinkName })
|
|
822
854
|
]
|
|
823
|
-
}) : /* @__PURE__ */
|
|
824
|
-
|
|
825
|
-
|
|
855
|
+
}) : /* @__PURE__ */ p("p", {
|
|
856
|
+
id: "test-input-hint",
|
|
857
|
+
className: v,
|
|
858
|
+
children: x("bigconsole.parsers.builder.test.inputHelper", "Type sample JSON to test against it, or Load a sample from the source.")
|
|
826
859
|
})
|
|
827
860
|
] }),
|
|
828
|
-
/* @__PURE__ */ m(
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
861
|
+
/* @__PURE__ */ m("div", {
|
|
862
|
+
className: "flex items-center gap-3",
|
|
863
|
+
children: [/* @__PURE__ */ p("div", {
|
|
864
|
+
className: "min-w-0 flex-1",
|
|
865
|
+
children: /* @__PURE__ */ p(me, {
|
|
866
|
+
permission: r.PARSER_TEST,
|
|
867
|
+
deniedBehavior: "disable",
|
|
868
|
+
children: /* @__PURE__ */ p(d, {
|
|
869
|
+
type: "button",
|
|
870
|
+
onClick: tn,
|
|
871
|
+
disabled: R || !O.expression.trim(),
|
|
872
|
+
variant: "default",
|
|
873
|
+
className: "w-full min-h-[44px]",
|
|
874
|
+
children: R ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(u, { className: "w-4 h-4 mr-2 animate-spin" }), x("bigconsole.parsers.builder.actions.testing", "Testing...")] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Te, { className: "w-4 h-4 mr-2" }), x("bigconsole.parsers.builder.actions.runTest", "Run Test")] })
|
|
875
|
+
})
|
|
876
|
+
})
|
|
877
|
+
}), ct !== null && !R && /* @__PURE__ */ m("span", {
|
|
878
|
+
className: "inline-flex items-center gap-1.5 whitespace-nowrap text-xs text-text-muted tabular-nums",
|
|
879
|
+
"data-testid": "parser-test-duration",
|
|
880
|
+
children: [/* @__PURE__ */ p(Oe, {
|
|
881
|
+
className: "w-3.5 h-3.5",
|
|
882
|
+
"aria-hidden": "true"
|
|
883
|
+
}), x("bigconsole.parsers.testPanel.executedIn", "Executed in {{ms}}ms", { ms: ct })]
|
|
884
|
+
})]
|
|
839
885
|
}),
|
|
840
|
-
|
|
841
|
-
className:
|
|
886
|
+
nn === "untested" && !R && /* @__PURE__ */ p("p", {
|
|
887
|
+
className: v,
|
|
842
888
|
role: "status",
|
|
843
889
|
"data-testid": "parser-test-gate",
|
|
844
|
-
children:
|
|
890
|
+
children: I && !rn ? x("bigconsole.parsers.builder.test.gateFailed", "The test failed. Fix the expression and run the test again to continue.") : x("bigconsole.parsers.builder.test.gateUntested", "Run a passing test of this expression to continue.")
|
|
845
891
|
}),
|
|
846
|
-
|
|
892
|
+
nn === "untestable" && /* @__PURE__ */ m("p", {
|
|
847
893
|
role: "status",
|
|
848
894
|
"data-testid": "parser-test-gate",
|
|
849
895
|
className: "flex items-start gap-1.5 rounded-md border border-[var(--color-status-warning-border)] bg-[var(--color-status-warning-bgSubtle)] px-2.5 py-1.5 text-xs text-[var(--color-status-warning-text)]",
|
|
850
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ p(l, {
|
|
851
897
|
className: "mt-0.5 h-3.5 w-3.5 shrink-0",
|
|
852
898
|
"aria-hidden": "true"
|
|
853
|
-
}),
|
|
899
|
+
}), x("bigconsole.parsers.builder.test.gateUntestable", "You don’t have permission to run tests, so this expression has not been tested. Ask someone who can to test it before dashboards rely on it.")]
|
|
854
900
|
}),
|
|
855
|
-
(
|
|
901
|
+
(st || I) && /* @__PURE__ */ m(t, {
|
|
856
902
|
emphasis: "muted",
|
|
857
903
|
padding: "compact",
|
|
858
904
|
headingLevel: 3,
|
|
859
|
-
tone:
|
|
860
|
-
title:
|
|
861
|
-
meta:
|
|
905
|
+
tone: I ? "danger" : "success",
|
|
906
|
+
title: I ? x("bigconsole.parsers.builder.test.errorOutputLabel", "Error Output") : x("bigconsole.parsers.builder.test.outputLabel", "Output"),
|
|
907
|
+
meta: I ? /* @__PURE__ */ m("span", {
|
|
862
908
|
className: "inline-flex items-center gap-1 text-xs text-[var(--color-status-error-text)]",
|
|
863
909
|
children: [
|
|
864
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ p(l, { className: "w-3 h-3" }),
|
|
865
911
|
" ",
|
|
866
|
-
|
|
912
|
+
x("bigconsole.parsers.builder.test.failed", "Failed")
|
|
867
913
|
]
|
|
868
|
-
}) : /* @__PURE__ */
|
|
914
|
+
}) : /* @__PURE__ */ m("span", {
|
|
869
915
|
className: "inline-flex items-center gap-1 text-xs text-status-success-text",
|
|
870
916
|
children: [
|
|
871
|
-
/* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ p(_e, { className: "w-3 h-3" }),
|
|
872
918
|
" ",
|
|
873
|
-
|
|
919
|
+
x("bigconsole.parsers.builder.test.passed", "Passed")
|
|
874
920
|
]
|
|
875
921
|
}),
|
|
876
922
|
"data-testid": "parser-test-output",
|
|
877
923
|
children: [
|
|
878
|
-
|
|
879
|
-
className: `${
|
|
924
|
+
rn && /* @__PURE__ */ p("p", {
|
|
925
|
+
className: `${v} mb-2`,
|
|
880
926
|
"data-testid": "parser-test-output-stale",
|
|
881
|
-
children:
|
|
927
|
+
children: x("bigconsole.parsers.builder.test.staleResult", "This result is from an earlier version of the expression. Run the test again.")
|
|
882
928
|
}),
|
|
883
|
-
/* @__PURE__ */
|
|
884
|
-
className: "max-h-[150px] min-w-0 overflow-auto rounded-md bg-bg-canvas px-3 py-2.5 font-mono text-xs leading-relaxed text-text-primary",
|
|
885
|
-
children:
|
|
929
|
+
I ? /* @__PURE__ */ p("pre", {
|
|
930
|
+
className: "max-h-[150px] min-w-0 overflow-auto whitespace-pre-wrap break-words rounded-md bg-bg-canvas px-3 py-2.5 font-mono text-xs leading-relaxed text-text-primary",
|
|
931
|
+
children: I
|
|
932
|
+
}) : /* @__PURE__ */ p(ue, {
|
|
933
|
+
value: st,
|
|
934
|
+
language: "json",
|
|
935
|
+
readOnly: !0,
|
|
936
|
+
height: Ie
|
|
886
937
|
}),
|
|
887
|
-
z && !
|
|
888
|
-
className:
|
|
938
|
+
z && !I && /* @__PURE__ */ m("p", {
|
|
939
|
+
className: v,
|
|
889
940
|
children: [
|
|
890
|
-
|
|
891
|
-
z.sampledRows != null && z.totalRows != null ?
|
|
941
|
+
x("bigconsole.parsers.builder.test.testedSample", "Tested a sample"),
|
|
942
|
+
z.sampledRows != null && z.totalRows != null ? x("bigconsole.parsers.builder.dataPreview.rowRange", " (first {{shown}} of {{total}} rows)", {
|
|
892
943
|
shown: z.sampledRows,
|
|
893
944
|
total: z.totalRows
|
|
894
945
|
}) : "",
|
|
895
|
-
|
|
946
|
+
x("bigconsole.parsers.builder.test.testedSampleNote", " — a saved parser runs over the full source, so results may differ.")
|
|
896
947
|
]
|
|
897
948
|
})
|
|
898
949
|
]
|
|
899
950
|
}),
|
|
900
|
-
!
|
|
951
|
+
!st && !I && /* @__PURE__ */ p(t, {
|
|
901
952
|
emphasis: "muted",
|
|
902
953
|
padding: "compact",
|
|
903
954
|
headingLevel: 3,
|
|
904
955
|
title: "No run yet",
|
|
905
956
|
"data-testid": "parser-test-empty",
|
|
906
|
-
children: /* @__PURE__ */
|
|
957
|
+
children: /* @__PURE__ */ m("p", {
|
|
907
958
|
className: "text-xs leading-relaxed text-text-secondary",
|
|
908
959
|
children: [
|
|
909
|
-
/* @__PURE__ */
|
|
960
|
+
/* @__PURE__ */ p("strong", { children: x("bigconsole.parsers.builder.test.tipLabel", "Tip:") }),
|
|
910
961
|
" ",
|
|
911
|
-
|
|
962
|
+
x("bigconsole.parsers.builder.test.tipBody", "write your expression and click “Run Test” to see the transformation.")
|
|
912
963
|
]
|
|
913
964
|
})
|
|
914
965
|
})
|
|
915
966
|
]
|
|
916
967
|
}),
|
|
917
|
-
|
|
968
|
+
C === 3 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(t, {
|
|
918
969
|
emphasis: "primary",
|
|
919
970
|
headingLevel: 2,
|
|
920
|
-
title:
|
|
921
|
-
description:
|
|
922
|
-
icon: /* @__PURE__ */
|
|
923
|
-
meta:
|
|
971
|
+
title: x("bigconsole.parsers.builder.review.cacheDurationLabel", "Cache Duration"),
|
|
972
|
+
description: x("bigconsole.parsers.builder.review.cacheDurationHelper", "How long should data be cached before refreshing?"),
|
|
973
|
+
icon: /* @__PURE__ */ p(De, { className: "h-icon-sm w-icon-sm" }),
|
|
974
|
+
meta: fn,
|
|
924
975
|
"data-testid": "parser-advanced-settings",
|
|
925
|
-
children: /* @__PURE__ */
|
|
926
|
-
value:
|
|
927
|
-
onChange:
|
|
928
|
-
error:
|
|
976
|
+
children: /* @__PURE__ */ p(le, {
|
|
977
|
+
value: O.ttl,
|
|
978
|
+
onChange: qt,
|
|
979
|
+
error: j.ttl,
|
|
929
980
|
hideLabel: !0
|
|
930
981
|
})
|
|
931
|
-
}), /* @__PURE__ */
|
|
982
|
+
}), /* @__PURE__ */ p(t, {
|
|
932
983
|
emphasis: "muted",
|
|
933
984
|
headingLevel: 2,
|
|
934
|
-
title:
|
|
985
|
+
title: x("bigconsole.parsers.builder.review.label", "Review"),
|
|
935
986
|
description: "Check these details before you save.",
|
|
936
987
|
"data-testid": "parser-review",
|
|
937
|
-
children: /* @__PURE__ */
|
|
988
|
+
children: /* @__PURE__ */ p("div", {
|
|
938
989
|
className: "overflow-hidden rounded-lg border border-[var(--color-border-subtle)]",
|
|
939
990
|
children: [
|
|
940
|
-
[
|
|
941
|
-
[
|
|
942
|
-
[
|
|
943
|
-
[
|
|
944
|
-
[
|
|
945
|
-
].map(([e, t]) => /* @__PURE__ */
|
|
991
|
+
[x("bigconsole.parsers.builder.review.name", "Name"), O.name || "—"],
|
|
992
|
+
[x("bigconsole.parsers.builder.review.outputKey", "Output Key"), O.outputKey || "—"],
|
|
993
|
+
[x("bigconsole.parsers.builder.review.scope", "Scope"), D ? T === "default" ? x("bigconsole.parsers.builder.review.scopeGlobal", "Global") : Ft.find((e) => e.id === T)?.name || T : x("bigconsole.parsers.builder.review.scopeDashboard", "Dashboard")],
|
|
994
|
+
[x("bigconsole.parsers.builder.review.type", "Type"), We[O.type].name],
|
|
995
|
+
[x("bigconsole.parsers.builder.review.source", "Source"), X || "—"]
|
|
996
|
+
].map(([e, t]) => /* @__PURE__ */ m("div", {
|
|
946
997
|
className: "flex flex-wrap items-center justify-between gap-3 border-b border-[var(--color-border-subtle)] px-4 py-2.5 text-sm last:border-b-0",
|
|
947
|
-
children: [/* @__PURE__ */
|
|
998
|
+
children: [/* @__PURE__ */ p("span", {
|
|
948
999
|
className: "text-text-secondary",
|
|
949
1000
|
children: e
|
|
950
|
-
}), /* @__PURE__ */
|
|
1001
|
+
}), /* @__PURE__ */ p("span", {
|
|
951
1002
|
className: "min-w-0 break-words text-right font-medium text-text-primary",
|
|
952
1003
|
children: t
|
|
953
1004
|
})]
|
|
954
1005
|
}, e))
|
|
955
1006
|
})
|
|
956
1007
|
})] }),
|
|
957
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ m("div", {
|
|
958
1009
|
className: "sticky bottom-0 z-10 flex flex-col-reverse gap-control-gap border-t border-[var(--color-border-subtle)] bg-bg-canvas py-form-gap sm:flex-row sm:items-center sm:justify-between",
|
|
959
|
-
children: [
|
|
1010
|
+
children: [C === 0 ? /* @__PURE__ */ p(d, {
|
|
960
1011
|
type: "button",
|
|
961
|
-
onClick:
|
|
1012
|
+
onClick: Z,
|
|
962
1013
|
variant: "secondary",
|
|
963
1014
|
className: "w-full sm:w-auto",
|
|
964
|
-
children:
|
|
965
|
-
}) : /* @__PURE__ */
|
|
1015
|
+
children: x("bigconsole.parsers.builder.actions.cancel", "Cancel")
|
|
1016
|
+
}) : /* @__PURE__ */ m(d, {
|
|
966
1017
|
type: "button",
|
|
967
|
-
onClick:
|
|
1018
|
+
onClick: ln,
|
|
968
1019
|
variant: "secondary",
|
|
969
1020
|
className: "w-full sm:w-auto",
|
|
970
|
-
children: [/* @__PURE__ */
|
|
971
|
-
}),
|
|
972
|
-
permission:
|
|
1021
|
+
children: [/* @__PURE__ */ p(ge, { className: "w-4 h-4 mr-2" }), x("bigconsole.parsers.builder.actions.back", "Back")]
|
|
1022
|
+
}), dn ? /* @__PURE__ */ p(me, {
|
|
1023
|
+
permission: Ze,
|
|
973
1024
|
deniedBehavior: "disable",
|
|
974
|
-
children: /* @__PURE__ */
|
|
1025
|
+
children: /* @__PURE__ */ p(d, {
|
|
975
1026
|
type: "submit",
|
|
976
|
-
disabled: !
|
|
1027
|
+
disabled: !on || nt || !Xe,
|
|
977
1028
|
variant: "default",
|
|
978
1029
|
className: "w-full sm:w-auto",
|
|
979
|
-
children:
|
|
1030
|
+
children: nt ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(u, { className: "w-4 h-4 mr-2 animate-spin" }), x("bigconsole.parsers.builder.actions.saving", "Saving...")] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(Ee, { className: "w-4 h-4 mr-2" }), E ? x("bigconsole.parsers.builder.actions.saveChanges", "Save Changes") : x("bigconsole.parsers.builder.actions.createParser", "Create Parser")] })
|
|
980
1031
|
})
|
|
981
|
-
}) : /* @__PURE__ */
|
|
1032
|
+
}) : /* @__PURE__ */ m(d, {
|
|
982
1033
|
type: "button",
|
|
983
|
-
onClick:
|
|
984
|
-
disabled:
|
|
1034
|
+
onClick: cn,
|
|
1035
|
+
disabled: !$(C),
|
|
985
1036
|
variant: "default",
|
|
986
1037
|
className: "w-full sm:w-auto",
|
|
987
|
-
children: [
|
|
1038
|
+
children: [x("bigconsole.parsers.builder.actions.next", "Next"), /* @__PURE__ */ p(ye, { className: "w-4 h-4 ml-2" })]
|
|
988
1039
|
})]
|
|
989
1040
|
})
|
|
990
1041
|
]
|
|
@@ -993,4 +1044,4 @@ var x = i(function() {
|
|
|
993
1044
|
})
|
|
994
1045
|
});
|
|
995
1046
|
});
|
|
996
|
-
export {
|
|
1047
|
+
export { b as ParserBuilderPage, b as default };
|