@burdenoff/microfe-bigconsole 2026.1122.3 → 2026.1122.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/dashboard/DashboardCommentsDrawer.d.ts +16 -0
- package/dist/bigconsole/components/dashboard/DashboardCommentsDrawer.js +308 -0
- package/dist/bigconsole/components/dashboard/DashboardPresenceBar.d.ts +8 -0
- package/dist/bigconsole/components/dashboard/DashboardPresenceBar.js +138 -0
- package/dist/bigconsole/components/dashboard/index.d.ts +2 -0
- package/dist/bigconsole/components/dashboard/index.js +3 -1
- package/dist/bigconsole/components/widgets/WidgetWrapper.js +1 -0
- package/dist/bigconsole/components/widgets/comments/WidgetComments.d.ts +13 -0
- package/dist/bigconsole/components/widgets/comments/WidgetComments.js +213 -117
- package/dist/bigconsole/components/widgets/comments/commentMentions.d.ts +58 -0
- package/dist/bigconsole/components/widgets/comments/commentMentions.js +66 -0
- package/dist/bigconsole/hooks/index.d.ts +2 -1
- package/dist/bigconsole/hooks/index.js +1 -0
- package/dist/bigconsole/hooks/useDashboardPresence.d.ts +44 -0
- package/dist/bigconsole/hooks/useDashboardPresence.js +147 -0
- package/dist/bigconsole/hooks/useWidgetComments.d.ts +12 -1
- package/dist/bigconsole/hooks/useWidgetComments.js +25 -13
- package/dist/bigconsole/pages/DashboardBuilderPage.js +88 -64
- package/dist/bigconsole/pages/DashboardViewPage.js +255 -226
- package/dist/generated/wspace-operations.d.ts +35 -0
- package/dist/generated/wspace-operations.js +353 -54
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import "../context/index.js";
|
|
2
|
+
import { useBigConsole as e } from "../context/BigConsoleContext.js";
|
|
3
|
+
import { BigConsoleDashboardPresenceDocument as t, BigConsoleShareMemberIdentitiesDocument as n, HeartbeatBigConsoleDashboardPresenceDocument as r, LeaveBigConsoleDashboardPresenceDocument as i } from "../../generated/wspace-operations.js";
|
|
4
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
5
|
+
import { useApolloClient as u, useMutation as d, useQuery as f } from "@apollo/client/react";
|
|
6
|
+
// src/bigconsole/hooks/useDashboardPresence.ts
|
|
7
|
+
var p = 15e3, m = 15e3;
|
|
8
|
+
function h() {
|
|
9
|
+
if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return `bc-${crypto.randomUUID()}`;
|
|
10
|
+
let e = Math.random().toString(36).slice(2, 12);
|
|
11
|
+
return `bc-${Date.now().toString(36)}-${e}`;
|
|
12
|
+
}
|
|
13
|
+
function g(e) {
|
|
14
|
+
return `User ${e.slice(0, 6)}`;
|
|
15
|
+
}
|
|
16
|
+
function _(_, v = !0) {
|
|
17
|
+
let y = u(), { workspaceId: b, currentUser: x } = e(), S = !!(v && _), C = c(null);
|
|
18
|
+
C.current ||= h();
|
|
19
|
+
let w = C.current, [T] = d(r), [E] = d(i), { data: D, loading: O, error: k, refetch: A } = f(t, {
|
|
20
|
+
variables: { dashboardId: _ ?? "" },
|
|
21
|
+
skip: !S,
|
|
22
|
+
fetchPolicy: "network-only",
|
|
23
|
+
nextFetchPolicy: "network-only",
|
|
24
|
+
pollInterval: S ? m : 0,
|
|
25
|
+
notifyOnNetworkStatusChange: !1
|
|
26
|
+
}), [j, M] = l(!1), [N, P] = l({}), F = c(/* @__PURE__ */ new Set()), I = a(async () => {
|
|
27
|
+
if (_) try {
|
|
28
|
+
let e = (await T({ variables: {
|
|
29
|
+
dashboardId: _,
|
|
30
|
+
connectionId: w
|
|
31
|
+
} })).data?.heartbeatDashboardPresence;
|
|
32
|
+
M(e === !1);
|
|
33
|
+
} catch {
|
|
34
|
+
M(!0);
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
w,
|
|
38
|
+
_,
|
|
39
|
+
T
|
|
40
|
+
]), L = a(() => {
|
|
41
|
+
_ && E({ variables: {
|
|
42
|
+
dashboardId: _,
|
|
43
|
+
connectionId: w
|
|
44
|
+
} }).catch(() => {});
|
|
45
|
+
}, [
|
|
46
|
+
w,
|
|
47
|
+
_,
|
|
48
|
+
E
|
|
49
|
+
]);
|
|
50
|
+
o(() => {
|
|
51
|
+
if (!S || !_) return;
|
|
52
|
+
let e = !1, t = async (t) => {
|
|
53
|
+
(typeof document > "u" || document.visibilityState !== "hidden") && (await I(), !e && t && A().catch(() => {}));
|
|
54
|
+
};
|
|
55
|
+
t(!0);
|
|
56
|
+
let n = window.setInterval(() => {
|
|
57
|
+
t(!1);
|
|
58
|
+
}, p), r = () => {
|
|
59
|
+
document.visibilityState === "visible" && t(!0);
|
|
60
|
+
}, i = () => {
|
|
61
|
+
L();
|
|
62
|
+
};
|
|
63
|
+
return typeof document < "u" && document.addEventListener("visibilitychange", r), typeof window < "u" && window.addEventListener("pagehide", i), () => {
|
|
64
|
+
e = !0, window.clearInterval(n), typeof document < "u" && document.removeEventListener("visibilitychange", r), typeof window < "u" && window.removeEventListener("pagehide", i), L();
|
|
65
|
+
};
|
|
66
|
+
}, [
|
|
67
|
+
S,
|
|
68
|
+
_,
|
|
69
|
+
A,
|
|
70
|
+
I,
|
|
71
|
+
L
|
|
72
|
+
]), o(() => {
|
|
73
|
+
F.current = /* @__PURE__ */ new Set(), P({});
|
|
74
|
+
}, [b]);
|
|
75
|
+
let R = D?.dashboardPresence.viewers;
|
|
76
|
+
o(() => {
|
|
77
|
+
if (!S || !b || !R || R.length === 0) return;
|
|
78
|
+
let e = R.map((e) => e.actorId).filter((e) => e !== x?.id && !F.current.has(e));
|
|
79
|
+
if (e.length === 0) return;
|
|
80
|
+
for (let t of e) F.current.add(t);
|
|
81
|
+
let t = !1;
|
|
82
|
+
return y.query({
|
|
83
|
+
query: n,
|
|
84
|
+
variables: {
|
|
85
|
+
workspaceId: b,
|
|
86
|
+
userIds: e.slice(0, 50)
|
|
87
|
+
},
|
|
88
|
+
fetchPolicy: "no-cache",
|
|
89
|
+
errorPolicy: "none",
|
|
90
|
+
context: {
|
|
91
|
+
requiredWorkspaceAuth: !0,
|
|
92
|
+
requiredWorkspaceId: b,
|
|
93
|
+
queryDeduplication: !1
|
|
94
|
+
}
|
|
95
|
+
}).then((e) => {
|
|
96
|
+
if (t) return;
|
|
97
|
+
let n = e.data?.workspaceMemberIdentities ?? [];
|
|
98
|
+
n.length !== 0 && P((e) => {
|
|
99
|
+
let t = { ...e };
|
|
100
|
+
for (let e of n) t[e.userId] = {
|
|
101
|
+
displayName: e.displayName,
|
|
102
|
+
...e.email ? { email: e.email } : {}
|
|
103
|
+
};
|
|
104
|
+
return t;
|
|
105
|
+
});
|
|
106
|
+
}).catch(() => {
|
|
107
|
+
for (let t of e) F.current.delete(t);
|
|
108
|
+
}), () => {
|
|
109
|
+
t = !0;
|
|
110
|
+
};
|
|
111
|
+
}, [
|
|
112
|
+
S,
|
|
113
|
+
y,
|
|
114
|
+
x?.id,
|
|
115
|
+
R,
|
|
116
|
+
b
|
|
117
|
+
]);
|
|
118
|
+
let z = s(() => R ? R.map((e) => {
|
|
119
|
+
let t = !!(x?.id && e.actorId === x.id), n = N[e.actorId], r = t ? x?.name || x?.email || n?.displayName || g(e.actorId) : n?.displayName || g(e.actorId), i = t ? x?.email ?? n?.email : n?.email;
|
|
120
|
+
return {
|
|
121
|
+
actorId: e.actorId,
|
|
122
|
+
displayName: r,
|
|
123
|
+
...i ? { email: i } : {},
|
|
124
|
+
connectionCount: e.connectionCount,
|
|
125
|
+
lastSeenAt: String(e.lastSeenAt),
|
|
126
|
+
isCurrentUser: t
|
|
127
|
+
};
|
|
128
|
+
}).sort((e, t) => e.isCurrentUser === t.isCurrentUser ? e.displayName.localeCompare(t.displayName) : e.isCurrentUser ? -1 : 1) : [], [
|
|
129
|
+
x?.email,
|
|
130
|
+
x?.id,
|
|
131
|
+
x?.name,
|
|
132
|
+
N,
|
|
133
|
+
R
|
|
134
|
+
]), B = !!(D?.dashboardPresence.unavailable || j && z.length === 0);
|
|
135
|
+
return {
|
|
136
|
+
viewers: z,
|
|
137
|
+
activeCount: z.length,
|
|
138
|
+
unavailable: B,
|
|
139
|
+
loading: O,
|
|
140
|
+
error: k,
|
|
141
|
+
connectionId: w,
|
|
142
|
+
refetch: a(() => {
|
|
143
|
+
S && A().catch(() => {});
|
|
144
|
+
}, [S, A])
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
export { p as PRESENCE_HEARTBEAT_INTERVAL_MS, m as PRESENCE_POLL_INTERVAL_MS, h as buildPresenceConnectionId, _ as default, _ as useDashboardPresence };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { EntityCommentFieldsFragment } from '../../generated/wspace-operations';
|
|
2
|
+
import { CommentAnchor } from '../components/widgets/comments/commentMentions';
|
|
2
3
|
/** Entity type used to scope comments to a BigConsole widget. */
|
|
3
4
|
export declare const WIDGET_COMMENT_ENTITY_TYPE = "bigconsole-widget";
|
|
5
|
+
/** Entity type used to scope comments (including region/widget-anchored notes) to a BigConsole dashboard. */
|
|
6
|
+
export declare const DASHBOARD_COMMENT_ENTITY_TYPE = "bigconsole-dashboard";
|
|
4
7
|
/** A top-level comment with its (one level of) replies attached. */
|
|
5
8
|
export interface WidgetCommentThread {
|
|
6
9
|
comment: EntityCommentFieldsFragment;
|
|
7
10
|
replies: EntityCommentFieldsFragment[];
|
|
8
11
|
}
|
|
12
|
+
export interface AddCommentOptions {
|
|
13
|
+
parentCommentId?: string;
|
|
14
|
+
mentionUserIds?: string[];
|
|
15
|
+
mentionNames?: string[];
|
|
16
|
+
anchor?: CommentAnchor;
|
|
17
|
+
}
|
|
9
18
|
export interface UseWidgetCommentsResult {
|
|
10
19
|
threads: WidgetCommentThread[];
|
|
11
20
|
/** Total comment count (top-level + replies), excluding deleted. */
|
|
@@ -13,10 +22,12 @@ export interface UseWidgetCommentsResult {
|
|
|
13
22
|
loading: boolean;
|
|
14
23
|
error?: Error;
|
|
15
24
|
mutating: boolean;
|
|
16
|
-
addComment: (text: string,
|
|
25
|
+
addComment: (text: string, parentOrOptions?: string | AddCommentOptions) => Promise<boolean>;
|
|
17
26
|
resolveComment: (id: string, resolved: boolean) => Promise<boolean>;
|
|
18
27
|
deleteComment: (id: string) => Promise<boolean>;
|
|
19
28
|
refetch: () => void;
|
|
20
29
|
}
|
|
30
|
+
export declare function useEntityComments(entityId: string | undefined, entityType: string, enabled?: boolean): UseWidgetCommentsResult;
|
|
21
31
|
export declare function useWidgetComments(widgetId: string | undefined, enabled?: boolean): UseWidgetCommentsResult;
|
|
32
|
+
export declare function useDashboardComments(dashboardId: string | undefined, enabled?: boolean): UseWidgetCommentsResult;
|
|
22
33
|
export default useWidgetComments;
|
|
@@ -3,28 +3,29 @@ import { ContentType as i } from "../../generated/wspace-types.js";
|
|
|
3
3
|
import { useCallback as a, useMemo as o, useState as s } from "react";
|
|
4
4
|
import { useMutation as c, useQuery as l } from "@apollo/client/react";
|
|
5
5
|
// src/bigconsole/hooks/useWidgetComments.ts
|
|
6
|
-
var u = "bigconsole-widget";
|
|
7
|
-
function
|
|
6
|
+
var u = "bigconsole-widget", d = "bigconsole-dashboard";
|
|
7
|
+
function f(u, d, f = !0) {
|
|
8
8
|
let { data: p, dataState: m, loading: h, error: g, refetch: _ } = l(n, {
|
|
9
9
|
returnPartialData: !1,
|
|
10
10
|
variables: { input: {
|
|
11
|
-
entityId:
|
|
12
|
-
entityType:
|
|
11
|
+
entityId: u ?? "",
|
|
12
|
+
entityType: d,
|
|
13
13
|
take: 100,
|
|
14
14
|
sortBy: "createdAt",
|
|
15
15
|
sortOrder: "asc"
|
|
16
16
|
} },
|
|
17
|
-
skip: !f || !
|
|
17
|
+
skip: !f || !u,
|
|
18
18
|
fetchPolicy: "cache-and-network",
|
|
19
19
|
notifyOnNetworkStatusChange: !0
|
|
20
20
|
}), v = m === "complete" ? p : void 0, [y, b] = c(e), [x, S] = c(r), [C, w] = c(t), [T, E] = s([]), D = o(() => {
|
|
21
21
|
let e = /* @__PURE__ */ new Map();
|
|
22
22
|
for (let t of v?.getEntityComments.items ?? []) e.set(t.id, t);
|
|
23
|
-
for (let t of T) t.entityId === d && e.set(t.id, t);
|
|
23
|
+
for (let t of T) t.entityId === u && t.entityType === d && e.set(t.id, t);
|
|
24
24
|
return [...e.values()].sort((e, t) => e.createdAt.localeCompare(t.createdAt));
|
|
25
25
|
}, [
|
|
26
26
|
T,
|
|
27
27
|
v,
|
|
28
|
+
u,
|
|
28
29
|
d
|
|
29
30
|
]), O = v?.getEntityComments.total ?? D.length, k = o(() => {
|
|
30
31
|
let e = D.filter((e) => !e.parentCommentId), t = /* @__PURE__ */ new Map();
|
|
@@ -38,14 +39,18 @@ function d(d, f = !0) {
|
|
|
38
39
|
}));
|
|
39
40
|
}, [D]), A = a(async (e, t) => {
|
|
40
41
|
let n = e.trim();
|
|
41
|
-
if (!n || !
|
|
42
|
+
if (!n || !u) return !1;
|
|
43
|
+
let r = typeof t == "string" ? { parentCommentId: t } : t ?? {}, a = r.mentionUserIds ? [...new Set(r.mentionUserIds.map((e) => e.trim()).filter(Boolean))] : [], o = {};
|
|
44
|
+
r.anchor && (o.anchor = r.anchor), r.mentionNames && r.mentionNames.length > 0 && (o.mentionNames = [...new Set(r.mentionNames.map((e) => e.trim()).filter(Boolean))]);
|
|
42
45
|
try {
|
|
43
46
|
let e = (await y({ variables: { input: {
|
|
44
|
-
entityId:
|
|
45
|
-
entityType:
|
|
47
|
+
entityId: u,
|
|
48
|
+
entityType: d,
|
|
46
49
|
content: { text: n },
|
|
47
50
|
contentType: i.Text,
|
|
48
|
-
...
|
|
51
|
+
...r.parentCommentId ? { parentCommentId: r.parentCommentId } : {},
|
|
52
|
+
...a.length > 0 ? { mentionUserIds: a } : {},
|
|
53
|
+
...Object.keys(o).length > 0 ? { metadata: o } : {}
|
|
49
54
|
} } })).data?.createEntityComment;
|
|
50
55
|
return e ? (E((t) => t.some((t) => t.id === e.id) ? t : [...t, e]), await _(), !0) : !1;
|
|
51
56
|
} catch {
|
|
@@ -53,8 +58,9 @@ function d(d, f = !0) {
|
|
|
53
58
|
}
|
|
54
59
|
}, [
|
|
55
60
|
y,
|
|
56
|
-
|
|
57
|
-
d
|
|
61
|
+
u,
|
|
62
|
+
d,
|
|
63
|
+
_
|
|
58
64
|
]), j = a(async (e, t) => {
|
|
59
65
|
try {
|
|
60
66
|
let n = (await x({ variables: { input: {
|
|
@@ -89,4 +95,10 @@ function d(d, f = !0) {
|
|
|
89
95
|
}, [_])
|
|
90
96
|
};
|
|
91
97
|
}
|
|
92
|
-
|
|
98
|
+
function p(e, t = !0) {
|
|
99
|
+
return f(e, u, t);
|
|
100
|
+
}
|
|
101
|
+
function m(e, t = !0) {
|
|
102
|
+
return f(e, d, t);
|
|
103
|
+
}
|
|
104
|
+
export { d as DASHBOARD_COMMENT_ENTITY_TYPE, u as WIDGET_COMMENT_ENTITY_TYPE, p as default, p as useWidgetComments, m as useDashboardComments, f as useEntityComments };
|
|
@@ -20,27 +20,29 @@ import { useDashboardLayoutBaseline as re } from "../hooks/useDashboardLayoutBas
|
|
|
20
20
|
import "../customWidget/index.js";
|
|
21
21
|
import { DashboardCanvas as ie } from "../components/dashboard/DashboardCanvas.js";
|
|
22
22
|
import { ExportDashboardDialog as ae } from "../components/dashboard/ExportDashboardDialog.js";
|
|
23
|
+
import { DashboardPresenceBar as oe } from "../components/dashboard/DashboardPresenceBar.js";
|
|
24
|
+
import { DashboardCommentsDrawer as se } from "../components/dashboard/DashboardCommentsDrawer.js";
|
|
23
25
|
import "../components/common/index.js";
|
|
24
|
-
import { findNextAvailablePosition as
|
|
25
|
-
import { layoutItemsFromPositionUpdates as
|
|
26
|
-
import { CustomWidgetBuilderSheet as
|
|
27
|
-
import { loadBigConsoleSettings as
|
|
28
|
-
import { registerBreadcrumbName as
|
|
26
|
+
import { findNextAvailablePosition as ce } from "../utils/widgetPositioning.js";
|
|
27
|
+
import { layoutItemsFromPositionUpdates as le } from "../utils/layoutBaseline.js";
|
|
28
|
+
import { CustomWidgetBuilderSheet as ue } from "../customWidget/CustomWidgetBuilderSheet.js";
|
|
29
|
+
import { loadBigConsoleSettings as de } from "../hooks/useBigConsoleSettings.js";
|
|
30
|
+
import { registerBreadcrumbName as fe, unregisterBreadcrumbName as pe } from "../utils/breadcrumbRegistry.js";
|
|
29
31
|
import { memo as u, useCallback as d, useEffect as f, useState as p } from "react";
|
|
30
|
-
import { useParams as
|
|
31
|
-
import { AccessDenied as
|
|
32
|
-
import { usePermissions as
|
|
33
|
-
import { Button as
|
|
34
|
-
import { useUnsavedChanges as
|
|
35
|
-
import { useI18n as
|
|
32
|
+
import { useParams as me } from "react-router";
|
|
33
|
+
import { AccessDenied as he } from "@burdenoff/fe-libs/shared/components";
|
|
34
|
+
import { usePermissions as ge } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
35
|
+
import { Button as _e } from "@burdenoff/fe-libs/ui";
|
|
36
|
+
import { useUnsavedChanges as ve } from "@burdenoff/fe-libs/shared/hooks";
|
|
37
|
+
import { useI18n as ye } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
36
38
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
37
39
|
// src/bigconsole/pages/DashboardBuilderPage.tsx
|
|
38
40
|
var g = u(function() {
|
|
39
|
-
let { dashboardId: u } =
|
|
40
|
-
|
|
41
|
+
let { dashboardId: u } = me(), g = r(), { t: _ } = ye(), { hasPermission: v, isLoading: be } = ge(), xe = v(n.DASHBOARD_READ), y = v(n.DASHBOARD_UPDATE), Se = v(n.DASHBOARD_EXPORT), Ce = v(n.WIDGET_CREATE), [we, b] = p(!1), [x, S] = p(null), [Te, C] = p(!1), [Ee, w] = p(!1), [T, E] = p(!1), { fetchDashboard: D, updateDashboard: O, loading: De, error: k } = s(), { createWidget: A, updateWidget: j, deleteWidget: M, duplicateWidget: N, batchUpdatePositions: P, loadPageWidgets: F } = o(void 0, u), { createPage: I, updatePage: L, deletePage: R, duplicatePage: z, reorderPages: B } = c(), V = t((e) => e.setCurrentDashboard), H = t((e) => e.currentDashboard), { activePageId: U, setActivePage: W } = l(H?.id === u ? H?.pages : void 0), G = t((e) => e.setViewMode), K = e((e) => e.selectWidget), q = e((e) => e.widgets), J = e((e) => e.clipboardWidgetId), Y = e((e) => e.clipboardAction), X = e((e) => e.clearClipboard), { dirty: Oe, markSaved: Z } = re(u);
|
|
42
|
+
ve({
|
|
41
43
|
id: "dashboard-editor",
|
|
42
44
|
label: _("bigconsole.assistant.unsaved.dashboardEditor", "the dashboard editor"),
|
|
43
|
-
dirty: y &&
|
|
45
|
+
dirty: y && Oe
|
|
44
46
|
}), f(() => (G("edit"), () => G("view")), [G]), f(() => {
|
|
45
47
|
if (!u) g("/dashboards");
|
|
46
48
|
else return D(u).then((e) => {
|
|
@@ -57,10 +59,10 @@ var g = u(function() {
|
|
|
57
59
|
layoutConfig: e.layoutConfig ?? {}
|
|
58
60
|
}))
|
|
59
61
|
};
|
|
60
|
-
V(t), e.name &&
|
|
62
|
+
V(t), e.name && fe(u, e.name);
|
|
61
63
|
} else g("/dashboards");
|
|
62
64
|
}), () => {
|
|
63
|
-
u &&
|
|
65
|
+
u && pe(u);
|
|
64
66
|
};
|
|
65
67
|
}, [
|
|
66
68
|
u,
|
|
@@ -79,7 +81,7 @@ var g = u(function() {
|
|
|
79
81
|
let n = Array.from(q.values()).filter((t) => t.pageId === e), r = H?.pages.find((t) => t.id === e)?.gridColumns ?? 12, i = {
|
|
80
82
|
width: Math.min(t.positionWidth ?? 4, r),
|
|
81
83
|
height: t.positionHeight ?? 4
|
|
82
|
-
}, { x: a, y: o } =
|
|
84
|
+
}, { x: a, y: o } = ce(n, i, { cols: r }), s = {
|
|
83
85
|
x: a,
|
|
84
86
|
y: o,
|
|
85
87
|
width: i.width,
|
|
@@ -122,11 +124,11 @@ var g = u(function() {
|
|
|
122
124
|
};
|
|
123
125
|
return document.addEventListener("keydown", n, !0), () => document.removeEventListener("keydown", n, !0);
|
|
124
126
|
}, [M, Q]);
|
|
125
|
-
let
|
|
127
|
+
let ke = d(() => {
|
|
126
128
|
g("/dashboards");
|
|
127
|
-
}, [g]),
|
|
129
|
+
}, [g]), $ = d(async () => {
|
|
128
130
|
if (u) {
|
|
129
|
-
|
|
131
|
+
b(!0), S(null);
|
|
130
132
|
try {
|
|
131
133
|
let t = e.getState(), n = Array.from(t.widgets.values()), r = t.dirtyWidgetIds, i = t.layoutEditRevision, a = n.length === 0 ? [] : null, o = n.filter((e) => r.has(e.id));
|
|
132
134
|
if (o.length > 0) {
|
|
@@ -155,7 +157,7 @@ var g = u(function() {
|
|
|
155
157
|
height: e.positionHeight ?? 4
|
|
156
158
|
}
|
|
157
159
|
}));
|
|
158
|
-
await P(e) && (a =
|
|
160
|
+
await P(e) && (a = le(e));
|
|
159
161
|
}
|
|
160
162
|
H && await O({
|
|
161
163
|
id: u,
|
|
@@ -163,9 +165,9 @@ var g = u(function() {
|
|
|
163
165
|
description: H.description
|
|
164
166
|
}), a && Z(a, i);
|
|
165
167
|
} catch (e) {
|
|
166
|
-
|
|
168
|
+
S(e instanceof Error ? e.message : _("bigconsole.dashboards.builder.errors.saveFailed", "Failed to save dashboard"));
|
|
167
169
|
} finally {
|
|
168
|
-
|
|
170
|
+
b(!1);
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
173
|
}, [
|
|
@@ -176,18 +178,18 @@ var g = u(function() {
|
|
|
176
178
|
O,
|
|
177
179
|
Z,
|
|
178
180
|
_
|
|
179
|
-
]),
|
|
180
|
-
|
|
181
|
-
}, []),
|
|
182
|
-
|
|
183
|
-
}, []),
|
|
181
|
+
]), Ae = d(() => {
|
|
182
|
+
C(!0);
|
|
183
|
+
}, []), je = d(() => {
|
|
184
|
+
C(!1);
|
|
185
|
+
}, []), Me = d((e) => {
|
|
184
186
|
W(e);
|
|
185
|
-
}, [W]),
|
|
187
|
+
}, [W]), Ne = d(async () => {
|
|
186
188
|
if (!H || !u) return;
|
|
187
189
|
let e = H.pages.length + 1, t = _("bigconsole.dashboards.builder.actions.newPageName", "Page {{count}}", { count: e }), n = await I({
|
|
188
190
|
dashboardId: u,
|
|
189
191
|
name: t,
|
|
190
|
-
gridColumns:
|
|
192
|
+
gridColumns: de().defaultGridColumns
|
|
191
193
|
});
|
|
192
194
|
n && (V({
|
|
193
195
|
...H,
|
|
@@ -206,7 +208,7 @@ var g = u(function() {
|
|
|
206
208
|
I,
|
|
207
209
|
W,
|
|
208
210
|
_
|
|
209
|
-
]),
|
|
211
|
+
]), Pe = d(async (e, t) => {
|
|
210
212
|
H && await L({
|
|
211
213
|
id: e,
|
|
212
214
|
name: t
|
|
@@ -221,7 +223,7 @@ var g = u(function() {
|
|
|
221
223
|
H,
|
|
222
224
|
V,
|
|
223
225
|
L
|
|
224
|
-
]),
|
|
226
|
+
]), Fe = d(async (e) => {
|
|
225
227
|
if (!H || !u) return;
|
|
226
228
|
let t = H.pages.find((t) => t.id === e);
|
|
227
229
|
if (!t) return;
|
|
@@ -244,7 +246,7 @@ var g = u(function() {
|
|
|
244
246
|
F,
|
|
245
247
|
W,
|
|
246
248
|
_
|
|
247
|
-
]),
|
|
249
|
+
]), Ie = d(async (e) => {
|
|
248
250
|
if (!(!H || H.pages.length <= 1) && await R(e)) {
|
|
249
251
|
let t = H.pages.filter((t) => t.id !== e).map((e, t) => ({
|
|
250
252
|
...e,
|
|
@@ -263,7 +265,7 @@ var g = u(function() {
|
|
|
263
265
|
U,
|
|
264
266
|
R,
|
|
265
267
|
W
|
|
266
|
-
]),
|
|
268
|
+
]), Le = d(async (e) => {
|
|
267
269
|
if (!H || !u) return;
|
|
268
270
|
V({
|
|
269
271
|
...H,
|
|
@@ -280,10 +282,10 @@ var g = u(function() {
|
|
|
280
282
|
V,
|
|
281
283
|
B
|
|
282
284
|
]);
|
|
283
|
-
return
|
|
285
|
+
return be ? /* @__PURE__ */ m("div", {
|
|
284
286
|
className: "flex items-center justify-center h-full",
|
|
285
287
|
children: /* @__PURE__ */ m("div", { className: "animate-spin w-8 h-8 border-4 border-action-primary-bg border-t-transparent rounded-full" })
|
|
286
|
-
}) :
|
|
288
|
+
}) : xe ? k ? /* @__PURE__ */ m("div", {
|
|
287
289
|
className: "flex h-full flex-col items-center justify-center p-6",
|
|
288
290
|
children: /* @__PURE__ */ m(a, {
|
|
289
291
|
headingLevel: 2,
|
|
@@ -295,13 +297,13 @@ var g = u(function() {
|
|
|
295
297
|
}),
|
|
296
298
|
className: "w-full max-w-md",
|
|
297
299
|
"data-testid": "dashboard-builder-error",
|
|
298
|
-
actions: /* @__PURE__ */ m(
|
|
300
|
+
actions: /* @__PURE__ */ m(_e, {
|
|
299
301
|
size: "sm",
|
|
300
302
|
onClick: () => g("/dashboards"),
|
|
301
303
|
children: _("bigconsole.dashboards.builder.actions.backToDashboards", "Back to Dashboards")
|
|
302
304
|
})
|
|
303
305
|
})
|
|
304
|
-
}) :
|
|
306
|
+
}) : De || !H ? /* @__PURE__ */ h("div", {
|
|
305
307
|
className: "flex items-center justify-center h-full",
|
|
306
308
|
role: "status",
|
|
307
309
|
"aria-live": "polite",
|
|
@@ -312,20 +314,32 @@ var g = u(function() {
|
|
|
312
314
|
}) : /* @__PURE__ */ h(ne, {
|
|
313
315
|
topbar: /* @__PURE__ */ m(te, {
|
|
314
316
|
title: H.title || _("bigconsole.dashboards.builder.header.untitledDashboard", "Untitled dashboard"),
|
|
315
|
-
onBack:
|
|
317
|
+
onBack: ke,
|
|
316
318
|
actions: /* @__PURE__ */ h("div", {
|
|
317
319
|
className: "flex items-center gap-2",
|
|
318
|
-
children: [
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ m(oe, { dashboardId: H.id }),
|
|
322
|
+
/* @__PURE__ */ m("button", {
|
|
323
|
+
type: "button",
|
|
324
|
+
"data-testid": "dashboard-comments-button",
|
|
325
|
+
onClick: () => E((e) => !e),
|
|
326
|
+
"aria-pressed": T,
|
|
327
|
+
className: `inline-flex min-h-control-md items-center rounded-button border border-[var(--color-border-subtle)] px-2 py-1 text-xs font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-sunken ${i}`,
|
|
328
|
+
children: _("bigconsole.dashboard.comments.buttonLabel", "Comments")
|
|
329
|
+
}),
|
|
330
|
+
x ? /* @__PURE__ */ m("span", {
|
|
331
|
+
className: "text-xs font-medium text-status-error-text",
|
|
332
|
+
role: "alert",
|
|
333
|
+
children: x
|
|
334
|
+
}) : null,
|
|
335
|
+
Ce ? /* @__PURE__ */ m("button", {
|
|
336
|
+
type: "button",
|
|
337
|
+
"data-testid": "open-custom-widget-builder",
|
|
338
|
+
onClick: () => w(!0),
|
|
339
|
+
className: `inline-flex min-h-control-md items-center rounded-button border border-[var(--color-border-subtle)] px-2 py-1 text-xs font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-sunken ${i}`,
|
|
340
|
+
children: _("bigconsole.dashboards.builder.toolbar.aiWidget", "AI widget")
|
|
341
|
+
}) : null
|
|
342
|
+
]
|
|
329
343
|
})
|
|
330
344
|
}),
|
|
331
345
|
children: [
|
|
@@ -334,37 +348,47 @@ var g = u(function() {
|
|
|
334
348
|
pageId: U || H.pages?.[0]?.id,
|
|
335
349
|
title: H.title,
|
|
336
350
|
onPaste: Q,
|
|
337
|
-
onSave: y ?
|
|
338
|
-
isSaving:
|
|
339
|
-
onExport:
|
|
351
|
+
onSave: y ? $ : void 0,
|
|
352
|
+
isSaving: we,
|
|
353
|
+
onExport: Se ? Ae : void 0,
|
|
340
354
|
pages: H.pages.map((e) => ({
|
|
341
355
|
id: e.id,
|
|
342
356
|
name: e.title || _("bigconsole.dashboards.builder.actions.newPageName", "Page {{count}}", { count: (e.index ?? 0) + 1 }),
|
|
343
357
|
order: e.index ?? 0
|
|
344
358
|
})),
|
|
345
359
|
activePageId: U || H.pages?.[0]?.id,
|
|
346
|
-
onPageChange:
|
|
347
|
-
onPageAdd:
|
|
348
|
-
onPageRename:
|
|
349
|
-
onPageDuplicate:
|
|
350
|
-
onPageDelete:
|
|
351
|
-
onPagesReorder:
|
|
360
|
+
onPageChange: Me,
|
|
361
|
+
onPageAdd: Ne,
|
|
362
|
+
onPageRename: Pe,
|
|
363
|
+
onPageDuplicate: Fe,
|
|
364
|
+
onPageDelete: Ie,
|
|
365
|
+
onPagesReorder: Le,
|
|
352
366
|
showPageTabs: !0
|
|
353
367
|
}) }),
|
|
354
368
|
/* @__PURE__ */ m(ae, {
|
|
355
|
-
isOpen:
|
|
369
|
+
isOpen: Te,
|
|
356
370
|
dashboardId: H.id,
|
|
357
371
|
dashboardName: H.title,
|
|
358
|
-
onClose:
|
|
372
|
+
onClose: je
|
|
359
373
|
}),
|
|
360
|
-
/* @__PURE__ */ m(
|
|
361
|
-
|
|
374
|
+
/* @__PURE__ */ m(se, {
|
|
375
|
+
dashboardId: H.id,
|
|
376
|
+
isOpen: T,
|
|
362
377
|
onClose: () => E(!1),
|
|
378
|
+
widgets: Array.from(q.values()).map((e) => ({
|
|
379
|
+
id: e.id,
|
|
380
|
+
title: e.title || e.type
|
|
381
|
+
})),
|
|
382
|
+
onSelectWidget: (e) => K(e)
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ m(ue, {
|
|
385
|
+
isOpen: Ee,
|
|
386
|
+
onClose: () => w(!1),
|
|
363
387
|
dashboardId: H.id,
|
|
364
388
|
pageId: U || H.pages?.[0]?.id || ""
|
|
365
389
|
})
|
|
366
390
|
]
|
|
367
|
-
}) : /* @__PURE__ */ m(
|
|
391
|
+
}) : /* @__PURE__ */ m(he, {
|
|
368
392
|
title: _("bigconsole.dashboards.builder.errors.accessDeniedTitle", "Access Denied"),
|
|
369
393
|
description: _("bigconsole.dashboards.builder.errors.accessDeniedDescription", "You don't have permission to view this dashboard.")
|
|
370
394
|
});
|