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