@burdenoff/microfe-bigconsole 2026.1124.2 → 2026.1124.3
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/FleetChildrenPanel.d.ts +8 -0
- package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +127 -122
- 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/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/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 +54 -0
- package/dist/generated/wspace-operations.js +405 -95
- package/dist/generated/wspace-types.d.ts +395 -9
- package/package.json +1 -1
|
@@ -4,53 +4,61 @@ import t from "../../hooks/useWidgetOperations.js";
|
|
|
4
4
|
import "../../hooks/index.js";
|
|
5
5
|
import { useAsOf as n } from "../../asof/AsOfProvider.js";
|
|
6
6
|
import "../../asof/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { useFleetWidgetMenu as r } from "../fleet/FleetWidgetActions.js";
|
|
8
|
+
import { fleetMenuOffers as i } from "../../utils/fleetWidgetMenu.js";
|
|
9
|
+
import { BIGCONSOLE_PERMISSIONS as a } from "../../../constants/permissions.js";
|
|
10
|
+
import { memo as o, useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
11
|
+
import { usePermissions as d } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
12
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
13
|
+
import { createPortal as h } from "react-dom";
|
|
12
14
|
// src/bigconsole/components/widgets/WidgetMenu.tsx
|
|
13
|
-
var
|
|
14
|
-
let [
|
|
15
|
+
var g = o(function({ widget: o, isEditMode: g, onRefresh: _, onExportCSV: v, onExportPNG: y, onSpotOutliers: b, onReconcile: x }) {
|
|
16
|
+
let [S, C] = u(!1), [w, T] = u(!1), [E, D] = u({
|
|
15
17
|
top: 0,
|
|
16
18
|
left: 0
|
|
17
|
-
}),
|
|
18
|
-
|
|
19
|
+
}), O = l(null), k = l(null), { hasPermission: A } = d(), j = A(a.WIDGET_UPDATE), M = A(a.WIDGET_CREATE), N = A(a.WIDGET_DELETE), P = e((e) => e.selectWidget), F = e((e) => e.copyWidget), I = e((e) => e.cutWidget), L = e((e) => e.removeWidget), R = e((e) => e.openConfigPanel), { asOf: z } = n(), B = r(), V = B ? i(o, {
|
|
20
|
+
isActiveCopy: B.isActiveCopy,
|
|
21
|
+
inPastView: !!z
|
|
22
|
+
}) : {
|
|
23
|
+
restore: !1,
|
|
24
|
+
promote: !1
|
|
25
|
+
}, { duplicateWidget: H, deleteWidget: U, refreshWidgetData: W } = t(o.pageId, o.dashboardId, { skipFetch: !0 });
|
|
26
|
+
c(() => {
|
|
19
27
|
let e = (e) => {
|
|
20
|
-
|
|
28
|
+
O.current && !O.current.contains(e.target) && k.current && !k.current.contains(e.target) && C(!1);
|
|
21
29
|
};
|
|
22
|
-
return
|
|
30
|
+
return S && document.addEventListener("mousedown", e), () => {
|
|
23
31
|
document.removeEventListener("mousedown", e);
|
|
24
32
|
};
|
|
25
|
-
}, [
|
|
33
|
+
}, [S]), c(() => {
|
|
26
34
|
let e = (e) => {
|
|
27
|
-
e.key === "Escape" && (
|
|
35
|
+
e.key === "Escape" && (C(!1), k.current?.focus());
|
|
28
36
|
};
|
|
29
|
-
return
|
|
37
|
+
return S && document.addEventListener("keydown", e), () => {
|
|
30
38
|
document.removeEventListener("keydown", e);
|
|
31
39
|
};
|
|
32
|
-
}, [
|
|
33
|
-
let
|
|
34
|
-
e.stopPropagation(),
|
|
35
|
-
if (!e &&
|
|
36
|
-
let e =
|
|
37
|
-
n + 160 > window.innerWidth - 10 && (n = window.innerWidth - 160 - 10), n < 10 && (n = 10), t +
|
|
40
|
+
}, [S]);
|
|
41
|
+
let G = s((e) => {
|
|
42
|
+
e.stopPropagation(), C((e) => {
|
|
43
|
+
if (!e && k.current) {
|
|
44
|
+
let e = k.current.getBoundingClientRect(), t = e.bottom + 4, n = e.right - 160;
|
|
45
|
+
n + 160 > window.innerWidth - 10 && (n = window.innerWidth - 160 - 10), n < 10 && (n = 10), t + 380 > window.innerHeight - 10 && (t = e.top - 380 - 4, t < 10 && (t = 10)), D({
|
|
38
46
|
top: t + window.scrollY,
|
|
39
47
|
left: n + window.scrollX
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
50
|
return !e;
|
|
43
51
|
});
|
|
44
|
-
}, []),
|
|
52
|
+
}, []), K = [
|
|
45
53
|
{
|
|
46
54
|
id: "edit",
|
|
47
55
|
label: "Edit Widget",
|
|
48
|
-
icon: /* @__PURE__ */
|
|
56
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
49
57
|
fill: "none",
|
|
50
58
|
stroke: "currentColor",
|
|
51
59
|
viewBox: "0 0 24 24",
|
|
52
60
|
className: "w-4 h-4",
|
|
53
|
-
children: /* @__PURE__ */
|
|
61
|
+
children: /* @__PURE__ */ p("path", {
|
|
54
62
|
strokeLinecap: "round",
|
|
55
63
|
strokeLinejoin: "round",
|
|
56
64
|
strokeWidth: 2,
|
|
@@ -58,20 +66,20 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
58
66
|
})
|
|
59
67
|
}),
|
|
60
68
|
action: () => {
|
|
61
|
-
|
|
69
|
+
P(o.id), R(), C(!1);
|
|
62
70
|
},
|
|
63
|
-
disabled: !
|
|
64
|
-
permitted:
|
|
71
|
+
disabled: !g,
|
|
72
|
+
permitted: j
|
|
65
73
|
},
|
|
66
74
|
{
|
|
67
75
|
id: "refresh",
|
|
68
76
|
label: "Refresh Data",
|
|
69
|
-
icon: /* @__PURE__ */
|
|
77
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
70
78
|
fill: "none",
|
|
71
79
|
stroke: "currentColor",
|
|
72
80
|
viewBox: "0 0 24 24",
|
|
73
81
|
className: "w-4 h-4",
|
|
74
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ p("path", {
|
|
75
83
|
strokeLinecap: "round",
|
|
76
84
|
strokeLinejoin: "round",
|
|
77
85
|
strokeWidth: 2,
|
|
@@ -79,19 +87,19 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
79
87
|
})
|
|
80
88
|
}),
|
|
81
89
|
action: async () => {
|
|
82
|
-
|
|
90
|
+
C(!1), z || (_ ? _() : await W(o.id));
|
|
83
91
|
},
|
|
84
|
-
disabled: !!
|
|
92
|
+
disabled: !!z
|
|
85
93
|
},
|
|
86
94
|
{
|
|
87
95
|
id: "spotOutliers",
|
|
88
96
|
label: "Spot outliers",
|
|
89
|
-
icon: /* @__PURE__ */
|
|
97
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
90
98
|
fill: "none",
|
|
91
99
|
stroke: "currentColor",
|
|
92
100
|
viewBox: "0 0 24 24",
|
|
93
101
|
className: "w-4 h-4",
|
|
94
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ p("path", {
|
|
95
103
|
strokeLinecap: "round",
|
|
96
104
|
strokeLinejoin: "round",
|
|
97
105
|
strokeWidth: 2,
|
|
@@ -99,19 +107,19 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
99
107
|
})
|
|
100
108
|
}),
|
|
101
109
|
action: () => {
|
|
102
|
-
|
|
110
|
+
C(!1), b?.();
|
|
103
111
|
},
|
|
104
|
-
disabled: !
|
|
112
|
+
disabled: !b
|
|
105
113
|
},
|
|
106
|
-
...
|
|
114
|
+
...x ? [{
|
|
107
115
|
id: "reconcile",
|
|
108
116
|
label: "Reconcile",
|
|
109
|
-
icon: /* @__PURE__ */
|
|
117
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
110
118
|
fill: "none",
|
|
111
119
|
stroke: "currentColor",
|
|
112
120
|
viewBox: "0 0 24 24",
|
|
113
121
|
className: "w-4 h-4",
|
|
114
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ p("path", {
|
|
115
123
|
strokeLinecap: "round",
|
|
116
124
|
strokeLinejoin: "round",
|
|
117
125
|
strokeWidth: 2,
|
|
@@ -119,18 +127,18 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
119
127
|
})
|
|
120
128
|
}),
|
|
121
129
|
action: () => {
|
|
122
|
-
|
|
130
|
+
C(!1), x();
|
|
123
131
|
}
|
|
124
132
|
}] : [],
|
|
125
133
|
{
|
|
126
134
|
id: "exportCSV",
|
|
127
135
|
label: "Export CSV",
|
|
128
|
-
icon: /* @__PURE__ */
|
|
136
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
129
137
|
fill: "none",
|
|
130
138
|
stroke: "currentColor",
|
|
131
139
|
viewBox: "0 0 24 24",
|
|
132
140
|
className: "w-4 h-4",
|
|
133
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ p("path", {
|
|
134
142
|
strokeLinecap: "round",
|
|
135
143
|
strokeLinejoin: "round",
|
|
136
144
|
strokeWidth: 2,
|
|
@@ -138,19 +146,19 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
138
146
|
})
|
|
139
147
|
}),
|
|
140
148
|
action: () => {
|
|
141
|
-
|
|
149
|
+
C(!1), v?.();
|
|
142
150
|
},
|
|
143
|
-
disabled: !
|
|
151
|
+
disabled: !v
|
|
144
152
|
},
|
|
145
153
|
{
|
|
146
154
|
id: "exportPNG",
|
|
147
155
|
label: "Export PNG",
|
|
148
|
-
icon: /* @__PURE__ */
|
|
156
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
149
157
|
fill: "none",
|
|
150
158
|
stroke: "currentColor",
|
|
151
159
|
viewBox: "0 0 24 24",
|
|
152
160
|
className: "w-4 h-4",
|
|
153
|
-
children: /* @__PURE__ */
|
|
161
|
+
children: /* @__PURE__ */ p("path", {
|
|
154
162
|
strokeLinecap: "round",
|
|
155
163
|
strokeLinejoin: "round",
|
|
156
164
|
strokeWidth: 2,
|
|
@@ -158,26 +166,26 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
158
166
|
})
|
|
159
167
|
}),
|
|
160
168
|
action: () => {
|
|
161
|
-
|
|
169
|
+
C(!1), y?.();
|
|
162
170
|
},
|
|
163
|
-
disabled: !
|
|
171
|
+
disabled: !y
|
|
164
172
|
},
|
|
165
173
|
{
|
|
166
174
|
id: "divider1",
|
|
167
175
|
label: "",
|
|
168
|
-
icon: /* @__PURE__ */
|
|
176
|
+
icon: /* @__PURE__ */ p(f, {}),
|
|
169
177
|
action: () => {},
|
|
170
178
|
divider: !0
|
|
171
179
|
},
|
|
172
180
|
{
|
|
173
181
|
id: "copy",
|
|
174
182
|
label: "Copy",
|
|
175
|
-
icon: /* @__PURE__ */
|
|
183
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
176
184
|
fill: "none",
|
|
177
185
|
stroke: "currentColor",
|
|
178
186
|
viewBox: "0 0 24 24",
|
|
179
187
|
className: "w-4 h-4",
|
|
180
|
-
children: /* @__PURE__ */
|
|
188
|
+
children: /* @__PURE__ */ p("path", {
|
|
181
189
|
strokeLinecap: "round",
|
|
182
190
|
strokeLinejoin: "round",
|
|
183
191
|
strokeWidth: 2,
|
|
@@ -185,20 +193,20 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
185
193
|
})
|
|
186
194
|
}),
|
|
187
195
|
action: () => {
|
|
188
|
-
|
|
196
|
+
F(o.id), C(!1);
|
|
189
197
|
},
|
|
190
|
-
disabled: !
|
|
191
|
-
permitted:
|
|
198
|
+
disabled: !g,
|
|
199
|
+
permitted: M
|
|
192
200
|
},
|
|
193
201
|
{
|
|
194
202
|
id: "cut",
|
|
195
203
|
label: "Cut",
|
|
196
|
-
icon: /* @__PURE__ */
|
|
204
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
197
205
|
fill: "none",
|
|
198
206
|
stroke: "currentColor",
|
|
199
207
|
viewBox: "0 0 24 24",
|
|
200
208
|
className: "w-4 h-4",
|
|
201
|
-
children: /* @__PURE__ */
|
|
209
|
+
children: /* @__PURE__ */ p("path", {
|
|
202
210
|
strokeLinecap: "round",
|
|
203
211
|
strokeLinejoin: "round",
|
|
204
212
|
strokeWidth: 2,
|
|
@@ -206,20 +214,20 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
206
214
|
})
|
|
207
215
|
}),
|
|
208
216
|
action: () => {
|
|
209
|
-
|
|
217
|
+
I(o.id), C(!1);
|
|
210
218
|
},
|
|
211
|
-
disabled: !
|
|
212
|
-
permitted:
|
|
219
|
+
disabled: !g,
|
|
220
|
+
permitted: M && j
|
|
213
221
|
},
|
|
214
222
|
{
|
|
215
223
|
id: "duplicate",
|
|
216
224
|
label: "Duplicate",
|
|
217
|
-
icon: /* @__PURE__ */
|
|
225
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
218
226
|
fill: "none",
|
|
219
227
|
stroke: "currentColor",
|
|
220
228
|
viewBox: "0 0 24 24",
|
|
221
229
|
className: "w-4 h-4",
|
|
222
|
-
children: /* @__PURE__ */
|
|
230
|
+
children: /* @__PURE__ */ p("path", {
|
|
223
231
|
strokeLinecap: "round",
|
|
224
232
|
strokeLinejoin: "round",
|
|
225
233
|
strokeWidth: 2,
|
|
@@ -227,34 +235,76 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
227
235
|
})
|
|
228
236
|
}),
|
|
229
237
|
action: async () => {
|
|
230
|
-
|
|
238
|
+
C(!1);
|
|
231
239
|
let e = {
|
|
232
|
-
x: (
|
|
233
|
-
y: (
|
|
234
|
-
width:
|
|
235
|
-
height:
|
|
240
|
+
x: (o.positionX ?? 0) + 1,
|
|
241
|
+
y: (o.positionY ?? 0) + 1,
|
|
242
|
+
width: o.positionWidth ?? 4,
|
|
243
|
+
height: o.positionHeight ?? 4
|
|
236
244
|
};
|
|
237
|
-
await
|
|
245
|
+
await H(o.id, e, `${o.title} (Copy)`);
|
|
238
246
|
},
|
|
239
|
-
disabled: !
|
|
240
|
-
permitted:
|
|
247
|
+
disabled: !g,
|
|
248
|
+
permitted: M
|
|
241
249
|
},
|
|
250
|
+
...B && V.restore ? [{
|
|
251
|
+
id: "fleetRestore",
|
|
252
|
+
label: B.labels.restore,
|
|
253
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
254
|
+
fill: "none",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
viewBox: "0 0 24 24",
|
|
257
|
+
className: "w-4 h-4",
|
|
258
|
+
children: /* @__PURE__ */ p("path", {
|
|
259
|
+
strokeLinecap: "round",
|
|
260
|
+
strokeLinejoin: "round",
|
|
261
|
+
strokeWidth: 2,
|
|
262
|
+
d: "M3 10h10a5 5 0 010 10H9M3 10l4-4m-4 4l4 4"
|
|
263
|
+
})
|
|
264
|
+
}),
|
|
265
|
+
action: () => {
|
|
266
|
+
C(!1), B.restore(o);
|
|
267
|
+
},
|
|
268
|
+
disabled: B.busy,
|
|
269
|
+
permitted: j
|
|
270
|
+
}] : [],
|
|
271
|
+
...B && V.promote ? [{
|
|
272
|
+
id: "fleetPromote",
|
|
273
|
+
label: B.labels.promote,
|
|
274
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
275
|
+
fill: "none",
|
|
276
|
+
stroke: "currentColor",
|
|
277
|
+
viewBox: "0 0 24 24",
|
|
278
|
+
className: "w-4 h-4",
|
|
279
|
+
children: /* @__PURE__ */ p("path", {
|
|
280
|
+
strokeLinecap: "round",
|
|
281
|
+
strokeLinejoin: "round",
|
|
282
|
+
strokeWidth: 2,
|
|
283
|
+
d: "M5 15l7-7 7 7M12 8v13"
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
286
|
+
action: () => {
|
|
287
|
+
C(!1), B.promote(o);
|
|
288
|
+
},
|
|
289
|
+
disabled: B.busy,
|
|
290
|
+
permitted: j
|
|
291
|
+
}] : [],
|
|
242
292
|
{
|
|
243
293
|
id: "divider2",
|
|
244
294
|
label: "",
|
|
245
|
-
icon: /* @__PURE__ */
|
|
295
|
+
icon: /* @__PURE__ */ p(f, {}),
|
|
246
296
|
action: () => {},
|
|
247
297
|
divider: !0
|
|
248
298
|
},
|
|
249
299
|
{
|
|
250
300
|
id: "delete",
|
|
251
301
|
label: "Delete",
|
|
252
|
-
icon: /* @__PURE__ */
|
|
302
|
+
icon: /* @__PURE__ */ p("svg", {
|
|
253
303
|
fill: "none",
|
|
254
304
|
stroke: "currentColor",
|
|
255
305
|
viewBox: "0 0 24 24",
|
|
256
306
|
className: "w-4 h-4",
|
|
257
|
-
children: /* @__PURE__ */
|
|
307
|
+
children: /* @__PURE__ */ p("path", {
|
|
258
308
|
strokeLinecap: "round",
|
|
259
309
|
strokeLinejoin: "round",
|
|
260
310
|
strokeWidth: 2,
|
|
@@ -263,58 +313,58 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
263
313
|
}),
|
|
264
314
|
action: async () => {
|
|
265
315
|
if (window.confirm("Are you sure you want to delete this widget?")) {
|
|
266
|
-
|
|
267
|
-
let e = await
|
|
268
|
-
|
|
269
|
-
} else
|
|
316
|
+
C(!1);
|
|
317
|
+
let e = await U(o.id);
|
|
318
|
+
o.savedQueryId ? T(!e) : e || L(o.id);
|
|
319
|
+
} else C(!1);
|
|
270
320
|
},
|
|
271
|
-
disabled: !
|
|
321
|
+
disabled: !g,
|
|
272
322
|
destructive: !0,
|
|
273
|
-
permitted:
|
|
323
|
+
permitted: N
|
|
274
324
|
}
|
|
275
|
-
].filter((e) => e.permitted !== !1 && (!
|
|
325
|
+
].filter((e) => e.permitted !== !1 && (!o.savedQueryId || g && e.id === "delete" || e.id === "fleetRestore" || e.id === "fleetPromote")), q = K.filter((e, t) => {
|
|
276
326
|
if (!e.divider) return !0;
|
|
277
|
-
let n =
|
|
327
|
+
let n = K[t - 1], r = K[t + 1];
|
|
278
328
|
return n !== void 0 && r !== void 0 && !n.divider && !r.divider;
|
|
279
329
|
});
|
|
280
|
-
return
|
|
330
|
+
return q.length ? /* @__PURE__ */ m("div", {
|
|
281
331
|
className: "relative",
|
|
282
332
|
children: [
|
|
283
|
-
|
|
333
|
+
w && /* @__PURE__ */ p("span", {
|
|
284
334
|
role: "alert",
|
|
285
335
|
children: "Could not delete this widget."
|
|
286
336
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
ref:
|
|
337
|
+
/* @__PURE__ */ p("button", {
|
|
338
|
+
ref: k,
|
|
289
339
|
type: "button",
|
|
290
|
-
onClick:
|
|
340
|
+
onClick: G,
|
|
291
341
|
className: `
|
|
292
342
|
p-1.5 rounded-md
|
|
293
343
|
text-text-secondary
|
|
294
344
|
hover:text-text-primary
|
|
295
345
|
hover:bg-bg-sunken
|
|
296
346
|
transition-colors
|
|
297
|
-
${
|
|
347
|
+
${S ? "bg-bg-sunken" : ""}
|
|
298
348
|
`,
|
|
299
349
|
title: "Widget options",
|
|
300
350
|
"aria-haspopup": "menu",
|
|
301
|
-
"aria-expanded":
|
|
302
|
-
children: /* @__PURE__ */
|
|
351
|
+
"aria-expanded": S,
|
|
352
|
+
children: /* @__PURE__ */ m("svg", {
|
|
303
353
|
className: "w-4 h-4",
|
|
304
354
|
fill: "currentColor",
|
|
305
355
|
viewBox: "0 0 24 24",
|
|
306
356
|
children: [
|
|
307
|
-
/* @__PURE__ */
|
|
357
|
+
/* @__PURE__ */ p("circle", {
|
|
308
358
|
cx: "12",
|
|
309
359
|
cy: "5",
|
|
310
360
|
r: "2"
|
|
311
361
|
}),
|
|
312
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ p("circle", {
|
|
313
363
|
cx: "12",
|
|
314
364
|
cy: "12",
|
|
315
365
|
r: "2"
|
|
316
366
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ p("circle", {
|
|
318
368
|
cx: "12",
|
|
319
369
|
cy: "19",
|
|
320
370
|
r: "2"
|
|
@@ -322,18 +372,18 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
322
372
|
]
|
|
323
373
|
})
|
|
324
374
|
}),
|
|
325
|
-
|
|
326
|
-
ref:
|
|
375
|
+
S && h(/* @__PURE__ */ p("div", {
|
|
376
|
+
ref: O,
|
|
327
377
|
style: {
|
|
328
378
|
position: "fixed",
|
|
329
|
-
top:
|
|
330
|
-
left:
|
|
379
|
+
top: E.top,
|
|
380
|
+
left: E.left,
|
|
331
381
|
zIndex: 99999
|
|
332
382
|
},
|
|
333
383
|
className: "\n min-w-[160px]\n py-1\n bg-bg-surface\n border border-border-default\n rounded-lg shadow-lg\n ",
|
|
334
384
|
role: "menu",
|
|
335
385
|
"aria-orientation": "vertical",
|
|
336
|
-
children:
|
|
386
|
+
children: q.map((e) => e.divider ? /* @__PURE__ */ p("div", { className: "my-1 border-t border-border-default" }, e.id) : /* @__PURE__ */ m("button", {
|
|
337
387
|
type: "button",
|
|
338
388
|
onClick: (t) => {
|
|
339
389
|
t.stopPropagation(), e.action();
|
|
@@ -347,10 +397,10 @@ var m = i(function({ widget: i, isEditMode: m, onRefresh: h, onExportCSV: g, onE
|
|
|
347
397
|
${e.destructive ? "text-status-error-text hover:text-status-error-text" : "text-text-primary"}
|
|
348
398
|
`,
|
|
349
399
|
role: "menuitem",
|
|
350
|
-
children: [e.icon, /* @__PURE__ */
|
|
400
|
+
children: [e.icon, /* @__PURE__ */ p("span", { children: e.label })]
|
|
351
401
|
}, e.id))
|
|
352
402
|
}), document.body)
|
|
353
403
|
]
|
|
354
404
|
}) : null;
|
|
355
405
|
});
|
|
356
|
-
export {
|
|
406
|
+
export { g as WidgetMenu, g as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFleetConfirm (BOFF-15410)
|
|
3
|
+
*
|
|
4
|
+
* The confirmation prompt of a fleet action that replaces the owner's work: the native one where the app runs
|
|
5
|
+
* inside a shell that has it, the browser's otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useFleetConfirm(): (title: string, text: string, ok: string) => Promise<boolean>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { nativeConfirm as e } from "../../utils/nativeBridge.js";
|
|
2
|
+
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetConfirm.ts
|
|
5
|
+
function r() {
|
|
6
|
+
let r = t();
|
|
7
|
+
return n(async (t, n, i) => {
|
|
8
|
+
let a = await e({
|
|
9
|
+
title: t,
|
|
10
|
+
message: n,
|
|
11
|
+
okButtonTitle: i,
|
|
12
|
+
cancelButtonTitle: r("bigconsole.fleet.link.cancel", "Cancel")
|
|
13
|
+
});
|
|
14
|
+
return a === null ? window.confirm(n) : a;
|
|
15
|
+
}, [r]);
|
|
16
|
+
}
|
|
17
|
+
export { r as useFleetConfirm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RestoreNotice } from './useFleetCopyActions';
|
|
2
|
+
interface UseFleetWidgetActionsResult {
|
|
3
|
+
busy: boolean;
|
|
4
|
+
/** Puts the widget back to the master's version. Returns what could not be carried over exactly. */
|
|
5
|
+
restoreWidget: (widgetId: string) => Promise<RestoreNotice[]>;
|
|
6
|
+
/** Adds the widget to the master, which the board's widget then follows. Returns what could not be carried over. */
|
|
7
|
+
promoteWidget: (widgetId: string) => Promise<RestoreNotice[]>;
|
|
8
|
+
}
|
|
9
|
+
export declare function useFleetWidgetActions(): UseFleetWidgetActionsResult;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PromoteWidgetToMasterDocument as e, RestoreWidgetToOriginalDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useCallback as n, useState as r } from "react";
|
|
3
|
+
import { useApolloClient as i } from "@apollo/client/react";
|
|
4
|
+
// src/bigconsole/hooks/useFleetWidgetActions.ts
|
|
5
|
+
var a = (e) => e.map((e) => ({
|
|
6
|
+
code: e.code,
|
|
7
|
+
pageName: e.pageName,
|
|
8
|
+
widgetId: e.widgetId
|
|
9
|
+
}));
|
|
10
|
+
function o() {
|
|
11
|
+
let o = i(), [s, c] = r(!1), l = n(async (e) => {
|
|
12
|
+
c(!0);
|
|
13
|
+
try {
|
|
14
|
+
return await e();
|
|
15
|
+
} finally {
|
|
16
|
+
c(!1);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
return {
|
|
20
|
+
busy: s,
|
|
21
|
+
restoreWidget: n((e) => l(async () => {
|
|
22
|
+
let n = (await o.mutate({
|
|
23
|
+
mutation: t,
|
|
24
|
+
variables: { widgetId: e },
|
|
25
|
+
errorPolicy: "none"
|
|
26
|
+
})).data?.restoreWidgetToOriginal;
|
|
27
|
+
if (!n) throw Error("The widget could not be restored.");
|
|
28
|
+
return a(n.notices);
|
|
29
|
+
}), [o, l]),
|
|
30
|
+
promoteWidget: n((t) => l(async () => {
|
|
31
|
+
let n = (await o.mutate({
|
|
32
|
+
mutation: e,
|
|
33
|
+
variables: { widgetId: t },
|
|
34
|
+
errorPolicy: "none"
|
|
35
|
+
})).data?.promoteWidgetToMaster;
|
|
36
|
+
if (!n) throw Error("The widget could not be promoted.");
|
|
37
|
+
return a(n.notices);
|
|
38
|
+
}), [o, l])
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export { o as useFleetWidgetActions };
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - the outcome is shown only if the panel is still on the owner (board, workspace and account) the action
|
|
8
|
-
* started for, so an answer that arrives after the person moved on is dropped before it touches any state;
|
|
9
|
-
* - a failed re-read is not a failed action: the action already happened, and the read reports its own failure;
|
|
10
|
-
* - `acting` stays true until the re-read is done, not only until the action returns, so a second click cannot
|
|
11
|
-
* start a second action in the gap.
|
|
12
|
-
*
|
|
13
|
-
* When the owner changes, `onOwnerChange` lets the panel drop the state that belonged to the previous one.
|
|
14
|
-
*
|
|
15
|
-
* Two sections of one panel can share a lock (`useActionLock`), so an action in one holds the buttons of the
|
|
16
|
-
* other: a board that is both a copy and a master must not start a push while a restore is still running.
|
|
17
|
-
* A run that finishes after the panel went away is dropped too: it must not touch a board the person left.
|
|
3
|
+
* An action lock: which owner has an action running (`owner`, for the buttons to show), and the same fact kept
|
|
4
|
+
* synchronously, which is what decides whether an action may start. The state is only seen after a render; the
|
|
5
|
+
* synchronous side changes the instant an action starts, so two prompts answered together in different sections
|
|
6
|
+
* of one panel cannot both start.
|
|
18
7
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
export interface ActionLock {
|
|
9
|
+
owner: string | null;
|
|
10
|
+
setOwner: Dispatch<SetStateAction<string | null>>;
|
|
11
|
+
/** Takes the lock for the owner; false when an action of that owner already holds it. */
|
|
12
|
+
tryAcquire: (owner: string) => boolean;
|
|
13
|
+
/** Lets go of the lock if the owner still holds it. */
|
|
14
|
+
release: (owner: string) => void;
|
|
15
|
+
}
|
|
21
16
|
/** One lock for the sections of a panel to share. */
|
|
22
17
|
export declare function useActionLock(): ActionLock;
|
|
23
18
|
interface UseOwnerBoundRunResult {
|