@burdenoff/microfe-bigconsole 2026.1124.5 → 2026.1124.7
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/builder/inspector/QuerySection.d.ts +15 -0
- package/dist/bigconsole/components/builder/inspector/QuerySection.js +501 -0
- package/dist/bigconsole/components/builder/inspector/index.d.ts +1 -0
- package/dist/bigconsole/components/builder/inspector/index.js +1 -0
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +113 -115
- package/dist/bigconsole/components/fleet/FleetCopySection.js +2 -2
- package/dist/bigconsole/components/fleet/FleetWidgetActions.js +62 -57
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +800 -779
- package/dist/bigconsole/components/widgets/chart/ChartWidget.js +140 -130
- package/dist/bigconsole/components/widgets/chart/charts/numericSeries.js +4 -4
- package/dist/bigconsole/components/widgets/chart/charts/referenceElements.js +1 -1
- package/dist/bigconsole/components/widgets/chart/charts/types.d.ts +1 -1
- package/dist/bigconsole/hooks/useWidgetQueryPreview.d.ts +11 -0
- package/dist/bigconsole/hooks/useWidgetQueryPreview.js +42 -0
- package/dist/bigconsole/utils/fleetPlural.d.ts +7 -0
- package/dist/bigconsole/utils/fleetPlural.js +11 -0
- package/dist/bigconsole/utils/widgetQuery.d.ts +102 -0
- package/dist/bigconsole/utils/widgetQuery.js +241 -0
- package/dist/generated/wspace-operations.d.ts +14 -0
- package/dist/generated/wspace-operations.js +130 -11
- package/dist/generated/wspace-types.d.ts +8 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { Widget } from '../../../types';
|
|
3
|
+
import { WidgetQuery } from '../../../utils/widgetQuery';
|
|
4
|
+
export interface QuerySectionProps {
|
|
5
|
+
widget: Widget;
|
|
6
|
+
/** The rows the parser produced (the Data tab's parser test), or null when there is no sample yet. */
|
|
7
|
+
rows: Record<string, unknown>[] | null;
|
|
8
|
+
/** The draft query: null means the widget shows the parser's rows as they are. */
|
|
9
|
+
query: WidgetQuery | null;
|
|
10
|
+
/** Query preview runs against the widget's saved source. */
|
|
11
|
+
sourceSaved: boolean;
|
|
12
|
+
/** Called with the new draft, or null to stop grouping. */
|
|
13
|
+
onChange: (query: WidgetQuery | null) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const QuerySection: FC<QuerySectionProps>;
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { Section as e } from "../../common/Section.js";
|
|
2
|
+
import { useWidgetQueryPreview as t } from "../../../hooks/useWidgetQueryPreview.js";
|
|
3
|
+
import { NUMERIC_ONLY as n, QUERY_AGGREGATES as r, QUERY_LIMITS as i, describeQuery as a, detectFields as o, normalizeQuery as s, omitKey as c, queryInputLimits as l, queryProblem as u, queryRendererProblem as d, repeatedXWarning as f, suggestQuery as p, supportsQuery as m, supportsQuerySeries as h } from "../../../utils/widgetQuery.js";
|
|
4
|
+
import "../../common/index.js";
|
|
5
|
+
import { Suspense as g, lazy as _, useMemo as v } from "react";
|
|
6
|
+
import { Calendar as y, Hash as b, Plus as x, ToggleLeft as S, Trash2 as C, Type as w } from "lucide-react";
|
|
7
|
+
import { Button as T, Input as ee, Label as E, Select as D, SelectContent as O, SelectItem as k, SelectTrigger as A, SelectValue as j, Spinner as M } from "@burdenoff/fe-libs/ui";
|
|
8
|
+
import { useI18n as N } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
9
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
10
|
+
// src/bigconsole/components/builder/inspector/QuerySection.tsx
|
|
11
|
+
var L = "__none__", R = 8, z = {
|
|
12
|
+
text: w,
|
|
13
|
+
number: b,
|
|
14
|
+
date: y,
|
|
15
|
+
boolean: S
|
|
16
|
+
}, B = {
|
|
17
|
+
text: "text",
|
|
18
|
+
number: "number",
|
|
19
|
+
date: "date",
|
|
20
|
+
boolean: "true/false"
|
|
21
|
+
}, V = {
|
|
22
|
+
sum: "Total",
|
|
23
|
+
avg: "Average",
|
|
24
|
+
min: "Smallest",
|
|
25
|
+
max: "Largest",
|
|
26
|
+
count: "Count",
|
|
27
|
+
distinct_count: "Distinct count"
|
|
28
|
+
}, H = [
|
|
29
|
+
{
|
|
30
|
+
value: "none",
|
|
31
|
+
label: "Keep the data order"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: "value-desc",
|
|
35
|
+
label: "Largest value first"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: "value-asc",
|
|
39
|
+
label: "Smallest value first"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: "group-asc",
|
|
43
|
+
label: "Group A to Z"
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
function U(e) {
|
|
47
|
+
let t = e.orderBy;
|
|
48
|
+
return t ? t.by === "dimension" ? "group-asc" : t.direction === "desc" ? "value-desc" : "value-asc" : "none";
|
|
49
|
+
}
|
|
50
|
+
function W(e, t) {
|
|
51
|
+
let n = c(e, "orderBy");
|
|
52
|
+
return t === "value-desc" ? {
|
|
53
|
+
...n,
|
|
54
|
+
orderBy: {
|
|
55
|
+
by: "measure",
|
|
56
|
+
index: 0,
|
|
57
|
+
direction: "desc"
|
|
58
|
+
}
|
|
59
|
+
} : t === "value-asc" ? {
|
|
60
|
+
...n,
|
|
61
|
+
orderBy: {
|
|
62
|
+
by: "measure",
|
|
63
|
+
index: 0,
|
|
64
|
+
direction: "asc"
|
|
65
|
+
}
|
|
66
|
+
} : t === "group-asc" && e.dimensions.length > 0 ? {
|
|
67
|
+
...n,
|
|
68
|
+
orderBy: {
|
|
69
|
+
by: "dimension",
|
|
70
|
+
index: 0,
|
|
71
|
+
direction: "asc"
|
|
72
|
+
}
|
|
73
|
+
} : n;
|
|
74
|
+
}
|
|
75
|
+
var G = _(() => import("../../widgets/chart/ChartWidget.js"));
|
|
76
|
+
function K(e) {
|
|
77
|
+
return e.map((e) => Object.fromEntries(Object.entries(e).map(([e, t]) => [e, t === null || typeof t == "string" || typeof t == "number" ? t : void 0])));
|
|
78
|
+
}
|
|
79
|
+
var q = ({ field: e }) => {
|
|
80
|
+
let t = z[e.kind];
|
|
81
|
+
return /* @__PURE__ */ I("span", {
|
|
82
|
+
className: "flex items-center gap-2",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ F(t, {
|
|
85
|
+
className: "h-3.5 w-3.5 shrink-0 text-text-secondary",
|
|
86
|
+
"aria-hidden": !0
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ F("span", { children: e.name }),
|
|
89
|
+
/* @__PURE__ */ I("span", {
|
|
90
|
+
className: "sr-only",
|
|
91
|
+
children: [
|
|
92
|
+
"(",
|
|
93
|
+
B[e.kind],
|
|
94
|
+
")"
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
});
|
|
99
|
+
}, J = ({ id: e, label: t, value: n, fields: r, optional: i = !1, placeholder: a, onChange: o }) => /* @__PURE__ */ I(D, {
|
|
100
|
+
value: n ?? (i ? L : void 0),
|
|
101
|
+
onValueChange: (e) => o(e === L ? void 0 : e),
|
|
102
|
+
children: [/* @__PURE__ */ F(A, {
|
|
103
|
+
id: e,
|
|
104
|
+
"aria-label": t,
|
|
105
|
+
style: {
|
|
106
|
+
height: "var(--size-controlHeight-md)",
|
|
107
|
+
fontSize: "var(--font-size-body-sm)"
|
|
108
|
+
},
|
|
109
|
+
children: /* @__PURE__ */ F(j, { placeholder: a })
|
|
110
|
+
}), /* @__PURE__ */ I(O, { children: [
|
|
111
|
+
i && /* @__PURE__ */ F(k, {
|
|
112
|
+
value: L,
|
|
113
|
+
children: "None"
|
|
114
|
+
}),
|
|
115
|
+
n !== void 0 && !r.some((e) => e.name === n) && /* @__PURE__ */ F(k, {
|
|
116
|
+
value: n,
|
|
117
|
+
children: n
|
|
118
|
+
}),
|
|
119
|
+
r.map((e) => /* @__PURE__ */ F(k, {
|
|
120
|
+
value: e.name,
|
|
121
|
+
children: /* @__PURE__ */ F(q, { field: e })
|
|
122
|
+
}, e.name))
|
|
123
|
+
] })]
|
|
124
|
+
}), Y = ({ children: e }) => /* @__PURE__ */ F("div", {
|
|
125
|
+
className: "flex min-w-0 items-center gap-2",
|
|
126
|
+
children: e
|
|
127
|
+
}), X = ({ widget: g, rows: _, query: y, sourceSaved: b, onChange: S }) => {
|
|
128
|
+
let { t: w } = N(), M = v(() => _ ? o(_) : [], [_]), P = h(g.type, g.config), L = m(g.type, g.config), R = g.type === "metric_card", z = l(g.type, g.config), B = y ? d(y, g.type, g.config) ?? u(y, M, P, L) : null, G = y !== null && B === null, K = t(g.id, G ? y : null, G && b), q = g.type === "chart", X = typeof g.config?.xAxisField == "string" ? g.config.xAxisField : y?.dimensions[0] ?? void 0, Q = !y && q && _ ? f(_, X) : null, $ = (e) => S(s(e) ?? e);
|
|
129
|
+
if (!L) return y ? /* @__PURE__ */ F(e, {
|
|
130
|
+
title: w("bigconsole.widget.query.title", "Group and total"),
|
|
131
|
+
"data-testid": "widget-inspector-query",
|
|
132
|
+
children: /* @__PURE__ */ I("div", {
|
|
133
|
+
className: "space-y-3",
|
|
134
|
+
children: [/* @__PURE__ */ F("p", {
|
|
135
|
+
role: "alert",
|
|
136
|
+
className: "text-sm text-text-secondary",
|
|
137
|
+
children: B
|
|
138
|
+
}), /* @__PURE__ */ F(T, {
|
|
139
|
+
type: "button",
|
|
140
|
+
variant: "outline",
|
|
141
|
+
onClick: () => S(null),
|
|
142
|
+
children: w("bigconsole.widget.query.stop", "Stop grouping")
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
}) : null;
|
|
146
|
+
if (!y) {
|
|
147
|
+
let t = _ ? p(M, _, P, z.dimensions > 0) : null;
|
|
148
|
+
return /* @__PURE__ */ F(e, {
|
|
149
|
+
title: w("bigconsole.widget.query.title", "Group and total"),
|
|
150
|
+
description: w(R ? "bigconsole.widget.query.metricIntro" : "bigconsole.widget.query.intro", R ? "Calculate one value across the rows without writing a parser." : "Add up, average or count the rows, grouped by a field, without writing a parser."),
|
|
151
|
+
"data-testid": "widget-inspector-query",
|
|
152
|
+
children: /* @__PURE__ */ I("div", {
|
|
153
|
+
className: "space-y-3",
|
|
154
|
+
children: [
|
|
155
|
+
Q && /* @__PURE__ */ F("p", {
|
|
156
|
+
role: "status",
|
|
157
|
+
className: "break-words text-xs text-[var(--color-status-warning-text)]",
|
|
158
|
+
"data-testid": "query-repeat-warning",
|
|
159
|
+
children: Q
|
|
160
|
+
}),
|
|
161
|
+
!_ && /* @__PURE__ */ F("p", {
|
|
162
|
+
className: "text-xs text-text-secondary",
|
|
163
|
+
children: w("bigconsole.widget.query.needsRows", "Connect a data source and parser that return a list of rows to use this.")
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ F(T, {
|
|
166
|
+
type: "button",
|
|
167
|
+
variant: "outline",
|
|
168
|
+
disabled: !_ || M.length === 0,
|
|
169
|
+
onClick: () => S(t ?? {
|
|
170
|
+
dimensions: [],
|
|
171
|
+
measures: [{ agg: "count" }],
|
|
172
|
+
filters: []
|
|
173
|
+
}),
|
|
174
|
+
"data-testid": "query-start",
|
|
175
|
+
children: R ? w("bigconsole.widget.query.metricStart", "Calculate a metric") : w("bigconsole.widget.query.start", "Group and total the rows")
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
let te = y.measures.length === 1;
|
|
182
|
+
return /* @__PURE__ */ F(e, {
|
|
183
|
+
title: w("bigconsole.widget.query.title", "Group and total"),
|
|
184
|
+
description: a(y),
|
|
185
|
+
"data-testid": "widget-inspector-query",
|
|
186
|
+
children: /* @__PURE__ */ I("div", {
|
|
187
|
+
className: "flex flex-col gap-form-gap",
|
|
188
|
+
children: [
|
|
189
|
+
B && /* @__PURE__ */ F("p", {
|
|
190
|
+
role: "alert",
|
|
191
|
+
className: "break-words text-xs text-[var(--color-status-error-text)]",
|
|
192
|
+
"data-testid": "query-problem",
|
|
193
|
+
children: B
|
|
194
|
+
}),
|
|
195
|
+
(z.dimensions > 0 || y.dimensions.length > 0) && /* @__PURE__ */ I("div", {
|
|
196
|
+
className: "space-y-2",
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ F(E, { children: w("bigconsole.widget.query.groupBy", "Group by") }),
|
|
199
|
+
y.dimensions.map((e, t) => /* @__PURE__ */ I(Y, { children: [/* @__PURE__ */ F(J, {
|
|
200
|
+
id: `query-group-${t}`,
|
|
201
|
+
label: w("bigconsole.widget.query.groupByField", "Group by field {{n}}", { n: t + 1 }),
|
|
202
|
+
value: e,
|
|
203
|
+
fields: M,
|
|
204
|
+
placeholder: w("bigconsole.widget.query.pickField", "Pick a field"),
|
|
205
|
+
onChange: (e) => $({
|
|
206
|
+
...y,
|
|
207
|
+
dimensions: y.dimensions.map((n, r) => r === t ? e ?? "" : n)
|
|
208
|
+
})
|
|
209
|
+
}), /* @__PURE__ */ F(T, {
|
|
210
|
+
type: "button",
|
|
211
|
+
variant: "ghost",
|
|
212
|
+
size: "icon",
|
|
213
|
+
"aria-label": w("bigconsole.widget.query.removeGroup", "Remove group by {{field}}", { field: e }),
|
|
214
|
+
onClick: () => $({
|
|
215
|
+
...y,
|
|
216
|
+
dimensions: y.dimensions.filter((e, n) => n !== t)
|
|
217
|
+
}),
|
|
218
|
+
children: /* @__PURE__ */ F(C, {
|
|
219
|
+
className: "h-4 w-4",
|
|
220
|
+
"aria-hidden": !0
|
|
221
|
+
})
|
|
222
|
+
})] }, `${e}-${t}`)),
|
|
223
|
+
y.dimensions.length < z.dimensions && /* @__PURE__ */ I(T, {
|
|
224
|
+
type: "button",
|
|
225
|
+
variant: "ghost",
|
|
226
|
+
size: "sm",
|
|
227
|
+
onClick: () => {
|
|
228
|
+
let e = M.find((e) => !y.dimensions.includes(e.name) && e.name !== y.series);
|
|
229
|
+
$({
|
|
230
|
+
...y,
|
|
231
|
+
dimensions: [...y.dimensions, e?.name ?? ""]
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
"data-testid": "query-add-group",
|
|
235
|
+
children: [/* @__PURE__ */ F(x, {
|
|
236
|
+
className: "mr-1 h-4 w-4",
|
|
237
|
+
"aria-hidden": !0
|
|
238
|
+
}), w("bigconsole.widget.query.addGroup", "Add a group by")]
|
|
239
|
+
})
|
|
240
|
+
]
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ I("div", {
|
|
243
|
+
className: "space-y-2",
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ F(E, { children: w("bigconsole.widget.query.values", "Values") }),
|
|
246
|
+
y.measures.map((e, t) => /* @__PURE__ */ I(Y, { children: [
|
|
247
|
+
/* @__PURE__ */ I(D, {
|
|
248
|
+
value: e.agg,
|
|
249
|
+
onValueChange: (r) => {
|
|
250
|
+
let i = r, a = e.field !== void 0 && (!n.has(i) || M.find((t) => t.name === e.field)?.kind === "number");
|
|
251
|
+
$({
|
|
252
|
+
...y,
|
|
253
|
+
measures: y.measures.map((e, n) => n === t ? {
|
|
254
|
+
agg: i,
|
|
255
|
+
...a && e.field ? { field: e.field } : {}
|
|
256
|
+
} : e)
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
children: [/* @__PURE__ */ F(A, {
|
|
260
|
+
"aria-label": w("bigconsole.widget.query.calculation", "Calculation {{n}}", { n: t + 1 }),
|
|
261
|
+
style: {
|
|
262
|
+
height: "var(--size-controlHeight-md)",
|
|
263
|
+
fontSize: "var(--font-size-body-sm)",
|
|
264
|
+
maxWidth: "9rem"
|
|
265
|
+
},
|
|
266
|
+
children: /* @__PURE__ */ F(j, {})
|
|
267
|
+
}), /* @__PURE__ */ F(O, { children: r.map((e) => /* @__PURE__ */ F(k, {
|
|
268
|
+
value: e,
|
|
269
|
+
children: V[e]
|
|
270
|
+
}, e)) })]
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ F(J, {
|
|
273
|
+
id: `query-value-${t}`,
|
|
274
|
+
label: w("bigconsole.widget.query.valueField", "Value field {{n}}", { n: t + 1 }),
|
|
275
|
+
value: e.field,
|
|
276
|
+
fields: n.has(e.agg) ? M.filter((e) => e.kind === "number") : M,
|
|
277
|
+
optional: e.agg === "count",
|
|
278
|
+
placeholder: e.agg === "count" ? w("bigconsole.widget.query.rows", "Rows") : w("bigconsole.widget.query.pickField", "Pick a field"),
|
|
279
|
+
onChange: (e) => $({
|
|
280
|
+
...y,
|
|
281
|
+
measures: y.measures.map((n, r) => {
|
|
282
|
+
if (r !== t) return n;
|
|
283
|
+
let i = c(n, "field");
|
|
284
|
+
return e ? {
|
|
285
|
+
...i,
|
|
286
|
+
field: e
|
|
287
|
+
} : i;
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
}),
|
|
291
|
+
y.measures.length > 1 && /* @__PURE__ */ F(T, {
|
|
292
|
+
type: "button",
|
|
293
|
+
variant: "ghost",
|
|
294
|
+
size: "icon",
|
|
295
|
+
"aria-label": w("bigconsole.widget.query.removeValue", "Remove value {{n}}", { n: t + 1 }),
|
|
296
|
+
onClick: () => $({
|
|
297
|
+
...y,
|
|
298
|
+
measures: y.measures.filter((e, n) => n !== t),
|
|
299
|
+
series: void 0
|
|
300
|
+
}),
|
|
301
|
+
children: /* @__PURE__ */ F(C, {
|
|
302
|
+
className: "h-4 w-4",
|
|
303
|
+
"aria-hidden": !0
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
] }, t)),
|
|
307
|
+
y.measures.length < z.measures && !y.series && /* @__PURE__ */ I(T, {
|
|
308
|
+
type: "button",
|
|
309
|
+
variant: "ghost",
|
|
310
|
+
size: "sm",
|
|
311
|
+
onClick: () => {
|
|
312
|
+
let e = M.find((e) => e.kind === "number" && !y.measures.some((t) => t.field === e.name));
|
|
313
|
+
$({
|
|
314
|
+
...y,
|
|
315
|
+
measures: [...y.measures, e ? {
|
|
316
|
+
agg: "sum",
|
|
317
|
+
field: e.name
|
|
318
|
+
} : { agg: "count" }]
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
"data-testid": "query-add-value",
|
|
322
|
+
children: [/* @__PURE__ */ F(x, {
|
|
323
|
+
className: "mr-1 h-4 w-4",
|
|
324
|
+
"aria-hidden": !0
|
|
325
|
+
}), w("bigconsole.widget.query.addValue", "Add a value")]
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}),
|
|
329
|
+
!P && y.series && /* @__PURE__ */ F(T, {
|
|
330
|
+
type: "button",
|
|
331
|
+
variant: "outline",
|
|
332
|
+
onClick: () => $(c(y, "series")),
|
|
333
|
+
children: w("bigconsole.widget.query.removeSeries", "Remove series split")
|
|
334
|
+
}),
|
|
335
|
+
P && /* @__PURE__ */ I("div", {
|
|
336
|
+
className: "space-y-2",
|
|
337
|
+
children: [
|
|
338
|
+
/* @__PURE__ */ F(E, {
|
|
339
|
+
htmlFor: "query-series",
|
|
340
|
+
children: w("bigconsole.widget.query.series", "Split into lines by")
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ F(J, {
|
|
343
|
+
id: "query-series",
|
|
344
|
+
label: w("bigconsole.widget.query.series", "Split into lines by"),
|
|
345
|
+
value: y.series,
|
|
346
|
+
fields: M.filter((e) => !y.dimensions.includes(e.name)),
|
|
347
|
+
optional: !0,
|
|
348
|
+
placeholder: w("bigconsole.widget.query.noSeries", "One line"),
|
|
349
|
+
onChange: (e) => {
|
|
350
|
+
let t = c(y, "series");
|
|
351
|
+
$(e ? {
|
|
352
|
+
...t,
|
|
353
|
+
series: e
|
|
354
|
+
} : t);
|
|
355
|
+
}
|
|
356
|
+
}),
|
|
357
|
+
!te && /* @__PURE__ */ F("p", {
|
|
358
|
+
className: "text-xs text-text-secondary",
|
|
359
|
+
children: w("bigconsole.widget.query.seriesNeedsOne", "Splitting into lines works with one value. Remove the others to use it.")
|
|
360
|
+
}),
|
|
361
|
+
y.series && /* @__PURE__ */ F("p", {
|
|
362
|
+
className: "text-xs text-text-secondary",
|
|
363
|
+
children: w("bigconsole.widget.query.seriesMax", "Up to {{max}} different values; more would be too many lines.", { max: i.series })
|
|
364
|
+
})
|
|
365
|
+
]
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ I("div", {
|
|
368
|
+
className: "grid grid-cols-2 gap-form-gap",
|
|
369
|
+
children: [/* @__PURE__ */ I("div", {
|
|
370
|
+
className: "space-y-2",
|
|
371
|
+
children: [/* @__PURE__ */ F(E, {
|
|
372
|
+
htmlFor: "query-sort",
|
|
373
|
+
children: w("bigconsole.widget.query.sort", "Sort")
|
|
374
|
+
}), /* @__PURE__ */ I(D, {
|
|
375
|
+
value: U(y),
|
|
376
|
+
onValueChange: (e) => $(W(y, e)),
|
|
377
|
+
children: [/* @__PURE__ */ F(A, {
|
|
378
|
+
id: "query-sort",
|
|
379
|
+
style: {
|
|
380
|
+
height: "var(--size-controlHeight-md)",
|
|
381
|
+
fontSize: "var(--font-size-body-sm)"
|
|
382
|
+
},
|
|
383
|
+
children: /* @__PURE__ */ F(j, {})
|
|
384
|
+
}), /* @__PURE__ */ F(O, { children: H.filter((e) => e.value !== "group-asc" || y.dimensions.length > 0).map((e) => /* @__PURE__ */ F(k, {
|
|
385
|
+
value: e.value,
|
|
386
|
+
children: e.label
|
|
387
|
+
}, e.value)) })]
|
|
388
|
+
})]
|
|
389
|
+
}), /* @__PURE__ */ I("div", {
|
|
390
|
+
className: "space-y-2",
|
|
391
|
+
children: [/* @__PURE__ */ F(E, {
|
|
392
|
+
htmlFor: "query-limit",
|
|
393
|
+
children: w("bigconsole.widget.query.limit", "Show only the first")
|
|
394
|
+
}), /* @__PURE__ */ F(ee, {
|
|
395
|
+
id: "query-limit",
|
|
396
|
+
type: "number",
|
|
397
|
+
min: 1,
|
|
398
|
+
max: i.rows,
|
|
399
|
+
value: y.limit ?? "",
|
|
400
|
+
placeholder: w("bigconsole.widget.query.limitPlaceholder", "All rows"),
|
|
401
|
+
onChange: (e) => {
|
|
402
|
+
let t = Number.parseInt(e.target.value, 10), n = c(y, "limit");
|
|
403
|
+
$(Number.isInteger(t) && t >= 1 ? {
|
|
404
|
+
...n,
|
|
405
|
+
limit: Math.min(t, i.rows)
|
|
406
|
+
} : n);
|
|
407
|
+
}
|
|
408
|
+
})]
|
|
409
|
+
})]
|
|
410
|
+
}),
|
|
411
|
+
G && !b && /* @__PURE__ */ F("p", {
|
|
412
|
+
role: "status",
|
|
413
|
+
className: "text-xs text-text-secondary",
|
|
414
|
+
children: w("bigconsole.widget.query.previewRequiresSavedSource", "Save the data source changes to preview this query.")
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ F(Z, {
|
|
417
|
+
widget: g,
|
|
418
|
+
isChart: q,
|
|
419
|
+
state: K,
|
|
420
|
+
ready: G && b
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ F("div", { children: /* @__PURE__ */ F(T, {
|
|
423
|
+
type: "button",
|
|
424
|
+
variant: "ghost",
|
|
425
|
+
size: "sm",
|
|
426
|
+
onClick: () => S(null),
|
|
427
|
+
"data-testid": "query-stop",
|
|
428
|
+
children: w("bigconsole.widget.query.stop", "Stop grouping and use the rows as they are")
|
|
429
|
+
}) })
|
|
430
|
+
]
|
|
431
|
+
})
|
|
432
|
+
});
|
|
433
|
+
}, Z = ({ widget: e, isChart: t, state: n, ready: r }) => {
|
|
434
|
+
let { t: i } = N();
|
|
435
|
+
if (!r) return null;
|
|
436
|
+
let a = n.rows && n.rows[0] ? Object.keys(n.rows[0]) : [];
|
|
437
|
+
return /* @__PURE__ */ I("div", {
|
|
438
|
+
className: "space-y-2",
|
|
439
|
+
"data-testid": "query-preview",
|
|
440
|
+
"aria-live": "polite",
|
|
441
|
+
children: [
|
|
442
|
+
/* @__PURE__ */ I("div", {
|
|
443
|
+
className: "flex items-center gap-2",
|
|
444
|
+
children: [/* @__PURE__ */ F(E, { children: i("bigconsole.widget.query.preview", "Preview") }), n.loading && /* @__PURE__ */ F(M, { style: {
|
|
445
|
+
width: "14px",
|
|
446
|
+
height: "14px"
|
|
447
|
+
} })]
|
|
448
|
+
}),
|
|
449
|
+
n.error && /* @__PURE__ */ F("p", {
|
|
450
|
+
role: "alert",
|
|
451
|
+
className: "break-words text-xs text-[var(--color-status-error-text)]",
|
|
452
|
+
"data-testid": "query-preview-error",
|
|
453
|
+
children: n.error
|
|
454
|
+
}),
|
|
455
|
+
!n.error && n.rows && n.rows.length === 0 && /* @__PURE__ */ F("p", {
|
|
456
|
+
className: "text-xs text-text-secondary",
|
|
457
|
+
children: i("bigconsole.widget.query.previewEmpty", "No rows to show.")
|
|
458
|
+
}),
|
|
459
|
+
n.rows && n.rows.length > 0 && /* @__PURE__ */ I(P, { children: [
|
|
460
|
+
t && /* @__PURE__ */ F("div", {
|
|
461
|
+
className: "h-56 min-w-0 rounded-input border border-[var(--color-border-subtle)] p-2",
|
|
462
|
+
"data-testid": "query-preview-chart",
|
|
463
|
+
children: /* @__PURE__ */ F(g, {
|
|
464
|
+
fallback: null,
|
|
465
|
+
children: /* @__PURE__ */ F(G, {
|
|
466
|
+
widget: e,
|
|
467
|
+
data: K(n.rows)
|
|
468
|
+
})
|
|
469
|
+
})
|
|
470
|
+
}),
|
|
471
|
+
/* @__PURE__ */ F("div", {
|
|
472
|
+
className: "max-h-48 min-w-0 overflow-auto rounded-input border border-[var(--color-border-subtle)]",
|
|
473
|
+
children: /* @__PURE__ */ I("table", {
|
|
474
|
+
className: "w-full text-xs",
|
|
475
|
+
children: [/* @__PURE__ */ F("thead", {
|
|
476
|
+
className: "bg-bg-surface text-left text-text-secondary",
|
|
477
|
+
children: /* @__PURE__ */ F("tr", { children: a.map((e) => /* @__PURE__ */ F("th", {
|
|
478
|
+
className: "px-2 py-1 font-medium",
|
|
479
|
+
children: e
|
|
480
|
+
}, e)) })
|
|
481
|
+
}), /* @__PURE__ */ F("tbody", { children: n.rows.slice(0, R).map((e, t) => /* @__PURE__ */ F("tr", {
|
|
482
|
+
className: "border-t border-[var(--color-border-subtle)]",
|
|
483
|
+
children: a.map((t) => /* @__PURE__ */ F("td", {
|
|
484
|
+
className: "px-2 py-1",
|
|
485
|
+
children: String(e[t] ?? "")
|
|
486
|
+
}, t))
|
|
487
|
+
}, t)) })]
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
n.rows.length > R && /* @__PURE__ */ F("p", {
|
|
491
|
+
className: "text-xs text-text-secondary",
|
|
492
|
+
children: i("bigconsole.widget.query.previewMore", "Showing the first {{n}} of {{total}} rows.", {
|
|
493
|
+
n: R,
|
|
494
|
+
total: n.rows.length
|
|
495
|
+
})
|
|
496
|
+
})
|
|
497
|
+
] })
|
|
498
|
+
]
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
export { X as QuerySection };
|
|
@@ -3,3 +3,4 @@ export { AppearanceSection, type AppearanceSectionProps } from './AppearanceSect
|
|
|
3
3
|
export { GeneralSection, type GeneralSectionProps } from './GeneralSection';
|
|
4
4
|
export { DataBindingSection, type DataBindingSectionProps } from './DataBindingSection';
|
|
5
5
|
export { LayoutSection, type LayoutSectionProps } from './LayoutSection';
|
|
6
|
+
export { QuerySection, type QuerySectionProps } from './QuerySection';
|
|
@@ -3,4 +3,5 @@ import { AppearanceSection as t } from "./AppearanceSection.js";
|
|
|
3
3
|
import { GeneralSection as n } from "./GeneralSection.js";
|
|
4
4
|
import { DataBindingSection as r } from "./DataBindingSection.js";
|
|
5
5
|
import { LayoutSection as i } from "./LayoutSection.js";
|
|
6
|
+
import "./QuerySection.js";
|
|
6
7
|
export { e as AdvancedSection, t as AppearanceSection, r as DataBindingSection, n as GeneralSection, i as LayoutSection };
|