@burdenoff/microfe-bigconsole 2026.1118.6 → 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/explore/SavedQueryWidget.d.ts +3 -1
- package/dist/bigconsole/components/explore/SavedQueryWidget.js +22 -18
- package/dist/bigconsole/components/insights/BoardLintPanel.d.ts +18 -8
- package/dist/bigconsole/components/insights/BoardLintPanel.js +52 -52
- package/dist/bigconsole/components/widgets/WidgetMenu.js +86 -75
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +221 -209
- 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
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LintableBoard, LintFix } from './boardLint';
|
|
2
|
+
/** The page fields Board Lint needs. */
|
|
3
|
+
export interface SavedBoardPage {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/** The widget fields Board Lint needs; a store `Widget` satisfies this. */
|
|
8
|
+
export interface SavedBoardWidget {
|
|
9
|
+
id: string;
|
|
10
|
+
pageId: string;
|
|
11
|
+
type: string;
|
|
12
|
+
title: string;
|
|
13
|
+
config: Record<string, unknown>;
|
|
14
|
+
position?: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
} | null;
|
|
20
|
+
dataSinkId?: string | null;
|
|
21
|
+
dataSourceId?: string | null;
|
|
22
|
+
parserId?: string | null;
|
|
23
|
+
datasetId?: string | null;
|
|
24
|
+
savedQueryId?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the widget has a data source by the app's own rule (see `widgetDataSourcePolicy`). When given it
|
|
27
|
+
* decides the "not connected" note; otherwise the ids above are used.
|
|
28
|
+
*/
|
|
29
|
+
connected?: boolean | null;
|
|
30
|
+
}
|
|
31
|
+
export interface SavedBoard {
|
|
32
|
+
board: LintableBoard;
|
|
33
|
+
/** `widgetIds[i]` is the saved widget behind flat widget index `i` (the index a `LintFix` carries). */
|
|
34
|
+
widgetIds: string[];
|
|
35
|
+
}
|
|
36
|
+
/** The part of `updateWidget`'s input that a lint fix (or its undo) can touch. */
|
|
37
|
+
export interface SavedWidgetUpdate {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
config: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/** One setting a fix changed: whether it existed, what it was, and what the fix set it to. */
|
|
43
|
+
export interface SavedSettingChange {
|
|
44
|
+
key: string;
|
|
45
|
+
had: boolean;
|
|
46
|
+
before: unknown;
|
|
47
|
+
after: unknown;
|
|
48
|
+
}
|
|
49
|
+
/** Exactly what a fix changed on one widget: enough to take back that, and only that. */
|
|
50
|
+
export interface SavedWidgetUndo {
|
|
51
|
+
id: string;
|
|
52
|
+
title: {
|
|
53
|
+
before: string;
|
|
54
|
+
after: string;
|
|
55
|
+
} | null;
|
|
56
|
+
settings: SavedSettingChange[];
|
|
57
|
+
}
|
|
58
|
+
export interface SavedWidgetUpdatePlan {
|
|
59
|
+
/** What to send to apply the fix. */
|
|
60
|
+
update: SavedWidgetUpdate;
|
|
61
|
+
/** What the fix changed, for Undo. */
|
|
62
|
+
undo: SavedWidgetUndo;
|
|
63
|
+
}
|
|
64
|
+
export type SavedWidgetRestore = {
|
|
65
|
+
ok: true;
|
|
66
|
+
update: SavedWidgetUpdate;
|
|
67
|
+
}
|
|
68
|
+
/** `gone`: the widget no longer exists. `changed`: someone changed what the fix had set, so Undo would erase it. */
|
|
69
|
+
| {
|
|
70
|
+
ok: false;
|
|
71
|
+
reason: 'gone' | 'changed';
|
|
72
|
+
};
|
|
73
|
+
/** Describe a saved dashboard to Board Lint. Widgets whose page is not in `pages` are left out. */
|
|
74
|
+
export declare function buildSavedBoard(pages: readonly SavedBoardPage[], widgets: Iterable<SavedBoardWidget>): SavedBoard;
|
|
75
|
+
/**
|
|
76
|
+
* True when the widget at `widgetIndex` is the same saved widget in both boards. A fix names its widget by
|
|
77
|
+
* position, so before applying one to a freshly fetched board, confirm the position still points where the
|
|
78
|
+
* review said it did. Widgets added, removed or moved since then change the answer, and the fix is refused
|
|
79
|
+
* instead of editing the wrong widget.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isSameWidgetAt(shown: SavedBoard | null, current: SavedBoard, widgetIndex: number): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Plan a fix again against a fresher copy of the board. A fix is planned from the board on screen and can carry
|
|
84
|
+
* whole arrays (colour rules, columns); applying it to a widget that has since changed would overwrite those
|
|
85
|
+
* edits. Re-planning rebuilds it from the current settings. Returns null when the problem is gone, or the fix
|
|
86
|
+
* has no rule to re-plan from, so nothing is written.
|
|
87
|
+
*/
|
|
88
|
+
export declare function replanFix(fix: LintFix, board: LintableBoard): LintFix | null;
|
|
89
|
+
/**
|
|
90
|
+
* Turn a planned fix into the update that applies it and a record of exactly what it changed. Returns null when
|
|
91
|
+
* the widget behind the fix is gone (for example deleted while the review was open), so nothing is written.
|
|
92
|
+
*
|
|
93
|
+
* `config` is sent whole, the same way the widget editors save it: the fix's overrides are merged over the
|
|
94
|
+
* current config.
|
|
95
|
+
*/
|
|
96
|
+
export declare function planSavedWidgetUpdate(fix: LintFix, widgetIds: readonly string[], widgets: ReadonlyMap<string, SavedBoardWidget>): SavedWidgetUpdatePlan | null;
|
|
97
|
+
/**
|
|
98
|
+
* Plan Undo against the widget as it is now. Only the title and settings the fix changed are put back, so
|
|
99
|
+
* anything else edited since stays. If one of those has itself been changed again, Undo would erase that newer
|
|
100
|
+
* edit, so it is refused instead.
|
|
101
|
+
*/
|
|
102
|
+
export declare function planSavedWidgetRestore(undo: SavedWidgetUndo, current: SavedBoardWidget | undefined): SavedWidgetRestore;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { lintBoard as e, planLintFix as t } from "./boardLint.js";
|
|
2
|
+
// src/bigconsole/utils/savedBoardLint.ts
|
|
3
|
+
function n(e, t) {
|
|
4
|
+
let n = e.position?.y ?? 0, r = t.position?.y ?? 0;
|
|
5
|
+
if (n !== r) return n - r;
|
|
6
|
+
let i = e.position?.x ?? 0, a = t.position?.x ?? 0;
|
|
7
|
+
return i === a ? e.id.localeCompare(t.id) : i - a;
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return {
|
|
11
|
+
title: e.title,
|
|
12
|
+
type: e.type,
|
|
13
|
+
config: e.config,
|
|
14
|
+
position: e.position ?? null,
|
|
15
|
+
dataSinkId: e.dataSinkId ?? null,
|
|
16
|
+
dataSourceId: e.dataSourceId ?? null,
|
|
17
|
+
parserId: e.parserId ?? null,
|
|
18
|
+
connected: e.connected ?? !!(e.dataSinkId || e.dataSourceId || e.parserId || e.datasetId || e.savedQueryId)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function i(e, t) {
|
|
22
|
+
let i = Array.from(t), a = [];
|
|
23
|
+
return {
|
|
24
|
+
board: { pages: e.map((e) => {
|
|
25
|
+
let t = i.filter((t) => t.pageId === e.id).sort(n);
|
|
26
|
+
for (let e of t) a.push(e.id);
|
|
27
|
+
return {
|
|
28
|
+
name: e.name,
|
|
29
|
+
widgets: t.map(r)
|
|
30
|
+
};
|
|
31
|
+
}) },
|
|
32
|
+
widgetIds: a
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function a(e, t, n) {
|
|
36
|
+
if (!e) return !1;
|
|
37
|
+
let r = e.widgetIds[n];
|
|
38
|
+
return r !== void 0 && t.widgetIds[n] === r;
|
|
39
|
+
}
|
|
40
|
+
function o(e, t) {
|
|
41
|
+
if (e === t) return !0;
|
|
42
|
+
if (typeof e != "object" || typeof t != "object" || e === null || t === null) return !1;
|
|
43
|
+
if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, n) => o(e, t[n]));
|
|
44
|
+
let n = Object.entries(e), r = new Map(Object.entries(t));
|
|
45
|
+
return n.length === r.size && n.every(([e, t]) => r.has(e) && o(t, r.get(e)));
|
|
46
|
+
}
|
|
47
|
+
function s(n, r) {
|
|
48
|
+
if (!n.ruleId) return null;
|
|
49
|
+
let i = e(r).find((e) => e.ruleId === n.ruleId && e.widgetFlatIndex === n.widgetIndex);
|
|
50
|
+
return i ? t(r, i) : null;
|
|
51
|
+
}
|
|
52
|
+
function c(e, t, n) {
|
|
53
|
+
let r = t[e.widgetIndex], i = r === void 0 ? void 0 : n.get(r);
|
|
54
|
+
if (!i) return null;
|
|
55
|
+
let a = e.configOverrides ?? {};
|
|
56
|
+
return {
|
|
57
|
+
update: {
|
|
58
|
+
id: i.id,
|
|
59
|
+
title: e.title ?? i.title,
|
|
60
|
+
config: {
|
|
61
|
+
...i.config,
|
|
62
|
+
...a
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
undo: {
|
|
66
|
+
id: i.id,
|
|
67
|
+
title: e.title !== void 0 && e.title !== i.title ? {
|
|
68
|
+
before: i.title,
|
|
69
|
+
after: e.title
|
|
70
|
+
} : null,
|
|
71
|
+
settings: Object.entries(a).map(([e, t]) => ({
|
|
72
|
+
key: e,
|
|
73
|
+
had: e in i.config,
|
|
74
|
+
before: i.config[e],
|
|
75
|
+
after: t
|
|
76
|
+
}))
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function l(e, t) {
|
|
81
|
+
if (!t) return {
|
|
82
|
+
ok: !1,
|
|
83
|
+
reason: "gone"
|
|
84
|
+
};
|
|
85
|
+
if (e.title && t.title !== e.title.after || e.settings.some((e) => !o(t.config[e.key], e.after))) return {
|
|
86
|
+
ok: !1,
|
|
87
|
+
reason: "changed"
|
|
88
|
+
};
|
|
89
|
+
let n = new Set(e.settings.filter((e) => !e.had).map((e) => e.key)), r = Object.fromEntries(Object.entries(t.config).filter(([e]) => !n.has(e)));
|
|
90
|
+
for (let t of e.settings) t.had && (r[t.key] = t.before);
|
|
91
|
+
return {
|
|
92
|
+
ok: !0,
|
|
93
|
+
update: {
|
|
94
|
+
id: t.id,
|
|
95
|
+
title: e.title ? e.title.before : t.title,
|
|
96
|
+
config: r
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export { i as buildSavedBoard, a as isSameWidgetAt, l as planSavedWidgetRestore, c as planSavedWidgetUpdate, s as replanFix };
|