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