@burdenoff/microfe-bigconsole 2026.1119.8 → 2026.1119.10
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/ExportDashboardDialog.js +129 -117
- package/dist/bigconsole/components/parser/ParserCard.d.ts +3 -1
- package/dist/bigconsole/components/parser/ParserCard.js +125 -120
- package/dist/bigconsole/components/parser/ParserScopeBadge.d.ts +6 -0
- package/dist/bigconsole/components/parser/ParserScopeBadge.js +23 -0
- package/dist/bigconsole/hooks/useExportDashboard.d.ts +14 -2
- package/dist/bigconsole/hooks/useExportDashboard.js +45 -41
- package/dist/bigconsole/hooks/useParserOperations.d.ts +6 -0
- package/dist/bigconsole/hooks/useParserOperations.js +64 -65
- package/dist/bigconsole/pages/DataParsersPage.js +201 -172
- package/dist/bigconsole/store/parserScope.js +9 -6
- package/dist/bigconsole/types/index.d.ts +8 -0
- package/dist/bigconsole/utils/parserScopeFilter.d.ts +14 -0
- package/dist/bigconsole/utils/parserScopeFilter.js +25 -0
- package/dist/generated/wspace-operations.d.ts +18 -1
- package/dist/generated/wspace-operations.js +58 -7
- package/package.json +4 -4
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { SECTION_FOCUS_RING as e } from "../common/sectionStyles.js";
|
|
2
2
|
import { ParserStatusBadge as t } from "./ParserStatusBadge.js";
|
|
3
3
|
import { ParserTypeBadge as n } from "./ParserTypeBadge.js";
|
|
4
|
+
import { ParserScopeBadge as r } from "./ParserScopeBadge.js";
|
|
4
5
|
import "../common/index.js";
|
|
5
|
-
import { useTr as
|
|
6
|
-
import { memo as
|
|
7
|
-
import { Database as
|
|
8
|
-
import { jsx as
|
|
6
|
+
import { useTr as i } from "../../../shared/hooks/useTr.js";
|
|
7
|
+
import { memo as a, useCallback as o, useMemo as s } from "react";
|
|
8
|
+
import { Database as c, Download as l, FlaskConical as u, Pencil as d, Play as f, Trash2 as p } from "lucide-react";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
10
|
// src/bigconsole/components/parser/ParserCard.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
11
|
+
var g = `inline-flex min-h-11 min-w-11 items-center justify-center rounded-md text-text-secondary motion-safe:transition-colors hover:bg-bg-sunken hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50 ${e}`, _ = 6, v = 2;
|
|
12
|
+
function y(e) {
|
|
12
13
|
let t = new Date(e);
|
|
13
14
|
return new Intl.DateTimeFormat("en-US", {
|
|
14
15
|
month: "short",
|
|
@@ -18,16 +19,16 @@ function v(e) {
|
|
|
18
19
|
minute: "2-digit"
|
|
19
20
|
}).format(t);
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function b(e) {
|
|
22
23
|
let t = new Date(e), n = Date.now() - t.getTime(), r = Math.floor(n / 6e4);
|
|
23
24
|
if (r < 1) return "just now";
|
|
24
25
|
if (r < 60) return `${r}m ago`;
|
|
25
26
|
let i = Math.floor(r / 60);
|
|
26
27
|
if (i < 24) return `${i}h ago`;
|
|
27
28
|
let a = Math.floor(i / 24);
|
|
28
|
-
return a < 7 ? `${a}d ago` :
|
|
29
|
+
return a < 7 ? `${a}d ago` : y(e);
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function x(e, t) {
|
|
31
32
|
if (!e) return {
|
|
32
33
|
lines: [],
|
|
33
34
|
truncated: !1
|
|
@@ -43,208 +44,212 @@ function b(e, t) {
|
|
|
43
44
|
truncated: r.length > t
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
var
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
var S = a(function({ label: e, onClick: t, destructive: n, disabled: r, children: i }) {
|
|
48
|
+
return /* @__PURE__ */ m("button", {
|
|
48
49
|
type: "button",
|
|
49
50
|
onClick: t,
|
|
50
51
|
disabled: r,
|
|
51
52
|
"aria-label": e,
|
|
52
53
|
title: e,
|
|
53
|
-
className: `${
|
|
54
|
+
className: `${g} ${n ? "hover:text-[var(--color-status-error-text)]" : ""}`,
|
|
54
55
|
children: i
|
|
55
56
|
});
|
|
56
|
-
}),
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
e.stopPropagation(),
|
|
61
|
-
}, [
|
|
62
|
-
e.stopPropagation(),
|
|
63
|
-
}, [
|
|
64
|
-
e.stopPropagation(),
|
|
65
|
-
}, [
|
|
66
|
-
e.stopPropagation(),
|
|
67
|
-
}, [
|
|
68
|
-
e.stopPropagation(),
|
|
69
|
-
}, [
|
|
70
|
-
e.stopPropagation(),
|
|
71
|
-
}, [
|
|
57
|
+
}), C = a(function({ parser: a, onView: g, onEdit: C, onTest: w, onExecute: T, onExport: E, onDelete: D, isDeleting: O = !1, layout: k = "grid", showScope: A = !1 }) {
|
|
58
|
+
let j = i(), M = a.name || j("bigconsole.parsers.view.untitled", "Untitled Parser"), N = o(() => {
|
|
59
|
+
g?.(a.id);
|
|
60
|
+
}, [g, a.id]), P = o((e) => {
|
|
61
|
+
e.stopPropagation(), g?.(a.id);
|
|
62
|
+
}, [g, a.id]), F = o((e) => {
|
|
63
|
+
e.stopPropagation(), w?.(a.id);
|
|
64
|
+
}, [w, a.id]), I = o((e) => {
|
|
65
|
+
e.stopPropagation(), T?.(a.id);
|
|
66
|
+
}, [T, a.id]), L = o((e) => {
|
|
67
|
+
e.stopPropagation(), C?.(a.id);
|
|
68
|
+
}, [C, a.id]), R = o((e) => {
|
|
69
|
+
e.stopPropagation(), E?.(a.id);
|
|
70
|
+
}, [E, a.id]), z = o((e) => {
|
|
71
|
+
e.stopPropagation(), D?.(a.id);
|
|
72
|
+
}, [D, a.id]), { lines: B, truncated: V } = s(() => x(a.expression, k === "list" ? v : _), [a.expression, k]), H = "h-icon-sm w-icon-sm", U = /* @__PURE__ */ h("div", {
|
|
72
73
|
className: "flex shrink-0 flex-wrap items-center",
|
|
73
74
|
children: [
|
|
74
|
-
|
|
75
|
-
label:
|
|
76
|
-
onClick:
|
|
77
|
-
disabled:
|
|
78
|
-
children: /* @__PURE__ */
|
|
75
|
+
w && /* @__PURE__ */ m(S, {
|
|
76
|
+
label: j("bigconsole.parsers.card.test", "Test parser"),
|
|
77
|
+
onClick: F,
|
|
78
|
+
disabled: O,
|
|
79
|
+
children: /* @__PURE__ */ m(u, {
|
|
79
80
|
"aria-hidden": "true",
|
|
80
|
-
className:
|
|
81
|
+
className: H
|
|
81
82
|
})
|
|
82
83
|
}),
|
|
83
|
-
|
|
84
|
-
label:
|
|
85
|
-
onClick:
|
|
86
|
-
disabled:
|
|
87
|
-
children: /* @__PURE__ */
|
|
84
|
+
T && /* @__PURE__ */ m(S, {
|
|
85
|
+
label: j("bigconsole.parsers.card.execute", "Execute parser"),
|
|
86
|
+
onClick: I,
|
|
87
|
+
disabled: O,
|
|
88
|
+
children: /* @__PURE__ */ m(f, {
|
|
88
89
|
"aria-hidden": "true",
|
|
89
|
-
className:
|
|
90
|
+
className: H
|
|
90
91
|
})
|
|
91
92
|
}),
|
|
92
|
-
|
|
93
|
-
label:
|
|
94
|
-
onClick:
|
|
95
|
-
disabled:
|
|
96
|
-
children: /* @__PURE__ */
|
|
93
|
+
C && /* @__PURE__ */ m(S, {
|
|
94
|
+
label: j("bigconsole.parsers.card.edit", "Edit parser"),
|
|
95
|
+
onClick: L,
|
|
96
|
+
disabled: O,
|
|
97
|
+
children: /* @__PURE__ */ m(d, {
|
|
97
98
|
"aria-hidden": "true",
|
|
98
|
-
className:
|
|
99
|
+
className: H
|
|
99
100
|
})
|
|
100
101
|
}),
|
|
101
|
-
|
|
102
|
-
label:
|
|
103
|
-
onClick:
|
|
104
|
-
disabled:
|
|
105
|
-
children: /* @__PURE__ */
|
|
102
|
+
E && /* @__PURE__ */ m(S, {
|
|
103
|
+
label: j("bigconsole.parsers.card.export", "Export parser"),
|
|
104
|
+
onClick: R,
|
|
105
|
+
disabled: O,
|
|
106
|
+
children: /* @__PURE__ */ m(l, {
|
|
106
107
|
"aria-hidden": "true",
|
|
107
|
-
className:
|
|
108
|
+
className: H
|
|
108
109
|
})
|
|
109
110
|
}),
|
|
110
|
-
|
|
111
|
-
label:
|
|
112
|
-
onClick:
|
|
111
|
+
D && /* @__PURE__ */ m(S, {
|
|
112
|
+
label: j("bigconsole.parsers.card.delete", "Delete parser"),
|
|
113
|
+
onClick: z,
|
|
113
114
|
destructive: !0,
|
|
114
|
-
disabled:
|
|
115
|
-
children: /* @__PURE__ */ p
|
|
115
|
+
disabled: O,
|
|
116
|
+
children: /* @__PURE__ */ m(p, {
|
|
116
117
|
"aria-hidden": "true",
|
|
117
|
-
className:
|
|
118
|
+
className: H
|
|
118
119
|
})
|
|
119
120
|
})
|
|
120
121
|
]
|
|
121
|
-
}),
|
|
122
|
+
}), W = a.inputSinkKey ? /* @__PURE__ */ h("span", {
|
|
122
123
|
className: "inline-flex min-w-0 items-center gap-icon-gap rounded-md border border-[var(--color-border-subtle)] bg-bg-sunken px-2 py-1 text-xs text-text-secondary",
|
|
123
|
-
title: `${
|
|
124
|
-
children: [/* @__PURE__ */
|
|
124
|
+
title: `${a.inputSinkKey} → ${a.outputKey}`,
|
|
125
|
+
children: [/* @__PURE__ */ m(c, {
|
|
125
126
|
"aria-hidden": "true",
|
|
126
127
|
className: "h-3 w-3 shrink-0"
|
|
127
|
-
}), /* @__PURE__ */
|
|
128
|
+
}), /* @__PURE__ */ m("span", {
|
|
128
129
|
className: "truncate font-mono",
|
|
129
|
-
children:
|
|
130
|
+
children: a.inputSinkKey
|
|
130
131
|
})]
|
|
131
|
-
}) : /* @__PURE__ */
|
|
132
|
+
}) : /* @__PURE__ */ m("span", {
|
|
132
133
|
className: "text-xs text-text-muted",
|
|
133
|
-
children:
|
|
134
|
-
}),
|
|
134
|
+
children: j("bigconsole.parsers.view.noneConfigured", "None configured")
|
|
135
|
+
}), G = /* @__PURE__ */ m("span", {
|
|
135
136
|
className: "whitespace-nowrap tabular-nums",
|
|
136
|
-
title: `Last updated: ${
|
|
137
|
-
children:
|
|
138
|
-
}),
|
|
137
|
+
title: `Last updated: ${y(a.updatedAt)}`,
|
|
138
|
+
children: b(a.updatedAt)
|
|
139
|
+
}), K = `
|
|
139
140
|
bg-bg-elevated
|
|
140
141
|
border border-[var(--color-border-default)]
|
|
141
142
|
rounded-card
|
|
142
143
|
cursor-pointer
|
|
143
144
|
hover:border-action-primary-bg
|
|
144
145
|
motion-safe:transition-colors
|
|
145
|
-
${
|
|
146
|
-
`,
|
|
146
|
+
${O ? "opacity-60 pointer-events-none" : ""}
|
|
147
|
+
`, q = /* @__PURE__ */ m("button", {
|
|
147
148
|
type: "button",
|
|
148
|
-
onClick:
|
|
149
|
-
disabled:
|
|
149
|
+
onClick: P,
|
|
150
|
+
disabled: O,
|
|
150
151
|
className: `block w-full min-w-0 truncate rounded-sm text-left ${e}`,
|
|
151
|
-
children:
|
|
152
|
+
children: M
|
|
152
153
|
});
|
|
153
|
-
return
|
|
154
|
-
onClick:
|
|
155
|
-
className: `${
|
|
154
|
+
return k === "list" ? /* @__PURE__ */ h("div", {
|
|
155
|
+
onClick: N,
|
|
156
|
+
className: `${K} flex flex-wrap items-center gap-x-3 gap-y-2 p-3 sm:flex-nowrap`,
|
|
156
157
|
children: [
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
type:
|
|
158
|
+
/* @__PURE__ */ m(n, {
|
|
159
|
+
type: a.type,
|
|
159
160
|
size: "sm"
|
|
160
161
|
}),
|
|
161
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ h("div", {
|
|
162
163
|
className: "min-w-0 flex-1",
|
|
163
|
-
children: [/* @__PURE__ */
|
|
164
|
+
children: [/* @__PURE__ */ m("h3", {
|
|
164
165
|
className: "min-w-0 text-sm font-semibold text-text-primary",
|
|
165
|
-
children:
|
|
166
|
-
}), /* @__PURE__ */
|
|
166
|
+
children: q
|
|
167
|
+
}), /* @__PURE__ */ h("p", {
|
|
167
168
|
className: "mt-0.5 truncate font-mono text-xs text-text-secondary",
|
|
168
169
|
children: [
|
|
169
|
-
|
|
170
|
+
a.inputSinkKey || "—",
|
|
170
171
|
" → ",
|
|
171
|
-
|
|
172
|
+
a.outputKey || "—"
|
|
172
173
|
]
|
|
173
174
|
})]
|
|
174
175
|
}),
|
|
175
|
-
|
|
176
|
+
A && /* @__PURE__ */ m(r, { parser: a }),
|
|
177
|
+
B.length > 0 && /* @__PURE__ */ m("pre", {
|
|
176
178
|
"aria-hidden": "true",
|
|
177
179
|
className: "hidden min-w-0 max-w-md flex-1 truncate whitespace-pre rounded-md border border-[var(--color-border-subtle)] bg-bg-sunken px-2 py-1 font-mono text-xs text-text-secondary lg:block",
|
|
178
|
-
children:
|
|
180
|
+
children: B.join(" ")
|
|
179
181
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
status:
|
|
182
|
+
/* @__PURE__ */ m(t, {
|
|
183
|
+
status: a.status,
|
|
182
184
|
size: "sm"
|
|
183
185
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ m("span", {
|
|
185
187
|
className: "text-xs text-text-muted",
|
|
186
|
-
children:
|
|
188
|
+
children: G
|
|
187
189
|
}),
|
|
188
|
-
|
|
190
|
+
U
|
|
189
191
|
]
|
|
190
|
-
}) : /* @__PURE__ */
|
|
191
|
-
onClick:
|
|
192
|
-
className: `${
|
|
192
|
+
}) : /* @__PURE__ */ h("div", {
|
|
193
|
+
onClick: N,
|
|
194
|
+
className: `${K} flex h-full flex-col overflow-hidden`,
|
|
193
195
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ h("div", {
|
|
195
197
|
className: "flex flex-wrap items-start justify-between gap-icon-gap p-4 pb-3",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ h("div", {
|
|
197
199
|
className: "flex min-w-0 flex-1 items-center gap-icon-gap pt-2",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
199
|
-
type:
|
|
200
|
+
children: [/* @__PURE__ */ m(n, {
|
|
201
|
+
type: a.type,
|
|
200
202
|
size: "sm"
|
|
201
|
-
}), /* @__PURE__ */
|
|
203
|
+
}), /* @__PURE__ */ m("h3", {
|
|
202
204
|
className: "min-w-0 flex-1 text-sm font-semibold text-text-primary",
|
|
203
|
-
children:
|
|
205
|
+
children: q
|
|
204
206
|
})]
|
|
205
|
-
}),
|
|
207
|
+
}), U]
|
|
206
208
|
}),
|
|
207
|
-
/* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ m("div", {
|
|
208
210
|
className: "px-4",
|
|
209
|
-
children:
|
|
211
|
+
children: B.length > 0 ? /* @__PURE__ */ h("pre", {
|
|
210
212
|
className: "min-h-28 overflow-x-auto rounded-md border border-[var(--color-border-subtle)] bg-bg-sunken p-3 font-mono text-xs leading-relaxed text-text-secondary",
|
|
211
|
-
children: [
|
|
213
|
+
children: [B.join("\n"), V && /* @__PURE__ */ m("span", {
|
|
212
214
|
className: "mt-1 block text-text-muted",
|
|
213
215
|
children: "…"
|
|
214
216
|
})]
|
|
215
|
-
}) : /* @__PURE__ */
|
|
217
|
+
}) : /* @__PURE__ */ m("div", {
|
|
216
218
|
className: "flex min-h-28 items-center justify-center rounded-md border border-[var(--color-border-subtle)] bg-bg-sunken text-xs text-text-muted",
|
|
217
|
-
children:
|
|
219
|
+
children: j("bigconsole.parsers.card.noExpression", "No expression configured")
|
|
218
220
|
})
|
|
219
221
|
}),
|
|
220
|
-
|
|
222
|
+
a.description && /* @__PURE__ */ m("p", {
|
|
221
223
|
className: "line-clamp-2 px-4 pt-3 text-xs text-text-secondary",
|
|
222
|
-
children:
|
|
224
|
+
children: a.description
|
|
223
225
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
226
|
+
/* @__PURE__ */ h("div", {
|
|
225
227
|
className: "mt-auto flex flex-col gap-2 p-4 pt-3",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
228
|
+
children: [/* @__PURE__ */ h("div", {
|
|
227
229
|
className: "flex flex-wrap items-center justify-between gap-icon-gap",
|
|
228
|
-
children: [
|
|
229
|
-
|
|
230
|
+
children: [/* @__PURE__ */ h("span", {
|
|
231
|
+
className: "flex min-w-0 flex-wrap items-center gap-icon-gap",
|
|
232
|
+
children: [W, A && /* @__PURE__ */ m(r, { parser: a })]
|
|
233
|
+
}), /* @__PURE__ */ m(t, {
|
|
234
|
+
status: a.status,
|
|
230
235
|
size: "sm"
|
|
231
236
|
})]
|
|
232
|
-
}), /* @__PURE__ */
|
|
237
|
+
}), /* @__PURE__ */ h("div", {
|
|
233
238
|
className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-[var(--color-border-subtle)] pt-2 text-xs text-text-muted",
|
|
234
|
-
children: [/* @__PURE__ */
|
|
239
|
+
children: [/* @__PURE__ */ h("span", {
|
|
235
240
|
className: "flex flex-wrap items-center gap-3",
|
|
236
|
-
children: [
|
|
237
|
-
title: `Cache TTL: ${
|
|
241
|
+
children: [a.version == null ? null : /* @__PURE__ */ h("span", { children: ["v", a.version] }), a.ttl ? /* @__PURE__ */ h("span", {
|
|
242
|
+
title: `Cache TTL: ${a.ttl} seconds`,
|
|
238
243
|
children: [
|
|
239
244
|
"TTL: ",
|
|
240
|
-
|
|
245
|
+
a.ttl,
|
|
241
246
|
"s"
|
|
242
247
|
]
|
|
243
248
|
}) : null]
|
|
244
|
-
}),
|
|
249
|
+
}), G]
|
|
245
250
|
})]
|
|
246
251
|
})
|
|
247
252
|
]
|
|
248
253
|
});
|
|
249
254
|
});
|
|
250
|
-
export {
|
|
255
|
+
export { C as ParserCard, C as default, x as previewExpression };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Parser } from '../../types';
|
|
2
|
+
interface ParserScopeBadgeProps {
|
|
3
|
+
parser: Pick<Parser, 'consoleId' | 'console'>;
|
|
4
|
+
}
|
|
5
|
+
export declare const ParserScopeBadge: import('react').MemoExoticComponent<({ parser }: ParserScopeBadgeProps) => import('react').JSX.Element>;
|
|
6
|
+
export default ParserScopeBadge;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isGlobalParser as e } from "../../store/parserScope.js";
|
|
2
|
+
import { useTr as t } from "../../../shared/hooks/useTr.js";
|
|
3
|
+
import { memo as n } from "react";
|
|
4
|
+
import { Globe as r, LayoutDashboard as i } from "lucide-react";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
// src/bigconsole/components/parser/ParserScopeBadge.tsx
|
|
7
|
+
var s = n(function({ parser: n }) {
|
|
8
|
+
let s = t(), c = e(n), l = c ? r : i, u = c ? s("bigconsole.parsers.scope.global", "Global") : n.console?.name ?? s("bigconsole.parsers.scope.dashboardFallback", "Dashboard"), d = c ? s("bigconsole.parsers.scope.globalDescription", "Available in every dashboard") : s("bigconsole.parsers.scope.dashboardDescription", "Only available in dashboard \"{{name}}\"", { name: u });
|
|
9
|
+
return /* @__PURE__ */ o("span", {
|
|
10
|
+
title: d,
|
|
11
|
+
"aria-label": d,
|
|
12
|
+
"data-testid": "parser-scope-badge",
|
|
13
|
+
className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md bg-bg-sunken px-1.5 py-0.5 text-xs text-text-secondary",
|
|
14
|
+
children: [/* @__PURE__ */ a(l, {
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
className: "h-3 w-3 shrink-0"
|
|
17
|
+
}), /* @__PURE__ */ a("span", {
|
|
18
|
+
className: "truncate",
|
|
19
|
+
children: u
|
|
20
|
+
})]
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
export { s as ParserScopeBadge, s as default };
|
|
@@ -4,10 +4,15 @@
|
|
|
4
4
|
* Provides dashboard export functionality with file download.
|
|
5
5
|
*/
|
|
6
6
|
export interface ExportDashboardOptions {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Write data sink and parser bindings as stable keys (default: false). When
|
|
9
|
+
* false the file carries no data source or workspace identifiers at all.
|
|
10
|
+
*/
|
|
8
11
|
includeDataSourceRefs?: boolean;
|
|
9
|
-
/** Include webhook mappings (default: false) */
|
|
12
|
+
/** Include webhook mappings (default: false). Needs an export consent grant. */
|
|
10
13
|
includeWebhookMappings?: boolean;
|
|
14
|
+
/** Write the `exportedAt` timestamp (default: true). Off gives diff-stable files. */
|
|
15
|
+
includeExportedAt?: boolean;
|
|
11
16
|
/** Pretty print JSON output (default: true) */
|
|
12
17
|
prettyPrint?: boolean;
|
|
13
18
|
/** Exact reviewed document to download, without another server export. */
|
|
@@ -25,5 +30,12 @@ export interface UseExportDashboardResult {
|
|
|
25
30
|
/** Clear error */
|
|
26
31
|
clearError: () => void;
|
|
27
32
|
}
|
|
33
|
+
/** The `BigConsoleExportDashboardOptions` input for a set of dialog options, with the server defaults filled in. */
|
|
34
|
+
export declare function exportOptionsInput(options: ExportDashboardOptions): {
|
|
35
|
+
includeDataSourceRefs: boolean;
|
|
36
|
+
includeWebhookMappings: boolean;
|
|
37
|
+
includeExportedAt: boolean;
|
|
38
|
+
prettyPrint: boolean;
|
|
39
|
+
};
|
|
28
40
|
export declare function useExportDashboard(): UseExportDashboardResult;
|
|
29
41
|
export default useExportDashboard;
|
|
@@ -4,43 +4,47 @@ import "../context/index.js";
|
|
|
4
4
|
import { useCallback as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
5
5
|
import { useApolloClient as o } from "@apollo/client/react";
|
|
6
6
|
// src/bigconsole/hooks/useExportDashboard.ts
|
|
7
|
-
function s(e
|
|
7
|
+
function s(e) {
|
|
8
|
+
return {
|
|
9
|
+
includeDataSourceRefs: e.includeDataSourceRefs ?? !1,
|
|
10
|
+
includeWebhookMappings: e.includeWebhookMappings ?? !1,
|
|
11
|
+
includeExportedAt: e.includeExportedAt ?? !0,
|
|
12
|
+
prettyPrint: e.prettyPrint ?? !0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function c(e, t) {
|
|
8
16
|
let n = new Blob([e], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
9
17
|
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
10
18
|
}
|
|
11
|
-
function
|
|
19
|
+
function l(e) {
|
|
12
20
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").substring(0, 50);
|
|
13
21
|
}
|
|
14
|
-
function
|
|
15
|
-
let [
|
|
16
|
-
r(() => (
|
|
17
|
-
|
|
18
|
-
}), [
|
|
19
|
-
let
|
|
20
|
-
if (!
|
|
22
|
+
function u() {
|
|
23
|
+
let [u, d] = a(!1), [f, p] = a(null), m = o(), { currentUser: h, workspaceId: g } = t(), _ = `${h?.id ?? ""}|${g ?? ""}`, v = i(_), y = i(0);
|
|
24
|
+
r(() => (v.current = _, y.current++, d(!1), p(null), () => {
|
|
25
|
+
v.current = "";
|
|
26
|
+
}), [_]);
|
|
27
|
+
let b = n(() => {
|
|
28
|
+
if (!g || !h?.id || v.current !== _) throw Error("Select a workspace before exporting a dashboard.");
|
|
21
29
|
return {
|
|
22
30
|
requiredWorkspaceAuth: !0,
|
|
23
|
-
requiredWorkspaceId:
|
|
31
|
+
requiredWorkspaceId: g,
|
|
24
32
|
queryDeduplication: !1
|
|
25
33
|
};
|
|
26
34
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]),
|
|
31
|
-
let r = ++
|
|
35
|
+
g,
|
|
36
|
+
h?.id,
|
|
37
|
+
_
|
|
38
|
+
]), x = n(async (t, n = {}) => {
|
|
39
|
+
let r = ++y.current, i = () => v.current === _ && y.current === r;
|
|
32
40
|
try {
|
|
33
|
-
let r =
|
|
34
|
-
|
|
35
|
-
let a = await
|
|
41
|
+
let r = b();
|
|
42
|
+
d(!0), p(null);
|
|
43
|
+
let a = await m.query({
|
|
36
44
|
query: e,
|
|
37
45
|
variables: {
|
|
38
46
|
id: t,
|
|
39
|
-
options:
|
|
40
|
-
includeDataSourceRefs: n.includeDataSourceRefs ?? !1,
|
|
41
|
-
includeWebhookMappings: n.includeWebhookMappings ?? !1,
|
|
42
|
-
prettyPrint: n.prettyPrint ?? !0
|
|
43
|
-
}
|
|
47
|
+
options: s(n)
|
|
44
48
|
},
|
|
45
49
|
fetchPolicy: "no-cache",
|
|
46
50
|
errorPolicy: "none",
|
|
@@ -58,43 +62,43 @@ function l() {
|
|
|
58
62
|
} catch (e) {
|
|
59
63
|
if (!i()) return null;
|
|
60
64
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to export dashboard");
|
|
61
|
-
return
|
|
65
|
+
return p(t), null;
|
|
62
66
|
} finally {
|
|
63
|
-
i() &&
|
|
67
|
+
i() && d(!1);
|
|
64
68
|
}
|
|
65
69
|
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
m,
|
|
71
|
+
_,
|
|
72
|
+
b
|
|
69
73
|
]);
|
|
70
74
|
return {
|
|
71
|
-
loading:
|
|
72
|
-
error:
|
|
73
|
-
exportDashboard:
|
|
75
|
+
loading: u,
|
|
76
|
+
error: f,
|
|
77
|
+
exportDashboard: x,
|
|
74
78
|
downloadDashboard: n(async (e, t, n = {}) => {
|
|
75
79
|
try {
|
|
76
|
-
|
|
77
|
-
let r = n.preparedContent ?? await
|
|
80
|
+
b();
|
|
81
|
+
let r = n.preparedContent ?? await x(e, n);
|
|
78
82
|
if (!r) return !1;
|
|
79
83
|
let i = t;
|
|
80
84
|
if (!i) {
|
|
81
85
|
let e = JSON.parse(r);
|
|
82
86
|
e && typeof e == "object" && "dashboard" in e && e.dashboard && typeof e.dashboard == "object" && "name" in e.dashboard && typeof e.dashboard.name == "string" && (i = e.dashboard.name);
|
|
83
87
|
}
|
|
84
|
-
return
|
|
88
|
+
return c(r, `${l(i || "dashboard")}-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`), !0;
|
|
85
89
|
} catch (e) {
|
|
86
|
-
if (
|
|
90
|
+
if (v.current !== _) return !1;
|
|
87
91
|
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to download dashboard");
|
|
88
|
-
return
|
|
92
|
+
return p(t), !1;
|
|
89
93
|
}
|
|
90
94
|
}, [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
x,
|
|
96
|
+
_,
|
|
97
|
+
b
|
|
94
98
|
]),
|
|
95
99
|
clearError: n(() => {
|
|
96
|
-
|
|
100
|
+
y.current++, d(!1), p(null);
|
|
97
101
|
}, [])
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
|
-
export {
|
|
104
|
+
export { u as default, u as useExportDashboard, s as exportOptionsInput };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Parser, ParserType, ParserStatus } from '../types';
|
|
2
2
|
interface UseParserOperationsOptions {
|
|
3
3
|
consoleId?: string;
|
|
4
|
+
/**
|
|
5
|
+
* List every parser the caller can see — the global ones plus each readable
|
|
6
|
+
* dashboard's — instead of one console's (BOFF-9770). `consoleId` is then
|
|
7
|
+
* ignored for listing.
|
|
8
|
+
*/
|
|
9
|
+
allScopes?: boolean;
|
|
4
10
|
skipFetch?: boolean;
|
|
5
11
|
}
|
|
6
12
|
interface ParserFilters {
|