@burdenoff/microfe-bigconsole 2026.1124.7 → 2026.1124.9
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.js +197 -144
- package/dist/bigconsole/components/dashboard/DashboardGalleryCard.d.ts +3 -0
- package/dist/bigconsole/components/dashboard/DashboardGalleryCard.js +13 -9
- package/dist/bigconsole/hooks/useBoardDragLink.d.ts +39 -0
- package/dist/bigconsole/hooks/useBoardDragLink.js +62 -0
- package/dist/bigconsole/pages/DashboardsPage.js +425 -389
- package/dist/bigconsole/utils/fleetDrag.d.ts +20 -0
- package/dist/bigconsole/utils/fleetDrag.js +9 -0
- package/dist/bigconsole/utils/widgetQuery.d.ts +9 -0
- package/dist/bigconsole/utils/widgetQuery.js +95 -71
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FleetLink } from './fleetTree';
|
|
2
|
+
export interface DragBoardState {
|
|
3
|
+
/** The caller may edit boards. */
|
|
4
|
+
canUpdate: boolean;
|
|
5
|
+
/** The links are known: while they load, or when they failed to, whether a board follows one is not. */
|
|
6
|
+
linksReady: boolean;
|
|
7
|
+
/** A fleet action is running: a drop must not start a second one. */
|
|
8
|
+
busy: boolean;
|
|
9
|
+
/** The board follows a master, or has asked to. */
|
|
10
|
+
follows: boolean;
|
|
11
|
+
/** The board's owner is asked to accept a link: the board answers it, it is not linked. */
|
|
12
|
+
awaitingAnswer: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** A board that follows nothing can be picked up to be linked; one that follows or waits cannot be moved. */
|
|
15
|
+
export declare function canPickUp(board: DragBoardState): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether `draggedId` can be dropped on `targetId`: not on itself, and not on a board that follows it (directly
|
|
18
|
+
* or through others), which would make a loop.
|
|
19
|
+
*/
|
|
20
|
+
export declare function canDropOn(draggedId: string, targetId: string, links: readonly FleetLink[]): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { descendantIds as e } from "./fleetTree.js";
|
|
2
|
+
// src/bigconsole/utils/fleetDrag.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.canUpdate && e.linksReady && !e.busy && !e.follows && !e.awaitingAnswer;
|
|
5
|
+
}
|
|
6
|
+
function n(t, n, r) {
|
|
7
|
+
return t !== n && !e(t, r).has(n);
|
|
8
|
+
}
|
|
9
|
+
export { n as canDropOn, t as canPickUp };
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const QUERY_AGGREGATES: readonly ["sum", "avg", "min", "max", "count", "distinct_count"];
|
|
11
11
|
export type QueryAggregate = (typeof QUERY_AGGREGATES)[number];
|
|
12
|
+
export declare const QUERY_DATE_BUCKETS: readonly ["day", "week", "month", "quarter", "year"];
|
|
13
|
+
export type QueryDateBucketUnit = (typeof QUERY_DATE_BUCKETS)[number];
|
|
14
|
+
export interface QueryDateBucket {
|
|
15
|
+
field: string;
|
|
16
|
+
unit: QueryDateBucketUnit;
|
|
17
|
+
}
|
|
12
18
|
/** Limits the service enforces; the pickers stop at the same numbers so a saved query always runs. */
|
|
13
19
|
export declare const QUERY_LIMITS: {
|
|
14
20
|
readonly dimensions: 2;
|
|
@@ -29,6 +35,7 @@ export interface QueryOrder {
|
|
|
29
35
|
}
|
|
30
36
|
export interface WidgetQuery {
|
|
31
37
|
dimensions: string[];
|
|
38
|
+
dateBuckets?: QueryDateBucket[];
|
|
32
39
|
measures: QueryMeasure[];
|
|
33
40
|
series?: string;
|
|
34
41
|
filters: Array<{
|
|
@@ -80,6 +87,8 @@ export declare function queryRendererProblem(query: WidgetQuery, widgetType: str
|
|
|
80
87
|
export declare function describeQuery(query: WidgetQuery): string;
|
|
81
88
|
/** Drop empty parts so a saved query stays small and a cleared form saves no query at all. */
|
|
82
89
|
export declare function normalizeQuery(query: WidgetQuery): WidgetQuery | null;
|
|
90
|
+
/** A parser's year-month value has insufficient precision for daily or weekly buckets. */
|
|
91
|
+
export declare function dateBucketUnits(rows: readonly Record<string, unknown>[] | null, field: string): readonly QueryDateBucketUnit[];
|
|
83
92
|
export declare function supportsQuery(widgetType: string | undefined, config?: Record<string, unknown>): boolean;
|
|
84
93
|
export declare function supportsQuerySeries(widgetType: string | undefined, config: Record<string, unknown> | undefined): boolean;
|
|
85
94
|
/**
|
|
@@ -6,62 +6,78 @@ var e = [
|
|
|
6
6
|
"max",
|
|
7
7
|
"count",
|
|
8
8
|
"distinct_count"
|
|
9
|
-
], t =
|
|
9
|
+
], t = [
|
|
10
|
+
"day",
|
|
11
|
+
"week",
|
|
12
|
+
"month",
|
|
13
|
+
"quarter",
|
|
14
|
+
"year"
|
|
15
|
+
], n = {
|
|
10
16
|
dimensions: 2,
|
|
11
17
|
measures: 6,
|
|
12
18
|
series: 12,
|
|
13
19
|
rows: 1e3
|
|
14
|
-
},
|
|
15
|
-
function a(e) {
|
|
16
|
-
return e == null || e === "" ? null : typeof e == "boolean" ? "boolean" : typeof e == "number" ? Number.isFinite(e) ? "number" : null : typeof e == "string" ? i.test(e) ? "date" : e.trim() !== "" && Number.isFinite(Number(e)) ? "number" : "text" : "text";
|
|
17
|
-
}
|
|
20
|
+
}, r = 200, i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = /^\d{4}-\d{2}(-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?)?$/;
|
|
18
21
|
function o(e) {
|
|
19
|
-
return
|
|
22
|
+
return e == null || e === "" ? null : typeof e == "boolean" ? "boolean" : typeof e == "number" ? Number.isFinite(e) ? "number" : null : typeof e == "string" ? a.test(e) ? "date" : e.trim() !== "" && Number.isFinite(Number(e)) ? "number" : "text" : "text";
|
|
20
23
|
}
|
|
21
24
|
function s(e) {
|
|
25
|
+
return !Array.isArray(e) || e.length === 0 ? null : e.every(i) ? e : null;
|
|
26
|
+
}
|
|
27
|
+
function c(e) {
|
|
22
28
|
let t = /* @__PURE__ */ new Map();
|
|
23
|
-
for (let
|
|
24
|
-
let
|
|
25
|
-
i == null ? t.set(e,
|
|
29
|
+
for (let n of e.slice(0, r)) for (let [e, r] of Object.entries(n)) {
|
|
30
|
+
let n = o(r), i = t.get(e);
|
|
31
|
+
i == null ? t.set(e, n) : n !== null && i !== n && t.set(e, "mixed");
|
|
26
32
|
}
|
|
27
33
|
return [...t].map(([e, t]) => ({
|
|
28
34
|
name: e,
|
|
29
35
|
kind: t === null || t === "mixed" ? "text" : t
|
|
30
36
|
}));
|
|
31
37
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
return e.filter(
|
|
38
|
+
var l = (e) => e.kind === "number";
|
|
39
|
+
function u(e) {
|
|
40
|
+
return e.filter(l);
|
|
35
41
|
}
|
|
36
|
-
var
|
|
42
|
+
var d = /* @__PURE__ */ new Set([
|
|
37
43
|
"sum",
|
|
38
44
|
"avg",
|
|
39
45
|
"min",
|
|
40
46
|
"max"
|
|
41
|
-
]),
|
|
47
|
+
]), f = {
|
|
42
48
|
sum: "added up",
|
|
43
49
|
avg: "averaged",
|
|
44
50
|
min: "used for the smallest value",
|
|
45
51
|
max: "used for the largest value"
|
|
46
52
|
};
|
|
47
|
-
function
|
|
48
|
-
let
|
|
49
|
-
if (!r
|
|
50
|
-
let
|
|
53
|
+
function p(n) {
|
|
54
|
+
let r = n?.query;
|
|
55
|
+
if (!i(r) || !Array.isArray(r.measures)) return null;
|
|
56
|
+
let a = r.measures.filter(i).flatMap((t) => {
|
|
51
57
|
if (typeof t.agg != "string" || !e.includes(t.agg)) return [];
|
|
52
58
|
let n = { agg: t.agg };
|
|
53
59
|
return typeof t.field == "string" && (n.field = t.field), typeof t.as == "string" && (n.as = t.as), [n];
|
|
54
60
|
});
|
|
55
|
-
if (
|
|
56
|
-
let
|
|
57
|
-
dimensions: Array.isArray(
|
|
58
|
-
measures:
|
|
59
|
-
filters: Array.isArray(
|
|
61
|
+
if (a.length === 0) return null;
|
|
62
|
+
let o = {
|
|
63
|
+
dimensions: Array.isArray(r.dimensions) ? r.dimensions.filter((e) => typeof e == "string") : [],
|
|
64
|
+
measures: a,
|
|
65
|
+
filters: Array.isArray(r.filters) ? r.filters.filter(i) : []
|
|
60
66
|
};
|
|
61
|
-
|
|
67
|
+
if (typeof r.series == "string" && r.series !== "" && (o.series = r.series), Array.isArray(r.dateBuckets)) {
|
|
68
|
+
let e = r.dateBuckets.filter(i).flatMap((e) => {
|
|
69
|
+
let n = t.find((t) => t === e.unit);
|
|
70
|
+
return typeof e.field == "string" && n ? [{
|
|
71
|
+
field: e.field,
|
|
72
|
+
unit: n
|
|
73
|
+
}] : [];
|
|
74
|
+
});
|
|
75
|
+
e.length > 0 && (o.dateBuckets = e);
|
|
76
|
+
}
|
|
77
|
+
return i(r.orderBy) && (o.orderBy = r.orderBy), typeof r.limit == "number" && (o.limit = r.limit), o;
|
|
62
78
|
}
|
|
63
|
-
function
|
|
64
|
-
let a =
|
|
79
|
+
function m(e, t, r = !0, i = !0) {
|
|
80
|
+
let a = u(e)[0];
|
|
65
81
|
if (!a) return null;
|
|
66
82
|
let o = i ? e.find((e) => e.kind === "date") ?? e.find((e) => e.kind === "text") : void 0;
|
|
67
83
|
if (!o) return {
|
|
@@ -79,18 +95,18 @@ function p(e, n, r = !0, i = !0) {
|
|
|
79
95
|
field: a.name
|
|
80
96
|
}],
|
|
81
97
|
filters: []
|
|
82
|
-
}, c = e.find((e) => e.kind === "text" && e.name !== o.name &&
|
|
98
|
+
}, c = e.find((e) => e.kind === "text" && e.name !== o.name && h(t, e.name) >= 2 && h(t, e.name) <= n.series);
|
|
83
99
|
return r && c && o.kind === "date" && (s.series = c.name), s;
|
|
84
100
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
for (let i of e.slice(0,
|
|
101
|
+
function h(e, t) {
|
|
102
|
+
let n = /* @__PURE__ */ new Set();
|
|
103
|
+
for (let i of e.slice(0, r)) {
|
|
88
104
|
let e = i[t];
|
|
89
|
-
e != null &&
|
|
105
|
+
e != null && n.add(String(e));
|
|
90
106
|
}
|
|
91
|
-
return
|
|
107
|
+
return n.size;
|
|
92
108
|
}
|
|
93
|
-
function
|
|
109
|
+
function g(e, t) {
|
|
94
110
|
if (!t || e.length < 2) return null;
|
|
95
111
|
let n = /* @__PURE__ */ new Map();
|
|
96
112
|
for (let r of e) {
|
|
@@ -104,7 +120,7 @@ function h(e, t) {
|
|
|
104
120
|
let [i] = r[0];
|
|
105
121
|
return `"${t}" repeats (for example "${i}" appears more than once), so the chart draws several points with the same label. Group by "${t}" and split by another field to show one point per value.`;
|
|
106
122
|
}
|
|
107
|
-
function
|
|
123
|
+
function _(e, t, n = !0, r = !0) {
|
|
108
124
|
if (!r) return "This chart type needs individual rows. Stop grouping or choose a different chart type.";
|
|
109
125
|
let i = new Set(t.map((e) => e.name));
|
|
110
126
|
if (e.measures.length === 0) return "Pick at least one value to calculate.";
|
|
@@ -112,38 +128,40 @@ function g(e, t, n = !0, r = !0) {
|
|
|
112
128
|
if (n.agg !== "count" && !n.field) return "Pick a field for each calculation.";
|
|
113
129
|
if (n.field && i.size > 0 && !i.has(n.field)) return `"${n.field}" is not in the data any more. Pick another field.`;
|
|
114
130
|
let e = t.find((e) => e.name === n.field);
|
|
115
|
-
if (e &&
|
|
131
|
+
if (e && d.has(n.agg) && e.kind !== "number") return `"${e.name}" holds ${e.kind === "date" ? "dates" : "text"}, so it cannot be ${f[n.agg] ?? "calculated"}. Use count or distinct count, or pick a number field.`;
|
|
116
132
|
}
|
|
117
133
|
for (let t of e.dimensions) if (i.size > 0 && !i.has(t)) return `"${t}" is not in the data any more. Pick another field.`;
|
|
118
134
|
if (new Set(e.dimensions).size !== e.dimensions.length) return "Choose a different field for each group.";
|
|
119
135
|
if (e.series && !n) return "Remove the series split to use this widget type.";
|
|
136
|
+
let a = (e.dateBuckets ?? []).map(({ field: e }) => e);
|
|
137
|
+
if (a.some((t) => !e.dimensions.includes(t)) || new Set(a).size !== a.length) return "Choose one date bucket for each group-by field.";
|
|
120
138
|
if (e.series && e.measures.length !== 1) return "Splitting into lines needs exactly one value.";
|
|
121
139
|
if (e.series && e.dimensions.includes(e.series)) return "Choose a different field to split into lines.";
|
|
122
|
-
let
|
|
123
|
-
return new Set(
|
|
140
|
+
let o = [...e.dimensions, ...k(e)];
|
|
141
|
+
return new Set(o).size === o.length ? null : "Choose distinct output fields and calculations.";
|
|
124
142
|
}
|
|
125
|
-
function
|
|
143
|
+
function v(e, t) {
|
|
126
144
|
return e === "metric_card" ? {
|
|
127
145
|
dimensions: 0,
|
|
128
146
|
measures: 1
|
|
129
147
|
} : e === "chart" ? {
|
|
130
148
|
dimensions: 1,
|
|
131
|
-
measures:
|
|
132
|
-
} :
|
|
149
|
+
measures: E(t) === "pie" ? 1 : n.measures
|
|
150
|
+
} : n;
|
|
133
151
|
}
|
|
134
|
-
function
|
|
135
|
-
let { dimensions: r, measures: i } =
|
|
152
|
+
function y(e, t, n) {
|
|
153
|
+
let { dimensions: r, measures: i } = v(t, n);
|
|
136
154
|
if (t === "metric_card") {
|
|
137
155
|
if (e.dimensions.length > r || e.series) return "Remove grouping and series to calculate one metric.";
|
|
138
156
|
if (e.measures.length !== i) return "Choose one value to calculate for this metric.";
|
|
139
157
|
}
|
|
140
158
|
if (t === "chart") {
|
|
141
|
-
if (
|
|
159
|
+
if (E(n) === "pie" && (e.dimensions.length !== r || e.measures.length !== i)) return "Choose one group and one value for a pie chart.";
|
|
142
160
|
if (e.dimensions.length > r) return "Choose one group for this chart’s x-axis.";
|
|
143
161
|
}
|
|
144
162
|
return null;
|
|
145
163
|
}
|
|
146
|
-
function
|
|
164
|
+
function b(e) {
|
|
147
165
|
let t = {
|
|
148
166
|
sum: "Total of",
|
|
149
167
|
avg: "Average of",
|
|
@@ -154,7 +172,7 @@ function y(e) {
|
|
|
154
172
|
}, n = [e.measures.map((e) => e.agg === "count" && !e.field ? "Number of rows" : `${t[e.agg]} ${e.field ?? ""}`.trim()).join(", ")];
|
|
155
173
|
return e.dimensions.length > 0 && n.push(`by ${e.dimensions.join(" and ")}`), e.series && n.push(`split by ${e.series}`), n.join(" ");
|
|
156
174
|
}
|
|
157
|
-
function
|
|
175
|
+
function x(e) {
|
|
158
176
|
if (e.measures.length === 0) return null;
|
|
159
177
|
let t = {
|
|
160
178
|
dimensions: e.dimensions.filter((e) => e !== ""),
|
|
@@ -164,44 +182,50 @@ function b(e) {
|
|
|
164
182
|
...e.as ? { as: e.as } : {}
|
|
165
183
|
})),
|
|
166
184
|
filters: e.filters
|
|
167
|
-
};
|
|
168
|
-
if (e.series && (t.series = e.series), e.orderBy) {
|
|
185
|
+
}, n = e.dateBuckets?.filter(({ field: e }) => t.dimensions.includes(e));
|
|
186
|
+
if (n?.length && (t.dateBuckets = n), e.series && (t.series = e.series), e.orderBy) {
|
|
169
187
|
let n = e.orderBy.by === "dimension" ? t.dimensions : t.measures;
|
|
170
188
|
e.orderBy.index >= 0 && e.orderBy.index < n.length && (t.orderBy = e.orderBy);
|
|
171
189
|
}
|
|
172
190
|
return e.limit !== void 0 && (t.limit = e.limit), t;
|
|
173
191
|
}
|
|
174
|
-
|
|
192
|
+
function S(e, n) {
|
|
193
|
+
return e?.some((e) => {
|
|
194
|
+
let t = e[n];
|
|
195
|
+
return typeof t == "string" && /^\d{4}-\d{2}$/.test(t);
|
|
196
|
+
}) ? t.filter((e) => e !== "day" && e !== "week") : t;
|
|
197
|
+
}
|
|
198
|
+
var C = /* @__PURE__ */ new Set([
|
|
175
199
|
"chart",
|
|
176
200
|
"table",
|
|
177
201
|
"metric_card"
|
|
178
|
-
]),
|
|
202
|
+
]), w = /* @__PURE__ */ new Set([
|
|
179
203
|
"line",
|
|
180
204
|
"bar",
|
|
181
205
|
"area",
|
|
182
206
|
"combo"
|
|
183
|
-
]),
|
|
184
|
-
function
|
|
207
|
+
]), T = /* @__PURE__ */ new Set([...w, "pie"]);
|
|
208
|
+
function E(e) {
|
|
185
209
|
return typeof e?.chartType == "string" ? e.chartType.toLowerCase() : "line";
|
|
186
210
|
}
|
|
187
|
-
function
|
|
188
|
-
return e === "chart" ?
|
|
211
|
+
function D(e, t) {
|
|
212
|
+
return e === "chart" ? T.has(E(t)) : e !== void 0 && C.has(e);
|
|
189
213
|
}
|
|
190
|
-
function
|
|
191
|
-
return e === "chart" &&
|
|
214
|
+
function O(e, t) {
|
|
215
|
+
return e === "chart" && w.has(E(t));
|
|
192
216
|
}
|
|
193
|
-
function
|
|
217
|
+
function k(e) {
|
|
194
218
|
let t = new Set(e.dimensions);
|
|
195
219
|
return e.measures.map((e) => {
|
|
196
220
|
let n = e.as ?? e.field ?? "count", r = t.has(n) ? `${e.agg}_${n}` : n;
|
|
197
221
|
return t.add(r), r;
|
|
198
222
|
});
|
|
199
223
|
}
|
|
200
|
-
function
|
|
201
|
-
return e.series ? Object.keys(t ?? {}).filter((t) => !e.dimensions.includes(t)) :
|
|
224
|
+
function A(e, t) {
|
|
225
|
+
return e.series ? Object.keys(t ?? {}).filter((t) => !e.dimensions.includes(t)) : k(e);
|
|
202
226
|
}
|
|
203
|
-
function
|
|
204
|
-
let [n] = t.dimensions, r =
|
|
227
|
+
function j(e, t) {
|
|
228
|
+
let [n] = t.dimensions, r = k(t), [i] = r;
|
|
205
229
|
return e === "chart" ? {
|
|
206
230
|
xAxisField: n,
|
|
207
231
|
labelField: n,
|
|
@@ -211,7 +235,7 @@ function k(e, t) {
|
|
|
211
235
|
series: void 0
|
|
212
236
|
} : e === "metric_card" ? { valueField: i } : e === "table" ? { columns: void 0 } : {};
|
|
213
237
|
}
|
|
214
|
-
var
|
|
238
|
+
var M = /* @__PURE__ */ new Map([
|
|
215
239
|
["chart", [
|
|
216
240
|
"xAxisField",
|
|
217
241
|
"labelField",
|
|
@@ -223,19 +247,19 @@ var A = /* @__PURE__ */ new Map([
|
|
|
223
247
|
["metric_card", ["valueField"]],
|
|
224
248
|
["table", ["columns"]]
|
|
225
249
|
]);
|
|
226
|
-
function
|
|
227
|
-
let
|
|
250
|
+
function N(e, t, n) {
|
|
251
|
+
let r = { ...e }, a = M.get(t ?? "") ?? [];
|
|
228
252
|
if (n === null) {
|
|
229
|
-
delete
|
|
253
|
+
delete r.query, delete r.querySourceMappings;
|
|
230
254
|
let t = e.querySourceMappings;
|
|
231
|
-
if (
|
|
232
|
-
return
|
|
255
|
+
if (i(t)) for (let e of a) Object.hasOwn(t, e) ? r[e] = t[e] : delete r[e];
|
|
256
|
+
return r;
|
|
233
257
|
}
|
|
234
|
-
!
|
|
235
|
-
for (let [e,
|
|
236
|
-
return
|
|
258
|
+
!p(e) && a.length > 0 && (r.querySourceMappings = Object.fromEntries(a.filter((t) => Object.hasOwn(e, t)).map((t) => [t, e[t]]))), r.query = n;
|
|
259
|
+
for (let [e, i] of Object.entries(j(t, n))) i === void 0 ? delete r[e] : r[e] = i;
|
|
260
|
+
return r;
|
|
237
261
|
}
|
|
238
|
-
function
|
|
262
|
+
function P(e, t) {
|
|
239
263
|
return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
|
|
240
264
|
}
|
|
241
|
-
export {
|
|
265
|
+
export { d as NUMERIC_ONLY, e as QUERY_AGGREGATES, t as QUERY_DATE_BUCKETS, n as QUERY_LIMITS, N as applyQueryToConfig, A as chartQueryColumns, S as dateBucketUnits, b as describeQuery, c as detectFields, j as mappingPatch, k as measureNames, x as normalizeQuery, u as numericFields, P as omitKey, s as previewRows, v as queryInputLimits, _ as queryProblem, y as queryRendererProblem, p as readQuery, g as repeatedXWarning, m as suggestQuery, D as supportsQuery, O as supportsQuerySeries };
|