@burdenoff/microfe-bigconsole 2026.1121.1 → 2026.1121.3
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/ask/AskYourData.js +126 -123
- package/dist/bigconsole/components/explore/CreateQueryWidget.js +106 -103
- package/dist/bigconsole/components/explore/SqlDraftEditor.js +85 -83
- package/dist/bigconsole/components/explore/exploreErrors.d.ts +21 -0
- package/dist/bigconsole/components/explore/exploreErrors.js +79 -0
- package/dist/bigconsole/components/explore/useExploreRun.d.ts +2 -2
- package/dist/bigconsole/components/explore/useExploreRun.js +40 -55
- package/dist/bigconsole/utils/backendError.d.ts +9 -2
- package/dist/bigconsole/utils/backendError.js +29 -26
- package/dist/shared/hooks/useTr.d.ts +8 -0
- package/dist/shared/hooks/useTr.js +15 -8
- package/package.json +1 -1
|
@@ -1,208 +1,211 @@
|
|
|
1
1
|
import { BigConsoleAskAddToDashboardDocument as e, CreateExploreWidgetDocument as t, ExploreDashboardsDocument as n, ExplorePagesDocument as r } from "../../../generated/wspace-operations.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { workspaceRequest as i } from "./useExploreRun.js";
|
|
3
|
+
import { exploreErrorMessage as a, withoutError as o } from "./exploreErrors.js";
|
|
4
|
+
import { Control as s, controlClass as c } from "./VisualBuilder.js";
|
|
5
|
+
import { useOptionalBigConsole as l } from "../../context/BigConsoleContext.js";
|
|
6
|
+
import { SavedQueryWidget as u } from "./SavedQueryWidget.js";
|
|
6
7
|
import "../../hooks/useActivePage.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useOptionalTr as d } from "../../../shared/hooks/useTr.js";
|
|
9
|
+
import { useEffect as f, useRef as p, useState as m } from "react";
|
|
10
|
+
import { useApolloClient as h } from "@apollo/client/react";
|
|
11
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
12
|
// src/bigconsole/components/explore/CreateQueryWidget.tsx
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]),
|
|
17
|
-
|
|
18
|
-
let e = new AbortController(), t =
|
|
19
|
-
return
|
|
13
|
+
function v({ savedId: v, askSpec: y, name: b, workspaceId: x }) {
|
|
14
|
+
let S = h(), C = d(), w = l(), [T, E] = m(""), [D, O] = m(""), [k, A] = m([]), [j, M] = m([]), [N, P] = m(b), [F, I] = m(""), [L, R] = m(""), [z, B] = m(""), [V, H] = m(null), [U, W] = m(null), [G, K] = m(null), [q, J] = m(null), Y = JSON.stringify([
|
|
15
|
+
T,
|
|
16
|
+
G,
|
|
17
|
+
q
|
|
18
|
+
]), X = Y !== L, [Z, Q] = m(!1);
|
|
19
|
+
f(() => {
|
|
20
|
+
let e = new AbortController(), t = i(x, e.signal);
|
|
21
|
+
return T ? S.query({
|
|
20
22
|
query: r,
|
|
21
23
|
variables: {
|
|
22
|
-
dashboardId:
|
|
23
|
-
after:
|
|
24
|
+
dashboardId: T,
|
|
25
|
+
after: q
|
|
24
26
|
},
|
|
25
27
|
fetchPolicy: "no-cache",
|
|
26
28
|
context: t
|
|
27
|
-
}).then(({ data: t }) => {
|
|
29
|
+
}).then(o).then(({ data: t }) => {
|
|
28
30
|
if (e.signal.aborted) return;
|
|
29
31
|
let n = t?.getDashboard?.pages;
|
|
30
32
|
if (!n) throw Error("Missing pages");
|
|
31
|
-
|
|
33
|
+
I(""), M((e) => [...q ? e : [], ...n.edges.map((e) => e.node)]), W(n.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null);
|
|
32
34
|
}).catch((t) => {
|
|
33
|
-
e.signal.aborted ||
|
|
35
|
+
e.signal.aborted || I(a(t, C));
|
|
34
36
|
}).finally(() => {
|
|
35
|
-
e.signal.aborted ||
|
|
36
|
-
}) :
|
|
37
|
+
e.signal.aborted || R(Y);
|
|
38
|
+
}) : S.query({
|
|
37
39
|
query: n,
|
|
38
|
-
variables: { after:
|
|
40
|
+
variables: { after: G },
|
|
39
41
|
fetchPolicy: "no-cache",
|
|
40
42
|
context: t
|
|
41
|
-
}).then(({ data: t }) => {
|
|
43
|
+
}).then(o).then(({ data: t }) => {
|
|
42
44
|
if (e.signal.aborted) return;
|
|
43
45
|
if (!t?.listDashboards) throw Error("Missing dashboards");
|
|
44
46
|
let n = t.listDashboards;
|
|
45
|
-
|
|
47
|
+
I(""), A((e) => [...G ? e : [], ...n.edges.map((e) => e.node)]), H(n.pageInfo.hasNextPage ? n.pageInfo.endCursor ?? null : null);
|
|
46
48
|
}).catch((t) => {
|
|
47
|
-
e.signal.aborted ||
|
|
49
|
+
e.signal.aborted || I(a(t, C));
|
|
48
50
|
}).finally(() => {
|
|
49
|
-
e.signal.aborted ||
|
|
51
|
+
e.signal.aborted || R(Y);
|
|
50
52
|
}), () => e.abort();
|
|
51
53
|
}, [
|
|
52
|
-
b,
|
|
53
|
-
y,
|
|
54
54
|
S,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
x,
|
|
56
|
+
T,
|
|
57
|
+
G,
|
|
58
|
+
q,
|
|
59
|
+
Y,
|
|
60
|
+
C
|
|
58
61
|
]);
|
|
59
|
-
let
|
|
60
|
-
|
|
62
|
+
let $ = p(null);
|
|
63
|
+
f(() => {
|
|
61
64
|
let e = new AbortController();
|
|
62
|
-
return
|
|
65
|
+
return $.current = e, () => e.abort();
|
|
63
66
|
}, []);
|
|
64
|
-
async function
|
|
65
|
-
let n =
|
|
66
|
-
if (n && !n.signal.aborted && !
|
|
67
|
-
|
|
67
|
+
async function ee() {
|
|
68
|
+
let n = $.current;
|
|
69
|
+
if (n && !n.signal.aborted && !Z && N.trim() && D) {
|
|
70
|
+
Q(!0), I("");
|
|
68
71
|
try {
|
|
69
|
-
let r =
|
|
70
|
-
if (
|
|
71
|
-
let { data: t } = await
|
|
72
|
+
let r = i(x, n.signal), a;
|
|
73
|
+
if (y !== void 0) {
|
|
74
|
+
let { data: t } = o(await S.mutate({
|
|
72
75
|
mutation: e,
|
|
73
76
|
variables: {
|
|
74
|
-
spec:
|
|
75
|
-
title:
|
|
76
|
-
pageId:
|
|
77
|
+
spec: y,
|
|
78
|
+
title: N.trim(),
|
|
79
|
+
pageId: D
|
|
77
80
|
},
|
|
78
81
|
fetchPolicy: "no-cache",
|
|
79
82
|
context: r
|
|
80
|
-
});
|
|
81
|
-
|
|
83
|
+
}));
|
|
84
|
+
a = t?.bigconsoleAskAddToDashboard;
|
|
82
85
|
} else {
|
|
83
|
-
let { data: e } = await
|
|
86
|
+
let { data: e } = o(await S.mutate({
|
|
84
87
|
mutation: t,
|
|
85
88
|
variables: {
|
|
86
|
-
savedQueryId:
|
|
87
|
-
title:
|
|
88
|
-
pageId:
|
|
89
|
+
savedQueryId: v ?? "",
|
|
90
|
+
title: N.trim(),
|
|
91
|
+
pageId: D
|
|
89
92
|
},
|
|
90
93
|
fetchPolicy: "no-cache",
|
|
91
94
|
context: r
|
|
92
|
-
});
|
|
93
|
-
|
|
95
|
+
}));
|
|
96
|
+
a = e?.bigconsoleCreateExploreWidget;
|
|
94
97
|
}
|
|
95
98
|
if (n.signal.aborted) return;
|
|
96
|
-
if (!
|
|
97
|
-
|
|
99
|
+
if (!a) throw Error("Missing widget");
|
|
100
|
+
B(a);
|
|
98
101
|
} catch (e) {
|
|
99
|
-
n.signal.aborted ||
|
|
102
|
+
n.signal.aborted || I(a(e, C));
|
|
100
103
|
} finally {
|
|
101
|
-
n.signal.aborted ||
|
|
104
|
+
n.signal.aborted || Q(!1);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
|
-
return
|
|
108
|
+
return z ? /* @__PURE__ */ _("div", {
|
|
106
109
|
className: "space-y-2",
|
|
107
110
|
children: [
|
|
108
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ g("p", {
|
|
109
112
|
role: "status",
|
|
110
113
|
children: "Widget created."
|
|
111
114
|
}),
|
|
112
|
-
|
|
115
|
+
w && /* @__PURE__ */ g("button", {
|
|
113
116
|
type: "button",
|
|
114
117
|
className: "underline",
|
|
115
|
-
onClick: () =>
|
|
118
|
+
onClick: () => w.navigate(`/dashboards/${encodeURIComponent(T)}?page=${encodeURIComponent(D)}`),
|
|
116
119
|
children: "Open dashboard"
|
|
117
120
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
id:
|
|
120
|
-
title:
|
|
121
|
+
/* @__PURE__ */ g(u, {
|
|
122
|
+
id: z,
|
|
123
|
+
title: N
|
|
121
124
|
})
|
|
122
125
|
]
|
|
123
|
-
}) : /* @__PURE__ */
|
|
126
|
+
}) : /* @__PURE__ */ _("fieldset", {
|
|
124
127
|
className: "space-y-2",
|
|
125
128
|
children: [
|
|
126
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ g("legend", {
|
|
127
130
|
className: "font-medium",
|
|
128
131
|
children: "Create a dashboard widget"
|
|
129
132
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ _("div", {
|
|
131
134
|
className: "flex flex-wrap items-end gap-2",
|
|
132
135
|
children: [
|
|
133
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ g(s, {
|
|
134
137
|
label: "Dashboard",
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
-
className:
|
|
137
|
-
value:
|
|
138
|
-
disabled:
|
|
138
|
+
children: /* @__PURE__ */ _("select", {
|
|
139
|
+
className: c,
|
|
140
|
+
value: T,
|
|
141
|
+
disabled: Z,
|
|
139
142
|
onChange: (e) => {
|
|
140
|
-
|
|
143
|
+
E(e.target.value), O(""), M([]), J(null), W(null);
|
|
141
144
|
},
|
|
142
|
-
children: [/* @__PURE__ */
|
|
145
|
+
children: [/* @__PURE__ */ g("option", {
|
|
143
146
|
value: "",
|
|
144
147
|
children: "Choose dashboard"
|
|
145
|
-
}),
|
|
148
|
+
}), k.map((e) => /* @__PURE__ */ g("option", {
|
|
146
149
|
value: e.id,
|
|
147
150
|
children: e.name
|
|
148
151
|
}, e.id))]
|
|
149
152
|
})
|
|
150
153
|
}),
|
|
151
|
-
!
|
|
154
|
+
!T && V && /* @__PURE__ */ g("button", {
|
|
152
155
|
type: "button",
|
|
153
|
-
disabled:
|
|
154
|
-
onClick: () =>
|
|
156
|
+
disabled: X,
|
|
157
|
+
onClick: () => K(V),
|
|
155
158
|
children: "More dashboards"
|
|
156
159
|
}),
|
|
157
|
-
|
|
160
|
+
T && /* @__PURE__ */ g(s, {
|
|
158
161
|
label: "Dashboard page",
|
|
159
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ _("select", {
|
|
160
163
|
className: "rounded border border-border-default bg-bg-surface px-2 py-1 text-sm text-text-primary",
|
|
161
|
-
value:
|
|
162
|
-
disabled:
|
|
163
|
-
onChange: (e) =>
|
|
164
|
-
children: [/* @__PURE__ */
|
|
164
|
+
value: D,
|
|
165
|
+
disabled: Z,
|
|
166
|
+
onChange: (e) => O(e.target.value),
|
|
167
|
+
children: [/* @__PURE__ */ g("option", {
|
|
165
168
|
value: "",
|
|
166
169
|
children: "Choose page"
|
|
167
|
-
}),
|
|
170
|
+
}), j.map((e) => /* @__PURE__ */ g("option", {
|
|
168
171
|
value: e.id,
|
|
169
172
|
children: e.name
|
|
170
173
|
}, e.id))]
|
|
171
174
|
})
|
|
172
175
|
}),
|
|
173
|
-
|
|
176
|
+
T && U && /* @__PURE__ */ g("button", {
|
|
174
177
|
type: "button",
|
|
175
|
-
disabled:
|
|
176
|
-
onClick: () =>
|
|
178
|
+
disabled: X,
|
|
179
|
+
onClick: () => J(U),
|
|
177
180
|
children: "More pages"
|
|
178
181
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ g(s, {
|
|
180
183
|
label: "Widget title",
|
|
181
|
-
children: /* @__PURE__ */
|
|
182
|
-
className:
|
|
183
|
-
value:
|
|
184
|
-
disabled:
|
|
185
|
-
onChange: (e) =>
|
|
184
|
+
children: /* @__PURE__ */ g("input", {
|
|
185
|
+
className: c,
|
|
186
|
+
value: N,
|
|
187
|
+
disabled: Z,
|
|
188
|
+
onChange: (e) => P(e.target.value)
|
|
186
189
|
})
|
|
187
190
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ g("button", {
|
|
189
192
|
type: "button",
|
|
190
|
-
className:
|
|
191
|
-
onClick: () => void
|
|
192
|
-
disabled:
|
|
193
|
+
className: c,
|
|
194
|
+
onClick: () => void ee(),
|
|
195
|
+
disabled: Z || !D || !N.trim(),
|
|
193
196
|
children: "Create widget"
|
|
194
197
|
})
|
|
195
198
|
]
|
|
196
199
|
}),
|
|
197
|
-
|
|
200
|
+
X && /* @__PURE__ */ g("p", {
|
|
198
201
|
role: "status",
|
|
199
202
|
children: "Loading destinations…"
|
|
200
203
|
}),
|
|
201
|
-
|
|
204
|
+
F && /* @__PURE__ */ g("p", {
|
|
202
205
|
role: "alert",
|
|
203
|
-
children:
|
|
206
|
+
children: F
|
|
204
207
|
})
|
|
205
208
|
]
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
|
-
export {
|
|
211
|
+
export { v as CreateQueryWidget };
|