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