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