@burdenoff/microfe-bigconsole 2026.1118.7 → 2026.1118.8
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/dashboard/DashboardCanvas.d.ts +2 -0
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +69 -68
- package/dist/bigconsole/components/dashboard/DashboardReviewDialog.d.ts +13 -0
- package/dist/bigconsole/components/dashboard/DashboardReviewDialog.js +136 -0
- package/dist/bigconsole/components/dashboard/DashboardToolbar.d.ts +2 -0
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +102 -89
- package/dist/bigconsole/components/dashboard/index.d.ts +1 -0
- package/dist/bigconsole/components/dashboard/index.js +2 -1
- package/dist/bigconsole/components/insights/BoardLintPanel.d.ts +18 -8
- package/dist/bigconsole/components/insights/BoardLintPanel.js +52 -52
- package/dist/bigconsole/pages/DashboardViewPage.js +191 -182
- package/dist/bigconsole/utils/boardLint.d.ts +8 -0
- package/dist/bigconsole/utils/boardLint.js +4 -0
- package/dist/bigconsole/utils/savedBoardLint.d.ts +102 -0
- package/dist/bigconsole/utils/savedBoardLint.js +100 -0
- package/package.json +1 -1
|
@@ -13,6 +13,8 @@ export interface DashboardCanvasProps {
|
|
|
13
13
|
onSave?: () => void;
|
|
14
14
|
/** Whether save is in progress */
|
|
15
15
|
isSaving?: boolean;
|
|
16
|
+
/** Open the chart-quality review (Board Lint) */
|
|
17
|
+
onReview?: () => void;
|
|
16
18
|
/** Callback to export dashboard */
|
|
17
19
|
onExport?: () => void;
|
|
18
20
|
onPublishTemplate?: () => void;
|
|
@@ -36,36 +36,36 @@ import { Button as v } from "@burdenoff/fe-libs/ui";
|
|
|
36
36
|
import { useI18n as he } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
37
37
|
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
38
38
|
// src/bigconsole/components/dashboard/DashboardCanvas.tsx
|
|
39
|
-
var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _e, isSaving: ve = !1,
|
|
40
|
-
let { t: T } = he(), E = g(null), D = g(null), [O,
|
|
39
|
+
var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _e, isSaving: ve = !1, onReview: ye, onExport: be, onPublishTemplate: xe, pages: C = [], activePageId: Se, onPageChange: Ce, onPagesReorder: w, onPageAdd: we, onPageRename: Te, onPageDuplicate: Ee, onPageDelete: De, showFilters: Oe = !0, showPageTabs: ke = !0, enableCrossFilter: Ae = !0 }) {
|
|
40
|
+
let { t: T } = he(), E = g(null), D = g(null), [O, je] = _(1200), [Me, k] = _(!1), [A, j] = _(null), [M, N] = _(!1), [Ne, P] = _(null), [F, Pe] = _(null), I = t((e) => e.viewMode === "edit"), L = t((e) => e.currentDashboard), R = L?.pages.find((e) => e.id === x)?.gridColumns ?? 12, { updateDashboard: z } = a({ skipFetch: !0 }), { hasPermission: Fe } = pe(), Ie = Fe(n.DASHBOARD_UPDATE), Le = F?.id === m ? F.value : L?.id === m ? L.visibility : void 0, Re = h(async (e) => {
|
|
41
41
|
let t = await z({
|
|
42
42
|
id: m,
|
|
43
43
|
visibility: e
|
|
44
44
|
});
|
|
45
45
|
if (!t) throw Error("The dashboard service did not accept the change.");
|
|
46
|
-
|
|
46
|
+
Pe({
|
|
47
47
|
id: m,
|
|
48
48
|
value: t.visibility ?? e
|
|
49
49
|
});
|
|
50
|
-
}, [m, z]), { workspaceId: B, apiGatewayUrl:
|
|
50
|
+
}, [m, z]), { workspaceId: B, apiGatewayUrl: ze, authToken: Be } = i(), { installedWidgets: Ve, loading: He } = c({
|
|
51
51
|
workspaceId: B,
|
|
52
52
|
enabled: I
|
|
53
|
-
}), { definitions:
|
|
53
|
+
}), { definitions: Ue } = l({
|
|
54
54
|
workspaceId: B,
|
|
55
|
-
apiGatewayUrl:
|
|
56
|
-
authToken:
|
|
55
|
+
apiGatewayUrl: ze,
|
|
56
|
+
authToken: Be,
|
|
57
57
|
enabled: I
|
|
58
|
-
}), V = t((e) => e.zoomLevel), H = t((e) => e.sidebarCollapsed), U = t((e) => e.toggleSidebar), W = !H, G = t((e) => e.setGlobalFilterValues),
|
|
58
|
+
}), V = t((e) => e.zoomLevel), H = t((e) => e.sidebarCollapsed), U = t((e) => e.toggleSidebar), W = !H, G = t((e) => e.setGlobalFilterValues), We = h((e) => {
|
|
59
59
|
G(e);
|
|
60
60
|
}, [G]), { createWidget: K } = s(x, m, { skipFetch: !0 }), q = e((e) => e.widgets), J = fe(() => {
|
|
61
61
|
let e = Array.from(q.values());
|
|
62
62
|
return x ? e.filter((e) => e.pageId === x) : e;
|
|
63
|
-
}, [q, x]),
|
|
63
|
+
}, [q, x]), Ge = e((e) => e.selectedWidgetId), Y = e((e) => e.selectWidget), X = e((e) => e.addWidget), Ke = e((e) => e.updateWidgetPosition), Z = e((e) => e.configPanelOpen), qe = e((e) => e.closeConfigPanel);
|
|
64
64
|
de(() => {
|
|
65
65
|
let e = E.current;
|
|
66
66
|
if (!e) return;
|
|
67
67
|
let t = () => {
|
|
68
|
-
|
|
68
|
+
je(e.offsetWidth);
|
|
69
69
|
};
|
|
70
70
|
if (t(), typeof ResizeObserver < "u") {
|
|
71
71
|
let n = new ResizeObserver(t);
|
|
@@ -73,18 +73,18 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
73
73
|
}
|
|
74
74
|
return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
75
75
|
}, []);
|
|
76
|
-
let
|
|
76
|
+
let Je = h((e) => {
|
|
77
77
|
e.forEach((e) => {
|
|
78
|
-
|
|
78
|
+
Ke(e.i, {
|
|
79
79
|
x: e.x,
|
|
80
80
|
y: e.y,
|
|
81
81
|
width: e.w,
|
|
82
82
|
height: e.h
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
|
-
}, [
|
|
85
|
+
}, [Ke]), Ye = h((e) => {
|
|
86
86
|
Y(e);
|
|
87
|
-
}, [Y]),
|
|
87
|
+
}, [Y]), Q = h(async (e, t) => {
|
|
88
88
|
j(null);
|
|
89
89
|
let n = t?.definition || (e.type ? f(e.type) : null), r = d(), i = {
|
|
90
90
|
width: Math.min(n?.defaultSize?.width ?? 4, R),
|
|
@@ -155,11 +155,11 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
155
155
|
J,
|
|
156
156
|
R,
|
|
157
157
|
T
|
|
158
|
-
]),
|
|
158
|
+
]), Xe = h((e) => {
|
|
159
159
|
N(!0), P(e);
|
|
160
|
-
}, []),
|
|
160
|
+
}, []), Ze = h(() => {
|
|
161
161
|
N(!1), P(null);
|
|
162
|
-
}, []),
|
|
162
|
+
}, []), Qe = h((e) => {
|
|
163
163
|
e.preventDefault(), N(!1), P(null);
|
|
164
164
|
try {
|
|
165
165
|
let t = e.dataTransfer.getData("application/json");
|
|
@@ -185,7 +185,7 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
185
185
|
width: s.width,
|
|
186
186
|
height: s.height
|
|
187
187
|
};
|
|
188
|
-
|
|
188
|
+
Q({
|
|
189
189
|
type: r.type,
|
|
190
190
|
title: r.name || i.name,
|
|
191
191
|
config: r.defaultConfig || i.defaultConfig
|
|
@@ -198,20 +198,20 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
198
198
|
}
|
|
199
199
|
}, [
|
|
200
200
|
O,
|
|
201
|
-
|
|
201
|
+
Q,
|
|
202
202
|
R
|
|
203
|
-
]),
|
|
203
|
+
]), $e = h((e) => {
|
|
204
204
|
e.preventDefault(), e.dataTransfer.dropEffect = "copy";
|
|
205
|
-
}, []),
|
|
205
|
+
}, []), et = h((e, t) => {
|
|
206
206
|
let n = t || f(e);
|
|
207
|
-
|
|
207
|
+
Q({
|
|
208
208
|
type: e,
|
|
209
209
|
title: n.name,
|
|
210
210
|
config: n.defaultConfig
|
|
211
211
|
});
|
|
212
|
-
}, [
|
|
212
|
+
}, [Q]), tt = h(() => {
|
|
213
213
|
U();
|
|
214
|
-
}, [U]),
|
|
214
|
+
}, [U]), nt = h(() => {
|
|
215
215
|
H && U(), window.requestAnimationFrame(() => {
|
|
216
216
|
let e = T("bigconsole.dashboards.widgetPalette.searchPlaceholder", "Search widgets...");
|
|
217
217
|
document.querySelector(`input[placeholder="${e}"]`)?.focus();
|
|
@@ -220,31 +220,32 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
220
220
|
H,
|
|
221
221
|
U,
|
|
222
222
|
T
|
|
223
|
-
]), { exportPNG:
|
|
223
|
+
]), { exportPNG: rt, exportPDF: $, isExporting: it } = u({
|
|
224
224
|
containerRef: D,
|
|
225
225
|
name: S || "dashboard"
|
|
226
|
-
}),
|
|
227
|
-
|
|
228
|
-
}, [
|
|
229
|
-
|
|
230
|
-
}, [
|
|
226
|
+
}), at = h(() => {
|
|
227
|
+
rt();
|
|
228
|
+
}, [rt]), ot = h(() => {
|
|
229
|
+
$();
|
|
230
|
+
}, [$]);
|
|
231
231
|
return /* @__PURE__ */ b("div", {
|
|
232
232
|
className: "flex flex-col h-full min-w-0 overflow-hidden",
|
|
233
233
|
children: [
|
|
234
234
|
/* @__PURE__ */ y(te, {
|
|
235
235
|
dashboardId: m,
|
|
236
236
|
title: S,
|
|
237
|
-
onAddWidget:
|
|
238
|
-
onTogglePalette:
|
|
237
|
+
onAddWidget: nt,
|
|
238
|
+
onTogglePalette: tt,
|
|
239
239
|
isPaletteOpen: W,
|
|
240
240
|
onPaste: ge,
|
|
241
241
|
onSave: _e,
|
|
242
242
|
isSaving: ve,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
onReview: ye,
|
|
244
|
+
onExport: be,
|
|
245
|
+
onPublishTemplate: xe,
|
|
246
|
+
onExportImage: at,
|
|
247
|
+
onExportPdf: ot,
|
|
248
|
+
isExportingImage: it,
|
|
248
249
|
onShare: () => k(!0)
|
|
249
250
|
}),
|
|
250
251
|
A && /* @__PURE__ */ y("div", {
|
|
@@ -273,36 +274,36 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
273
274
|
widgets: J,
|
|
274
275
|
isEditMode: I
|
|
275
276
|
}),
|
|
276
|
-
|
|
277
|
+
Oe && /* @__PURE__ */ y(re, {
|
|
277
278
|
dashboardId: m,
|
|
278
|
-
onFilterChange:
|
|
279
|
+
onFilterChange: We,
|
|
279
280
|
collapsible: !0
|
|
280
281
|
}),
|
|
281
|
-
|
|
282
|
+
ke && (I || C.length > 0) && /* @__PURE__ */ y(ae, {
|
|
282
283
|
pages: C,
|
|
283
|
-
activePageId:
|
|
284
|
+
activePageId: Se || C[0]?.id,
|
|
284
285
|
editable: I,
|
|
285
|
-
onPageSelect:
|
|
286
|
+
onPageSelect: Ce || (() => {}),
|
|
286
287
|
onPagesReorder: w ? (e) => {
|
|
287
288
|
w(e.map((e) => C.find((t) => t.id === e)).filter(Boolean));
|
|
288
289
|
} : void 0,
|
|
289
|
-
onPageCreate:
|
|
290
|
-
onPageRename:
|
|
291
|
-
onPageDuplicate:
|
|
292
|
-
onPageDelete:
|
|
290
|
+
onPageCreate: we,
|
|
291
|
+
onPageRename: Te,
|
|
292
|
+
onPageDuplicate: Ee,
|
|
293
|
+
onPageDelete: De
|
|
293
294
|
}),
|
|
294
295
|
/* @__PURE__ */ b("div", {
|
|
295
296
|
"data-testid": "dashboard-canvas-panes",
|
|
296
|
-
className: `flex flex-1 min-w-0 overflow-hidden ${
|
|
297
|
+
className: `flex flex-1 min-w-0 overflow-hidden ${Z ? "lg:mr-[var(--bc-inspector-width,420px)]" : ""}`,
|
|
297
298
|
children: [I && /* @__PURE__ */ y(oe, {
|
|
298
299
|
isOpen: W,
|
|
299
|
-
onClose:
|
|
300
|
-
onWidgetSelect:
|
|
301
|
-
onDragStart:
|
|
302
|
-
onDragEnd:
|
|
303
|
-
installedWidgets:
|
|
304
|
-
installedWidgetsLoading:
|
|
305
|
-
definitions:
|
|
300
|
+
onClose: tt,
|
|
301
|
+
onWidgetSelect: et,
|
|
302
|
+
onDragStart: Xe,
|
|
303
|
+
onDragEnd: Ze,
|
|
304
|
+
installedWidgets: Ve,
|
|
305
|
+
installedWidgetsLoading: He,
|
|
306
|
+
definitions: Ue
|
|
306
307
|
}), /* @__PURE__ */ b("div", {
|
|
307
308
|
ref: E,
|
|
308
309
|
role: "region",
|
|
@@ -310,8 +311,8 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
310
311
|
"data-section-emphasis": "primary",
|
|
311
312
|
"data-testid": "dashboard-board",
|
|
312
313
|
className: "relative min-w-0 flex-1 overflow-auto border-2 border-transparent bg-bg-sunken motion-safe:transition-[border-color,background-color]",
|
|
313
|
-
onDrop:
|
|
314
|
-
onDragOver:
|
|
314
|
+
onDrop: Qe,
|
|
315
|
+
onDragOver: $e,
|
|
315
316
|
onClick: () => {
|
|
316
317
|
I && Y(null);
|
|
317
318
|
},
|
|
@@ -343,7 +344,7 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
343
344
|
children: [
|
|
344
345
|
T("bigconsole.dashboards.canvas.dropToAddBefore", "Drop to add"),
|
|
345
346
|
" ",
|
|
346
|
-
/* @__PURE__ */ y("strong", { children:
|
|
347
|
+
/* @__PURE__ */ y("strong", { children: Ne }),
|
|
347
348
|
" ",
|
|
348
349
|
T("bigconsole.dashboards.canvas.dropToAddAfter", "widget")
|
|
349
350
|
]
|
|
@@ -356,17 +357,17 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
356
357
|
width: `${100 / (V / 100)}%`
|
|
357
358
|
},
|
|
358
359
|
children: J.length > 0 ? /* @__PURE__ */ y(r, {
|
|
359
|
-
enabled:
|
|
360
|
+
enabled: Ae,
|
|
360
361
|
onCrossFilter: (e) => {},
|
|
361
362
|
children: /* @__PURE__ */ y(ee, {
|
|
362
363
|
widgets: J,
|
|
363
364
|
cols: R,
|
|
364
365
|
isEditMode: I,
|
|
365
366
|
width: O,
|
|
366
|
-
onLayoutChange:
|
|
367
|
+
onLayoutChange: Je,
|
|
367
368
|
transformScale: V / 100,
|
|
368
|
-
onWidgetSelect:
|
|
369
|
-
selectedWidgetId:
|
|
369
|
+
onWidgetSelect: Ye,
|
|
370
|
+
selectedWidgetId: Ge
|
|
370
371
|
})
|
|
371
372
|
}) : /* @__PURE__ */ y("div", {
|
|
372
373
|
className: "flex min-h-[min(400px,60vh)] items-center justify-center p-card-padding",
|
|
@@ -378,7 +379,7 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
378
379
|
title: T("bigconsole.dashboards.canvas.noWidgetsTitle", "No widgets yet"),
|
|
379
380
|
description: T("bigconsole.dashboards.canvas.noWidgetsDescription", "Add widgets to build your dashboard. Click the \"Add Widget\" button to get started."),
|
|
380
381
|
children: I && /* @__PURE__ */ b(v, {
|
|
381
|
-
onClick:
|
|
382
|
+
onClick: nt,
|
|
382
383
|
children: [/* @__PURE__ */ y(me, { className: "size-4" }), T("bigconsole.dashboards.canvas.addWidget", "Add Widget")]
|
|
383
384
|
})
|
|
384
385
|
})
|
|
@@ -387,17 +388,17 @@ var x = m(function({ dashboardId: m, pageId: x, title: S, onPaste: ge, onSave: _
|
|
|
387
388
|
})]
|
|
388
389
|
}),
|
|
389
390
|
/* @__PURE__ */ y(ce, {
|
|
390
|
-
isOpen:
|
|
391
|
-
onClose:
|
|
391
|
+
isOpen: Z,
|
|
392
|
+
onClose: qe
|
|
392
393
|
}),
|
|
393
394
|
/* @__PURE__ */ y(se, {
|
|
394
395
|
dashboardId: m,
|
|
395
396
|
dashboardName: S || T("bigconsole.dashboards.canvas.dashboardFallbackName", "Dashboard"),
|
|
396
|
-
isOpen:
|
|
397
|
+
isOpen: Me,
|
|
397
398
|
onClose: () => k(!1),
|
|
398
|
-
visibility:
|
|
399
|
-
onVisibilityChange:
|
|
400
|
-
canChangeVisibility:
|
|
399
|
+
visibility: Le,
|
|
400
|
+
onVisibilityChange: Re,
|
|
401
|
+
canChangeVisibility: Ie
|
|
401
402
|
})
|
|
402
403
|
]
|
|
403
404
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { SavedBoardPage } from '../../utils/savedBoardLint';
|
|
3
|
+
export interface DashboardReviewDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
dashboardId: string;
|
|
7
|
+
/** The dashboard's pages, in tab order. */
|
|
8
|
+
pages: readonly SavedBoardPage[];
|
|
9
|
+
/** Whether the person may edit this dashboard. Without it the review is read-only. */
|
|
10
|
+
canFix: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const DashboardReviewDialog: FC<DashboardReviewDialogProps>;
|
|
13
|
+
export default DashboardReviewDialog;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ListWidgetsByDashboardDocument as e } from "../../../generated/wspace-operations.js";
|
|
2
|
+
import t, { normalizeWidget as n } from "../../hooks/useWidgetOperations.js";
|
|
3
|
+
import { buildSavedBoard as r, isSameWidgetAt as i, planSavedWidgetRestore as a, planSavedWidgetUpdate as o, replanFix as s } from "../../utils/savedBoardLint.js";
|
|
4
|
+
import { getBindingForWidget as c } from "../../utils/widgetBinding.js";
|
|
5
|
+
import { widgetDataSourcePolicy as l } from "../../utils/widgetDisplayData.js";
|
|
6
|
+
import { BoardLintPanel as u } from "../insights/BoardLintPanel.js";
|
|
7
|
+
import { memo as d, useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
8
|
+
import { Loader2 as _ } from "lucide-react";
|
|
9
|
+
import { Dialog as v, DialogContent as y, DialogDescription as b, DialogHeader as x, DialogTitle as S } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { useApolloClient as w } from "@apollo/client/react";
|
|
12
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
13
|
+
import { clearGraphqlFetchResponseCache as D } from "@burdenoff/fe-libs/shared/graphql";
|
|
14
|
+
// src/bigconsole/components/dashboard/DashboardReviewDialog.tsx
|
|
15
|
+
function O(e) {
|
|
16
|
+
return Array.from(e, (e) => ({
|
|
17
|
+
...e,
|
|
18
|
+
connected: l(e, c(e)).hasDataSource || !!e.savedQueryId
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function k(e, t) {
|
|
22
|
+
return r(e, O(t.values()));
|
|
23
|
+
}
|
|
24
|
+
var A = d(function({ open: r, onClose: c, dashboardId: l, pages: d, canFix: O }) {
|
|
25
|
+
let { t: A } = C(), j = w(), { updateWidget: M, loadPageWidgets: N } = t(void 0, void 0, { skipFetch: !0 }), [P, F] = g(null), [I, L] = g(null), R = f(async () => {
|
|
26
|
+
D();
|
|
27
|
+
let t = (await j.query({
|
|
28
|
+
query: e,
|
|
29
|
+
variables: { dashboardId: l },
|
|
30
|
+
fetchPolicy: "network-only"
|
|
31
|
+
})).data?.listWidgetsByDashboard ?? [];
|
|
32
|
+
return new Map(t.map((e) => n(e)).map((e) => [e.id, e]));
|
|
33
|
+
}, [j, l]);
|
|
34
|
+
p(() => {
|
|
35
|
+
if (!r) {
|
|
36
|
+
F(null), L(null);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let e = !1;
|
|
40
|
+
return L(null), Promise.all([R(), Promise.all(d.map((e) => N(e.id)))]).then(([t]) => {
|
|
41
|
+
e || F(t);
|
|
42
|
+
}).catch((t) => {
|
|
43
|
+
e || L(t instanceof Error ? t.message : String(t));
|
|
44
|
+
}), () => {
|
|
45
|
+
e = !0;
|
|
46
|
+
};
|
|
47
|
+
}, [
|
|
48
|
+
r,
|
|
49
|
+
d,
|
|
50
|
+
R,
|
|
51
|
+
N
|
|
52
|
+
]);
|
|
53
|
+
let z = m(() => P ? k(d, P) : null, [d, P]), B = h(null);
|
|
54
|
+
p(() => {
|
|
55
|
+
B.current = z;
|
|
56
|
+
}, [z]);
|
|
57
|
+
let [V, H] = g([]), U = h(/* @__PURE__ */ new Map()), W = h(0);
|
|
58
|
+
p(() => {
|
|
59
|
+
r || (H([]), U.current.clear());
|
|
60
|
+
}, [r]);
|
|
61
|
+
let G = f(async (e) => {
|
|
62
|
+
let t = B.current, n = await R(), r = k(d, n);
|
|
63
|
+
if (!i(t, r, e.widgetIndex)) throw F(n), Error(A("bigconsole.analysis.boardLint.changedMeanwhile", "This dashboard changed while you were reviewing it. The list is updated; please review again."));
|
|
64
|
+
let a = s(e, r.board);
|
|
65
|
+
if (!a) throw F(n), Error(A("bigconsole.analysis.boardLint.noLongerNeeded", "This change is no longer needed. The list is updated."));
|
|
66
|
+
let c = o(a, r.widgetIds, n);
|
|
67
|
+
if (!c) throw Error(A("bigconsole.analysis.boardLint.widgetGone", "This widget no longer exists."));
|
|
68
|
+
let l = await M(c.update);
|
|
69
|
+
if (!l) throw Error(A("bigconsole.analysis.boardLint.updateFailed", "The change could not be saved. Please try again."));
|
|
70
|
+
W.current += 1;
|
|
71
|
+
let u = `lint-fix-${W.current}`;
|
|
72
|
+
return U.current.set(u, c.undo), F(await R().catch(() => new Map(n).set(l.id, l))), u;
|
|
73
|
+
}, [
|
|
74
|
+
d,
|
|
75
|
+
R,
|
|
76
|
+
M,
|
|
77
|
+
A
|
|
78
|
+
]), K = f(async (e) => {
|
|
79
|
+
let t = U.current.get(e);
|
|
80
|
+
if (!t) return;
|
|
81
|
+
let n = await R(), r = a(t, n.get(t.id));
|
|
82
|
+
if (!r.ok) throw F(n), Error(r.reason === "gone" ? A("bigconsole.analysis.boardLint.widgetGone", "This widget no longer exists.") : A("bigconsole.analysis.boardLint.undoConflict", "This widget was changed after the fix, so Undo would erase that change. Please adjust it by hand."));
|
|
83
|
+
let i = await M(r.update);
|
|
84
|
+
if (!i) throw Error(A("bigconsole.analysis.boardLint.undoFailed", "The change could not be undone. Please try again."));
|
|
85
|
+
U.current.delete(e), F(await R().catch(() => new Map(n).set(i.id, i)));
|
|
86
|
+
}, [
|
|
87
|
+
M,
|
|
88
|
+
R,
|
|
89
|
+
A
|
|
90
|
+
]), q = f((e) => {
|
|
91
|
+
H((t) => e ? [...t, e] : t.slice(0, -1));
|
|
92
|
+
}, []);
|
|
93
|
+
return /* @__PURE__ */ T(v, {
|
|
94
|
+
open: r,
|
|
95
|
+
onOpenChange: (e) => !e && c(),
|
|
96
|
+
children: /* @__PURE__ */ E(y, {
|
|
97
|
+
className: "sm:max-w-lg flex max-h-[calc(100dvh-3rem)] flex-col overflow-hidden",
|
|
98
|
+
children: [/* @__PURE__ */ E(x, {
|
|
99
|
+
className: "shrink-0",
|
|
100
|
+
children: [/* @__PURE__ */ T(S, { children: A("bigconsole.dashboards.review.title", "Review this dashboard") }), /* @__PURE__ */ T(b, { children: O ? A("bigconsole.dashboards.review.description", "Finds charts that can mislead or be hard to read. Fix it shows the change first, and you can undo it.") : A("bigconsole.dashboards.review.readOnlyDescription", "Finds charts that can mislead or be hard to read. You need edit access to change anything.") })]
|
|
101
|
+
}), /* @__PURE__ */ T("div", {
|
|
102
|
+
className: "min-h-0 flex-1 overflow-y-auto py-4",
|
|
103
|
+
children: I ? /* @__PURE__ */ T("p", {
|
|
104
|
+
role: "alert",
|
|
105
|
+
style: { color: "var(--color-status-danger-text, var(--color-text-primary))" },
|
|
106
|
+
children: A("bigconsole.dashboards.review.loadFailed", "Could not read your widgets: {{message}}", { message: I })
|
|
107
|
+
}) : z ? /* @__PURE__ */ T(u, {
|
|
108
|
+
spec: z.board,
|
|
109
|
+
saved: !0,
|
|
110
|
+
repeatable: !0,
|
|
111
|
+
onApplyFix: O ? G : void 0,
|
|
112
|
+
onUndoFix: O ? K : void 0,
|
|
113
|
+
applied: V[V.length - 1] ?? null,
|
|
114
|
+
onAppliedChange: q
|
|
115
|
+
}) : /* @__PURE__ */ E("div", {
|
|
116
|
+
role: "status",
|
|
117
|
+
style: {
|
|
118
|
+
display: "flex",
|
|
119
|
+
minHeight: "6rem",
|
|
120
|
+
alignItems: "center",
|
|
121
|
+
justifyContent: "center",
|
|
122
|
+
gap: "var(--space-controlGap)",
|
|
123
|
+
color: "var(--color-text-muted)",
|
|
124
|
+
fontSize: "var(--font-size-body-sm)"
|
|
125
|
+
},
|
|
126
|
+
children: [/* @__PURE__ */ T(_, {
|
|
127
|
+
size: 20,
|
|
128
|
+
className: "animate-spin",
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
}), A("bigconsole.dashboards.review.loading", "Reading your widgets…")]
|
|
131
|
+
})
|
|
132
|
+
})]
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
export { A as DashboardReviewDialog, A as default };
|
|
@@ -16,6 +16,8 @@ export interface DashboardToolbarProps {
|
|
|
16
16
|
onSave?: () => void;
|
|
17
17
|
/** Whether save is in progress */
|
|
18
18
|
isSaving?: boolean;
|
|
19
|
+
/** Open the chart-quality review (Board Lint) for this dashboard */
|
|
20
|
+
onReview?: () => void;
|
|
19
21
|
/** Callback to export dashboard (JSON console definition) */
|
|
20
22
|
onExport?: () => void;
|
|
21
23
|
/** Publish this dashboard as a reusable template. */
|