@burdenoff/microfe-bigconsole 2026.1117.2 → 2026.1118.1
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/insights/DraftCheckDialog.d.ts +6 -0
- package/dist/bigconsole/components/insights/DraftCheckDialog.js +148 -47
- package/dist/bigconsole/pages/InsightsPage.js +551 -521
- package/dist/bigconsole/utils/boardLint.d.ts +87 -0
- package/dist/bigconsole/utils/boardLint.js +273 -0
- package/dist/bigconsole/utils/consoleDefinition.d.ts +9 -0
- package/package.json +4 -4
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { GeneratedDashboardSpecLike } from '../../utils/consoleDefinition';
|
|
3
|
+
import { LintFix } from '../../utils/boardLint';
|
|
3
4
|
export interface DraftCheckDialogProps {
|
|
4
5
|
open: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
/** The generated proposal being checked. */
|
|
7
8
|
spec: GeneratedDashboardSpecLike | null;
|
|
9
|
+
/**
|
|
10
|
+
* Applies one Board Lint fix as a refined copy of the draft (the original is never changed).
|
|
11
|
+
* When omitted, findings are listed without a "Fix it" action.
|
|
12
|
+
*/
|
|
13
|
+
onApplyFix?: (fix: LintFix) => Promise<void>;
|
|
8
14
|
}
|
|
9
15
|
export declare const DraftCheckDialog: FC<DraftCheckDialogProps>;
|
|
10
16
|
export default DraftCheckDialog;
|
|
@@ -2,37 +2,53 @@ import { BigConsoleValidateConsoleDefinitionDocument as e } from "../../../gener
|
|
|
2
2
|
import { Section as t } from "../common/Section.js";
|
|
3
3
|
import "../common/index.js";
|
|
4
4
|
import { buildConsoleDefinition as n } from "../../utils/consoleDefinition.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { lintBoard as r, planLintFix as i } from "../../utils/boardLint.js";
|
|
6
|
+
import { memo as a, useEffect as o, useMemo as s, useState as c } from "react";
|
|
7
|
+
import { CheckCircle as l, Loader2 as u, TriangleAlert as d, XCircle as f } from "lucide-react";
|
|
8
|
+
import { Button as p, Dialog as m, DialogContent as h, DialogDescription as g, DialogHeader as _, DialogTitle as v } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
10
|
+
import { useLazyQuery as b } from "@apollo/client/react";
|
|
11
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
11
12
|
// src/bigconsole/components/insights/DraftCheckDialog.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var w = a(function({ open: a, onClose: w, spec: T, onApplyFix: E }) {
|
|
14
|
+
let { t: D } = y(), [O, k] = c(null), [A, j] = c(null), M = s(() => T ? r(T, { draft: !0 }) : [], [T]), [N, P] = c(null), [F, I] = c(!1), [L, R] = c(null), z = s(() => T && N !== null && M[N] ? i(T, M[N]) : null, [
|
|
15
|
+
T,
|
|
16
|
+
N,
|
|
17
|
+
M
|
|
18
|
+
]), B = async () => {
|
|
19
|
+
if (z && E) {
|
|
20
|
+
I(!0), R(null);
|
|
21
|
+
try {
|
|
22
|
+
await E(z), P(null), w();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
R(e instanceof Error ? e.message : String(e));
|
|
25
|
+
} finally {
|
|
26
|
+
I(!1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [V, { loading: H }] = b(e, { fetchPolicy: "no-cache" });
|
|
30
|
+
return o(() => {
|
|
31
|
+
a && T && (k(null), j(null), P(null), R(null), V({ variables: { definition: n(T) } }).then((e) => {
|
|
32
|
+
e.data && k(e.data.validateConsoleDefinition.errors);
|
|
17
33
|
}).catch((e) => {
|
|
18
|
-
|
|
34
|
+
j(e instanceof Error ? e.message : String(e));
|
|
19
35
|
}));
|
|
20
36
|
}, [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]), /* @__PURE__ */
|
|
25
|
-
open:
|
|
26
|
-
onOpenChange: (e) => !e && !
|
|
27
|
-
children: /* @__PURE__ */
|
|
37
|
+
a,
|
|
38
|
+
T,
|
|
39
|
+
V
|
|
40
|
+
]), /* @__PURE__ */ S(m, {
|
|
41
|
+
open: a,
|
|
42
|
+
onOpenChange: (e) => !e && !H && w(),
|
|
43
|
+
children: /* @__PURE__ */ C(h, {
|
|
28
44
|
className: "sm:max-w-lg flex max-h-[calc(100dvh-3rem)] flex-col overflow-hidden",
|
|
29
|
-
children: [/* @__PURE__ */
|
|
45
|
+
children: [/* @__PURE__ */ C(_, {
|
|
30
46
|
className: "shrink-0",
|
|
31
|
-
children: [/* @__PURE__ */ v
|
|
32
|
-
}), /* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ C(v, { children: [D("bigconsole.analysis.draftCheck.title", "Draft check"), T ? ` — ${T.name}` : ""] }), /* @__PURE__ */ S(g, { children: D("bigconsole.analysis.draftCheck.description", "The proposal is validated against the Console Definition contract. Fix flagged issues by refining the draft before creating the dashboard.") })]
|
|
48
|
+
}), /* @__PURE__ */ C("div", {
|
|
33
49
|
className: "min-h-0 flex-1 overflow-y-auto py-4 space-y-4",
|
|
34
50
|
children: [
|
|
35
|
-
|
|
51
|
+
H && /* @__PURE__ */ C("div", {
|
|
36
52
|
style: {
|
|
37
53
|
display: "flex",
|
|
38
54
|
minHeight: "6rem",
|
|
@@ -42,53 +58,53 @@ var y = r(function({ open: r, onClose: y, spec: b }) {
|
|
|
42
58
|
gap: "var(--space-controlGap)",
|
|
43
59
|
color: "var(--color-text-muted)"
|
|
44
60
|
},
|
|
45
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ S(u, {
|
|
46
62
|
size: 24,
|
|
47
63
|
className: "animate-spin",
|
|
48
64
|
"aria-hidden": "true"
|
|
49
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ S("p", {
|
|
50
66
|
style: { fontSize: "var(--font-size-body-sm)" },
|
|
51
|
-
children:
|
|
67
|
+
children: D("bigconsole.analysis.draftCheck.checking", "Checking the draft…")
|
|
52
68
|
})]
|
|
53
69
|
}),
|
|
54
|
-
|
|
70
|
+
A && !H && /* @__PURE__ */ S(t, {
|
|
55
71
|
headingLevel: 3,
|
|
56
72
|
tone: "danger",
|
|
57
73
|
padding: "compact",
|
|
58
|
-
icon: /* @__PURE__ */
|
|
59
|
-
title:
|
|
60
|
-
description:
|
|
74
|
+
icon: /* @__PURE__ */ S(f, { className: "size-4" }),
|
|
75
|
+
title: D("bigconsole.analysis.draftCheck.failedTitle", "Draft check failed"),
|
|
76
|
+
description: A,
|
|
61
77
|
"data-testid": "draft-check-error"
|
|
62
78
|
}),
|
|
63
|
-
|
|
79
|
+
O && !H && !A && /* @__PURE__ */ S(x, { children: O.length === 0 ? /* @__PURE__ */ S(t, {
|
|
64
80
|
headingLevel: 3,
|
|
65
81
|
tone: "success",
|
|
66
82
|
padding: "compact",
|
|
67
|
-
icon: /* @__PURE__ */
|
|
68
|
-
title:
|
|
69
|
-
description:
|
|
83
|
+
icon: /* @__PURE__ */ S(l, { className: "size-4" }),
|
|
84
|
+
title: D("bigconsole.analysis.draftCheck.cleanTitle", "Draft is structurally sound"),
|
|
85
|
+
description: D("bigconsole.analysis.draftCheck.cleanDescription", "The proposal satisfies the Console Definition v2.0 contract — pages, widget types and titles all check out."),
|
|
70
86
|
"data-testid": "draft-check-clean"
|
|
71
|
-
}) : /* @__PURE__ */
|
|
87
|
+
}) : /* @__PURE__ */ S(t, {
|
|
72
88
|
headingLevel: 3,
|
|
73
89
|
tone: "danger",
|
|
74
90
|
padding: "compact",
|
|
75
|
-
icon: /* @__PURE__ */
|
|
76
|
-
title:
|
|
77
|
-
count:
|
|
78
|
-
plural:
|
|
91
|
+
icon: /* @__PURE__ */ S(f, { className: "size-4" }),
|
|
92
|
+
title: D("bigconsole.analysis.draftCheck.issuesTitle", "{{count}} issue{{plural}} found", {
|
|
93
|
+
count: O.length,
|
|
94
|
+
plural: O.length === 1 ? "" : "s"
|
|
79
95
|
}),
|
|
80
|
-
description:
|
|
96
|
+
description: D("bigconsole.analysis.draftCheck.issuesDescription", "Each issue points at the exact location in the draft. Refine the generation and check again."),
|
|
81
97
|
"data-testid": "draft-check-issues",
|
|
82
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ S("ul", {
|
|
83
99
|
className: "space-y-2",
|
|
84
|
-
children:
|
|
100
|
+
children: O.map((e, t) => /* @__PURE__ */ C("li", {
|
|
85
101
|
style: {
|
|
86
102
|
padding: "var(--space-controlGap)",
|
|
87
103
|
borderRadius: "var(--radius-input)",
|
|
88
104
|
border: "1px solid var(--color-border-subtle)",
|
|
89
105
|
backgroundColor: "var(--color-bg-surface)"
|
|
90
106
|
},
|
|
91
|
-
children: [/* @__PURE__ */
|
|
107
|
+
children: [/* @__PURE__ */ S("span", {
|
|
92
108
|
style: {
|
|
93
109
|
display: "block",
|
|
94
110
|
fontFamily: "var(--font-family-mono, monospace)",
|
|
@@ -97,13 +113,13 @@ var y = r(function({ open: r, onClose: y, spec: b }) {
|
|
|
97
113
|
wordBreak: "break-all"
|
|
98
114
|
},
|
|
99
115
|
children: e.path
|
|
100
|
-
}), /* @__PURE__ */
|
|
116
|
+
}), /* @__PURE__ */ C("span", {
|
|
101
117
|
style: {
|
|
102
118
|
fontSize: "var(--font-size-body-sm)",
|
|
103
119
|
color: "var(--color-text-primary)"
|
|
104
120
|
},
|
|
105
121
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ C("span", {
|
|
107
123
|
style: { fontWeight: "var(--font-weight-semibold)" },
|
|
108
124
|
children: [
|
|
109
125
|
"[",
|
|
@@ -117,10 +133,95 @@ var y = r(function({ open: r, onClose: y, spec: b }) {
|
|
|
117
133
|
})]
|
|
118
134
|
}, `${e.path}-${e.code}-${t}`))
|
|
119
135
|
})
|
|
120
|
-
}) })
|
|
136
|
+
}) }),
|
|
137
|
+
!H && T && /* @__PURE__ */ S(t, {
|
|
138
|
+
headingLevel: 3,
|
|
139
|
+
tone: M.length === 0 ? "success" : "warning",
|
|
140
|
+
padding: "compact",
|
|
141
|
+
icon: M.length === 0 ? /* @__PURE__ */ S(l, { className: "size-4" }) : /* @__PURE__ */ S(d, { className: "size-4" }),
|
|
142
|
+
title: M.length === 0 ? D("bigconsole.analysis.boardLint.cleanTitle", "No chart-quality problems found") : D("bigconsole.analysis.boardLint.issuesTitle", "{{count}} chart-quality note{{plural}}", {
|
|
143
|
+
count: M.length,
|
|
144
|
+
plural: M.length === 1 ? "" : "s"
|
|
145
|
+
}),
|
|
146
|
+
description: D("bigconsole.analysis.boardLint.description", "A quick review of axes, colours and labels. These do not block creating the dashboard."),
|
|
147
|
+
"data-testid": "board-lint",
|
|
148
|
+
children: M.length > 0 && /* @__PURE__ */ S("ul", {
|
|
149
|
+
className: "space-y-2",
|
|
150
|
+
"data-testid": "board-lint-findings",
|
|
151
|
+
children: M.map((e, t) => /* @__PURE__ */ C("li", {
|
|
152
|
+
"data-rule": e.ruleId,
|
|
153
|
+
style: {
|
|
154
|
+
padding: "var(--space-controlGap)",
|
|
155
|
+
borderRadius: "var(--radius-input)",
|
|
156
|
+
border: "1px solid var(--color-border-subtle)",
|
|
157
|
+
backgroundColor: "var(--color-bg-surface)",
|
|
158
|
+
fontSize: "var(--font-size-body-sm)",
|
|
159
|
+
color: "var(--color-text-primary)"
|
|
160
|
+
},
|
|
161
|
+
children: [
|
|
162
|
+
D(`bigconsole.analysis.boardLint.rule.${e.ruleId}`, e.message),
|
|
163
|
+
E && e.fixable && N !== t && /* @__PURE__ */ S("div", {
|
|
164
|
+
style: { marginTop: "var(--space-controlGap)" },
|
|
165
|
+
children: /* @__PURE__ */ S(p, {
|
|
166
|
+
type: "button",
|
|
167
|
+
size: "sm",
|
|
168
|
+
variant: "outline",
|
|
169
|
+
onClick: () => {
|
|
170
|
+
R(null), P(t);
|
|
171
|
+
},
|
|
172
|
+
"data-testid": "board-lint-fix",
|
|
173
|
+
children: D("bigconsole.analysis.boardLint.fixIt", "Fix it")
|
|
174
|
+
})
|
|
175
|
+
}),
|
|
176
|
+
N === t && z && /* @__PURE__ */ C("div", {
|
|
177
|
+
"data-testid": "board-lint-preview",
|
|
178
|
+
style: {
|
|
179
|
+
marginTop: "var(--space-controlGap)",
|
|
180
|
+
color: "var(--color-text-muted)"
|
|
181
|
+
},
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ C("p", { children: [
|
|
184
|
+
/* @__PURE__ */ C("span", {
|
|
185
|
+
style: { fontWeight: "var(--font-weight-semibold)" },
|
|
186
|
+
children: [D("bigconsole.analysis.boardLint.previewLabel", "Proposed change"), ":"]
|
|
187
|
+
}),
|
|
188
|
+
" ",
|
|
189
|
+
z.summary
|
|
190
|
+
] }),
|
|
191
|
+
/* @__PURE__ */ S("p", { children: D("bigconsole.analysis.boardLint.previewNote", "This creates a refined copy of the draft. Your current draft stays as it is.") }),
|
|
192
|
+
L && /* @__PURE__ */ S("p", {
|
|
193
|
+
role: "alert",
|
|
194
|
+
style: { color: "var(--color-status-danger-text, var(--color-text-primary))" },
|
|
195
|
+
children: L
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ C("div", {
|
|
198
|
+
className: "flex gap-2",
|
|
199
|
+
style: { marginTop: "var(--space-controlGap)" },
|
|
200
|
+
children: [/* @__PURE__ */ S(p, {
|
|
201
|
+
type: "button",
|
|
202
|
+
size: "sm",
|
|
203
|
+
onClick: B,
|
|
204
|
+
disabled: F,
|
|
205
|
+
"data-testid": "board-lint-apply",
|
|
206
|
+
children: F ? D("bigconsole.analysis.boardLint.applying", "Creating…") : D("bigconsole.analysis.boardLint.apply", "Create refined draft")
|
|
207
|
+
}), /* @__PURE__ */ S(p, {
|
|
208
|
+
type: "button",
|
|
209
|
+
size: "sm",
|
|
210
|
+
variant: "outline",
|
|
211
|
+
onClick: () => P(null),
|
|
212
|
+
disabled: F,
|
|
213
|
+
children: D("bigconsole.analysis.boardLint.cancel", "Cancel")
|
|
214
|
+
})]
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
}, `${e.ruleId}-${e.pageIndex}-${e.widgetIndex}-${t}`))
|
|
220
|
+
})
|
|
221
|
+
})
|
|
121
222
|
]
|
|
122
223
|
})]
|
|
123
224
|
})
|
|
124
225
|
});
|
|
125
226
|
});
|
|
126
|
-
export {
|
|
227
|
+
export { w as DraftCheckDialog, w as default };
|