@burdenoff/microfe-bigconsole 2026.1124.5 → 2026.1124.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,72 +1,73 @@
1
1
  import { useBigConsole as e } from "../../context/BigConsoleContext.js";
2
2
  import { useTr as t } from "../../../shared/hooks/useTr.js";
3
+ import { trCount as n } from "../../utils/fleetPlural.js";
3
4
  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";
5
+ import { useFleetBindingActions as ee } from "../../hooks/useFleetBindingActions.js";
6
+ import { useFleetBindings as te } from "../../hooks/useFleetBindings.js";
7
+ import { useOwnerBoundRun as ne } from "../../hooks/useOwnerBoundRun.js";
8
+ import { bindingsInput as re, chosenSink as ie, withChoice as ae } from "../../utils/fleetBindings.js";
9
+ import { memo as r, useCallback as i, useMemo as a, useRef as oe, useState as o } from "react";
10
+ import { Button as s, Input as se, ResponsiveDialog as ce, ResponsiveDialogContent as le, ResponsiveDialogDescription as ue, ResponsiveDialogFooter as de, ResponsiveDialogHeader as fe, ResponsiveDialogTitle as pe, Select as c, SelectContent as l, SelectItem as u, SelectTrigger as d, SelectValue as f, Spinner as p } from "@burdenoff/fe-libs/ui";
10
11
  import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
11
12
  // 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();
