@burdenoff/microfe-bigconsole 2026.1124.2 → 2026.1124.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.
Files changed (33) hide show
  1. package/dist/bigconsole/components/fleet/FleetBindingsDialog.d.ts +19 -0
  2. package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +287 -0
  3. package/dist/bigconsole/components/fleet/FleetChildrenPanel.d.ts +8 -0
  4. package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +185 -156
  5. package/dist/bigconsole/components/fleet/FleetCopySection.d.ts +5 -0
  6. package/dist/bigconsole/components/fleet/FleetCopySection.js +115 -118
  7. package/dist/bigconsole/components/fleet/FleetWidgetActions.d.ts +36 -0
  8. package/dist/bigconsole/components/fleet/FleetWidgetActions.js +82 -0
  9. package/dist/bigconsole/components/widgets/WidgetMenu.js +146 -96
  10. package/dist/bigconsole/hooks/useFleetBindingActions.d.ts +23 -0
  11. package/dist/bigconsole/hooks/useFleetBindingActions.js +50 -0
  12. package/dist/bigconsole/hooks/useFleetBindings.d.ts +19 -0
  13. package/dist/bigconsole/hooks/useFleetBindings.js +140 -0
  14. package/dist/bigconsole/hooks/useFleetConfirm.d.ts +7 -0
  15. package/dist/bigconsole/hooks/useFleetConfirm.js +17 -0
  16. package/dist/bigconsole/hooks/useFleetWidgetActions.d.ts +10 -0
  17. package/dist/bigconsole/hooks/useFleetWidgetActions.js +41 -0
  18. package/dist/bigconsole/hooks/useOwnerBoundRun.d.ts +13 -18
  19. package/dist/bigconsole/hooks/useOwnerBoundRun.js +45 -30
  20. package/dist/bigconsole/hooks/useWidgetOperations.js +2 -0
  21. package/dist/bigconsole/pages/DashboardViewPage.js +303 -291
  22. package/dist/bigconsole/types/index.d.ts +4 -0
  23. package/dist/bigconsole/utils/fleetBindings.d.ts +49 -0
  24. package/dist/bigconsole/utils/fleetBindings.js +52 -0
  25. package/dist/bigconsole/utils/fleetNotices.d.ts +12 -0
  26. package/dist/bigconsole/utils/fleetNotices.js +5 -0
  27. package/dist/bigconsole/utils/fleetWidgetMenu.d.ts +20 -0
  28. package/dist/bigconsole/utils/fleetWidgetMenu.js +13 -0
  29. package/dist/generated/wspace-operations.d.ts +163 -0
  30. package/dist/generated/wspace-operations.js +935 -122
  31. package/dist/generated/wspace-types.d.ts +395 -9
  32. package/dist/generated/wspace-types.js +12 -10
  33. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ import { ActionLock } from '../../hooks/useOwnerBoundRun';
