@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.
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +113 -115
- package/dist/bigconsole/components/fleet/FleetCopySection.js +2 -2
- package/dist/bigconsole/components/fleet/FleetWidgetActions.js +62 -57
- package/dist/bigconsole/utils/fleetPlural.d.ts +7 -0
- package/dist/bigconsole/utils/fleetPlural.js +11 -0
- package/package.json +1 -1
|
@@ -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
|
|
5
|
-
import { useFleetBindings as
|
|
6
|
-
import { useOwnerBoundRun as
|
|
7
|
-
import { bindingsInput as
|
|
8
|
-
import { memo as r, useCallback as i, useMemo as a, useRef as
|
|
9
|
-
import { Button as s, Input as
|
|
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:
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
}, []),
|
|
16
|
-
|
|
17
|
-
}, [
|
|
18
|
-
let e =
|
|
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,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
}, [b, F]), Z = a(() => re(y, N, C), [
|
|
22
|
+
C,
|
|
23
|
+
N,
|
|
23
24
|
y
|
|
24
|
-
]),
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
if (
|
|
28
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
}, (e) =>
|
|
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
|
-
|
|
35
|
+
U.current = !1;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, (e) =>
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
]),
|
|
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
|
-
},
|
|
55
|
-
return /* @__PURE__ */ h(
|
|
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 && !
|
|
58
|
-
children: /* @__PURE__ */ g(
|
|
59
|
-
/* @__PURE__ */ g(
|
|
60
|
-
|
|
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
|
-
} }),
|
|
68
|
+
} }), S("bigconsole.fleet.bindings.loading", "Reading the data sources…")]
|
|
68
69
|
}),
|
|
69
|
-
!
|
|
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:
|
|
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
|
|
82
|
-
children:
|
|
82
|
+
onClick: () => void k(),
|
|
83
|
+
children: S("bigconsole.fleet.bindings.retry", "Try again")
|
|
83
84
|
}) })]
|
|
84
85
|
}),
|
|
85
|
-
!
|
|
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:
|
|
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
|
-
!
|
|
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:
|
|
100
|
+
style: Q,
|
|
101
|
+
children: S("bigconsole.fleet.bindings.master", "The master reads")
|
|
101
102
|
}), /* @__PURE__ */ g(c, {
|
|
102
|
-
value:
|
|
103
|
-
onValueChange:
|
|
103
|
+
value: J,
|
|
104
|
+
onValueChange: M,
|
|
104
105
|
children: [/* @__PURE__ */ h(d, {
|
|
105
|
-
"aria-label":
|
|
106
|
+
"aria-label": S("bigconsole.fleet.bindings.master", "The master reads"),
|
|
106
107
|
children: /* @__PURE__ */ h(f, {})
|
|
107
|
-
}), /* @__PURE__ */ h(l, { children:
|
|
108
|
+
}), /* @__PURE__ */ h(l, { children: E.sinks.map((e) => /* @__PURE__ */ h(u, {
|
|
108
109
|
value: e.id,
|
|
109
|
-
children:
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
122
|
+
be && /* @__PURE__ */ h("p", {
|
|
125
123
|
style: {
|
|
126
|
-
|
|
124
|
+
...Q,
|
|
127
125
|
margin: 0
|
|
128
126
|
},
|
|
129
|
-
children:
|
|
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(
|
|
132
|
-
value:
|
|
133
|
-
onChange: (e) =>
|
|
134
|
-
placeholder:
|
|
135
|
-
"aria-label":
|
|
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: [
|
|
148
|
-
style:
|
|
149
|
-
children:
|
|
150
|
-
}),
|
|
151
|
-
let t =
|
|
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) =>
|
|
163
|
+
onValueChange: (t) => Te(e.id, t),
|
|
166
164
|
children: [/* @__PURE__ */ h(d, {
|
|
167
|
-
"aria-label":
|
|
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:
|
|
170
|
+
children: S("bigconsole.fleet.bindings.mastersOwn", "The master's ({{name}})", { name: Y(J) })
|
|
173
171
|
}),
|
|
174
|
-
t !== null &&
|
|
172
|
+
t !== null && !$.some((e) => e.id === t) && /* @__PURE__ */ h(u, {
|
|
175
173
|
value: t,
|
|
176
|
-
children:
|
|
174
|
+
children: Y(t)
|
|
177
175
|
}),
|
|
178
|
-
|
|
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
|
-
(
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
217
|
+
children: Oe(e.state, z.preview)
|
|
220
218
|
})]
|
|
221
219
|
}),
|
|
222
220
|
e.state === "APPLIED" && /* @__PURE__ */ g("span", {
|
|
223
|
-
style:
|
|
224
|
-
children: [
|
|
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
|
-
|
|
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:
|
|
243
|
+
children: W
|
|
246
244
|
}),
|
|
247
|
-
/* @__PURE__ */ g(
|
|
248
|
-
|
|
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:
|
|
252
|
-
children:
|
|
249
|
+
disabled: q,
|
|
250
|
+
children: S("bigconsole.fleet.link.cancel", "Cancel")
|
|
253
251
|
}), /* @__PURE__ */ g(s, {
|
|
254
|
-
onClick: () => void
|
|
255
|
-
disabled:
|
|
252
|
+
onClick: () => void Ee(),
|
|
253
|
+
disabled: q || !Z,
|
|
256
254
|
"data-testid": "fleet-bindings-preview",
|
|
257
|
-
children: [
|
|
255
|
+
children: [q && /* @__PURE__ */ h(p, { style: {
|
|
258
256
|
height: "var(--size-icon-sm)",
|
|
259
257
|
width: "var(--size-icon-sm)"
|
|
260
|
-
} }),
|
|
258
|
+
} }), n(S, ke, "bigconsole.fleet.bindings.preview", "Preview {{count}} copies", "Preview 1 copy")]
|
|
261
259
|
})] }),
|
|
262
|
-
|
|
260
|
+
L === "preview" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(s, {
|
|
263
261
|
variant: "ghost",
|
|
264
262
|
onClick: () => {
|
|
265
|
-
|
|
263
|
+
R("edit"), B(null), H(null), G(null);
|
|
266
264
|
},
|
|
267
|
-
disabled:
|
|
268
|
-
children:
|
|
265
|
+
disabled: q,
|
|
266
|
+
children: S("bigconsole.fleet.bindings.back", "Back")
|
|
269
267
|
}), /* @__PURE__ */ g(s, {
|
|
270
|
-
onClick: () => void
|
|
271
|
-
disabled:
|
|
268
|
+
onClick: () => void De(),
|
|
269
|
+
disabled: q || !V || !z || z.appliedCount === 0,
|
|
272
270
|
"data-testid": "fleet-bindings-apply",
|
|
273
|
-
children: [
|
|
271
|
+
children: [q && /* @__PURE__ */ h(p, { style: {
|
|
274
272
|
height: "var(--size-icon-sm)",
|
|
275
273
|
width: "var(--size-icon-sm)"
|
|
276
|
-
} }),
|
|
274
|
+
} }), S("bigconsole.fleet.bindings.apply", "Apply")]
|
|
277
275
|
})] }),
|
|
278
|
-
|
|
276
|
+
L === "done" && /* @__PURE__ */ h(s, {
|
|
279
277
|
onClick: x,
|
|
280
|
-
disabled:
|
|
281
|
-
children:
|
|
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", "
|
|
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", "
|
|
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 {
|
|
2
|
-
import {
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
var h = s(null);
|
|
14
|
+
function g() {
|
|
15
|
+
return l(h);
|
|
15
16
|
}
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}, [
|
|
21
|
-
let
|
|
22
|
-
await
|
|
23
|
-
}, [
|
|
24
|
-
for (let t of e)
|
|
25
|
-
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
}),
|
|
46
|
-
|
|
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
|
-
})),
|
|
50
|
-
}, (e) =>
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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:
|
|
65
|
-
promote:
|
|
69
|
+
restore: z,
|
|
70
|
+
promote: B
|
|
66
71
|
},
|
|
67
|
-
restore:
|
|
68
|
-
promote:
|
|
72
|
+
restore: L,
|
|
73
|
+
promote: R
|
|
69
74
|
}), [
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
l,
|
|
76
|
+
P,
|
|
77
|
+
z,
|
|
78
|
+
B,
|
|
72
79
|
L,
|
|
73
|
-
R
|
|
74
|
-
F,
|
|
75
|
-
I
|
|
80
|
+
R
|
|
76
81
|
]);
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
value:
|
|
79
|
-
children:
|
|
82
|
+
return /* @__PURE__ */ p(h.Provider, {
|
|
83
|
+
value: V,
|
|
84
|
+
children: S
|
|
80
85
|
});
|
|
81
86
|
};
|
|
82
|
-
export {
|
|
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 {};
|