@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.
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.d.ts +19 -0
- package/dist/bigconsole/components/fleet/FleetBindingsDialog.js +287 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.d.ts +8 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +185 -156
- package/dist/bigconsole/components/fleet/FleetCopySection.d.ts +5 -0
- package/dist/bigconsole/components/fleet/FleetCopySection.js +115 -118
- package/dist/bigconsole/components/fleet/FleetWidgetActions.d.ts +36 -0
- package/dist/bigconsole/components/fleet/FleetWidgetActions.js +82 -0
- package/dist/bigconsole/components/widgets/WidgetMenu.js +146 -96
- package/dist/bigconsole/hooks/useFleetBindingActions.d.ts +23 -0
- package/dist/bigconsole/hooks/useFleetBindingActions.js +50 -0
- package/dist/bigconsole/hooks/useFleetBindings.d.ts +19 -0
- package/dist/bigconsole/hooks/useFleetBindings.js +140 -0
- package/dist/bigconsole/hooks/useFleetConfirm.d.ts +7 -0
- package/dist/bigconsole/hooks/useFleetConfirm.js +17 -0
- package/dist/bigconsole/hooks/useFleetWidgetActions.d.ts +10 -0
- package/dist/bigconsole/hooks/useFleetWidgetActions.js +41 -0
- package/dist/bigconsole/hooks/useOwnerBoundRun.d.ts +13 -18
- package/dist/bigconsole/hooks/useOwnerBoundRun.js +45 -30
- package/dist/bigconsole/hooks/useWidgetOperations.js +2 -0
- package/dist/bigconsole/pages/DashboardViewPage.js +303 -291
- package/dist/bigconsole/types/index.d.ts +4 -0
- package/dist/bigconsole/utils/fleetBindings.d.ts +49 -0
- package/dist/bigconsole/utils/fleetBindings.js +52 -0
- package/dist/bigconsole/utils/fleetNotices.d.ts +12 -0
- package/dist/bigconsole/utils/fleetNotices.js +5 -0
- package/dist/bigconsole/utils/fleetWidgetMenu.d.ts +20 -0
- package/dist/bigconsole/utils/fleetWidgetMenu.js +13 -0
- package/dist/generated/wspace-operations.d.ts +163 -0
- package/dist/generated/wspace-operations.js +935 -122
- package/dist/generated/wspace-types.d.ts +395 -9
- package/dist/generated/wspace-types.js +12 -10
- package/package.json +1 -1
|
@@ -1,111 +1,108 @@
|
|
|
1
1
|
import { useBigConsole as e } from "../../context/BigConsoleContext.js";
|
|
2
2
|
import { BIGCONSOLE_PERMISSIONS as t } from "../../../constants/permissions.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useTr as r } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { useTr as n } from "../../../shared/hooks/useTr.js";
|
|
5
4
|
import "../../context/index.js";
|
|
5
|
+
import { useFleetConfirm as r } from "../../hooks/useFleetConfirm.js";
|
|
6
6
|
import { useFleetCopyActions as i } from "../../hooks/useFleetCopyActions.js";
|
|
7
|
-
import { useFleetFlags as
|
|
8
|
-
import { useOwnerBoundRun as
|
|
9
|
-
import { allowedAnswers as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { useFleetFlags as ee } from "../../hooks/useFleetFlags.js";
|
|
8
|
+
import { useOwnerBoundRun as a } from "../../hooks/useOwnerBoundRun.js";
|
|
9
|
+
import { allowedAnswers as o, changedFieldLabel as s, restoreIsEmpty as c } from "../../utils/fleetFlags.js";
|
|
10
|
+
import { restoreNoticeText as l } from "../../utils/fleetNotices.js";
|
|
11
|
+
import { memo as u, useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
|
|
12
|
+
import { PermissionButton as h } from "@burdenoff/fe-libs/shared/components";
|
|
13
|
+
import { Button as g, Spinner as _ } from "@burdenoff/fe-libs/ui";
|
|
14
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
14
15
|
// src/bigconsole/components/fleet/FleetCopySection.tsx
|
|
15
|
-
var
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
return i === null ? window.confirm(t) : i;
|
|
28
|
-
}, [S]), W = (e) => S("bigconsole.fleet.copy.noticeDrilldown", "A widget's drilldown led to the page \"{{page}}\", which this board does not have, so it now opens the default page.", { page: e.pageName }), G = (e, t) => e === "ACCEPTED_MASTER" ? S("bigconsole.fleet.flags.accept", "Take the master's version") : e === "REMOVED" ? S("bigconsole.fleet.flags.remove", "Remove it") : t === "MASTER_REMOVED" ? S("bigconsole.fleet.flags.keepRemoved", "Keep it") : S("bigconsole.fleet.flags.keep", "Keep mine"), K = d(async (e, t) => {
|
|
29
|
-
let n = B();
|
|
16
|
+
var b = (e, t) => e instanceof Error && e.message ? e.message : t, x = u(function({ dashboardId: u, masterName: x, onBoardChanged: S, lock: C, changeToken: w }) {
|
|
17
|
+
let T = n(), { workspaceId: E, currentUser: D } = e(), O = `${E ?? ""}:${D?.id ?? ""}:${u}`, { loading: k, error: A, flags: j, refetch: M } = ee(u, !0), N = i(), P = p(w);
|
|
18
|
+
f(() => {
|
|
19
|
+
w !== P.current && (P.current = w, I((e) => e.phase === "preview" ? { phase: "idle" } : e), M());
|
|
20
|
+
}, [w, M]);
|
|
21
|
+
let [F, I] = m({ phase: "idle" }), [L, R] = m(null), [z, B] = m([]), V = d(() => {
|
|
22
|
+
I({ phase: "idle" }), R(null), B([]);
|
|
23
|
+
}, []), H = d(async () => {
|
|
24
|
+
await M(), await S?.();
|
|
25
|
+
}, [S, M]), { acting: U, begin: W, run: G } = a(O, H, V, C), K = N.busy || U, q = r(), J = (e) => l(T, e), Y = (e, t) => e === "ACCEPTED_MASTER" ? T("bigconsole.fleet.flags.accept", "Take the master's version") : e === "REMOVED" ? T("bigconsole.fleet.flags.remove", "Remove it") : t === "MASTER_REMOVED" ? T("bigconsole.fleet.flags.keepRemoved", "Keep it") : T("bigconsole.fleet.flags.keep", "Keep mine"), X = d(async (e, t) => {
|
|
26
|
+
let n = W();
|
|
30
27
|
if (t === "ACCEPTED_MASTER") {
|
|
31
|
-
if (!await
|
|
32
|
-
} else if (t === "REMOVED" && (!await
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if (!await q(T("bigconsole.fleet.flags.acceptTitle", "Take the master's version?"), T("bigconsole.fleet.flags.acceptConfirm", "\"{{title}}\" goes back to the master's version. Your changes to it are lost.", { title: e.widgetTitle }), T("bigconsole.fleet.flags.acceptOk", "Take it")) || !n()) return;
|
|
29
|
+
} else if (t === "REMOVED" && (!await q(T("bigconsole.fleet.flags.removeTitle", "Remove this widget?"), T("bigconsole.fleet.flags.removeConfirm", "\"{{title}}\" is removed from this board. A push does not give it back.", { title: e.widgetTitle }), T("bigconsole.fleet.flags.removeOk", "Remove")) || !n())) return;
|
|
30
|
+
R(null), B([]), await G(() => N.resolveFlag(e.id, t), (n) => {
|
|
31
|
+
I({ phase: "idle" }), B(n), R({
|
|
35
32
|
tone: "ok",
|
|
36
|
-
text: t === "ACCEPTED_MASTER" ?
|
|
33
|
+
text: t === "ACCEPTED_MASTER" ? T("bigconsole.fleet.flags.accepted", "\"{{title}}\" is back to the master's version.", { title: e.widgetTitle }) : t === "REMOVED" ? T("bigconsole.fleet.flags.removed", "\"{{title}}\" was removed.", { title: e.widgetTitle }) : T("bigconsole.fleet.flags.kept", "\"{{title}}\" is now your own. The master will not flag it again.", { title: e.widgetTitle })
|
|
37
34
|
});
|
|
38
|
-
}, (e) =>
|
|
35
|
+
}, (e) => R({
|
|
39
36
|
tone: "error",
|
|
40
|
-
text:
|
|
37
|
+
text: b(e, T("bigconsole.fleet.error.flag", "The flag could not be answered."))
|
|
41
38
|
}));
|
|
42
39
|
}, [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
]),
|
|
40
|
+
N,
|
|
41
|
+
W,
|
|
42
|
+
q,
|
|
43
|
+
G,
|
|
44
|
+
T
|
|
45
|
+
]), Z = d(() => (R(null), B([]), G(() => N.previewRestore(u), (e) => I({
|
|
49
46
|
phase: "preview",
|
|
50
47
|
counts: e
|
|
51
|
-
}), (e) =>
|
|
48
|
+
}), (e) => R({
|
|
52
49
|
tone: "error",
|
|
53
|
-
text:
|
|
50
|
+
text: b(e, T("bigconsole.fleet.error.restorePreview", "The preview could not be made."))
|
|
54
51
|
}))), [
|
|
55
|
-
|
|
52
|
+
N,
|
|
56
53
|
u,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
]),
|
|
60
|
-
let e =
|
|
61
|
-
await
|
|
62
|
-
|
|
54
|
+
G,
|
|
55
|
+
T
|
|
56
|
+
]), Q = d(async () => {
|
|
57
|
+
let e = W();
|
|
58
|
+
await q(T("bigconsole.fleet.restore.title", "Restore this board to its original?"), T("bigconsole.fleet.restore.confirm", "Edited widgets go back to the master's version and removed ones come back. Your own widgets stay."), T("bigconsole.fleet.restore.ok", "Restore")) && e() && (R(null), await G(() => N.restore(u), (e) => {
|
|
59
|
+
I({
|
|
63
60
|
phase: "done",
|
|
64
61
|
counts: e
|
|
65
|
-
}),
|
|
66
|
-
}, (e) =>
|
|
62
|
+
}), B(e.notices);
|
|
63
|
+
}, (e) => R({
|
|
67
64
|
tone: "error",
|
|
68
|
-
text:
|
|
65
|
+
text: b(e, T("bigconsole.fleet.error.restore", "The board could not be restored."))
|
|
69
66
|
})));
|
|
70
67
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
N,
|
|
69
|
+
W,
|
|
70
|
+
q,
|
|
74
71
|
u,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
]),
|
|
72
|
+
G,
|
|
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.", {
|
|
78
75
|
restored: e.widgetsRestored,
|
|
79
76
|
back: e.widgetsBroughtBack,
|
|
80
77
|
kept: e.localWidgetsKept
|
|
81
|
-
}) :
|
|
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.", {
|
|
82
79
|
restored: e.widgetsRestored,
|
|
83
80
|
back: e.widgetsBroughtBack,
|
|
84
81
|
kept: e.localWidgetsKept
|
|
85
82
|
});
|
|
86
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ y("div", {
|
|
87
84
|
className: "flex flex-col gap-form-gap",
|
|
88
85
|
"data-testid": "fleet-copy-section",
|
|
89
86
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ v("p", {
|
|
91
88
|
style: {
|
|
92
89
|
margin: 0,
|
|
93
90
|
color: "var(--color-text-secondary)",
|
|
94
91
|
fontSize: "var(--font-size-body-sm)"
|
|
95
92
|
},
|
|
96
|
-
children:
|
|
93
|
+
children: x ? T("bigconsole.fleet.copy.follows", "This board is a linked copy of \"{{name}}\".", { name: x }) : T("bigconsole.fleet.copy.followsUnknown", "This board is a linked copy of another board.")
|
|
97
94
|
}),
|
|
98
|
-
|
|
99
|
-
role:
|
|
95
|
+
L && /* @__PURE__ */ v("p", {
|
|
96
|
+
role: L.tone === "error" ? "alert" : "status",
|
|
100
97
|
"data-testid": "fleet-copy-message",
|
|
101
98
|
style: {
|
|
102
99
|
margin: 0,
|
|
103
|
-
color:
|
|
100
|
+
color: L.tone === "error" ? "var(--color-status-error-text)" : "var(--color-text-primary)",
|
|
104
101
|
fontSize: "var(--font-size-body-sm)"
|
|
105
102
|
},
|
|
106
|
-
children:
|
|
103
|
+
children: L.text
|
|
107
104
|
}),
|
|
108
|
-
|
|
105
|
+
z.length > 0 && /* @__PURE__ */ v("ul", {
|
|
109
106
|
"data-testid": "fleet-copy-notices",
|
|
110
107
|
style: {
|
|
111
108
|
margin: 0,
|
|
@@ -113,154 +110,154 @@ var v = (e, t) => e instanceof Error && e.message ? e.message : t, y = u(functio
|
|
|
113
110
|
color: "var(--color-text-secondary)",
|
|
114
111
|
fontSize: "var(--font-size-body-sm)"
|
|
115
112
|
},
|
|
116
|
-
children:
|
|
113
|
+
children: z.map((e, t) => /* @__PURE__ */ v("li", { children: J(e) }, `${e.widgetId}-${t}`))
|
|
117
114
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ v("strong", {
|
|
119
116
|
style: { color: "var(--color-text-primary)" },
|
|
120
|
-
children:
|
|
117
|
+
children: T("bigconsole.fleet.flags.title", "Waiting for your answer")
|
|
121
118
|
}),
|
|
122
|
-
|
|
119
|
+
k && j.length === 0 && /* @__PURE__ */ y("div", {
|
|
123
120
|
className: "flex items-center gap-2",
|
|
124
121
|
style: { color: "var(--color-text-secondary)" },
|
|
125
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ v(_, { style: {
|
|
126
123
|
height: "var(--size-icon-sm)",
|
|
127
124
|
width: "var(--size-icon-sm)"
|
|
128
|
-
} }),
|
|
125
|
+
} }), T("bigconsole.fleet.flags.loading", "Loading…")]
|
|
129
126
|
}),
|
|
130
|
-
!
|
|
127
|
+
!k && A && /* @__PURE__ */ v("p", {
|
|
131
128
|
role: "alert",
|
|
132
129
|
style: {
|
|
133
130
|
margin: 0,
|
|
134
131
|
color: "var(--color-status-error-text)"
|
|
135
132
|
},
|
|
136
|
-
children:
|
|
133
|
+
children: T("bigconsole.fleet.flags.loadError", "The flags on this board could not be loaded.")
|
|
137
134
|
}),
|
|
138
|
-
!
|
|
135
|
+
!k && !A && j.length === 0 && /* @__PURE__ */ v("p", {
|
|
139
136
|
"data-testid": "fleet-flags-none",
|
|
140
137
|
style: {
|
|
141
138
|
margin: 0,
|
|
142
139
|
color: "var(--color-text-secondary)",
|
|
143
140
|
fontSize: "var(--font-size-body-sm)"
|
|
144
141
|
},
|
|
145
|
-
children:
|
|
142
|
+
children: T("bigconsole.fleet.flags.none", "Nothing. The master has no change waiting for you.")
|
|
146
143
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
144
|
+
/* @__PURE__ */ v("ul", {
|
|
148
145
|
className: "flex flex-col gap-1",
|
|
149
146
|
style: {
|
|
150
147
|
listStyle: "none",
|
|
151
148
|
margin: 0,
|
|
152
149
|
padding: 0
|
|
153
150
|
},
|
|
154
|
-
children:
|
|
151
|
+
children: j.map((e) => /* @__PURE__ */ y("li", {
|
|
155
152
|
"data-testid": "fleet-flag",
|
|
156
153
|
className: "flex flex-col gap-2 rounded-input border px-3 py-2",
|
|
157
154
|
style: { borderColor: "var(--color-border-subtle)" },
|
|
158
155
|
children: [
|
|
159
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ v("span", {
|
|
160
157
|
style: { color: "var(--color-text-primary)" },
|
|
161
158
|
children: e.widgetTitle
|
|
162
159
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ v("span", {
|
|
164
161
|
style: {
|
|
165
162
|
color: "var(--color-text-secondary)",
|
|
166
163
|
fontSize: "var(--font-size-body-sm)"
|
|
167
164
|
},
|
|
168
|
-
children: e.type === "MASTER_REMOVED" ?
|
|
169
|
-
let t =
|
|
170
|
-
return t ?
|
|
165
|
+
children: e.type === "MASTER_REMOVED" ? T("bigconsole.fleet.flags.removedByMaster", "The master removed this widget. It stays on your board until you answer.") : T("bigconsole.fleet.flags.changedByMaster", "The master changed this widget and you edited it too. Your version stays until you answer. Changed: {{fields}}.", { fields: e.changedFields.map((e) => {
|
|
166
|
+
let t = s(e);
|
|
167
|
+
return t ? T(t.key, t.fallback) : e;
|
|
171
168
|
}).join(", ") })
|
|
172
169
|
}),
|
|
173
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ v(h, {
|
|
174
171
|
permission: t.DASHBOARD_UPDATE,
|
|
175
172
|
deniedBehavior: "hide",
|
|
176
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ v("span", {
|
|
177
174
|
className: "flex flex-wrap gap-2",
|
|
178
|
-
children:
|
|
175
|
+
children: o(e.type).map((t) => /* @__PURE__ */ v(g, {
|
|
179
176
|
size: "sm",
|
|
180
177
|
variant: t === "REMOVED" ? "ghost" : "outline",
|
|
181
|
-
disabled:
|
|
182
|
-
onClick: () => void
|
|
178
|
+
disabled: K,
|
|
179
|
+
onClick: () => void X(e, t),
|
|
183
180
|
"data-testid": `fleet-flag-${t}`,
|
|
184
|
-
children:
|
|
181
|
+
children: Y(t, e.type)
|
|
185
182
|
}, t))
|
|
186
183
|
})
|
|
187
184
|
})
|
|
188
185
|
]
|
|
189
186
|
}, e.id))
|
|
190
187
|
}),
|
|
191
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ v("strong", {
|
|
192
189
|
style: { color: "var(--color-text-primary)" },
|
|
193
|
-
children:
|
|
190
|
+
children: T("bigconsole.fleet.restore.heading", "Back to the original")
|
|
194
191
|
}),
|
|
195
|
-
|
|
192
|
+
F.phase === "idle" && /* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(h, {
|
|
196
193
|
permission: t.DASHBOARD_UPDATE,
|
|
197
194
|
deniedBehavior: "hide",
|
|
198
|
-
children: /* @__PURE__ */ g
|
|
195
|
+
children: /* @__PURE__ */ v(g, {
|
|
199
196
|
variant: "outline",
|
|
200
|
-
onClick:
|
|
201
|
-
disabled:
|
|
197
|
+
onClick: Z,
|
|
198
|
+
disabled: K,
|
|
202
199
|
"data-testid": "fleet-restore",
|
|
203
|
-
children:
|
|
200
|
+
children: T("bigconsole.fleet.restore.start", "Restore board to original…")
|
|
204
201
|
})
|
|
205
202
|
}) }),
|
|
206
|
-
|
|
203
|
+
F.phase === "preview" && /* @__PURE__ */ y("div", {
|
|
207
204
|
className: "flex flex-col gap-form-gap rounded-input border p-3",
|
|
208
205
|
style: { borderColor: "var(--color-border-subtle)" },
|
|
209
206
|
"data-testid": "fleet-restore-preview",
|
|
210
207
|
children: [
|
|
211
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ v("span", {
|
|
212
209
|
style: { color: "var(--color-text-primary)" },
|
|
213
|
-
children:
|
|
210
|
+
children: T("bigconsole.fleet.restore.previewTitle", "Preview: nothing has been changed yet")
|
|
214
211
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ v("span", {
|
|
216
213
|
"data-testid": "fleet-restore-counts",
|
|
217
214
|
style: {
|
|
218
215
|
color: "var(--color-text-secondary)",
|
|
219
216
|
fontSize: "var(--font-size-body-sm)"
|
|
220
217
|
},
|
|
221
|
-
children:
|
|
218
|
+
children: $(F.counts, !1)
|
|
222
219
|
}),
|
|
223
|
-
|
|
220
|
+
c(F.counts) && /* @__PURE__ */ v("span", {
|
|
224
221
|
style: {
|
|
225
222
|
color: "var(--color-text-secondary)",
|
|
226
223
|
fontSize: "var(--font-size-body-sm)"
|
|
227
224
|
},
|
|
228
|
-
children:
|
|
225
|
+
children: T("bigconsole.fleet.restore.nothing", "Nothing to restore: this board already matches its master.")
|
|
229
226
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ y("div", {
|
|
231
228
|
className: "flex gap-2",
|
|
232
|
-
children: [/* @__PURE__ */
|
|
233
|
-
onClick: () => void
|
|
234
|
-
disabled:
|
|
229
|
+
children: [/* @__PURE__ */ y(g, {
|
|
230
|
+
onClick: () => void Q(),
|
|
231
|
+
disabled: K || c(F.counts),
|
|
235
232
|
"data-testid": "fleet-restore-confirm",
|
|
236
|
-
children: [
|
|
233
|
+
children: [K && /* @__PURE__ */ v(_, { style: {
|
|
237
234
|
height: "var(--size-icon-sm)",
|
|
238
235
|
width: "var(--size-icon-sm)"
|
|
239
|
-
} }),
|
|
240
|
-
}), /* @__PURE__ */ g
|
|
236
|
+
} }), T("bigconsole.fleet.restore.ok", "Restore")]
|
|
237
|
+
}), /* @__PURE__ */ v(g, {
|
|
241
238
|
variant: "outline",
|
|
242
|
-
onClick: () =>
|
|
243
|
-
disabled:
|
|
244
|
-
children:
|
|
239
|
+
onClick: () => I({ phase: "idle" }),
|
|
240
|
+
disabled: K,
|
|
241
|
+
children: T("bigconsole.fleet.link.cancel", "Cancel")
|
|
245
242
|
})]
|
|
246
243
|
})
|
|
247
244
|
]
|
|
248
245
|
}),
|
|
249
|
-
|
|
246
|
+
F.phase === "done" && /* @__PURE__ */ y("div", {
|
|
250
247
|
className: "flex flex-col gap-form-gap rounded-input border p-3",
|
|
251
248
|
style: { borderColor: "var(--color-border-subtle)" },
|
|
252
249
|
"data-testid": "fleet-restore-done",
|
|
253
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ v("span", {
|
|
254
251
|
"data-testid": "fleet-restore-result",
|
|
255
252
|
style: { color: "var(--color-text-primary)" },
|
|
256
|
-
children:
|
|
257
|
-
}), /* @__PURE__ */
|
|
253
|
+
children: $(F.counts, !0)
|
|
254
|
+
}), /* @__PURE__ */ v("div", { children: /* @__PURE__ */ v(g, {
|
|
258
255
|
variant: "outline",
|
|
259
|
-
onClick: () =>
|
|
260
|
-
children:
|
|
256
|
+
onClick: () => I({ phase: "idle" }),
|
|
257
|
+
children: T("bigconsole.fleet.push.done", "Done")
|
|
261
258
|
}) })]
|
|
262
259
|
})
|
|
263
260
|
]
|
|
264
261
|
});
|
|
265
262
|
});
|
|
266
|
-
export {
|
|
263
|
+
export { x as FleetCopySection, x as default };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { ActionLock } from '../../hooks/useOwnerBoundRun';
|
|
3
|
+
/** What the widget menu needs to know about a widget. */
|
|
4
|
+
export interface FleetMenuWidget {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FleetWidgetMenuValue {
|
|
9
|
+
/** The board follows a master (an active link) whose board the caller can read. */
|
|
10
|
+
isActiveCopy: boolean;
|
|
11
|
+
/** An action is running: the menu items are held until it is done. */
|
|
12
|
+
busy: boolean;
|
|
13
|
+
/** The words of the two menu items, so the menu itself needs no translation provider. */
|
|
14
|
+
labels: {
|
|
15
|
+
restore: string;
|
|
16
|
+
promote: string;
|
|
17
|
+
};
|
|
18
|
+
restore: (widget: FleetMenuWidget) => Promise<void>;
|
|
19
|
+
promote: (widget: FleetMenuWidget) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/** The fleet actions of the widget menu, or null where the board offers none. */
|
|
22
|
+
export declare function useFleetWidgetMenu(): FleetWidgetMenuValue | null;
|
|
23
|
+
export interface FleetWidgetActionsProviderProps {
|
|
24
|
+
dashboardId: string;
|
|
25
|
+
isActiveCopy: boolean;
|
|
26
|
+
/** The board this one follows, when its name can be read. */
|
|
27
|
+
masterName: string | null;
|
|
28
|
+
/** Shared with the Children panel, so an action in one holds the buttons of the other. */
|
|
29
|
+
lock: ActionLock;
|
|
30
|
+
/** Reads the board's widgets again after an action. Awaited. */
|
|
31
|
+
onBoardChanged?: () => Promise<unknown> | void;
|
|
32
|
+
/** Called after an action changed this board, for the Children panel to read its flags again. */
|
|
33
|
+
onChanged?: () => void;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare const FleetWidgetActionsProvider: FC<FleetWidgetActionsProviderProps>;
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { useFleetConfirm as n } from "../../hooks/useFleetConfirm.js";
|
|
5
|
+
import { useFleetWidgetActions as r } from "../../hooks/useFleetWidgetActions.js";
|
|
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";
|
|
11
|
+
// src/bigconsole/components/fleet/FleetWidgetActions.tsx
|
|
12
|
+
var m = o(null);
|
|
13
|
+
function h() {
|
|
14
|
+
return c(m);
|
|
15
|
+
}
|
|
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."))));
|
|
31
|
+
}, [
|
|
32
|
+
E,
|
|
33
|
+
j,
|
|
34
|
+
N,
|
|
35
|
+
D,
|
|
36
|
+
M,
|
|
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.", {
|
|
43
|
+
title: e.title,
|
|
44
|
+
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}}.", {
|
|
47
|
+
title: e.title,
|
|
48
|
+
master: n
|
|
49
|
+
})), P(t);
|
|
50
|
+
}, (e) => p.error(g(e, S("bigconsole.fleet.error.widgetPromote", "The widget could not be promoted."))));
|
|
51
|
+
}, [
|
|
52
|
+
E,
|
|
53
|
+
j,
|
|
54
|
+
N,
|
|
55
|
+
D,
|
|
56
|
+
h,
|
|
57
|
+
M,
|
|
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,
|
|
63
|
+
labels: {
|
|
64
|
+
restore: L,
|
|
65
|
+
promote: R
|
|
66
|
+
},
|
|
67
|
+
restore: F,
|
|
68
|
+
promote: I
|
|
69
|
+
}), [
|
|
70
|
+
c,
|
|
71
|
+
N,
|
|
72
|
+
L,
|
|
73
|
+
R,
|
|
74
|
+
F,
|
|
75
|
+
I
|
|
76
|
+
]);
|
|
77
|
+
return /* @__PURE__ */ f(m.Provider, {
|
|
78
|
+
value: z,
|
|
79
|
+
children: x
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
export { v as FleetWidgetActionsProvider, h as useFleetWidgetMenu };
|