3
+ export interface FleetBindingCopy {
4
+ id: string;
5
+ name: string;
6
+ }
7
+ export interface FleetBindingsDialogProps {
8
+ isOpen: boolean;
9
+ masterId: string;
10
+ masterName: string;
11
+ /** The active copies of the master, the ones whose data sources can be changed. */
12
+ copies: readonly FleetBindingCopy[];
13
+ /** Shared with the rest of the Children panel, so a change holds the buttons of the other actions. */
14
+ lock?: ActionLock;
15
+ onClose: () => void;
16
+ /** Called after the copies' data sources changed, so the panel reads the board again. Awaited. */
17
+ onChanged?: () => Promise<unknown> | void;
18
+ }
19
+ export declare const FleetBindingsDialog: FC<FleetBindingsDialogProps>;
@@ -0,0 +1,287 @@
1
+ import { useBigConsole as e } from "../../context/BigConsoleContext.js";
2
+ import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import "../../context/index.js";
4
+ import { useFleetBindingActions as n } from "../../hooks/useFleetBindingActions.js";
5
+ import { useFleetBindings as ee } from "../../hooks/useFleetBindings.js";
6
+ import { useOwnerBoundRun as te } from "../../hooks/useOwnerBoundRun.js";
7
+ import { bindingsInput as ne, chosenSink as re, withChoice as ie } from "../../utils/fleetBindings.js";
8
+ import { memo as r, useCallback as i, useMemo as a, useRef as ae, useState as o } from "react";
9
+ import { Button as s, Input as oe, ResponsiveDialog as se, ResponsiveDialogContent as ce, ResponsiveDialogDescription as le, ResponsiveDialogFooter as ue, ResponsiveDialogHeader as de, ResponsiveDialogTitle as fe, Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f, Spinner as p } from "@burdenoff/fe-libs/ui";
10
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
11
+ // src/bigconsole/components/fleet/FleetBindingsDialog.tsx
12
+ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message : t, y = r(function({ isOpen: r, masterId: y, masterName: pe, copies: b, lock: me, onClose: x, onChanged: S }) {
13
+ let C = t(), { workspaceId: he, currentUser: ge } = e(), _e = `${he ?? ""}:${ge?.id ?? ""}:${y}`, w = a(() => b.map((e) => e.id), [b]), { loading: T, error: E, master: D, sinks: O, sinksTruncated: ve, bindings: k, refetch: A } = ee(y, w, r), j = n(), [M, N] = o(null), [P, F] = o({}), [I, L] = o(""), [R, z] = o("edit"), [B, V] = o(null), [H, U] = o(null), W = ae(!1), [G, K] = o(null), ye = i(() => {
14
+ N(null), F({}), L(""), z("edit"), V(null), U(null), K(null);
15
+ }, []), be = i(async () => {
16
+ W.current || (await A(), await S?.());
17
+ }, [S, A]), { acting: xe, run: q } = te(_e, be, ye, me), J = xe || j.busy, Y = M && D.sinks.some((e) => e.id === M) ? M : D.sinks[0]?.id ?? null, X = i((e) => O.get(e)?.name ?? C("bigconsole.fleet.bindings.unknownSink", "A data source you cannot see"), [O, C]), Z = a(() => {
18
+ let e = I.trim().toLowerCase();
19
+ return b.filter((t) => !e || t.name.toLowerCase().includes(e));
20
+ }, [b, I]), Q = a(() => ne(y, P, w), [
21
+ w,
22
+ P,
23
+ y
24
+ ]), Se = i((e, t) => b.find((t) => t.id === e)?.name ?? t ?? e, [b]), Ce = i((e, t) => {
25
+ Y !== null && F((n) => ie(n, k, e, Y, t === _ ? null : t));
26
+ }, [k, Y]), we = i(async () => {
27
+ if (Q) {
28
+ K(null), W.current = !0;
29
+ try {
30
+ await q(() => j.preview(Q), (e) => {
31
+ V(e), U(Q), z("preview");
32
+ }, (e) => K(v(e, C("bigconsole.fleet.bindings.error.preview", "The preview could not be made."))));
33
+ } finally {
34
+ W.current = !1;
35
+ }
36
+ }
37
+ }, [
38
+ j,
39
+ Q,
40
+ q,
41
+ C
42
+ ]), Te = i(async () => {
43
+ H && (K(null), await q(() => j.apply(H), (e) => {
44
+ V(e), z("done"), F({});
45
+ }, (e) => K(v(e, C("bigconsole.fleet.bindings.error.apply", "The data sources could not be changed.")))));
46
+ }, [
47
+ j,
48
+ H,
49
+ q,
50
+ C
51
+ ]), Ee = (e, t) => e === "APPLIED" ? t ? C("bigconsole.fleet.bindings.state.willUse", "Will use it") : C("bigconsole.fleet.bindings.state.uses", "Uses it now") : e === "UNCHANGED" ? C("bigconsole.fleet.bindings.state.unchanged", "Already uses it") : C("bigconsole.fleet.bindings.state.incompatible", "Cannot take it"), $ = {
52
+ color: "var(--color-text-secondary)",
53
+ fontSize: "var(--font-size-body-sm)"
54
+ }, De = Q?.copies.length ?? 0, Oe = [...O.values()].filter((e) => e.isActive && e.id !== Y);
55
+ return /* @__PURE__ */ h(se, {
56
+ open: r,
57
+ onOpenChange: (e) => !e && !J && x(),
58
+ children: /* @__PURE__ */ g(ce, { children: [
59
+ /* @__PURE__ */ g(de, { children: [/* @__PURE__ */ h(fe, { children: C("bigconsole.fleet.bindings.title", "Copies' data sources") }), /* @__PURE__ */ h(le, { children: C("bigconsole.fleet.bindings.description", "Each copy of \"{{name}}\" can read its own data source where the master reads one, so the board is designed once and shows each place its own data. A push keeps them.", { name: pe }) })] }),
60
+ T && /* @__PURE__ */ g("p", {
61
+ className: "flex items-center gap-2",
62
+ style: $,
63
+ "data-testid": "fleet-bindings-loading",
64
+ children: [/* @__PURE__ */ h(p, { style: {
65
+ height: "var(--size-icon-sm)",
66
+ width: "var(--size-icon-sm)"
67
+ } }), C("bigconsole.fleet.bindings.loading", "Reading the data sources…")]
68
+ }),
69
+ !T && E && /* @__PURE__ */ g("div", {
70
+ className: "flex flex-col gap-form-gap",
71
+ role: "alert",
72
+ "data-testid": "fleet-bindings-load-error",
73
+ children: [/* @__PURE__ */ h("p", {
74
+ style: {
75
+ margin: 0,
76
+ color: "var(--color-status-error-text)"
77
+ },
78
+ children: C("bigconsole.fleet.bindings.loadError", "The data sources could not be read.")
79
+ }), /* @__PURE__ */ h("div", { children: /* @__PURE__ */ h(s, {
80
+ variant: "outline",
81
+ onClick: () => void A(),
82
+ children: C("bigconsole.fleet.bindings.retry", "Try again")
83
+ }) })]
84
+ }),
85
+ !T && !E && Y === null && /* @__PURE__ */ h("p", {
86
+ style: {
87
+ ...$,
88
+ margin: 0
89
+ },
90
+ "data-testid": "fleet-bindings-none",
91
+ children: C("bigconsole.fleet.bindings.none", "None of this board's widgets read from a data source of their own, so there is nothing to change.")
92
+ }),
93
+ !T && !E && Y !== null && R === "edit" && /* @__PURE__ */ g("div", {
94
+ className: "flex flex-col gap-form-gap",
95
+ children: [
96
+ /* @__PURE__ */ g("div", {
97
+ className: "flex flex-col gap-1",
98
+ children: [/* @__PURE__ */ h("span", {
99
+ style: $,
100
+ children: C("bigconsole.fleet.bindings.master", "The master reads")
101
+ }), /* @__PURE__ */ g(c, {
102
+ value: Y,
103
+ onValueChange: N,
104
+ children: [/* @__PURE__ */ h(d, {
105
+ "aria-label": C("bigconsole.fleet.bindings.master", "The master reads"),
106
+ children: /* @__PURE__ */ h(f, {})
107
+ }), /* @__PURE__ */ h(l, { children: D.sinks.map((e) => /* @__PURE__ */ h(u, {
108
+ value: e.id,
109
+ children: C("bigconsole.fleet.bindings.masterSink", "{{name}} ({{count}} widgets)", {
110
+ name: X(e.id),
111
+ count: e.widgetCount
112
+ })
113
+ }, e.id)) })]
114
+ })]
115
+ }),
116
+ D.otherSourceWidgets > 0 && /* @__PURE__ */ h("p", {
117
+ style: {
118
+ ...$,
119
+ margin: 0
120
+ },
121
+ "data-testid": "fleet-bindings-other",
122
+ children: C("bigconsole.fleet.bindings.other", "{{count}} widgets read through a parser or a saved query. Those are not changed here.", { count: D.otherSourceWidgets })
123
+ }),
124
+ ve && /* @__PURE__ */ h("p", {
125
+ style: {
126
+ ...$,
127
+ margin: 0
128
+ },
129
+ children: C("bigconsole.fleet.bindings.truncated", "There are more data sources than can be listed. Only the first ones are offered.")
130
+ }),
131
+ b.length > 6 && /* @__PURE__ */ h(oe, {
132
+ value: I,
133
+ onChange: (e) => L(e.target.value),
134
+ placeholder: C("bigconsole.fleet.bindings.search", "Search copies"),
135
+ "aria-label": C("bigconsole.fleet.bindings.search", "Search copies")
136
+ }),
137
+ /* @__PURE__ */ g("ul", {
138
+ className: "flex flex-col gap-2",
139
+ "data-testid": "fleet-bindings-copies",
140
+ style: {
141
+ margin: 0,
142
+ padding: 0,
143
+ listStyle: "none",
144
+ maxHeight: "18rem",
145
+ overflowY: "auto"
146
+ },
147
+ children: [Z.length === 0 && /* @__PURE__ */ h("li", {
148
+ style: $,
149
+ children: C("bigconsole.fleet.bindings.noCopies", "No copy matches.")
150
+ }), Z.map((e) => {
151
+ let t = re(P, k, e.id, Y), n = P[Y]?.[e.id] !== void 0;
152
+ return /* @__PURE__ */ g("li", {
153
+ className: "flex flex-wrap items-center justify-between gap-form-gap rounded-input border px-3 py-2",
154
+ style: {
155
+ borderColor: n ? "var(--color-action-primary-bg)" : "var(--color-border-subtle)",
156
+ color: "var(--color-text-primary)"
157
+ },
158
+ children: [/* @__PURE__ */ h("span", {
159
+ className: "min-w-0 flex-1 truncate",
160
+ children: e.name
161
+ }), /* @__PURE__ */ h("div", {
162
+ style: { minWidth: "min(100%, 14rem)" },
163
+ children: /* @__PURE__ */ g(c, {
164
+ value: t ?? _,
165
+ onValueChange: (t) => Ce(e.id, t),
166
+ children: [/* @__PURE__ */ h(d, {
167
+ "aria-label": C("bigconsole.fleet.bindings.copyReads", "{{name}} reads", { name: e.name }),
168
+ children: /* @__PURE__ */ h(f, {})
169
+ }), /* @__PURE__ */ g(l, { children: [
170
+ /* @__PURE__ */ h(u, {
171
+ value: _,
172
+ children: C("bigconsole.fleet.bindings.mastersOwn", "The master's ({{name}})", { name: X(Y) })
173
+ }),
174
+ t !== null && !Oe.some((e) => e.id === t) && /* @__PURE__ */ h(u, {
175
+ value: t,
176
+ children: X(t)
177
+ }),
178
+ Oe.map((e) => /* @__PURE__ */ h(u, {
179
+ value: e.id,
180
+ children: e.name
181
+ }, e.id))
182
+ ] })]
183
+ })
184
+ })]
185
+ }, e.id);
186
+ })]
187
+ })
188
+ ]
189
+ }),
190
+ (R === "preview" || R === "done") && B && /* @__PURE__ */ g("div", {
191
+ className: "flex flex-col gap-form-gap",
192
+ "data-testid": "fleet-bindings-result",
193
+ children: [/* @__PURE__ */ h("strong", {
194
+ style: { color: "var(--color-text-primary)" },
195
+ children: R === "preview" ? C("bigconsole.fleet.bindings.previewTitle", "Preview: nothing has been changed yet") : C("bigconsole.fleet.bindings.doneTitle", "Data sources changed for {{count}} copies.", { count: B.appliedCount })
196
+ }), /* @__PURE__ */ h("ul", {
197
+ style: {
198
+ margin: 0,
199
+ padding: 0,
200
+ listStyle: "none",
201
+ maxHeight: "18rem",
202
+ overflowY: "auto"
203
+ },
204
+ children: B.copies.map((e) => /* @__PURE__ */ g("li", {
205
+ className: "flex flex-col gap-1 border-b py-2",
206
+ style: { borderColor: "var(--color-border-subtle)" },
207
+ children: [
208
+ /* @__PURE__ */ g("div", {
209
+ className: "flex items-center justify-between gap-form-gap",
210
+ children: [/* @__PURE__ */ h("span", {
211
+ className: "min-w-0 truncate",
212
+ style: { color: "var(--color-text-primary)" },
213
+ children: Se(e.dashboardId, e.name)
214
+ }), /* @__PURE__ */ h("span", {
215
+ style: {
216
+ fontSize: "var(--font-size-body-sm)",
217
+ color: e.state === "INCOMPATIBLE" ? "var(--color-status-error-text)" : e.state === "APPLIED" ? "var(--color-status-success-text)" : "var(--color-text-secondary)"
218
+ },
219
+ children: Ee(e.state, B.preview)
220
+ })]
221
+ }),
222
+ e.state === "APPLIED" && /* @__PURE__ */ g("span", {
223
+ style: $,
224
+ children: [B.preview ? C("bigconsole.fleet.bindings.willRebind", "{{count}} widgets would read it.", { count: e.widgetsRebound }) : C("bigconsole.fleet.bindings.rebound", "{{count}} widgets read it now.", { count: e.widgetsRebound }), e.widgetsKeptLocal > 0 && " " + C("bigconsole.fleet.bindings.keptLocal", "{{count}} the copy pointed elsewhere itself stay as they are.", { count: e.widgetsKeptLocal })]
225
+ }),
226
+ e.state === "INCOMPATIBLE" && e.reason && /* @__PURE__ */ h("span", {
227
+ role: "alert",
228
+ style: {
229
+ ...$,
230
+ color: "var(--color-status-error-text)"
231
+ },
232
+ children: e.reason
233
+ })
234
+ ]
235
+ }, e.dashboardId))
236
+ })]
237
+ }),
238
+ G && /* @__PURE__ */ h("p", {
239
+ role: "alert",
240
+ "data-testid": "fleet-bindings-error",
241
+ style: {
242
+ margin: 0,
243
+ color: "var(--color-status-error-text)"
244
+ },
245
+ children: G
246
+ }),
247
+ /* @__PURE__ */ g(ue, { children: [
248
+ R === "edit" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
249
+ variant: "ghost",
250
+ onClick: x,
251
+ disabled: J,
252
+ children: C("bigconsole.fleet.link.cancel", "Cancel")
253
+ }), /* @__PURE__ */ g(s, {
254
+ onClick: () => void we(),
255
+ disabled: J || !Q,
256
+ "data-testid": "fleet-bindings-preview",
257
+ children: [J && /* @__PURE__ */ h(p, { style: {
258
+ height: "var(--size-icon-sm)",
259
+ width: "var(--size-icon-sm)"
260
+ } }), C("bigconsole.fleet.bindings.preview", "Preview {{count}} copies", { count: De })]
261
+ })] }),
262
+ R === "preview" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
263
+ variant: "ghost",
264
+ onClick: () => {
265
+ z("edit"), V(null), U(null), K(null);
266
+ },
267
+ disabled: J,
268
+ children: C("bigconsole.fleet.bindings.back", "Back")
269
+ }), /* @__PURE__ */ g(s, {
270
+ onClick: () => void Te(),
271
+ disabled: J || !H || !B || B.appliedCount === 0,
272
+ "data-testid": "fleet-bindings-apply",
273
+ children: [J && /* @__PURE__ */ h(p, { style: {
274
+ height: "var(--size-icon-sm)",
275
+ width: "var(--size-icon-sm)"
276
+ } }), C("bigconsole.fleet.bindings.apply", "Apply")]
277
+ })] }),
278
+ R === "done" && /* @__PURE__ */ h(s, {
279
+ onClick: x,
280
+ disabled: J,
281
+ children: C("bigconsole.fleet.bindings.close", "Close")
282
+ })
283
+ ] })
284
+ ] })
285
+ });
286
+ });
287
+ export { y as FleetBindingsDialog };
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
+ import { ActionLock } from '../../hooks/useOwnerBoundRun';
2
3
  export interface FleetChildrenPanelProps {
3
4
  dashboardId: string;
4
5
  dashboardName: string;
@@ -6,6 +7,13 @@ export interface FleetChildrenPanelProps {
6
7
  masterName?: string | null;
7
8
  /** Called after an action changed this board's widgets (a flag answered, the board restored). */
8
9
  onBoardChanged?: () => Promise<unknown> | void;
10
+ /**
11
+ * The page's action lock, when the board's widget menu shares it with this panel, so a widget restored or
12
+ * promoted from its menu holds the panel's buttons too. The panel keeps its own when none is given.
13
+ */
14
+ lock?: ActionLock;
15
+ /** Changes when something outside the panel changed this board's widgets, so open flags are read again. */
16
+ changeToken?: number;
9
17
  onClose: () => void;
10
18
  onOpenBoard: (dashboardId: string) => void;
11
19
  }