13
+ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message : t, y = r(function({ isOpen: r, masterId: y, masterName: me, copies: b, lock: he, onClose: x, onChanged: ge }) {
14
+ let S = t(), { workspaceId: _e, currentUser: ve } = e(), ye = `${_e ?? ""}:${ve?.id ?? ""}:${y}`, C = a(() => b.map((e) => e.id), [b]), { loading: w, error: T, master: E, sinks: D, sinksTruncated: be, bindings: O, refetch: k } = te(y, C, r), A = ee(), [j, M] = o(null), [N, P] = o({}), [F, I] = o(""), [L, R] = o("edit"), [z, B] = o(null), [V, H] = o(null), U = oe(!1), [W, G] = o(null), xe = i(() => {
15
+ M(null), P({}), I(""), R("edit"), B(null), H(null), G(null);
16
+ }, []), Se = i(async () => {
17
+ U.current || (await k(), await ge?.());
18
+ }, [ge, k]), { acting: Ce, run: K } = ne(ye, Se, xe, he), q = Ce || A.busy, J = j && E.sinks.some((e) => e.id === j) ? j : E.sinks[0]?.id ?? null, Y = i((e) => D.get(e)?.name ?? S("bigconsole.fleet.bindings.unknownSink", "A data source you cannot see"), [D, S]), X = a(() => {
19
+ let e = F.trim().toLowerCase();
19
20
  return b.filter((t) => !e || t.name.toLowerCase().includes(e));
20
- }, [b, I]), Q = a(() => ne(y, P, w), [
21
- w,
22
- P,
21
+ }, [b, F]), Z = a(() => re(y, N, C), [
22
+ C,
23
+ N,
23
24
  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;
25
+ ]), we = i((e, t) => b.find((t) => t.id === e)?.name ?? t ?? e, [b]), Te = i((e, t) => {
26
+ J !== null && P((n) => ae(n, O, e, J, t === _ ? null : t));
27
+ }, [O, J]), Ee = i(async () => {
28
+ if (Z) {
29
+ G(null), U.current = !0;
29
30
  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."))));
31
+ await K(() => A.preview(Z), (e) => {
32
+ B(e), H(Z), R("preview");
33
+ }, (e) => G(v(e, S("bigconsole.fleet.bindings.error.preview", "The preview could not be made."))));
33
34
  } finally {
34
- W.current = !1;
35
+ U.current = !1;
35
36
  }
36
37
  }
37
38
  }, [
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.")))));
39
+ A,
40
+ Z,
41
+ K,
42
+ S
43
+ ]), De = i(async () => {
44
+ V && (G(null), await K(() => A.apply(V), (e) => {
45
+ B(e), R("done"), P({});
46
+ }, (e) => G(v(e, S("bigconsole.fleet.bindings.error.apply", "The data sources could not be changed.")))));
46
47
  }, [
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"), $ = {
48
+ A,
49
+ V,
50
+ K,
51
+ S
52
+ ]), Oe = (e, t) => e === "APPLIED" ? t ? S("bigconsole.fleet.bindings.state.willUse", "Will use it") : S("bigconsole.fleet.bindings.state.uses", "Uses it now") : e === "UNCHANGED" ? S("bigconsole.fleet.bindings.state.unchanged", "Already uses it") : S("bigconsole.fleet.bindings.state.incompatible", "Cannot take it"), Q = {
52
53
  color: "var(--color-text-secondary)",
53
54
  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, {
55
+ }, ke = Z?.copies.length ?? 0, $ = [...D.values()].filter((e) => e.isActive && e.id !== J);
56
+ return /* @__PURE__ */ h(ce, {
56
57
  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", {
58
+ onOpenChange: (e) => !e && !q && x(),
59
+ children: /* @__PURE__ */ g(le, { children: [
60
+ /* @__PURE__ */ g(fe, { children: [/* @__PURE__ */ h(pe, { children: S("bigconsole.fleet.bindings.title", "Copies' data sources") }), /* @__PURE__ */ h(ue, { children: S("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: me }) })] }),
61
+ w && /* @__PURE__ */ g("p", {
61
62
  className: "flex items-center gap-2",
62
- style: $,
63
+ style: Q,
63
64
  "data-testid": "fleet-bindings-loading",
64
65
  children: [/* @__PURE__ */ h(p, { style: {
65
66
  height: "var(--size-icon-sm)",
66
67
  width: "var(--size-icon-sm)"
67
- } }), C("bigconsole.fleet.bindings.loading", "Reading the data sources…")]
68
+ } }), S("bigconsole.fleet.bindings.loading", "Reading the data sources…")]
68
69
  }),
69
- !T && E && /* @__PURE__ */ g("div", {
70
+ !w && T && /* @__PURE__ */ g("div", {
70
71
  className: "flex flex-col gap-form-gap",
71
72
  role: "alert",
72
73
  "data-testid": "fleet-bindings-load-error",
@@ -75,64 +76,61 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
75
76
  margin: 0,
76
77
  color: "var(--color-status-error-text)"
77
78
  },
78
- children: C("bigconsole.fleet.bindings.loadError", "The data sources could not be read.")
79
+ children: S("bigconsole.fleet.bindings.loadError", "The data sources could not be read.")
79
80
  }), /* @__PURE__ */ h("div", { children: /* @__PURE__ */ h(s, {
80
81
  variant: "outline",
81
- onClick: () => void A(),
82
- children: C("bigconsole.fleet.bindings.retry", "Try again")
82
+ onClick: () => void k(),
83
+ children: S("bigconsole.fleet.bindings.retry", "Try again")
83
84
  }) })]
84
85
  }),
85
- !T && !E && Y === null && /* @__PURE__ */ h("p", {
86
+ !w && !T && J === null && /* @__PURE__ */ h("p", {
86
87
  style: {
87
- ...$,
88
+ ...Q,
88
89
  margin: 0
89
90
  },
90
91
  "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
+ children: S("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
  }),
93
- !T && !E && Y !== null && R === "edit" && /* @__PURE__ */ g("div", {
94
+ !w && !T && J !== null && L === "edit" && /* @__PURE__ */ g("div", {
94
95
  className: "flex flex-col gap-form-gap",
95
96
  children: [
96
97
  /* @__PURE__ */ g("div", {
97
98
  className: "flex flex-col gap-1",
98
99
  children: [/* @__PURE__ */ h("span", {
99
- style: $,
100
- children: C("bigconsole.fleet.bindings.master", "The master reads")
100
+ style: Q,
101
+ children: S("bigconsole.fleet.bindings.master", "The master reads")
101
102
  }), /* @__PURE__ */ g(c, {
102
- value: Y,
103
- onValueChange: N,
103
+ value: J,
104
+ onValueChange: M,
104
105
  children: [/* @__PURE__ */ h(d, {
105
- "aria-label": C("bigconsole.fleet.bindings.master", "The master reads"),
106
+ "aria-label": S("bigconsole.fleet.bindings.master", "The master reads"),
106
107
  children: /* @__PURE__ */ h(f, {})
107
- }), /* @__PURE__ */ h(l, { children: D.sinks.map((e) => /* @__PURE__ */ h(u, {
108
+ }), /* @__PURE__ */ h(l, { children: E.sinks.map((e) => /* @__PURE__ */ h(u, {
108
109
  value: e.id,
109
- children: C("bigconsole.fleet.bindings.masterSink", "{{name}} ({{count}} widgets)", {
110
- name: X(e.id),
111
- count: e.widgetCount
112
- })
110
+ children: n(S, e.widgetCount, "bigconsole.fleet.bindings.masterSink", "{{name}} ({{count}} widgets)", "{{name}} (1 widget)", { name: Y(e.id) })
113
111
  }, e.id)) })]
114
112
  })]
115
113
  }),
116
- D.otherSourceWidgets > 0 && /* @__PURE__ */ h("p", {
114
+ E.otherSourceWidgets > 0 && /* @__PURE__ */ h("p", {
117
115
  style: {
118
- ...$,
116
+ ...Q,
119
117
  margin: 0
120
118
  },
121
119
  "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 })
120
+ children: n(S, E.otherSourceWidgets, "bigconsole.fleet.bindings.other", "{{count}} widgets read through a parser or a saved query. Those are not changed here.", "1 widget reads through a parser or a saved query. It is not changed here.")
123
121
  }),
124
- ve && /* @__PURE__ */ h("p", {
122
+ be && /* @__PURE__ */ h("p", {
125
123
  style: {
126
- ...$,
124
+ ...Q,
127
125
  margin: 0
128
126
  },
129
- children: C("bigconsole.fleet.bindings.truncated", "There are more data sources than can be listed. Only the first ones are offered.")
127
+ children: S("bigconsole.fleet.bindings.truncated", "There are more data sources than can be listed. Only the first ones are offered.")
130
128
  }),
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")
129
+ b.length > 6 && /* @__PURE__ */ h(se, {
130
+ value: F,
131
+ onChange: (e) => I(e.target.value),
132
+ placeholder: S("bigconsole.fleet.bindings.search", "Search copies"),
133
+ "aria-label": S("bigconsole.fleet.bindings.search", "Search copies")
136
134
  }),
137
135
  /* @__PURE__ */ g("ul", {
138
136
  className: "flex flex-col gap-2",
@@ -144,11 +142,11 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
144
142
  maxHeight: "18rem",
145
143
  overflowY: "auto"
146
144
  },
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;
145
+ children: [X.length === 0 && /* @__PURE__ */ h("li", {
146
+ style: Q,
147
+ children: S("bigconsole.fleet.bindings.noCopies", "No copy matches.")
148
+ }), X.map((e) => {
149
+ let t = ie(N, O, e.id, J), n = N[J]?.[e.id] !== void 0;
152
150
  return /* @__PURE__ */ g("li", {
153
151
  className: "flex flex-wrap items-center justify-between gap-form-gap rounded-input border px-3 py-2",
154
152
  style: {
@@ -162,20 +160,20 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
162
160
  style: { minWidth: "min(100%, 14rem)" },
163
161
  children: /* @__PURE__ */ g(c, {
164
162
  value: t ?? _,
165
- onValueChange: (t) => Ce(e.id, t),
163
+ onValueChange: (t) => Te(e.id, t),
166
164
  children: [/* @__PURE__ */ h(d, {
167
- "aria-label": C("bigconsole.fleet.bindings.copyReads", "{{name}} reads", { name: e.name }),
165
+ "aria-label": S("bigconsole.fleet.bindings.copyReads", "{{name}} reads", { name: e.name }),
168
166
  children: /* @__PURE__ */ h(f, {})
169
167
  }), /* @__PURE__ */ g(l, { children: [
170
168
  /* @__PURE__ */ h(u, {
171
169
  value: _,
172
- children: C("bigconsole.fleet.bindings.mastersOwn", "The master's ({{name}})", { name: X(Y) })
170
+ children: S("bigconsole.fleet.bindings.mastersOwn", "The master's ({{name}})", { name: Y(J) })
173
171
  }),
174
- t !== null && !Oe.some((e) => e.id === t) && /* @__PURE__ */ h(u, {
172
+ t !== null && !$.some((e) => e.id === t) && /* @__PURE__ */ h(u, {
175
173
  value: t,
176
- children: X(t)
174
+ children: Y(t)
177
175
  }),
178
- Oe.map((e) => /* @__PURE__ */ h(u, {
176
+ $.map((e) => /* @__PURE__ */ h(u, {
179
177
  value: e.id,
180
178
  children: e.name
181
179
  }, e.id))
@@ -187,12 +185,12 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
187
185
  })
188
186
  ]
189
187
  }),
190
- (R === "preview" || R === "done") && B && /* @__PURE__ */ g("div", {
188
+ (L === "preview" || L === "done") && z && /* @__PURE__ */ g("div", {
191
189
  className: "flex flex-col gap-form-gap",
192
190
  "data-testid": "fleet-bindings-result",
193
191
  children: [/* @__PURE__ */ h("strong", {
194
192
  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 })
193
+ children: L === "preview" ? S("bigconsole.fleet.bindings.previewTitle", "Preview: nothing has been changed yet") : n(S, z.appliedCount, "bigconsole.fleet.bindings.doneTitle", "Data sources changed for {{count}} copies.", "Data sources changed for 1 copy.")
196
194
  }), /* @__PURE__ */ h("ul", {
197
195
  style: {
198
196
  margin: 0,
@@ -201,7 +199,7 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
201
199
  maxHeight: "18rem",
202
200
  overflowY: "auto"
203
201
  },
204
- children: B.copies.map((e) => /* @__PURE__ */ g("li", {
202
+ children: z.copies.map((e) => /* @__PURE__ */ g("li", {
205
203
  className: "flex flex-col gap-1 border-b py-2",
206
204
  style: { borderColor: "var(--color-border-subtle)" },
207
205
  children: [
@@ -210,23 +208,23 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
210
208
  children: [/* @__PURE__ */ h("span", {
211
209
  className: "min-w-0 truncate",
212
210
  style: { color: "var(--color-text-primary)" },
213
- children: Se(e.dashboardId, e.name)
211
+ children: we(e.dashboardId, e.name)
214
212
  }), /* @__PURE__ */ h("span", {
215
213
  style: {
216
214
  fontSize: "var(--font-size-body-sm)",
217
215
  color: e.state === "INCOMPATIBLE" ? "var(--color-status-error-text)" : e.state === "APPLIED" ? "var(--color-status-success-text)" : "var(--color-text-secondary)"
218
216
  },
219
- children: Ee(e.state, B.preview)
217
+ children: Oe(e.state, z.preview)
220
218
  })]
221
219
  }),
222
220
  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 })]
221
+ style: Q,
222
+ children: [z.preview ? n(S, e.widgetsRebound, "bigconsole.fleet.bindings.willRebind", "{{count}} widgets would read it.", "1 widget would read it.") : n(S, e.widgetsRebound, "bigconsole.fleet.bindings.rebound", "{{count}} widgets read it now.", "1 widget reads it now."), e.widgetsKeptLocal > 0 && " " + n(S, e.widgetsKeptLocal, "bigconsole.fleet.bindings.keptLocal", "{{count}} widgets the copy pointed elsewhere itself stay as they are.", "1 widget the copy pointed elsewhere itself stays as it is.")]
225
223
  }),
226
224
  e.state === "INCOMPATIBLE" && e.reason && /* @__PURE__ */ h("span", {
227
225
  role: "alert",
228
226
  style: {
229
- ...$,
227
+ ...Q,
230
228
  color: "var(--color-status-error-text)"
231
229
  },
232
230
  children: e.reason
@@ -235,50 +233,50 @@ var _ = "__master__", v = (e, t) => e instanceof Error && e.message ? e.message
235
233
  }, e.dashboardId))
236
234
  })]
237
235
  }),
238
- G && /* @__PURE__ */ h("p", {
236
+ W && /* @__PURE__ */ h("p", {
239
237
  role: "alert",
240
238
  "data-testid": "fleet-bindings-error",
241
239
  style: {
242
240
  margin: 0,
243
241
  color: "var(--color-status-error-text)"
244
242
  },
245
- children: G
243
+ children: W
246
244
  }),
247
- /* @__PURE__ */ g(ue, { children: [
248
- R === "edit" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
245
+ /* @__PURE__ */ g(de, { children: [
246
+ L === "edit" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
249
247
  variant: "ghost",
250
248
  onClick: x,
251
- disabled: J,
252
- children: C("bigconsole.fleet.link.cancel", "Cancel")
249
+ disabled: q,
250
+ children: S("bigconsole.fleet.link.cancel", "Cancel")
253
251
  }), /* @__PURE__ */ g(s, {
254
- onClick: () => void we(),
255
- disabled: J || !Q,
252
+ onClick: () => void Ee(),
253
+ disabled: q || !Z,
256
254
  "data-testid": "fleet-bindings-preview",
257
- children: [J && /* @__PURE__ */ h(p, { style: {
255
+ children: [q && /* @__PURE__ */ h(p, { style: {
258
256
  height: "var(--size-icon-sm)",
259
257
  width: "var(--size-icon-sm)"
260
- } }), C("bigconsole.fleet.bindings.preview", "Preview {{count}} copies", { count: De })]
258
+ } }), n(S, ke, "bigconsole.fleet.bindings.preview", "Preview {{count}} copies", "Preview 1 copy")]
261
259
  })] }),
262
- R === "preview" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
260
+ L === "preview" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
263
261
  variant: "ghost",
264
262
  onClick: () => {
265
- z("edit"), V(null), U(null), K(null);
263
+ R("edit"), B(null), H(null), G(null);
266
264
  },
267
- disabled: J,
268
- children: C("bigconsole.fleet.bindings.back", "Back")
265
+ disabled: q,
266
+ children: S("bigconsole.fleet.bindings.back", "Back")
269
267
  }), /* @__PURE__ */ g(s, {
270
- onClick: () => void Te(),
271
- disabled: J || !H || !B || B.appliedCount === 0,
268
+ onClick: () => void De(),
269
+ disabled: q || !V || !z || z.appliedCount === 0,
272
270
  "data-testid": "fleet-bindings-apply",
273
- children: [J && /* @__PURE__ */ h(p, { style: {
271
+ children: [q && /* @__PURE__ */ h(p, { style: {
274
272
  height: "var(--size-icon-sm)",
275
273
  width: "var(--size-icon-sm)"
276
- } }), C("bigconsole.fleet.bindings.apply", "Apply")]
274
+ } }), S("bigconsole.fleet.bindings.apply", "Apply")]
277
275
  })] }),
278
- R === "done" && /* @__PURE__ */ h(s, {
276
+ L === "done" && /* @__PURE__ */ h(s, {
279
277
  onClick: x,
280
- disabled: J,
281
- children: C("bigconsole.fleet.bindings.close", "Close")
278
+ disabled: q,
279
+ children: S("bigconsole.fleet.bindings.close", "Close")
282
280
  })
283
281
  ] })
284
282
  ] })
@@ -71,11 +71,11 @@ var b = (e, t) => e instanceof Error && e.message ? e.message : t, x = u(functio
71
71
  u,
72
72
  G,
73
73
  T
74
- ]), $ = (e, t) => t ? T("bigconsole.fleet.restore.done", "{{restored}} edited widgets went back to the master's version, {{back}} removed ones came back, {{kept}} of your own stayed.", {
74
+ ]), $ = (e, t) => t ? T("bigconsole.fleet.restore.done", "Edited widgets put back to the master's version: {{restored}}. Removed widgets brought back: {{back}}. Your own widgets kept: {{kept}}.", {
75
75
  restored: e.widgetsRestored,
76
76
  back: e.widgetsBroughtBack,
77
77
  kept: e.localWidgetsKept
78
- }) : T("bigconsole.fleet.restore.preview", "{{restored}} edited widgets would go back to the master's version, {{back}} removed ones would come back, {{kept}} of your own would stay.", {
78
+ }) : T("bigconsole.fleet.restore.preview", "Edited widgets that would go back to the master's version: {{restored}}. Removed widgets that would come back: {{back}}. Your own widgets that would stay: {{kept}}.", {
79
79
  restored: e.widgetsRestored,
80
80
  back: e.widgetsBroughtBack,
81
81
  kept: e.localWidgetsKept
@@ -1,82 +1,87 @@
1
- import { useBigConsole as e } from "../../context/BigConsoleContext.js";
2
- import { useTr as t } from "../../../shared/hooks/useTr.js";
1
+ import { useTr as e } from "../../../shared/hooks/useTr.js";
2
+ import { useBigConsole as t } from "../../context/BigConsoleContext.js";
3
3
  import "../../context/index.js";
4
4
  import { useFleetConfirm as n } from "../../hooks/useFleetConfirm.js";
5
5
  import { useFleetWidgetActions as r } from "../../hooks/useFleetWidgetActions.js";
6
6
  import { useOwnerBoundRun as i } from "../../hooks/useOwnerBoundRun.js";
7
- import { restoreNoticeText as a } from "../../utils/fleetNotices.js";
8
- import { createContext as o, useCallback as s, useContext as c, useLayoutEffect as l, useMemo as u, useRef as d } from "react";
9
- import { jsx as f } from "react/jsx-runtime";
10
- import { toast as p } from "sonner";
7
+ import { graphQLErrorDetails as a } from "../../utils/backendError.js";
8
+ import { restoreNoticeText as o } from "../../utils/fleetNotices.js";
9
+ import { createContext as s, useCallback as c, useContext as l, useLayoutEffect as u, useMemo as d, useRef as f } from "react";
10
+ import { jsx as p } from "react/jsx-runtime";
11
+ import { toast as m } from "sonner";
11
12
  // src/bigconsole/components/fleet/FleetWidgetActions.tsx
12
- var m = o(null);
13
- function h() {
14
- return c(m);
13
+ var h = s(null);
14
+ function g() {
15
+ return l(h);
15
16
  }
16
- var g = (e, t) => e instanceof Error && e.message ? e.message : t, _ = () => {}, v = ({ dashboardId: o, isActiveCopy: c, masterName: h, lock: v, onBoardChanged: y, onChanged: b, children: x }) => {
17
- let S = t(), { workspaceId: C, currentUser: w } = e(), T = `${C ?? ""}:${w?.id ?? ""}:${o}`, E = r(), D = n(), O = d(c);
18
- l(() => {
19
- O.current = c;
20
- }, [c]);
21
- let k = s(async () => {
22
- await y?.(), b?.();
23
- }, [y, b]), { acting: A, begin: j, run: M } = i(T, k, _, v), N = A || E.busy, P = s((e) => {
24
- for (let t of e) p.warning(a(S, t));
25
- }, [S]), F = s(async (e) => {
26
- if (N) return;
27
- let t = j();
28
- await D(S("bigconsole.fleet.widget.restoreTitle", "Restore to the master's version?"), S("bigconsole.fleet.widget.restoreConfirm", "\"{{title}}\" goes back to the master's version. Your changes to it are lost. Where it sits on the board is kept.", { title: e.title }), S("bigconsole.fleet.widget.restoreOk", "Restore")) && t() && O.current && await M(() => E.restoreWidget(e.id), (t) => {
29
- p.success(S("bigconsole.fleet.widget.restored", "\"{{title}}\" is back to the master's version.", { title: e.title })), P(t);
30
- }, (e) => p.error(g(e, S("bigconsole.fleet.error.widgetRestore", "The widget could not be restored."))));
17
+ var _ = (e, t) => e instanceof Error && e.message ? e.message : t, v = () => {}, y = ({ dashboardId: s, isActiveCopy: l, masterName: g, lock: y, onBoardChanged: b, onChanged: x, children: S }) => {
18
+ let C = e(), { workspaceId: w, currentUser: T } = t(), E = `${w ?? ""}:${T?.id ?? ""}:${s}`, D = r(), O = n(), k = f(l);
19
+ u(() => {
20
+ k.current = l;
21
+ }, [l]);
22
+ let A = c(async () => {
23
+ await b?.(), x?.();
24
+ }, [b, x]), { acting: j, begin: M, run: N } = i(E, A, v, y), P = j || D.busy, F = c((e) => {
25
+ for (let t of e) m.warning(o(C, t));
26
+ }, [C]), I = c((e, t) => {
27
+ a(e).length > 0 || m.error(_(e, t));
28
+ }, []), L = c(async (e) => {
29
+ if (P) return;
30
+ let t = M();
31
+ await O(C("bigconsole.fleet.widget.restoreTitle", "Restore to the master's version?"), C("bigconsole.fleet.widget.restoreConfirm", "\"{{title}}\" goes back to the master's version. Your changes to it are lost. Where it sits on the board is kept.", { title: e.title }), C("bigconsole.fleet.widget.restoreOk", "Restore")) && t() && k.current && await N(() => D.restoreWidget(e.id), (t) => {
32
+ m.success(C("bigconsole.fleet.widget.restored", "\"{{title}}\" is back to the master's version.", { title: e.title })), F(t);
33
+ }, (e) => I(e, C("bigconsole.fleet.error.widgetRestore", "The widget could not be restored.")));
31
34
  }, [
32
- E,
33
- j,
34
- N,
35
35
  D,
36
36
  M,
37
37
  P,
38
- S
39
- ]), I = s(async (e) => {
40
- if (N) return;
41
- let t = j(), n = h ? `"${h}"` : S("bigconsole.fleet.widget.theMaster", "the master");
42
- await D(S("bigconsole.fleet.widget.promoteTitle", "Promote to the master?"), S("bigconsole.fleet.widget.promoteConfirm", "\"{{title}}\" is added to {{master}}, and this board's widget follows it from now on. The master's other copies get it with the next push.", {
38
+ O,
39
+ N,
40
+ I,
41
+ F,
42
+ C
43
+ ]), R = c(async (e) => {
44
+ if (P) return;
45
+ let t = M(), n = g ? `"${g}"` : C("bigconsole.fleet.widget.theMaster", "the master");
46
+ await O(C("bigconsole.fleet.widget.promoteTitle", "Promote to the master?"), C("bigconsole.fleet.widget.promoteConfirm", "\"{{title}}\" is added to {{master}}, and this board's widget follows it from now on. The master's other copies get it with the next push.", {
43
47
  title: e.title,
44
48
  master: n
45
- }), S("bigconsole.fleet.widget.promoteOk", "Promote")) && t() && O.current && await M(() => E.promoteWidget(e.id), (t) => {
46
- p.success(S("bigconsole.fleet.widget.promoted", "\"{{title}}\" is now on {{master}}.", {
49
+ }), C("bigconsole.fleet.widget.promoteOk", "Promote")) && t() && k.current && await N(() => D.promoteWidget(e.id), (t) => {
50
+ m.success(C("bigconsole.fleet.widget.promoted", "\"{{title}}\" is now on {{master}}.", {
47
51
  title: e.title,
48
52
  master: n
49
- })), P(t);
50
- }, (e) => p.error(g(e, S("bigconsole.fleet.error.widgetPromote", "The widget could not be promoted."))));
53
+ })), F(t);
54
+ }, (e) => I(e, C("bigconsole.fleet.error.widgetPromote", "The widget could not be promoted.")));
51
55
  }, [
52
- E,
53
- j,
54
- N,
55
56
  D,
56
- h,
57
57
  M,
58
58
  P,
59
- S
60
- ]), L = S("bigconsole.fleet.widget.restore", "Restore to master's version"), R = S("bigconsole.fleet.widget.promote", "Promote to master"), z = u(() => ({
61
- isActiveCopy: c,
62
- busy: N,
59
+ O,
60
+ g,
61
+ N,
62
+ I,
63
+ F,
64
+ C
65
+ ]), z = C("bigconsole.fleet.widget.restore", "Restore to master's version"), B = C("bigconsole.fleet.widget.promote", "Promote to master"), V = d(() => ({
66
+ isActiveCopy: l,
67
+ busy: P,
63
68
  labels: {
64
- restore: L,
65
- promote: R
69
+ restore: z,
70
+ promote: B
66
71
  },
67
- restore: F,
68
- promote: I
72
+ restore: L,
73
+ promote: R
69
74
  }), [
70
- c,
71
- N,
75
+ l,
76
+ P,
77
+ z,
78
+ B,
72
79
  L,
73
- R,
74
- F,
75
- I
80
+ R
76
81
  ]);
77
- return /* @__PURE__ */ f(m.Provider, {
78
- value: z,
79
- children: x
82
+ return /* @__PURE__ */ p(h.Provider, {
83
+ value: V,
84
+ children: S
80
85
  });
81
86
  };
82
- export { v as FleetWidgetActionsProvider, h as useFleetWidgetMenu };
87
+ export { y as FleetWidgetActionsProvider, g as useFleetWidgetMenu };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A text that depends on a count (BOFF-15410): the singular form has its own key (the plural key with `One`
3
+ * added), so a translation can word each form on its own and "1 copies" is never shown.
4
+ */
5
+ type Translate = (key: string, defaultValue: string, vars?: Record<string, string | number>) => string;
6
+ export declare function trCount(tr: Translate, count: number, key: string, other: string, one: string, vars?: Record<string, string | number>): string;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ // src/bigconsole/utils/fleetPlural.ts
2
+ function e(e, t, n, r, i, a = {}) {
3
+ return t === 1 ? e(`${n}One`, i, {
4
+ ...a,
5
+ count: t
6
+ }) : e(n, r, {
7
+ ...a,
8
+ count: t
9
+ });
10
+ }
11
+ export { e as trCount };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-bigconsole",
3
- "version": "2026.1124.5",
3
+ "version": "2026.1124.6",
4
4
  "description": "BigConsole - AI-powered analytics and dashboard platform",
5
5
  "repository": {
6
6
  "type": "git",