@burdenoff/microfe-bigconsole 2026.1118.4 → 2026.1118.6
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/explore/CreateQueryWidget.d.ts +5 -0
- package/dist/bigconsole/components/explore/CreateQueryWidget.js +192 -0
- package/dist/bigconsole/components/explore/QueryResults.d.ts +4 -0
- package/dist/bigconsole/components/explore/QueryResults.js +42 -0
- package/dist/bigconsole/components/explore/SavedQueryWidget.d.ts +4 -0
- package/dist/bigconsole/components/explore/SavedQueryWidget.js +69 -0
- package/dist/bigconsole/components/explore/SqlDraftEditor.d.ts +3 -1
- package/dist/bigconsole/components/explore/SqlDraftEditor.js +336 -58
- package/dist/bigconsole/components/explore/SqlDraftEntry.js +11 -11
- package/dist/bigconsole/components/explore/VisualBuilder.d.ts +14 -0
- package/dist/bigconsole/components/explore/VisualBuilder.js +283 -0
- package/dist/bigconsole/components/explore/useExploreRun.d.ts +32 -0
- package/dist/bigconsole/components/explore/useExploreRun.js +104 -0
- package/dist/bigconsole/components/explore/visualSql.d.ts +49 -0
- package/dist/bigconsole/components/explore/visualSql.js +95 -0
- package/dist/bigconsole/components/insights/BoardLintPanel.d.ts +28 -0
- package/dist/bigconsole/components/insights/BoardLintPanel.js +171 -0
- package/dist/bigconsole/components/insights/DraftCheckDialog.d.ts +9 -3
- package/dist/bigconsole/components/insights/DraftCheckDialog.js +53 -146
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +237 -228
- package/dist/bigconsole/hooks/useWidgetOperations.js +1 -0
- package/dist/bigconsole/pages/InsightsPage.js +305 -274
- package/dist/bigconsole/types/index.d.ts +1 -0
- package/dist/bigconsole/utils/boardLint.d.ts +5 -0
- package/dist/bigconsole/utils/boardLint.js +4 -1
- package/dist/generated/wspace-operations.d.ts +143 -0
- package/dist/generated/wspace-operations.js +1127 -73
- package/dist/generated/wspace-types.d.ts +93 -0
- package/package.json +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { CreateExploreWidgetDocument as e, ExploreDashboardsDocument as t, ExplorePagesDocument as n } from "../../../generated/wspace-operations.js";
|
|
2
|
+
import { exploreError as r, workspaceRequest as i } from "./useExploreRun.js";
|
|
3
|
+
import { Control as a, controlClass as o } from "./VisualBuilder.js";
|
|
4
|
+
import { useOptionalBigConsole as s } from "../../context/BigConsoleContext.js";
|
|
5
|
+
import { SavedQueryWidget as c } from "./SavedQueryWidget.js";
|
|
6
|
+
import "../../hooks/useActivePage.js";
|
|
7
|
+
import { useEffect as l, useRef as u, useState as d } from "react";
|
|
8
|
+
import { useApolloClient as f } from "@apollo/client/react";
|
|
9
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
|
+
// src/bigconsole/components/explore/CreateQueryWidget.tsx
|
|
11
|
+
function h({ savedId: h, name: g, workspaceId: _ }) {
|
|
12
|
+
let v = f(), y = s(), [b, x] = d(""), [S, C] = d(""), [w, T] = d([]), [E, D] = d([]), [O, k] = d(g), [A, j] = d(""), [M, N] = d(""), [P, F] = d(""), [I, L] = d(null), [R, z] = d(null), [B, V] = d(null), [H, U] = d(null), W = JSON.stringify([
|
|
13
|
+
b,
|
|
14
|
+
B,
|
|
15
|
+
H
|
|
16
|
+
]), G = W !== M, [K, q] = d(!1);
|
|
17
|
+
l(() => {
|
|
18
|
+
let e = new AbortController(), a = i(_, e.signal);
|
|
19
|
+
return b ? v.query({
|
|
20
|
+
query: n,
|
|
21
|
+
variables: {
|
|
22
|
+
dashboardId: b,
|
|
23
|
+
after: H
|
|
24
|
+
},
|
|
25
|
+
fetchPolicy: "no-cache",
|
|
26
|
+
context: a
|
|
27
|
+
}).then(({ data: t }) => {
|
|
28
|
+
if (e.signal.aborted) return;
|
|
29
|
+
let n = t?.getDashboard?.pages;
|
|
30
|
+
if (!n) throw Error("Missing pages");
|
|
31
|
+
j(""), D((e) => [...H ? e : [], ...n.edges.map((e) => e.node)]), z(n.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null);
|
|
32
|
+
}).catch((t) => {
|
|
33
|
+
e.signal.aborted || j(r(t));
|
|
34
|
+
}).finally(() => {
|
|
35
|
+
e.signal.aborted || N(W);
|
|
36
|
+
}) : v.query({
|
|
37
|
+
query: t,
|
|
38
|
+
variables: { after: B },
|
|
39
|
+
fetchPolicy: "no-cache",
|
|
40
|
+
context: a
|
|
41
|
+
}).then(({ data: t }) => {
|
|
42
|
+
if (e.signal.aborted) return;
|
|
43
|
+
if (!t?.listDashboards) throw Error("Missing dashboards");
|
|
44
|
+
let n = t.listDashboards;
|
|
45
|
+
j(""), T((e) => [...B ? e : [], ...n.edges.map((e) => e.node)]), L(n.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null);
|
|
46
|
+
}).catch((t) => {
|
|
47
|
+
e.signal.aborted || j(r(t));
|
|
48
|
+
}).finally(() => {
|
|
49
|
+
e.signal.aborted || N(W);
|
|
50
|
+
}), () => e.abort();
|
|
51
|
+
}, [
|
|
52
|
+
v,
|
|
53
|
+
_,
|
|
54
|
+
b,
|
|
55
|
+
B,
|
|
56
|
+
H,
|
|
57
|
+
W
|
|
58
|
+
]);
|
|
59
|
+
let J = u(null);
|
|
60
|
+
l(() => {
|
|
61
|
+
let e = new AbortController();
|
|
62
|
+
return J.current = e, () => e.abort();
|
|
63
|
+
}, []);
|
|
64
|
+
async function Y() {
|
|
65
|
+
let t = J.current;
|
|
66
|
+
if (t && !t.signal.aborted && !K && O.trim() && S) {
|
|
67
|
+
q(!0), j("");
|
|
68
|
+
try {
|
|
69
|
+
let { data: n } = await v.mutate({
|
|
70
|
+
mutation: e,
|
|
71
|
+
variables: {
|
|
72
|
+
savedQueryId: h,
|
|
73
|
+
title: O.trim(),
|
|
74
|
+
pageId: S
|
|
75
|
+
},
|
|
76
|
+
fetchPolicy: "no-cache",
|
|
77
|
+
context: i(_, t.signal)
|
|
78
|
+
});
|
|
79
|
+
if (t.signal.aborted) return;
|
|
80
|
+
if (!n?.bigconsoleCreateExploreWidget) throw Error("Missing widget");
|
|
81
|
+
F(n.bigconsoleCreateExploreWidget);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
t.signal.aborted || j(r(e));
|
|
84
|
+
} finally {
|
|
85
|
+
t.signal.aborted || q(!1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return P ? /* @__PURE__ */ m("div", {
|
|
90
|
+
className: "space-y-2",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ p("p", {
|
|
93
|
+
role: "status",
|
|
94
|
+
children: "Widget created."
|
|
95
|
+
}),
|
|
96
|
+
y && /* @__PURE__ */ p("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
className: "underline",
|
|
99
|
+
onClick: () => y.navigate(`/dashboards/${encodeURIComponent(b)}?page=${encodeURIComponent(S)}`),
|
|
100
|
+
children: "Open dashboard"
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ p(c, {
|
|
103
|
+
id: P,
|
|
104
|
+
title: O
|
|
105
|
+
})
|
|
106
|
+
]
|
|
107
|
+
}) : /* @__PURE__ */ m("fieldset", {
|
|
108
|
+
className: "space-y-2",
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ p("legend", {
|
|
111
|
+
className: "font-medium",
|
|
112
|
+
children: "Create a dashboard widget"
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ m("div", {
|
|
115
|
+
className: "flex flex-wrap items-end gap-2",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ p(a, {
|
|
118
|
+
label: "Dashboard",
|
|
119
|
+
children: /* @__PURE__ */ m("select", {
|
|
120
|
+
className: o,
|
|
121
|
+
value: b,
|
|
122
|
+
disabled: K,
|
|
123
|
+
onChange: (e) => {
|
|
124
|
+
x(e.target.value), C(""), D([]), U(null), z(null);
|
|
125
|
+
},
|
|
126
|
+
children: [/* @__PURE__ */ p("option", {
|
|
127
|
+
value: "",
|
|
128
|
+
children: "Choose dashboard"
|
|
129
|
+
}), w.map((e) => /* @__PURE__ */ p("option", {
|
|
130
|
+
value: e.id,
|
|
131
|
+
children: e.name
|
|
132
|
+
}, e.id))]
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
!b && I && /* @__PURE__ */ p("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
disabled: G,
|
|
138
|
+
onClick: () => V(I),
|
|
139
|
+
children: "More dashboards"
|
|
140
|
+
}),
|
|
141
|
+
b && /* @__PURE__ */ p(a, {
|
|
142
|
+
label: "Dashboard page",
|
|
143
|
+
children: /* @__PURE__ */ m("select", {
|
|
144
|
+
className: "rounded border border-border-default bg-bg-surface px-2 py-1 text-sm text-text-primary",
|
|
145
|
+
value: S,
|
|
146
|
+
disabled: K,
|
|
147
|
+
onChange: (e) => C(e.target.value),
|
|
148
|
+
children: [/* @__PURE__ */ p("option", {
|
|
149
|
+
value: "",
|
|
150
|
+
children: "Choose page"
|
|
151
|
+
}), E.map((e) => /* @__PURE__ */ p("option", {
|
|
152
|
+
value: e.id,
|
|
153
|
+
children: e.name
|
|
154
|
+
}, e.id))]
|
|
155
|
+
})
|
|
156
|
+
}),
|
|
157
|
+
b && R && /* @__PURE__ */ p("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
disabled: G,
|
|
160
|
+
onClick: () => U(R),
|
|
161
|
+
children: "More pages"
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ p(a, {
|
|
164
|
+
label: "Widget title",
|
|
165
|
+
children: /* @__PURE__ */ p("input", {
|
|
166
|
+
className: o,
|
|
167
|
+
value: O,
|
|
168
|
+
disabled: K,
|
|
169
|
+
onChange: (e) => k(e.target.value)
|
|
170
|
+
})
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ p("button", {
|
|
173
|
+
type: "button",
|
|
174
|
+
className: o,
|
|
175
|
+
onClick: () => void Y(),
|
|
176
|
+
disabled: K || !S || !O.trim(),
|
|
177
|
+
children: "Create widget"
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
}),
|
|
181
|
+
G && /* @__PURE__ */ p("p", {
|
|
182
|
+
role: "status",
|
|
183
|
+
children: "Loading destinations…"
|
|
184
|
+
}),
|
|
185
|
+
A && /* @__PURE__ */ p("p", {
|
|
186
|
+
role: "alert",
|
|
187
|
+
children: A
|
|
188
|
+
})
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
export { h as CreateQueryWidget };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
// src/bigconsole/components/explore/QueryResults.tsx
|
|
3
|
+
function n({ result: n }) {
|
|
4
|
+
return /* @__PURE__ */ t("section", {
|
|
5
|
+
"aria-label": "Query results",
|
|
6
|
+
className: "space-y-2",
|
|
7
|
+
children: [/* @__PURE__ */ t("p", {
|
|
8
|
+
role: "status",
|
|
9
|
+
className: "text-sm text-text-secondary",
|
|
10
|
+
children: [
|
|
11
|
+
n.rows.length === 0 ? "No matching rows." : n.rows.length + " rows returned.",
|
|
12
|
+
" ",
|
|
13
|
+
n.truncated && "Results truncated at the service limit."
|
|
14
|
+
]
|
|
15
|
+
}), /* @__PURE__ */ e("div", {
|
|
16
|
+
className: "max-h-96 overflow-auto rounded border border-border-default",
|
|
17
|
+
tabIndex: 0,
|
|
18
|
+
"aria-label": "Scrollable results",
|
|
19
|
+
children: /* @__PURE__ */ t("table", {
|
|
20
|
+
className: "w-full text-left text-sm",
|
|
21
|
+
children: [/* @__PURE__ */ e("thead", {
|
|
22
|
+
className: "sticky top-0 bg-bg-surface",
|
|
23
|
+
children: /* @__PURE__ */ e("tr", { children: n.columns.map((t, n) => /* @__PURE__ */ e("th", {
|
|
24
|
+
className: "px-3 py-2",
|
|
25
|
+
scope: "col",
|
|
26
|
+
children: t
|
|
27
|
+
}, n)) })
|
|
28
|
+
}), /* @__PURE__ */ e("tbody", { children: n.rows.map((t, n) => /* @__PURE__ */ e("tr", {
|
|
29
|
+
className: "border-t border-border-default",
|
|
30
|
+
children: t.map((t, n) => /* @__PURE__ */ e("td", {
|
|
31
|
+
className: "whitespace-pre-wrap break-words px-3 py-1.5",
|
|
32
|
+
children: t === null ? /* @__PURE__ */ e("i", {
|
|
33
|
+
className: "text-text-secondary",
|
|
34
|
+
children: "NULL"
|
|
35
|
+
}) : String(t)
|
|
36
|
+
}, n))
|
|
37
|
+
}, n)) })]
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { n as QueryResults };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useOptionalBigConsole as e } from "../../context/BigConsoleContext.js";
|
|
2
|
+
import { QueryResults as t } from "./QueryResults.js";
|
|
3
|
+
import { useExploreRun as n } from "./useExploreRun.js";
|
|
4
|
+
import { useEffect as r, useState as i } from "react";
|
|
5
|
+
import { useApolloClient as a } from "@apollo/client/react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
// src/bigconsole/components/explore/SavedQueryWidget.tsx
|
|
8
|
+
var l = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
function u({ widgetId: e, workspaceId: u, actorId: d }) {
|
|
10
|
+
let f = a(), { run: p, result: m, error: h } = n(u), [g, _] = i(0), [v, y] = i(-1), b = g !== v;
|
|
11
|
+
return r(() => {
|
|
12
|
+
let t = JSON.stringify([d, u]), n = l.get(f) ?? /* @__PURE__ */ new Map();
|
|
13
|
+
l.set(f, n);
|
|
14
|
+
let r = !0, i = (n.get(t) ?? Promise.resolve()).then(async () => {
|
|
15
|
+
r && (await p({ widgetId: e }), r && y(g));
|
|
16
|
+
});
|
|
17
|
+
return n.set(t, i), i.finally(() => {
|
|
18
|
+
n.get(t) === i && n.delete(t);
|
|
19
|
+
}), () => {
|
|
20
|
+
r = !1;
|
|
21
|
+
};
|
|
22
|
+
}, [
|
|
23
|
+
f,
|
|
24
|
+
d,
|
|
25
|
+
u,
|
|
26
|
+
p,
|
|
27
|
+
g,
|
|
28
|
+
e
|
|
29
|
+
]), /* @__PURE__ */ c(o, { children: [
|
|
30
|
+
b && /* @__PURE__ */ s("p", {
|
|
31
|
+
role: "status",
|
|
32
|
+
children: "Loading query results…"
|
|
33
|
+
}),
|
|
34
|
+
h && /* @__PURE__ */ s("p", {
|
|
35
|
+
role: "alert",
|
|
36
|
+
children: h
|
|
37
|
+
}),
|
|
38
|
+
m && /* @__PURE__ */ s(t, { result: m }),
|
|
39
|
+
/* @__PURE__ */ s("button", {
|
|
40
|
+
type: "button",
|
|
41
|
+
className: "mt-2 text-sm underline",
|
|
42
|
+
onClick: () => _((e) => e + 1),
|
|
43
|
+
disabled: b,
|
|
44
|
+
children: "Refresh results"
|
|
45
|
+
})
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
function d({ id: t, title: n }) {
|
|
49
|
+
let r = e();
|
|
50
|
+
return /* @__PURE__ */ c("section", {
|
|
51
|
+
className: "h-full overflow-auto rounded-card border border-border-default bg-bg-surface p-3",
|
|
52
|
+
children: [/* @__PURE__ */ s("h3", {
|
|
53
|
+
className: "widget-drag-handle mb-2 font-medium [.react-draggable_&]:cursor-move",
|
|
54
|
+
children: n || "Saved query"
|
|
55
|
+
}), r?.currentUser?.id && r.workspaceId ? /* @__PURE__ */ s(u, {
|
|
56
|
+
actorId: r.currentUser.id,
|
|
57
|
+
widgetId: t,
|
|
58
|
+
workspaceId: r.workspaceId
|
|
59
|
+
}, JSON.stringify([
|
|
60
|
+
r.currentUser.id,
|
|
61
|
+
r.workspaceId,
|
|
62
|
+
t
|
|
63
|
+
])) : /* @__PURE__ */ s("p", {
|
|
64
|
+
role: "alert",
|
|
65
|
+
children: "Sign in to view this widget."
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { d as SavedQueryWidget };
|