@burdenoff/microfe-bigconsole 2026.730.4 → 2026.730.6
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/assistant/attachmentExtract.js +50 -0
- package/dist/bigconsole/assistant/attachmentExtract.js.map +1 -0
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js +174 -173
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js +44 -43
- package/dist/bigconsole/components/dashboard/DashboardCanvas.js.map +1 -1
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +93 -81
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js.map +1 -1
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js +165 -0
- package/dist/bigconsole/components/dashboard/PublishToStoreDialog.js.map +1 -0
- package/dist/bigconsole/components/dashboard/index.js +1 -0
- package/dist/bigconsole/graphql/storeTemplates.js +19 -1
- package/dist/bigconsole/graphql/storeTemplates.js.map +1 -1
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js +123 -55
- package/dist/bigconsole/hooks/useStoreDashboardTemplates.js.map +1 -1
- package/dist/bigconsole/pages/DashboardViewPage.js +197 -184
- package/dist/bigconsole/pages/DashboardViewPage.js.map +1 -1
- package/dist/generated/global-operations.js +19 -2
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/node_modules/pdfjs-dist/build/pdf.js +12493 -0
- package/dist/node_modules/pdfjs-dist/build/pdf.js.map +1 -0
- package/dist/node_modules/xlsx/xlsx.js +16412 -0
- package/dist/node_modules/xlsx/xlsx.js.map +1 -0
- package/package.json +4 -2
|
@@ -4,149 +4,161 @@ import "../../store/index.js";
|
|
|
4
4
|
import n from "./SavedViewsDropdown/SavedViewsDropdown.js";
|
|
5
5
|
import "./SavedViewsDropdown/index.js";
|
|
6
6
|
import { memo as r, useCallback as i } from "react";
|
|
7
|
-
import { Clipboard as a, Download as o, Eye as s, FileText as c, Image as l, Minus as u, PanelLeft as d, PanelLeftClose as f, Pencil as p, Plus as m, RotateCcw as h, Save as g, Share2 as _ } from "lucide-react";
|
|
8
|
-
import { Button as
|
|
9
|
-
import { Fragment as
|
|
7
|
+
import { Clipboard as a, Download as o, Eye as s, FileText as c, Image as l, Minus as u, PanelLeft as d, PanelLeftClose as f, Pencil as p, Plus as m, RotateCcw as h, Save as g, Share2 as _, Store as v } from "lucide-react";
|
|
8
|
+
import { Button as y, Spinner as b, Tooltip as x, TooltipContent as S, TooltipProvider as C, TooltipTrigger as w } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
10
10
|
//#region src/bigconsole/components/dashboard/DashboardToolbar.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
}, [
|
|
15
|
-
return /* @__PURE__ */
|
|
11
|
+
var O = r(function({ dashboardId: r, title: O, onAddWidget: k, onTogglePalette: A, isPaletteOpen: j = !1, onPaste: M, onSave: N, isSaving: P = !1, onExport: F, onPublishTemplate: I, onExportImage: L, onExportPdf: R, isExportingImage: z = !1, onShare: B }) {
|
|
12
|
+
let V = t((e) => e.viewMode === "edit"), H = t((e) => e.toggleViewMode), U = t((e) => e.zoomLevel), W = t((e) => e.setZoomLevel), G = !!e((e) => e.clipboardWidgetId), K = i(() => {
|
|
13
|
+
G && M && M();
|
|
14
|
+
}, [G, M]);
|
|
15
|
+
return /* @__PURE__ */ E(C, { children: /* @__PURE__ */ D("div", {
|
|
16
16
|
className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-2 bg-bg-surface border-b",
|
|
17
17
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
18
|
+
/* @__PURE__ */ D("div", {
|
|
19
19
|
className: "flex min-w-0 items-center gap-4",
|
|
20
|
-
children: [
|
|
20
|
+
children: [O && /* @__PURE__ */ E("h1", {
|
|
21
21
|
className: "min-w-0 truncate text-lg font-semibold",
|
|
22
|
-
title:
|
|
23
|
-
children:
|
|
24
|
-
}), r && /* @__PURE__ */
|
|
22
|
+
title: O,
|
|
23
|
+
children: O
|
|
24
|
+
}), r && /* @__PURE__ */ E(n, { dashboardId: r })]
|
|
25
25
|
}),
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ D("div", {
|
|
27
27
|
className: "flex flex-shrink-0 items-center gap-1",
|
|
28
28
|
children: [
|
|
29
|
-
/* @__PURE__ */
|
|
29
|
+
/* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
30
30
|
asChild: !0,
|
|
31
|
-
children: /* @__PURE__ */
|
|
31
|
+
children: /* @__PURE__ */ E(y, {
|
|
32
32
|
variant: "ghost",
|
|
33
33
|
size: "icon-sm",
|
|
34
|
-
onClick: () =>
|
|
35
|
-
disabled:
|
|
36
|
-
children: /* @__PURE__ */
|
|
34
|
+
onClick: () => W(Math.max(50, U - 10)),
|
|
35
|
+
disabled: U <= 50,
|
|
36
|
+
children: /* @__PURE__ */ E(u, { className: "size-4" })
|
|
37
37
|
})
|
|
38
|
-
}), /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
38
|
+
}), /* @__PURE__ */ E(S, { children: "Zoom out" })] }),
|
|
39
|
+
/* @__PURE__ */ D("span", {
|
|
40
40
|
className: "text-sm text-text-secondary w-12 text-center",
|
|
41
|
-
children: [
|
|
41
|
+
children: [U, "%"]
|
|
42
42
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
44
44
|
asChild: !0,
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ E(y, {
|
|
46
46
|
variant: "ghost",
|
|
47
47
|
size: "icon-sm",
|
|
48
|
-
onClick: () =>
|
|
49
|
-
disabled:
|
|
50
|
-
children: /* @__PURE__ */
|
|
48
|
+
onClick: () => W(Math.min(200, U + 10)),
|
|
49
|
+
disabled: U >= 200,
|
|
50
|
+
children: /* @__PURE__ */ E(m, { className: "size-4" })
|
|
51
51
|
})
|
|
52
|
-
}), /* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
52
|
+
}), /* @__PURE__ */ E(S, { children: "Zoom in" })] }),
|
|
53
|
+
/* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
54
54
|
asChild: !0,
|
|
55
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ D(y, {
|
|
56
56
|
variant: "ghost",
|
|
57
57
|
size: "sm",
|
|
58
|
-
onClick: () =>
|
|
59
|
-
children: [/* @__PURE__ */
|
|
58
|
+
onClick: () => W(100),
|
|
59
|
+
children: [/* @__PURE__ */ E(h, { className: "size-3.5 mr-1" }), "Reset"]
|
|
60
60
|
})
|
|
61
|
-
}), /* @__PURE__ */
|
|
61
|
+
}), /* @__PURE__ */ E(S, { children: "Reset zoom to 100%" })] })
|
|
62
62
|
]
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ D("div", {
|
|
65
65
|
className: "flex flex-wrap items-center justify-end gap-2",
|
|
66
66
|
children: [
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
V && /* @__PURE__ */ D(T, { children: [
|
|
68
|
+
A && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
69
69
|
asChild: !0,
|
|
70
|
-
children: /* @__PURE__ */
|
|
71
|
-
variant:
|
|
70
|
+
children: /* @__PURE__ */ D(y, {
|
|
71
|
+
variant: j ? "secondary" : "outline",
|
|
72
72
|
size: "sm",
|
|
73
|
-
onClick:
|
|
74
|
-
children: [
|
|
73
|
+
onClick: A,
|
|
74
|
+
children: [E(j ? f : d, { className: "size-4" }), "Widgets"]
|
|
75
75
|
})
|
|
76
|
-
}), /* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
76
|
+
}), /* @__PURE__ */ E(S, { children: j ? "Hide widget palette" : "Show widget palette for drag & drop" })] }),
|
|
77
|
+
/* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
78
78
|
asChild: !0,
|
|
79
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ D(y, {
|
|
80
80
|
variant: "ghost",
|
|
81
81
|
size: "sm",
|
|
82
|
-
onClick:
|
|
83
|
-
disabled: !
|
|
84
|
-
children: [/* @__PURE__ */
|
|
82
|
+
onClick: K,
|
|
83
|
+
disabled: !G,
|
|
84
|
+
children: [/* @__PURE__ */ E(a, { className: "size-4" }), "Paste"]
|
|
85
85
|
})
|
|
86
|
-
}), /* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */
|
|
86
|
+
}), /* @__PURE__ */ E(S, { children: "Paste widget from clipboard" })] }),
|
|
87
|
+
/* @__PURE__ */ D(y, {
|
|
88
88
|
size: "sm",
|
|
89
|
-
onClick:
|
|
90
|
-
children: [/* @__PURE__ */
|
|
89
|
+
onClick: k,
|
|
90
|
+
children: [/* @__PURE__ */ E(m, { className: "size-4" }), "Add Widget"]
|
|
91
91
|
})
|
|
92
92
|
] }),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
variant:
|
|
93
|
+
/* @__PURE__ */ E(y, {
|
|
94
|
+
variant: V ? "secondary" : "outline",
|
|
95
95
|
size: "sm",
|
|
96
|
-
onClick:
|
|
97
|
-
children:
|
|
96
|
+
onClick: H,
|
|
97
|
+
children: V ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(s, { className: "size-4" }), "Preview"] }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(p, { className: "size-4" }), "Edit"] })
|
|
98
98
|
}),
|
|
99
|
-
|
|
99
|
+
N && /* @__PURE__ */ E(y, {
|
|
100
100
|
variant: "outline",
|
|
101
101
|
size: "sm",
|
|
102
|
-
onClick:
|
|
103
|
-
disabled:
|
|
104
|
-
children:
|
|
102
|
+
onClick: N,
|
|
103
|
+
disabled: P,
|
|
104
|
+
children: P ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(b, { className: "size-4" }), "Saving..."] }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(g, { className: "size-4" }), "Save"] })
|
|
105
105
|
}),
|
|
106
|
-
|
|
106
|
+
B && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
107
107
|
asChild: !0,
|
|
108
|
-
children: /* @__PURE__ */
|
|
108
|
+
children: /* @__PURE__ */ D(y, {
|
|
109
109
|
variant: "outline",
|
|
110
110
|
size: "sm",
|
|
111
|
-
onClick:
|
|
112
|
-
children: [/* @__PURE__ */
|
|
111
|
+
onClick: B,
|
|
112
|
+
children: [/* @__PURE__ */ E(_, { className: "size-4" }), "Share"]
|
|
113
113
|
})
|
|
114
|
-
}), /* @__PURE__ */
|
|
115
|
-
|
|
114
|
+
}), /* @__PURE__ */ E(S, { children: "Share dashboard with others" })] }),
|
|
115
|
+
I && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
116
116
|
asChild: !0,
|
|
117
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ D(y, {
|
|
118
118
|
variant: "outline",
|
|
119
119
|
size: "sm",
|
|
120
|
-
onClick:
|
|
121
|
-
children: [/* @__PURE__ */
|
|
120
|
+
onClick: I,
|
|
121
|
+
children: [/* @__PURE__ */ E(v, { className: "size-4" }), /* @__PURE__ */ E("span", {
|
|
122
|
+
className: "hidden sm:inline",
|
|
123
|
+
children: "Publish"
|
|
124
|
+
})]
|
|
122
125
|
})
|
|
123
|
-
}), /* @__PURE__ */
|
|
124
|
-
F && /* @__PURE__ */
|
|
126
|
+
}), /* @__PURE__ */ E(S, { children: "Publish this dashboard as a reusable template" })] }),
|
|
127
|
+
F && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
125
128
|
asChild: !0,
|
|
126
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ D(y, {
|
|
127
130
|
variant: "outline",
|
|
128
|
-
size: "
|
|
131
|
+
size: "sm",
|
|
129
132
|
onClick: F,
|
|
130
|
-
|
|
131
|
-
children: T(L ? y : l, { className: "size-4" })
|
|
133
|
+
children: [/* @__PURE__ */ E(o, { className: "size-4" }), "Export"]
|
|
132
134
|
})
|
|
133
|
-
}), /* @__PURE__ */
|
|
134
|
-
|
|
135
|
+
}), /* @__PURE__ */ E(S, { children: "Export dashboard to JSON" })] }),
|
|
136
|
+
L && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
135
137
|
asChild: !0,
|
|
136
|
-
children: /* @__PURE__ */
|
|
138
|
+
children: /* @__PURE__ */ E(y, {
|
|
137
139
|
variant: "outline",
|
|
138
140
|
size: "icon-sm",
|
|
139
|
-
onClick:
|
|
140
|
-
disabled:
|
|
141
|
-
children:
|
|
141
|
+
onClick: L,
|
|
142
|
+
disabled: z,
|
|
143
|
+
children: E(z ? b : l, { className: "size-4" })
|
|
144
|
+
})
|
|
145
|
+
}), /* @__PURE__ */ E(S, { children: "Export board as PNG image" })] }),
|
|
146
|
+
R && /* @__PURE__ */ D(x, { children: [/* @__PURE__ */ E(w, {
|
|
147
|
+
asChild: !0,
|
|
148
|
+
children: /* @__PURE__ */ E(y, {
|
|
149
|
+
variant: "outline",
|
|
150
|
+
size: "icon-sm",
|
|
151
|
+
onClick: R,
|
|
152
|
+
disabled: z,
|
|
153
|
+
children: /* @__PURE__ */ E(c, { className: "size-4" })
|
|
142
154
|
})
|
|
143
|
-
}), /* @__PURE__ */
|
|
155
|
+
}), /* @__PURE__ */ E(S, { children: "Export board as PDF" })] })
|
|
144
156
|
]
|
|
145
157
|
})
|
|
146
158
|
]
|
|
147
159
|
}) });
|
|
148
160
|
});
|
|
149
161
|
//#endregion
|
|
150
|
-
export {
|
|
162
|
+
export { O as default };
|
|
151
163
|
|
|
152
164
|
//# sourceMappingURL=DashboardToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardToolbar.js","names":[],"sources":["../../../../src/bigconsole/components/dashboard/DashboardToolbar.tsx"],"sourcesContent":["/**\n * DashboardToolbar Component\n *\n * Toolbar for dashboard actions and controls.\n * Uses fe-libs shared components for consistent styling.\n * Phase 2: Added SavedViewsDropdown and Share button.\n */\n\nimport { type FC, memo, useCallback } from 'react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@burdenoff/fe-libs/ui';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport {\n Plus,\n Clipboard,\n Eye,\n Pencil,\n Save,\n Download,\n Minus,\n RotateCcw,\n Share2,\n PanelLeftClose,\n PanelLeft,\n Image as ImageIcon,\n FileText,\n} from 'lucide-react';\nimport { useDashboardStore, useWidgetStore } from '../../store';\nimport { SavedViewsDropdown } from './SavedViewsDropdown';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DashboardToolbarProps {\n /** Dashboard ID for saved views */\n dashboardId?: string;\n /** Dashboard title */\n title?: string;\n /** Callback to add widget */\n onAddWidget: () => void;\n /** Callback to toggle widget palette */\n onTogglePalette?: () => void;\n /** Whether palette is open */\n isPaletteOpen?: boolean;\n /** Callback to paste widget */\n onPaste?: () => void;\n /** Callback to save dashboard */\n onSave?: () => void;\n /** Whether save is in progress */\n isSaving?: boolean;\n /** Callback to export dashboard (JSON console definition) */\n onExport?: () => void;\n /** Callback to export the board as a PNG image */\n onExportImage?: () => void;\n /** Callback to export the board as a PDF */\n onExportPdf?: () => void;\n /** Whether an image/PDF export is in progress */\n isExportingImage?: boolean;\n /** Callback to open share dialog */\n onShare?: () => void;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport const DashboardToolbar: FC<DashboardToolbarProps> = memo(function DashboardToolbar({\n dashboardId,\n title,\n onAddWidget,\n onTogglePalette,\n isPaletteOpen = false,\n onPaste,\n onSave,\n isSaving = false,\n onExport,\n onExportImage,\n onExportPdf,\n isExportingImage = false,\n onShare,\n}) {\n const isEditMode = useDashboardStore((state) => state.viewMode === 'edit');\n const toggleViewMode = useDashboardStore((state) => state.toggleViewMode);\n const zoomLevel = useDashboardStore((state) => state.zoomLevel);\n const setZoomLevel = useDashboardStore((state) => state.setZoomLevel);\n\n const clipboardWidgetId = useWidgetStore((state) => state.clipboardWidgetId);\n const hasClipboard = !!clipboardWidgetId;\n\n // Handle paste - use provided callback or fallback\n const handlePaste = useCallback(() => {\n if (hasClipboard && onPaste) {\n onPaste();\n }\n }, [hasClipboard, onPaste]);\n\n return (\n <TooltipProvider>\n <div className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-2 bg-bg-surface border-b\">\n {/* Left section */}\n <div className=\"flex min-w-0 items-center gap-4\">\n {title && (\n <h1 className=\"min-w-0 truncate text-lg font-semibold\" title={title}>\n {title}\n </h1>\n )}\n {/* Saved Views Dropdown */}\n {dashboardId && <SavedViewsDropdown dashboardId={dashboardId} />}\n </div>\n\n {/* Center section - Zoom controls */}\n <div className=\"flex flex-shrink-0 items-center gap-1\">\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => setZoomLevel(Math.max(50, zoomLevel - 10))}\n disabled={zoomLevel <= 50}\n >\n <Minus className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Zoom out</TooltipContent>\n </Tooltip>\n\n <span className=\"text-sm text-text-secondary w-12 text-center\">{zoomLevel}%</span>\n\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => setZoomLevel(Math.min(200, zoomLevel + 10))}\n disabled={zoomLevel >= 200}\n >\n <Plus className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Zoom in</TooltipContent>\n </Tooltip>\n\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setZoomLevel(100)}>\n <RotateCcw className=\"size-3.5 mr-1\" />\n Reset\n </Button>\n </TooltipTrigger>\n <TooltipContent>Reset zoom to 100%</TooltipContent>\n </Tooltip>\n </div>\n\n {/* Right section - Actions */}\n <div className=\"flex flex-wrap items-center justify-end gap-2\">\n {isEditMode && (\n <>\n {/* Widget Palette Toggle */}\n {onTogglePalette && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant={isPaletteOpen ? 'secondary' : 'outline'} size=\"sm\" onClick={onTogglePalette}>\n {isPaletteOpen ? <PanelLeftClose className=\"size-4\" /> : <PanelLeft className=\"size-4\" />}\n Widgets\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n {isPaletteOpen ? 'Hide widget palette' : 'Show widget palette for drag & drop'}\n </TooltipContent>\n </Tooltip>\n )}\n\n {/* Paste */}\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" onClick={handlePaste} disabled={!hasClipboard}>\n <Clipboard className=\"size-4\" />\n Paste\n </Button>\n </TooltipTrigger>\n <TooltipContent>Paste widget from clipboard</TooltipContent>\n </Tooltip>\n\n {/* Add Widget (Dialog) */}\n <Button size=\"sm\" onClick={onAddWidget}>\n <Plus className=\"size-4\" />\n Add Widget\n </Button>\n </>\n )}\n\n {/* Edit/View Mode Toggle */}\n <Button variant={isEditMode ? 'secondary' : 'outline'} size=\"sm\" onClick={toggleViewMode}>\n {isEditMode ? (\n <>\n <Eye className=\"size-4\" />\n Preview\n </>\n ) : (\n <>\n <Pencil className=\"size-4\" />\n Edit\n </>\n )}\n </Button>\n\n {/* Save */}\n {onSave && (\n <Button variant=\"outline\" size=\"sm\" onClick={onSave} disabled={isSaving}>\n {isSaving ? (\n <>\n <Spinner className=\"size-4\" />\n Saving...\n </>\n ) : (\n <>\n <Save className=\"size-4\" />\n Save\n </>\n )}\n </Button>\n )}\n\n {/* Share */}\n {onShare && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" onClick={onShare}>\n <Share2 className=\"size-4\" />\n Share\n </Button>\n </TooltipTrigger>\n <TooltipContent>Share dashboard with others</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — JSON definition */}\n {onExport && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" onClick={onExport}>\n <Download className=\"size-4\" />\n Export\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export dashboard to JSON</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — board PNG */}\n {onExportImage && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"icon-sm\" onClick={onExportImage} disabled={isExportingImage}>\n {isExportingImage ? <Spinner className=\"size-4\" /> : <ImageIcon className=\"size-4\" />}\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export board as PNG image</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — board PDF */}\n {onExportPdf && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"icon-sm\" onClick={onExportPdf} disabled={isExportingImage}>\n <FileText className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export board as PDF</TooltipContent>\n </Tooltip>\n )}\n </div>\n </div>\n </TooltipProvider>\n );\n});\n\nexport default DashboardToolbar;\n"],"mappings":";;;;;;;;;;AAmEA,IAAa,IAA8C,EAAK,SAA0B,EACxF,gBACA,UACA,gBACA,oBACA,mBAAgB,IAChB,YACA,WACA,cAAW,IACX,aACA,kBACA,gBACA,sBAAmB,IACnB,cACC;CACD,IAAM,IAAa,GAAmB,MAAU,EAAM,aAAa,OAAO,EACpE,IAAiB,GAAmB,MAAU,EAAM,eAAe,EACnE,IAAY,GAAmB,MAAU,EAAM,UAAU,EACzD,IAAe,GAAmB,MAAU,EAAM,aAAa,EAG/D,IAAe,CAAC,CADI,GAAgB,MAAU,EAAM,kBAAkB,EAItE,IAAc,QAAkB;AACpC,EAAI,KAAgB,KAClB,GAAS;IAEV,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AA;KAER;;GACF;KACU,CAAA;EAEpB"}
|
|
1
|
+
{"version":3,"file":"DashboardToolbar.js","names":[],"sources":["../../../../src/bigconsole/components/dashboard/DashboardToolbar.tsx"],"sourcesContent":["/**\n * DashboardToolbar Component\n *\n * Toolbar for dashboard actions and controls.\n * Uses fe-libs shared components for consistent styling.\n * Phase 2: Added SavedViewsDropdown and Share button.\n */\n\nimport { type FC, memo, useCallback } from 'react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@burdenoff/fe-libs/ui';\nimport { Spinner } from '@burdenoff/fe-libs/ui';\nimport {\n Clipboard,\n Download,\n Eye,\n FileText,\n Image as ImageIcon,\n Minus,\n PanelLeft,\n PanelLeftClose,\n Pencil,\n Plus,\n RotateCcw,\n Save,\n Share2,\n Store,\n} from 'lucide-react';\nimport { useDashboardStore, useWidgetStore } from '../../store';\nimport { SavedViewsDropdown } from './SavedViewsDropdown';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DashboardToolbarProps {\n /** Dashboard ID for saved views */\n dashboardId?: string;\n /** Dashboard title */\n title?: string;\n /** Callback to add widget */\n onAddWidget: () => void;\n /** Callback to toggle widget palette */\n onTogglePalette?: () => void;\n /** Whether palette is open */\n isPaletteOpen?: boolean;\n /** Callback to paste widget */\n onPaste?: () => void;\n /** Callback to save dashboard */\n onSave?: () => void;\n /** Whether save is in progress */\n isSaving?: boolean;\n /** Callback to export dashboard (JSON console definition) */\n onExport?: () => void;\n /** Publish this dashboard as a reusable template. */\n onPublishTemplate?: () => void;\n /** Callback to export the board as a PNG image */\n onExportImage?: () => void;\n /** Callback to export the board as a PDF */\n onExportPdf?: () => void;\n /** Whether an image/PDF export is in progress */\n isExportingImage?: boolean;\n /** Callback to open share dialog */\n onShare?: () => void;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\nexport const DashboardToolbar: FC<DashboardToolbarProps> = memo(function DashboardToolbar({\n dashboardId,\n title,\n onAddWidget,\n onTogglePalette,\n isPaletteOpen = false,\n onPaste,\n onSave,\n isSaving = false,\n onExport,\n onPublishTemplate,\n onExportImage,\n onExportPdf,\n isExportingImage = false,\n onShare,\n}) {\n const isEditMode = useDashboardStore((state) => state.viewMode === 'edit');\n const toggleViewMode = useDashboardStore((state) => state.toggleViewMode);\n const zoomLevel = useDashboardStore((state) => state.zoomLevel);\n const setZoomLevel = useDashboardStore((state) => state.setZoomLevel);\n\n const clipboardWidgetId = useWidgetStore((state) => state.clipboardWidgetId);\n const hasClipboard = !!clipboardWidgetId;\n\n // Handle paste - use provided callback or fallback\n const handlePaste = useCallback(() => {\n if (hasClipboard && onPaste) {\n onPaste();\n }\n }, [hasClipboard, onPaste]);\n\n return (\n <TooltipProvider>\n <div className=\"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-2 bg-bg-surface border-b\">\n {/* Left section */}\n <div className=\"flex min-w-0 items-center gap-4\">\n {title && (\n <h1 className=\"min-w-0 truncate text-lg font-semibold\" title={title}>\n {title}\n </h1>\n )}\n {/* Saved Views Dropdown */}\n {dashboardId && <SavedViewsDropdown dashboardId={dashboardId} />}\n </div>\n\n {/* Center section - Zoom controls */}\n <div className=\"flex flex-shrink-0 items-center gap-1\">\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => setZoomLevel(Math.max(50, zoomLevel - 10))}\n disabled={zoomLevel <= 50}\n >\n <Minus className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Zoom out</TooltipContent>\n </Tooltip>\n\n <span className=\"text-sm text-text-secondary w-12 text-center\">{zoomLevel}%</span>\n\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n onClick={() => setZoomLevel(Math.min(200, zoomLevel + 10))}\n disabled={zoomLevel >= 200}\n >\n <Plus className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Zoom in</TooltipContent>\n </Tooltip>\n\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setZoomLevel(100)}>\n <RotateCcw className=\"size-3.5 mr-1\" />\n Reset\n </Button>\n </TooltipTrigger>\n <TooltipContent>Reset zoom to 100%</TooltipContent>\n </Tooltip>\n </div>\n\n {/* Right section - Actions */}\n <div className=\"flex flex-wrap items-center justify-end gap-2\">\n {isEditMode && (\n <>\n {/* Widget Palette Toggle */}\n {onTogglePalette && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant={isPaletteOpen ? 'secondary' : 'outline'} size=\"sm\" onClick={onTogglePalette}>\n {isPaletteOpen ? <PanelLeftClose className=\"size-4\" /> : <PanelLeft className=\"size-4\" />}\n Widgets\n </Button>\n </TooltipTrigger>\n <TooltipContent>\n {isPaletteOpen ? 'Hide widget palette' : 'Show widget palette for drag & drop'}\n </TooltipContent>\n </Tooltip>\n )}\n\n {/* Paste */}\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"ghost\" size=\"sm\" onClick={handlePaste} disabled={!hasClipboard}>\n <Clipboard className=\"size-4\" />\n Paste\n </Button>\n </TooltipTrigger>\n <TooltipContent>Paste widget from clipboard</TooltipContent>\n </Tooltip>\n\n {/* Add Widget (Dialog) */}\n <Button size=\"sm\" onClick={onAddWidget}>\n <Plus className=\"size-4\" />\n Add Widget\n </Button>\n </>\n )}\n\n {/* Edit/View Mode Toggle */}\n <Button variant={isEditMode ? 'secondary' : 'outline'} size=\"sm\" onClick={toggleViewMode}>\n {isEditMode ? (\n <>\n <Eye className=\"size-4\" />\n Preview\n </>\n ) : (\n <>\n <Pencil className=\"size-4\" />\n Edit\n </>\n )}\n </Button>\n\n {/* Save */}\n {onSave && (\n <Button variant=\"outline\" size=\"sm\" onClick={onSave} disabled={isSaving}>\n {isSaving ? (\n <>\n <Spinner className=\"size-4\" />\n Saving...\n </>\n ) : (\n <>\n <Save className=\"size-4\" />\n Save\n </>\n )}\n </Button>\n )}\n\n {/* Share */}\n {onShare && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" onClick={onShare}>\n <Share2 className=\"size-4\" />\n Share\n </Button>\n </TooltipTrigger>\n <TooltipContent>Share dashboard with others</TooltipContent>\n </Tooltip>\n )}\n\n {/* Publish as a store template */}\n {onPublishTemplate && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" onClick={onPublishTemplate}>\n <Store className=\"size-4\" />\n <span className=\"hidden sm:inline\">Publish</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent>Publish this dashboard as a reusable template</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — JSON definition */}\n {onExport && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"sm\" onClick={onExport}>\n <Download className=\"size-4\" />\n Export\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export dashboard to JSON</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — board PNG */}\n {onExportImage && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"icon-sm\" onClick={onExportImage} disabled={isExportingImage}>\n {isExportingImage ? <Spinner className=\"size-4\" /> : <ImageIcon className=\"size-4\" />}\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export board as PNG image</TooltipContent>\n </Tooltip>\n )}\n\n {/* Export — board PDF */}\n {onExportPdf && (\n <Tooltip>\n <TooltipTrigger asChild>\n <Button variant=\"outline\" size=\"icon-sm\" onClick={onExportPdf} disabled={isExportingImage}>\n <FileText className=\"size-4\" />\n </Button>\n </TooltipTrigger>\n <TooltipContent>Export board as PDF</TooltipContent>\n </Tooltip>\n )}\n </div>\n </div>\n </TooltipProvider>\n );\n});\n\nexport default DashboardToolbar;\n"],"mappings":";;;;;;;;;;AAsEA,IAAa,IAA8C,EAAK,SAA0B,EACxF,gBACA,UACA,gBACA,oBACA,mBAAgB,IAChB,YACA,WACA,cAAW,IACX,aAC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A,EACjB,kBAAC,GAAD,EAAA,UAAgB,4BAAyC,CAAA,CACjD,EAAA,CAAA;KAIX,KACC,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;MAAgB,SAAA;gBACd,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAU,SAAS;OAAe,UAAU;iBACrD,EAAnB,IAAoB,IAAiC,GAAlC,EAAS,WAAU,UAAW,CAAmC;OAC9E,CAAA;MACM,CAAA,EACjB,kBAAC,GAAD,EAAA,UAAgB,6BAA0C,CAAA,CAClD,EAAA,CAAA;KAIX,KACC,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;MAAgB,SAAA;gBACd,kBAAC,GAAD;OAAQ,SAAQ;OAAU,MAAK;OAAU,SAAS;OAAa,UAAU;iBACvE,kBAAC,GAAD,EAAU,WAAU,UAAW,CAAA;OACxB,CAAA;MACM,CAAA,EACjB,kBAAC,GAAD,EAAA,UAAgB,uBAAoC,CAAA,CAC5C,EAAA,CAAA;KAER;;GACF;KACU,CAAA;EAEpB"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import e from "../../hooks/useStoreDashboardTemplates.js";
|
|
2
|
+
import { memo as t, useCallback as n, useEffect as r, useState as i } from "react";
|
|
3
|
+
import { Button as a, Dialog as o, DialogContent as s, DialogDescription as c, DialogFooter as l, DialogHeader as u, DialogTitle as d, Input as f, Spinner as p, Textarea as m } from "@burdenoff/fe-libs/ui";
|
|
4
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
5
|
+
//#region src/bigconsole/components/dashboard/PublishToStoreDialog.tsx
|
|
6
|
+
function _(e) {
|
|
7
|
+
return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").slice(0, 60);
|
|
8
|
+
}
|
|
9
|
+
var v = t(function({ isOpen: t, dashboardId: v, dashboardName: y, dashboardDescription: b, onClose: x, onPublished: S }) {
|
|
10
|
+
let { publishToStore: C } = e({ autoLoad: !1 }), [w, T] = i(y), [E, D] = i(_(y)), [O, k] = i(b ?? ""), [A, j] = i(!1), [M, N] = i(null), [P, F] = i(null);
|
|
11
|
+
r(() => {
|
|
12
|
+
t && (T(y), D(_(y)), k(b ?? ""), N(null), F(null));
|
|
13
|
+
}, [
|
|
14
|
+
t,
|
|
15
|
+
y,
|
|
16
|
+
b
|
|
17
|
+
]);
|
|
18
|
+
let I = n(async () => {
|
|
19
|
+
if (!w.trim()) {
|
|
20
|
+
N("A template name is required");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!E.trim()) {
|
|
24
|
+
N("A slug is required");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!O.trim()) {
|
|
28
|
+
N("A description is required — it is what people see in the gallery");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
N(null), j(!0);
|
|
32
|
+
try {
|
|
33
|
+
let e = await C({
|
|
34
|
+
dashboardId: v,
|
|
35
|
+
name: w.trim(),
|
|
36
|
+
slug: E.trim(),
|
|
37
|
+
description: O.trim()
|
|
38
|
+
});
|
|
39
|
+
if (!e.success) {
|
|
40
|
+
N(e.errorMessage ?? "Failed to publish to the store");
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
F(e), S?.(e);
|
|
44
|
+
} finally {
|
|
45
|
+
j(!1);
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
w,
|
|
49
|
+
E,
|
|
50
|
+
O,
|
|
51
|
+
v,
|
|
52
|
+
C,
|
|
53
|
+
S
|
|
54
|
+
]), L = {
|
|
55
|
+
display: "block",
|
|
56
|
+
marginBottom: "var(--space-2xs)",
|
|
57
|
+
fontSize: "var(--font-size-sm)"
|
|
58
|
+
};
|
|
59
|
+
return /* @__PURE__ */ h(o, {
|
|
60
|
+
open: t,
|
|
61
|
+
onOpenChange: (e) => !e && !A && x(),
|
|
62
|
+
children: /* @__PURE__ */ g(s, {
|
|
63
|
+
style: { maxWidth: "520px" },
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ g(u, { children: [/* @__PURE__ */ h(d, { children: "Publish as Template" }), /* @__PURE__ */ h(c, { children: "Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing from this workspace is published." })] }),
|
|
66
|
+
P ? /* @__PURE__ */ g("div", {
|
|
67
|
+
style: { padding: "var(--space-md) 0" },
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ h("p", {
|
|
70
|
+
style: { fontWeight: "var(--font-weight-medium)" },
|
|
71
|
+
children: "Draft template created"
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ g("p", {
|
|
74
|
+
style: {
|
|
75
|
+
fontSize: "var(--font-size-sm)",
|
|
76
|
+
color: "var(--color-text-muted)"
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
P.sinkCount,
|
|
80
|
+
" data source",
|
|
81
|
+
P.sinkCount === 1 ? "" : "s",
|
|
82
|
+
" turned into slots. Finish in the Developer Portal: review the listing, then submit it for approval. It appears in the gallery once approved."
|
|
83
|
+
]
|
|
84
|
+
}),
|
|
85
|
+
P.unknownSinkIds.length > 0 && /* @__PURE__ */ g("p", {
|
|
86
|
+
style: {
|
|
87
|
+
fontSize: "var(--font-size-sm)",
|
|
88
|
+
color: "var(--color-text-warning)"
|
|
89
|
+
},
|
|
90
|
+
children: [
|
|
91
|
+
P.unknownSinkIds.length,
|
|
92
|
+
" data source",
|
|
93
|
+
P.unknownSinkIds.length === 1 ? "" : "s",
|
|
94
|
+
" could not be named — those slots use generic labels."
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}) : /* @__PURE__ */ g("div", {
|
|
99
|
+
style: {
|
|
100
|
+
display: "flex",
|
|
101
|
+
flexDirection: "column",
|
|
102
|
+
gap: "var(--space-sm)"
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
106
|
+
htmlFor: "tpl-name",
|
|
107
|
+
style: L,
|
|
108
|
+
children: "Template name"
|
|
109
|
+
}), /* @__PURE__ */ h(f, {
|
|
110
|
+
id: "tpl-name",
|
|
111
|
+
value: w,
|
|
112
|
+
disabled: A,
|
|
113
|
+
onChange: (e) => {
|
|
114
|
+
T(e.target.value), D(_(e.target.value));
|
|
115
|
+
}
|
|
116
|
+
})] }),
|
|
117
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
118
|
+
htmlFor: "tpl-slug",
|
|
119
|
+
style: L,
|
|
120
|
+
children: "Slug"
|
|
121
|
+
}), /* @__PURE__ */ h(f, {
|
|
122
|
+
id: "tpl-slug",
|
|
123
|
+
value: E,
|
|
124
|
+
disabled: A,
|
|
125
|
+
onChange: (e) => D(_(e.target.value))
|
|
126
|
+
})] }),
|
|
127
|
+
/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
128
|
+
htmlFor: "tpl-desc",
|
|
129
|
+
style: L,
|
|
130
|
+
children: "Description"
|
|
131
|
+
}), /* @__PURE__ */ h(m, {
|
|
132
|
+
id: "tpl-desc",
|
|
133
|
+
rows: 3,
|
|
134
|
+
value: O,
|
|
135
|
+
disabled: A,
|
|
136
|
+
placeholder: "What is this dashboard for, and what data does it need?",
|
|
137
|
+
onChange: (e) => k(e.target.value)
|
|
138
|
+
})] }),
|
|
139
|
+
M && /* @__PURE__ */ h("p", {
|
|
140
|
+
style: {
|
|
141
|
+
color: "var(--color-text-danger)",
|
|
142
|
+
fontSize: "var(--font-size-sm)"
|
|
143
|
+
},
|
|
144
|
+
children: M
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ g(l, { children: [/* @__PURE__ */ h(a, {
|
|
149
|
+
variant: "outline",
|
|
150
|
+
onClick: x,
|
|
151
|
+
disabled: A,
|
|
152
|
+
children: P ? "Done" : "Cancel"
|
|
153
|
+
}), !P && /* @__PURE__ */ h(a, {
|
|
154
|
+
onClick: I,
|
|
155
|
+
disabled: A,
|
|
156
|
+
children: A ? /* @__PURE__ */ h(p, {}) : "Publish"
|
|
157
|
+
})] })
|
|
158
|
+
]
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
//#endregion
|
|
163
|
+
export { v as default };
|
|
164
|
+
|
|
165
|
+
//# sourceMappingURL=PublishToStoreDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublishToStoreDialog.js","names":[],"sources":["../../../../src/bigconsole/components/dashboard/PublishToStoreDialog.tsx"],"sourcesContent":["/**\n * PublishToStoreDialog\n *\n * Turns the open dashboard into a store template.\n *\n * WHY THIS EXISTS:\n * A workflow template's {nodes, edges} can plausibly be hand-written into the\n * developer portal. A dashboard export — every widget with its layout\n * coordinates, bindings and filters — cannot. Without this, authoring a\n * dashboard template means hand-crafting a large JSON document, which nobody\n * will do, and the gallery stays empty.\n *\n * The backend tokenises the board (replacing this workspace's data-sink\n * references with named slots), then a DRAFT Dashboard Template application is\n * created in the developer portal from the result. It deliberately stops there\n * rather than writing a store product directly: devportal already owns\n * versioning, review and publisher identity for dashboard templates, and\n * forking that pipeline would orphan the listing.\n *\n * @module bigconsole/components/dashboard/PublishToStoreDialog\n */\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n Spinner,\n Textarea,\n} from '@burdenoff/fe-libs/ui';\nimport { type FC, memo, useCallback, useEffect, useState } from 'react';\n\nimport { useStoreDashboardTemplates, type PublishToStoreResult } from '../../hooks/useStoreDashboardTemplates';\n\nexport interface PublishToStoreDialogProps {\n isOpen: boolean;\n dashboardId: string;\n dashboardName: string;\n dashboardDescription?: string | null;\n onClose: () => void;\n onPublished?: (result: PublishToStoreResult) => void;\n}\n\n/** Store slugs are lowercase, hyphenated and unique. */\nfunction slugify(value: string): string {\n return value\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter(Boolean)\n .join('-')\n .slice(0, 60);\n}\n\nexport const PublishToStoreDialog: FC<PublishToStoreDialogProps> = memo(function PublishToStoreDialog({\n isOpen,\n dashboardId,\n dashboardName,\n dashboardDescription,\n onClose,\n onPublished,\n}) {\n const { publishToStore } = useStoreDashboardTemplates({ autoLoad: false });\n\n const [name, setName] = useState(dashboardName);\n const [slug, setSlug] = useState(slugify(dashboardName));\n const [description, setDescription] = useState(dashboardDescription ?? '');\n const [publishing, setPublishing] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [result, setResult] = useState<PublishToStoreResult | null>(null);\n\n useEffect(() => {\n if (!isOpen) return;\n setName(dashboardName);\n setSlug(slugify(dashboardName));\n setDescription(dashboardDescription ?? '');\n setError(null);\n setResult(null);\n }, [isOpen, dashboardName, dashboardDescription]);\n\n const handlePublish = useCallback(async () => {\n if (!name.trim()) {\n setError('A template name is required');\n return;\n }\n if (!slug.trim()) {\n setError('A slug is required');\n return;\n }\n if (!description.trim()) {\n setError('A description is required — it is what people see in the gallery');\n return;\n }\n\n setError(null);\n setPublishing(true);\n try {\n const published = await publishToStore({\n dashboardId,\n name: name.trim(),\n slug: slug.trim(),\n description: description.trim(),\n });\n if (!published.success) {\n setError(published.errorMessage ?? 'Failed to publish to the store');\n return;\n }\n setResult(published);\n onPublished?.(published);\n } finally {\n setPublishing(false);\n }\n }, [name, slug, description, dashboardId, publishToStore, onPublished]);\n\n const label = { display: 'block', marginBottom: 'var(--space-2xs)', fontSize: 'var(--font-size-sm)' };\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && !publishing && onClose()}>\n <DialogContent style={{ maxWidth: '520px' }}>\n <DialogHeader>\n <DialogTitle>Publish as Template</DialogTitle>\n <DialogDescription>\n Share this dashboard as a reusable template. Your data sources are replaced with named slots, so nothing\n from this workspace is published.\n </DialogDescription>\n </DialogHeader>\n\n {result ? (\n <div style={{ padding: 'var(--space-md) 0' }}>\n <p style={{ fontWeight: 'var(--font-weight-medium)' }}>Draft template created</p>\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-muted)' }}>\n {result.sinkCount} data source{result.sinkCount === 1 ? '' : 's'} turned into slots. Finish in the\n Developer Portal: review the listing, then submit it for approval. It appears in the gallery once\n approved.\n </p>\n {result.unknownSinkIds.length > 0 && (\n <p style={{ fontSize: 'var(--font-size-sm)', color: 'var(--color-text-warning)' }}>\n {result.unknownSinkIds.length} data source\n {result.unknownSinkIds.length === 1 ? '' : 's'} could not be named — those slots use generic labels.\n </p>\n )}\n </div>\n ) : (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 'var(--space-sm)' }}>\n <div>\n <label htmlFor=\"tpl-name\" style={label}>\n Template name\n </label>\n <Input\n id=\"tpl-name\"\n value={name}\n disabled={publishing}\n onChange={(e) => {\n setName(e.target.value);\n setSlug(slugify(e.target.value));\n }}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-slug\" style={label}>\n Slug\n </label>\n <Input\n id=\"tpl-slug\"\n value={slug}\n disabled={publishing}\n onChange={(e) => setSlug(slugify(e.target.value))}\n />\n </div>\n\n <div>\n <label htmlFor=\"tpl-desc\" style={label}>\n Description\n </label>\n <Textarea\n id=\"tpl-desc\"\n rows={3}\n value={description}\n disabled={publishing}\n placeholder=\"What is this dashboard for, and what data does it need?\"\n onChange={(e) => setDescription(e.target.value)}\n />\n </div>\n\n {error && <p style={{ color: 'var(--color-text-danger)', fontSize: 'var(--font-size-sm)' }}>{error}</p>}\n </div>\n )}\n\n <DialogFooter>\n <Button variant=\"outline\" onClick={onClose} disabled={publishing}>\n {result ? 'Done' : 'Cancel'}\n </Button>\n {!result && (\n <Button onClick={handlePublish} disabled={publishing}>\n {publishing ? <Spinner /> : 'Publish'}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n});\n\nexport default PublishToStoreDialog;\n"],"mappings":";;;;;AA+CA,SAAS,EAAQ,GAAuB;AACtC,QAAO,EACJ,aAAa,CACb,MAAM,aAAa,CACnB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O;OACP,UAAU;OACV,WAAW,MAAM,EAAQ,EAAQ,EAAE,OAAO,MAAM,CAAC;OACjD,CAAA,CACE,EAAA,CAAA;MAEN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;OAAO,SAAQ;OAAW,OAAO;iBAAO;OAEhC,CAAA,EACR,kBAAC,GAAD;OACE,IAAG;OACH,MAAM;OACN,OAAO;OACP,UAAU;OACV,aAAY;OACZ,WAAW,MAAM,EAAe,EAAE,OAAO,MAAM;OAC/C,CAAA,CACE,EAAA,CAAA;MAEL,KAAS,kBAAC,KAAD;OAAG,OAAO;QAAE,OAAO;QAA4B,UAAU;QAAuB;iBAAG;OAAU,CAAA;MACnG;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAU,SAAS;KAAS,UAAU;eACnD,IAAS,SAAS;KACZ,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,SAAS;KAAe,UAAU;eACvC,IAAa,kBAAC,GAAD,EAAW,CAAA,GAAG;KACrB,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA;EAEX"}
|
|
@@ -20,8 +20,26 @@ var t = e`
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
`, n = e`
|
|
24
|
+
query BuildDashboardTemplateContent(
|
|
25
|
+
$dashboardId: ID!
|
|
26
|
+
$defaultDashboardName: String
|
|
27
|
+
$defaultCategory: String
|
|
28
|
+
$defaultTags: [String!]
|
|
29
|
+
) {
|
|
30
|
+
buildDashboardTemplateContent(
|
|
31
|
+
dashboardId: $dashboardId
|
|
32
|
+
defaultDashboardName: $defaultDashboardName
|
|
33
|
+
defaultCategory: $defaultCategory
|
|
34
|
+
defaultTags: $defaultTags
|
|
35
|
+
) {
|
|
36
|
+
content
|
|
37
|
+
sinkCount
|
|
38
|
+
unknownSinkIds
|
|
39
|
+
}
|
|
40
|
+
}
|
|
23
41
|
`;
|
|
24
42
|
//#endregion
|
|
25
|
-
export { t as IMPORT_DASHBOARD_TEMPLATE };
|
|
43
|
+
export { n as BUILD_DASHBOARD_TEMPLATE_CONTENT, t as IMPORT_DASHBOARD_TEMPLATE };
|
|
26
44
|
|
|
27
45
|
//# sourceMappingURL=storeTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storeTemplates.js","names":[],"sources":["../../../src/bigconsole/graphql/storeTemplates.ts"],"sourcesContent":["/**\n * GraphQL documents for store-distributed dashboard templates.\n *\n * The two catalog reads are generated from\n * `src/operations/global/store/queries/*.graphql` in the usual way.\n *\n * `IMPORT_DASHBOARD_TEMPLATE` is defined inline as an interim measure.\n * `importDashboardTemplate` is new in wspace-bigconsole-svc, so it is not yet\n * present in `graphql/wspace.graphql` — that file is only ever refreshed by\n * `bun run schema:pull` against a live gateway (hand-editing it is a repo\n * guardrail), and the gateway supergraph only carries the field once the\n * service has deployed and Hive has reconciled.\n *\n * It cannot simply be dropped into `src/operations/wspace/**` yet either:\n * `src/generated` is gitignored and CI regenerates it, so an operation file\n * referencing a field the checked-in schema lacks fails codegen and breaks the\n * build. Once `schema:pull` has run, move this document into\n * `src/operations/wspace/dashboard/mutations/importDashboardTemplate.graphql`\n * and import the generated `ImportDashboardTemplateDocument` instead — the\n * shape is unchanged.\n *\n * @module bigconsole/graphql/storeTemplates\n */\nimport { gql } from '@apollo/client';\n\nexport {\n BrowseDashboardTemplatesDocument as BROWSE_DASHBOARD_TEMPLATES,\n GetDashboardTemplateDetailDocument as GET_DASHBOARD_TEMPLATE_DETAIL,\n} from '../../generated/global-operations';\n\nexport const IMPORT_DASHBOARD_TEMPLATE = gql`\n mutation ImportDashboardTemplate($input: ImportDashboardTemplateInput!) {\n importDashboardTemplate(input: $input) {\n success\n errorMessage\n unresolvedSlots\n resolvedSlots\n widgetsNeedingData\n warnings\n stats {\n pagesCreated\n widgetsCreated\n }\n dashboard {\n id\n name\n }\n }\n }\n`;\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"storeTemplates.js","names":[],"sources":["../../../src/bigconsole/graphql/storeTemplates.ts"],"sourcesContent":["/**\n * GraphQL documents for store-distributed dashboard templates.\n *\n * The two catalog reads are generated from\n * `src/operations/global/store/queries/*.graphql` in the usual way.\n *\n * `IMPORT_DASHBOARD_TEMPLATE` is defined inline as an interim measure.\n * `importDashboardTemplate` is new in wspace-bigconsole-svc, so it is not yet\n * present in `graphql/wspace.graphql` — that file is only ever refreshed by\n * `bun run schema:pull` against a live gateway (hand-editing it is a repo\n * guardrail), and the gateway supergraph only carries the field once the\n * service has deployed and Hive has reconciled.\n *\n * It cannot simply be dropped into `src/operations/wspace/**` yet either:\n * `src/generated` is gitignored and CI regenerates it, so an operation file\n * referencing a field the checked-in schema lacks fails codegen and breaks the\n * build. Once `schema:pull` has run, move this document into\n * `src/operations/wspace/dashboard/mutations/importDashboardTemplate.graphql`\n * and import the generated `ImportDashboardTemplateDocument` instead — the\n * shape is unchanged.\n *\n * @module bigconsole/graphql/storeTemplates\n */\nimport { gql } from '@apollo/client';\n\nexport {\n BrowseDashboardTemplatesDocument as BROWSE_DASHBOARD_TEMPLATES,\n GetDashboardTemplateDetailDocument as GET_DASHBOARD_TEMPLATE_DETAIL,\n CreateDashboardTemplateAppDocument as CREATE_TEMPLATE_APP,\n CreateDashboardTemplateVersionDocument as CREATE_TEMPLATE_VERSION,\n} from '../../generated/global-operations';\n\nexport const IMPORT_DASHBOARD_TEMPLATE = gql`\n mutation ImportDashboardTemplate($input: ImportDashboardTemplateInput!) {\n importDashboardTemplate(input: $input) {\n success\n errorMessage\n unresolvedSlots\n resolvedSlots\n widgetsNeedingData\n warnings\n stats {\n pagesCreated\n widgetsCreated\n }\n dashboard {\n id\n name\n }\n }\n }\n`;\n\n/**\n * Same interim treatment as IMPORT_DASHBOARD_TEMPLATE, and for the same reason:\n * buildDashboardTemplateContent is new in wspace-bigconsole-svc and is not yet\n * in the checked-in wspace schema.\n */\nexport const BUILD_DASHBOARD_TEMPLATE_CONTENT = gql`\n query BuildDashboardTemplateContent(\n $dashboardId: ID!\n $defaultDashboardName: String\n $defaultCategory: String\n $defaultTags: [String!]\n ) {\n buildDashboardTemplateContent(\n dashboardId: $dashboardId\n defaultDashboardName: $defaultDashboardName\n defaultCategory: $defaultCategory\n defaultTags: $defaultTags\n ) {\n content\n sinkCount\n unknownSinkIds\n }\n }\n`;\n"],"mappings":";;;AAgCA,IAAa,IAA4B,CAAG;;;;;;;;;;;;;;;;;;;GA0B/B,IAAmC,CAAG"}
|