@burdenoff/microfe-semanticfed 2026.1031.6 → 2026.1031.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/semanticfed/api/semanticfedGraphql.js +1 -1
- package/dist/semanticfed/components/AskQuestionPanel.js +221 -103
- package/dist/semanticfed/components/AskQuestionPanel.js.map +1 -1
- package/dist/semanticfed/components/NlAssistSettings.js +143 -0
- package/dist/semanticfed/components/NlAssistSettings.js.map +1 -0
- package/dist/semanticfed/components/SavedQueryRunsPanel.js +407 -0
- package/dist/semanticfed/components/SavedQueryRunsPanel.js.map +1 -0
- package/dist/semanticfed/hooks/useNlQuery.js +63 -11
- package/dist/semanticfed/hooks/useNlQuery.js.map +1 -1
- package/dist/semanticfed/hooks/useQueryRuns.js +171 -0
- package/dist/semanticfed/hooks/useQueryRuns.js.map +1 -0
- package/dist/semanticfed/pages/QueryConsolePage.js +138 -138
- package/dist/semanticfed/pages/QueryConsolePage.js.map +1 -1
- package/dist/semanticfed/providers/SemanticFedProvider.js +22 -10
- package/dist/semanticfed/providers/SemanticFedProvider.js.map +1 -1
- package/dist/semanticfed/utils/format.js +8 -0
- package/dist/semanticfed/utils/format.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { translateWithFallback as e } from "../utils/i18n.js";
|
|
2
2
|
import { sqlErrorMessage as t, useSemExecuteSql as n, useSemSqlCatalog as r, useSemSqlModels as i } from "../hooks/useSqlConsole.js";
|
|
3
3
|
import { AskQuestionPanel as a } from "../components/AskQuestionPanel.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { formatCell as o } from "../utils/format.js";
|
|
5
|
+
import { SavedQueryRunsPanel as ee } from "../components/SavedQueryRunsPanel.js";
|
|
6
|
+
import { useMemo as s, useState as c } from "react";
|
|
7
|
+
import { AlertTriangle as l, CheckCircle2 as u, Clock as d, Database as f, EyeOff as p, Loader2 as m, Play as h, Plug as g, Table2 as _, Terminal as v, XCircle as y } from "lucide-react";
|
|
8
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
9
|
+
import { useI18n as C } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
10
|
+
import { Badge as w, Button as T, Card as E, CardContent as D, CardHeader as O, CardTitle as k } from "@burdenoff/fe-libs/ui";
|
|
9
11
|
//#region src/semanticfed/pages/QueryConsolePage.tsx
|
|
10
|
-
var
|
|
12
|
+
var A = [
|
|
11
13
|
100,
|
|
12
14
|
1e3,
|
|
13
15
|
1e4
|
|
14
|
-
],
|
|
15
|
-
function
|
|
16
|
+
], j = 10;
|
|
17
|
+
function M(e) {
|
|
16
18
|
if (!e) return "";
|
|
17
19
|
let t = e.columns.find((e) => e.kind === "DIMENSION"), n = e.columns.find((e) => e.kind === "METRIC"), r = (e) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(e) ? e : `"${e.replace(/"/g, "\"\"")}"`, i = r(e.name);
|
|
18
20
|
if (t && n) {
|
|
@@ -27,46 +29,43 @@ function j(e) {
|
|
|
27
29
|
}
|
|
28
30
|
return `SELECT *\nFROM ${i}\nLIMIT 100;`;
|
|
29
31
|
}
|
|
30
|
-
function M(e) {
|
|
31
|
-
return e == null ? "NULL" : typeof e == "object" ? JSON.stringify(e) : String(e);
|
|
32
|
-
}
|
|
33
32
|
function N() {
|
|
34
|
-
let { t: N } =
|
|
35
|
-
if (!
|
|
36
|
-
|
|
37
|
-
let e =
|
|
33
|
+
let { t: N } = C(), P = (t, n, r) => e(N, t, n, r), F = i(), [I, L] = c(null), R = I ?? F.data?.[0]?.id ?? null, z = r(R), B = n(), [V, H] = c(null), U = V ?? M(z.data?.tables[0]), W = (e) => H(e), [G, K] = c(1e3), [q, J] = c(null), [Y, X] = c(null), [Z, Q] = c([]), te = s(() => F.data?.find((e) => e.id === R)?.name ?? "", [F.data, R]), $ = async () => {
|
|
34
|
+
if (!R || U.trim() === "" || B.isPending) return;
|
|
35
|
+
X(null);
|
|
36
|
+
let e = U, n = {
|
|
38
37
|
id: Date.now(),
|
|
39
38
|
sql: e,
|
|
40
|
-
modelName:
|
|
39
|
+
modelName: te,
|
|
41
40
|
executedAt: (/* @__PURE__ */ new Date()).toLocaleTimeString()
|
|
42
41
|
};
|
|
43
42
|
try {
|
|
44
|
-
let t = await
|
|
43
|
+
let t = await B.mutateAsync({
|
|
45
44
|
sql: e,
|
|
46
|
-
modelId:
|
|
47
|
-
maxRows:
|
|
45
|
+
modelId: R,
|
|
46
|
+
maxRows: G
|
|
48
47
|
});
|
|
49
|
-
|
|
48
|
+
J(t), Q((e) => [{
|
|
50
49
|
...n,
|
|
51
50
|
ok: !0,
|
|
52
51
|
rowCount: t.rowCount,
|
|
53
52
|
durationMs: Math.round(t.durationMs),
|
|
54
53
|
message: null
|
|
55
|
-
}, ...e].slice(0,
|
|
54
|
+
}, ...e].slice(0, j));
|
|
56
55
|
} catch (e) {
|
|
57
56
|
let r = t(e);
|
|
58
|
-
|
|
57
|
+
J(null), X(r), Q((e) => [{
|
|
59
58
|
...n,
|
|
60
59
|
ok: !1,
|
|
61
60
|
rowCount: 0,
|
|
62
61
|
durationMs: 0,
|
|
63
62
|
message: r
|
|
64
|
-
}, ...e].slice(0,
|
|
63
|
+
}, ...e].slice(0, j));
|
|
65
64
|
}
|
|
66
|
-
},
|
|
67
|
-
|
|
65
|
+
}, ne = (e) => {
|
|
66
|
+
X(null), J(e.result);
|
|
68
67
|
let { translation: t, result: n } = e;
|
|
69
|
-
!n || !t.sql ||
|
|
68
|
+
!n || !t.sql || Q((e) => [{
|
|
70
69
|
id: Date.now(),
|
|
71
70
|
sql: t.sql ?? "",
|
|
72
71
|
modelName: t.modelName,
|
|
@@ -75,104 +74,104 @@ function N() {
|
|
|
75
74
|
rowCount: n.rowCount,
|
|
76
75
|
durationMs: Math.round(n.durationMs),
|
|
77
76
|
message: null
|
|
78
|
-
}, ...e].slice(0,
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
return /* @__PURE__ */
|
|
77
|
+
}, ...e].slice(0, j));
|
|
78
|
+
}, re = (e) => {
|
|
79
|
+
J(null), X(e);
|
|
80
|
+
}, ie = (e) => W(U.trim() === "" ? e : `${U}${e}`), ae = F.isSuccess && F.data.length === 0;
|
|
81
|
+
return /* @__PURE__ */ S("div", {
|
|
83
82
|
className: "space-y-6 p-6",
|
|
84
83
|
children: [
|
|
85
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ S("div", {
|
|
86
85
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
87
86
|
"data-tour": "semanticfed-query-console-header",
|
|
88
|
-
children: [/* @__PURE__ */
|
|
87
|
+
children: [/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h1", {
|
|
89
88
|
className: "text-2xl font-semibold",
|
|
90
89
|
children: P("semanticfed.queryConsole.title", "Query Console")
|
|
91
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ x("p", {
|
|
92
91
|
className: "text-sm text-muted-foreground",
|
|
93
92
|
children: P("semanticfed.queryConsole.askDescription", "Ask a question in plain English or run read-only SQL against a semantic model. Every query is federated across its data sources with your access policies applied.")
|
|
94
|
-
})] }), /* @__PURE__ */
|
|
93
|
+
})] }), /* @__PURE__ */ S("div", {
|
|
95
94
|
className: "flex gap-2",
|
|
96
|
-
children: [/* @__PURE__ */
|
|
95
|
+
children: [/* @__PURE__ */ S(w, {
|
|
97
96
|
variant: "outline",
|
|
98
97
|
className: "gap-1",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
100
|
-
}), /* @__PURE__ */
|
|
98
|
+
children: [/* @__PURE__ */ x(v, { className: "h-3 w-3" }), " SQL SELECT"]
|
|
99
|
+
}), /* @__PURE__ */ S(w, {
|
|
101
100
|
variant: "outline",
|
|
102
101
|
className: "gap-1",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ x(g, { className: "h-3 w-3" }), P("semanticfed.queryConsole.badges.httpApi", "HTTP SQL API")]
|
|
104
103
|
})]
|
|
105
104
|
})]
|
|
106
105
|
}),
|
|
107
|
-
|
|
106
|
+
ae && /* @__PURE__ */ x(E, { children: /* @__PURE__ */ S(D, {
|
|
108
107
|
className: "flex items-center gap-3 p-6 text-sm text-muted-foreground",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
108
|
+
children: [/* @__PURE__ */ x(f, { className: "h-5 w-5" }), P("semanticfed.queryConsole.noModels", "No semantic model yet. Create a model with entities, dimensions and metrics, then query it here with SQL.")]
|
|
110
109
|
}) }),
|
|
111
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ S("div", {
|
|
112
111
|
className: "grid gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]",
|
|
113
|
-
children: [/* @__PURE__ */
|
|
112
|
+
children: [/* @__PURE__ */ S(E, {
|
|
114
113
|
className: "min-w-0",
|
|
115
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ x(O, {
|
|
116
115
|
className: "pb-3",
|
|
117
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ S(k, {
|
|
118
117
|
className: "flex items-center gap-2 text-base",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ x(_, { className: "h-4 w-4" }), P("semanticfed.queryConsole.schema.title", "Tables")]
|
|
120
119
|
})
|
|
121
|
-
}), /* @__PURE__ */
|
|
120
|
+
}), /* @__PURE__ */ S(D, {
|
|
122
121
|
className: "space-y-3",
|
|
123
122
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ x("label", {
|
|
125
124
|
className: "block text-xs font-medium text-muted-foreground",
|
|
126
125
|
htmlFor: "sql-console-model",
|
|
127
126
|
children: P("semanticfed.queryConsole.schema.model", "Semantic model")
|
|
128
127
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ x("select", {
|
|
130
129
|
id: "sql-console-model",
|
|
131
130
|
"data-testid": "sql-console-model",
|
|
132
131
|
className: "w-full rounded border bg-background p-2 text-sm",
|
|
133
|
-
value:
|
|
132
|
+
value: R ?? "",
|
|
134
133
|
onChange: (e) => {
|
|
135
|
-
|
|
134
|
+
L(e.target.value || null), H(null), J(null), X(null);
|
|
136
135
|
},
|
|
137
136
|
disabled: !F.data || F.data.length === 0,
|
|
138
|
-
children: (F.data ?? []).map((e) => /* @__PURE__ */
|
|
137
|
+
children: (F.data ?? []).map((e) => /* @__PURE__ */ x("option", {
|
|
139
138
|
value: e.id,
|
|
140
139
|
children: e.name
|
|
141
140
|
}, e.id))
|
|
142
141
|
}),
|
|
143
|
-
F.isError && /* @__PURE__ */
|
|
142
|
+
F.isError && /* @__PURE__ */ x("p", {
|
|
144
143
|
className: "text-xs text-destructive",
|
|
145
144
|
children: t(F.error)
|
|
146
145
|
}),
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
z.isLoading && /* @__PURE__ */ x(m, { className: "h-4 w-4 animate-spin text-muted-foreground" }),
|
|
147
|
+
z.isError && /* @__PURE__ */ x("p", {
|
|
149
148
|
className: "text-xs text-destructive",
|
|
150
|
-
children: t(
|
|
149
|
+
children: t(z.error)
|
|
151
150
|
}),
|
|
152
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ x("div", {
|
|
153
152
|
className: "max-h-96 space-y-2 overflow-y-auto",
|
|
154
153
|
"data-testid": "sql-console-tables",
|
|
155
|
-
children: (
|
|
154
|
+
children: (z.data?.tables ?? []).map((e) => /* @__PURE__ */ S("details", {
|
|
156
155
|
className: "rounded border p-2",
|
|
157
|
-
open:
|
|
158
|
-
children: [/* @__PURE__ */
|
|
156
|
+
open: z.data?.tables.length === 1,
|
|
157
|
+
children: [/* @__PURE__ */ x("summary", {
|
|
159
158
|
className: "cursor-pointer truncate font-mono text-xs font-medium",
|
|
160
159
|
children: e.name
|
|
161
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ S("ul", {
|
|
162
161
|
className: "mt-2 space-y-1",
|
|
163
|
-
children: [e.columns.map((e) => /* @__PURE__ */
|
|
162
|
+
children: [e.columns.map((e) => /* @__PURE__ */ x("li", { children: /* @__PURE__ */ S("button", {
|
|
164
163
|
type: "button",
|
|
165
164
|
className: "flex w-full items-center justify-between gap-2 rounded px-1 text-left font-mono text-xs hover:bg-muted",
|
|
166
|
-
onClick: () =>
|
|
165
|
+
onClick: () => ie(e.name),
|
|
167
166
|
title: e.description ?? void 0,
|
|
168
|
-
children: [/* @__PURE__ */
|
|
167
|
+
children: [/* @__PURE__ */ x("span", {
|
|
169
168
|
className: "truncate",
|
|
170
169
|
children: e.name
|
|
171
|
-
}), /* @__PURE__ */
|
|
170
|
+
}), /* @__PURE__ */ x("span", {
|
|
172
171
|
className: "shrink-0 text-[10px] text-muted-foreground",
|
|
173
172
|
children: e.kind === "METRIC" ? e.aggregation ?? "METRIC" : e.dataType
|
|
174
173
|
})]
|
|
175
|
-
}) }, e.name)), e.columns.length === 0 && /* @__PURE__ */
|
|
174
|
+
}) }, e.name)), e.columns.length === 0 && /* @__PURE__ */ x("li", {
|
|
176
175
|
className: "text-xs text-muted-foreground",
|
|
177
176
|
children: P("semanticfed.queryConsole.schema.noColumns", "No dimensions or metrics registered")
|
|
178
177
|
})]
|
|
@@ -181,184 +180,185 @@ function N() {
|
|
|
181
180
|
})
|
|
182
181
|
]
|
|
183
182
|
})]
|
|
184
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ S("div", {
|
|
185
184
|
className: "min-w-0 space-y-4",
|
|
186
185
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
modelId:
|
|
189
|
-
maxRows:
|
|
190
|
-
onAnswer:
|
|
191
|
-
onError:
|
|
192
|
-
onOpenInEditor: (e) =>
|
|
186
|
+
/* @__PURE__ */ x(a, {
|
|
187
|
+
modelId: R,
|
|
188
|
+
maxRows: G,
|
|
189
|
+
onAnswer: ne,
|
|
190
|
+
onError: re,
|
|
191
|
+
onOpenInEditor: (e) => W(e)
|
|
193
192
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, {
|
|
195
194
|
className: "pb-3",
|
|
196
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ S("div", {
|
|
197
196
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
197
|
+
children: [/* @__PURE__ */ x(k, {
|
|
199
198
|
className: "text-base",
|
|
200
199
|
children: P("semanticfed.queryConsole.editor.title", "Query Editor")
|
|
201
|
-
}), /* @__PURE__ */
|
|
200
|
+
}), /* @__PURE__ */ S("div", {
|
|
202
201
|
className: "flex items-center gap-2",
|
|
203
202
|
children: [
|
|
204
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ x("label", {
|
|
205
204
|
className: "sr-only",
|
|
206
205
|
htmlFor: "sql-console-max-rows",
|
|
207
206
|
children: P("semanticfed.queryConsole.editor.maxRowsLabel", "Maximum rows")
|
|
208
207
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ x("select", {
|
|
210
209
|
id: "sql-console-max-rows",
|
|
211
210
|
className: "rounded border bg-background p-1 text-xs",
|
|
212
|
-
value:
|
|
213
|
-
onChange: (e) =>
|
|
214
|
-
children:
|
|
211
|
+
value: G,
|
|
212
|
+
onChange: (e) => K(Number(e.target.value)),
|
|
213
|
+
children: A.map((e) => /* @__PURE__ */ x("option", {
|
|
215
214
|
value: e,
|
|
216
215
|
children: P("semanticfed.queryConsole.editor.maxRowsOption", "Max {count} rows", { count: e.toLocaleString() })
|
|
217
216
|
}, e))
|
|
218
217
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ S(T, {
|
|
220
219
|
size: "sm",
|
|
221
220
|
onClick: () => void $(),
|
|
222
|
-
disabled: !
|
|
221
|
+
disabled: !R || U.trim() === "" || B.isPending,
|
|
223
222
|
"data-testid": "sql-console-run",
|
|
224
|
-
children: [
|
|
223
|
+
children: [B.isPending ? /* @__PURE__ */ x(m, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ x(h, { className: "mr-2 h-4 w-4" }), P("semanticfed.queryConsole.actions.execute", "Execute")]
|
|
225
224
|
})
|
|
226
225
|
]
|
|
227
226
|
})]
|
|
228
227
|
})
|
|
229
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ S(D, { children: [/* @__PURE__ */ x("textarea", {
|
|
230
229
|
"aria-label": P("semanticfed.queryConsole.editor.ariaLabel", "SQL statement"),
|
|
231
230
|
"data-testid": "sql-console-editor",
|
|
232
231
|
className: "w-full rounded border bg-muted/30 p-4 font-mono text-sm leading-relaxed focus:outline-none focus:ring-2 focus:ring-primary",
|
|
233
232
|
rows: 8,
|
|
234
|
-
value:
|
|
235
|
-
onChange: (e) =>
|
|
233
|
+
value: U,
|
|
234
|
+
onChange: (e) => W(e.target.value),
|
|
236
235
|
onKeyDown: (e) => {
|
|
237
236
|
(e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), $());
|
|
238
237
|
},
|
|
239
238
|
spellCheck: !1,
|
|
240
239
|
placeholder: "SELECT region, SUM(revenue) FROM orders GROUP BY region"
|
|
241
|
-
}), /* @__PURE__ */
|
|
240
|
+
}), /* @__PURE__ */ S("div", {
|
|
242
241
|
className: "mt-2 flex flex-wrap items-center gap-4 text-xs text-muted-foreground",
|
|
243
242
|
children: [
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
/* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.shortcut", "Ctrl/Cmd + Enter to run") }),
|
|
244
|
+
/* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.timeout", "Timeout: 30s") }),
|
|
245
|
+
/* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.editor.supported", "SELECT, JOIN … ON, WHERE … AND, GROUP BY, ORDER BY, LIMIT/OFFSET") })
|
|
247
246
|
]
|
|
248
247
|
})] })] }),
|
|
249
|
-
|
|
248
|
+
Y && /* @__PURE__ */ x(E, {
|
|
250
249
|
"data-testid": "sql-console-error",
|
|
251
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ S(D, {
|
|
252
251
|
className: "flex items-start gap-3 p-4 text-sm text-destructive",
|
|
253
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ x(y, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ x("span", {
|
|
254
253
|
className: "break-words",
|
|
255
|
-
children:
|
|
254
|
+
children: Y
|
|
256
255
|
})]
|
|
257
256
|
})
|
|
258
257
|
}),
|
|
259
|
-
|
|
258
|
+
q && /* @__PURE__ */ S(E, {
|
|
260
259
|
"data-testid": "sql-console-result",
|
|
261
|
-
children: [/* @__PURE__ */
|
|
260
|
+
children: [/* @__PURE__ */ x(O, {
|
|
262
261
|
className: "pb-3",
|
|
263
|
-
children: /* @__PURE__ */
|
|
262
|
+
children: /* @__PURE__ */ S("div", {
|
|
264
263
|
className: "flex flex-wrap items-center gap-3 text-sm",
|
|
265
264
|
children: [
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ x(u, { className: "h-4 w-4 text-primary" }),
|
|
266
|
+
/* @__PURE__ */ x("span", {
|
|
268
267
|
className: "font-medium",
|
|
269
268
|
"data-testid": "sql-console-row-count",
|
|
270
|
-
children: P("semanticfed.queryConsole.result.rows", "{count} rows", { count:
|
|
269
|
+
children: P("semanticfed.queryConsole.result.rows", "{count} rows", { count: q.rowCount.toLocaleString() })
|
|
271
270
|
}),
|
|
272
|
-
/* @__PURE__ */
|
|
271
|
+
/* @__PURE__ */ S("span", {
|
|
273
272
|
className: "text-muted-foreground",
|
|
274
|
-
children: [Math.round(
|
|
273
|
+
children: [Math.round(q.durationMs), "ms"]
|
|
275
274
|
}),
|
|
276
|
-
/* @__PURE__ */
|
|
275
|
+
/* @__PURE__ */ x("span", {
|
|
277
276
|
className: "text-muted-foreground",
|
|
278
|
-
children: P("semanticfed.queryConsole.result.sources", "{count} sources", { count:
|
|
277
|
+
children: P("semanticfed.queryConsole.result.sources", "{count} sources", { count: q.sourcesTouched })
|
|
279
278
|
}),
|
|
280
|
-
|
|
279
|
+
q.truncated && /* @__PURE__ */ S(w, {
|
|
281
280
|
variant: "outline",
|
|
282
281
|
className: "gap-1",
|
|
283
|
-
children: [/* @__PURE__ */
|
|
282
|
+
children: [/* @__PURE__ */ x(l, { className: "h-3 w-3" }), P("semanticfed.queryConsole.result.truncated", "Truncated — more rows matched")]
|
|
284
283
|
})
|
|
285
284
|
]
|
|
286
285
|
})
|
|
287
|
-
}), /* @__PURE__ */
|
|
286
|
+
}), /* @__PURE__ */ x(D, { children: /* @__PURE__ */ x("div", {
|
|
288
287
|
className: "max-h-[28rem] overflow-auto rounded border",
|
|
289
|
-
children: /* @__PURE__ */
|
|
288
|
+
children: /* @__PURE__ */ S("table", {
|
|
290
289
|
className: "w-full text-left text-xs",
|
|
291
|
-
children: [/* @__PURE__ */
|
|
290
|
+
children: [/* @__PURE__ */ x("thead", {
|
|
292
291
|
className: "sticky top-0 bg-muted",
|
|
293
|
-
children: /* @__PURE__ */
|
|
292
|
+
children: /* @__PURE__ */ x("tr", { children: q.columns.map((e) => /* @__PURE__ */ S("th", {
|
|
294
293
|
className: "whitespace-nowrap px-3 py-2 font-medium",
|
|
295
|
-
children: [/* @__PURE__ */
|
|
294
|
+
children: [/* @__PURE__ */ S("span", {
|
|
296
295
|
className: "inline-flex items-center gap-1",
|
|
297
|
-
children: [e.name, e.masked && /* @__PURE__ */
|
|
296
|
+
children: [e.name, e.masked && /* @__PURE__ */ x(p, {
|
|
298
297
|
className: "h-3 w-3 text-muted-foreground",
|
|
299
298
|
"aria-label": P("semanticfed.queryConsole.result.masked", "Masked by policy ({mask})", { mask: e.mask ?? "" })
|
|
300
299
|
})]
|
|
301
|
-
}), /* @__PURE__ */
|
|
300
|
+
}), /* @__PURE__ */ x("span", {
|
|
302
301
|
className: "block text-[10px] font-normal text-muted-foreground",
|
|
303
302
|
children: e.aggregation ?? e.dataType
|
|
304
303
|
})]
|
|
305
304
|
}, e.name)) })
|
|
306
|
-
}), /* @__PURE__ */
|
|
305
|
+
}), /* @__PURE__ */ S("tbody", { children: [q.rows.map((e, t) => /* @__PURE__ */ x("tr", {
|
|
307
306
|
className: "border-t",
|
|
308
|
-
children:
|
|
307
|
+
children: q.columns.map((t) => /* @__PURE__ */ x("td", {
|
|
309
308
|
className: "whitespace-nowrap px-3 py-1.5 font-mono",
|
|
310
|
-
children:
|
|
309
|
+
children: o(e[t.name])
|
|
311
310
|
}, t.name))
|
|
312
|
-
}, t)),
|
|
313
|
-
colSpan:
|
|
311
|
+
}, t)), q.rows.length === 0 && /* @__PURE__ */ x("tr", { children: /* @__PURE__ */ x("td", {
|
|
312
|
+
colSpan: q.columns.length,
|
|
314
313
|
className: "px-3 py-4 text-center text-muted-foreground",
|
|
315
314
|
children: P("semanticfed.queryConsole.result.empty", "No rows matched")
|
|
316
315
|
}) })] })]
|
|
317
316
|
})
|
|
318
317
|
}) })]
|
|
319
318
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
319
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, { children: /* @__PURE__ */ S(k, {
|
|
321
320
|
className: "flex items-center gap-2 text-base",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
323
|
-
}) }), /* @__PURE__ */
|
|
321
|
+
children: [/* @__PURE__ */ x(d, { className: "h-4 w-4" }), P("semanticfed.queryConsole.history.title", "Query History")]
|
|
322
|
+
}) }), /* @__PURE__ */ x(D, { children: Z.length === 0 ? /* @__PURE__ */ x("p", {
|
|
324
323
|
className: "text-xs text-muted-foreground",
|
|
325
324
|
children: P("semanticfed.queryConsole.history.empty", "Statements you run in this session appear here.")
|
|
326
|
-
}) : /* @__PURE__ */
|
|
325
|
+
}) : /* @__PURE__ */ x("div", {
|
|
327
326
|
className: "space-y-2",
|
|
328
|
-
children:
|
|
327
|
+
children: Z.map((e) => /* @__PURE__ */ S("button", {
|
|
329
328
|
type: "button",
|
|
330
329
|
className: "flex w-full items-start gap-3 rounded border p-3 text-left hover:bg-muted",
|
|
331
|
-
onClick: () =>
|
|
332
|
-
children: [e.ok ? /* @__PURE__ */
|
|
330
|
+
onClick: () => W(e.sql),
|
|
331
|
+
children: [e.ok ? /* @__PURE__ */ x(u, { className: "mt-0.5 h-4 w-4 shrink-0 text-primary" }) : /* @__PURE__ */ x(y, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }), /* @__PURE__ */ S("div", {
|
|
333
332
|
className: "min-w-0 flex-1",
|
|
334
|
-
children: [/* @__PURE__ */
|
|
333
|
+
children: [/* @__PURE__ */ x("p", {
|
|
335
334
|
className: "truncate font-mono text-xs",
|
|
336
335
|
children: e.sql
|
|
337
|
-
}), /* @__PURE__ */
|
|
336
|
+
}), /* @__PURE__ */ S("div", {
|
|
338
337
|
className: "mt-1 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",
|
|
339
338
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
e.ok ? /* @__PURE__ */
|
|
339
|
+
/* @__PURE__ */ x("span", { children: e.modelName }),
|
|
340
|
+
e.ok ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("span", { children: P("semanticfed.queryConsole.history.results", "{count} results", { count: e.rowCount.toLocaleString() }) }), /* @__PURE__ */ S("span", { children: [e.durationMs, "ms"] })] }) : /* @__PURE__ */ x("span", {
|
|
342
341
|
className: "truncate",
|
|
343
342
|
children: e.message
|
|
344
343
|
}),
|
|
345
|
-
/* @__PURE__ */
|
|
344
|
+
/* @__PURE__ */ x("span", { children: e.executedAt })
|
|
346
345
|
]
|
|
347
346
|
})]
|
|
348
347
|
})]
|
|
349
348
|
}, e.id))
|
|
350
349
|
}) })] }),
|
|
351
|
-
/* @__PURE__ */ x(
|
|
350
|
+
/* @__PURE__ */ x(ee, { modelId: R }, R ?? "no-model"),
|
|
351
|
+
/* @__PURE__ */ S(E, { children: [/* @__PURE__ */ x(O, {
|
|
352
352
|
className: "pb-2",
|
|
353
|
-
children: /* @__PURE__ */
|
|
353
|
+
children: /* @__PURE__ */ S(k, {
|
|
354
354
|
className: "flex items-center gap-2 text-base",
|
|
355
|
-
children: [/* @__PURE__ */
|
|
355
|
+
children: [/* @__PURE__ */ x(g, { className: "h-4 w-4" }), P("semanticfed.queryConsole.connect.title", "Connect BI tools and notebooks")]
|
|
356
356
|
})
|
|
357
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ S(D, {
|
|
358
358
|
className: "space-y-2 text-xs text-muted-foreground",
|
|
359
|
-
children: [/* @__PURE__ */
|
|
359
|
+
children: [/* @__PURE__ */ x("p", { children: P("semanticfed.queryConsole.connect.body", "The same SQL runs over HTTPS: POST the semExecuteSql operation to the workspace API with a workspace token. Power BI (Web connector), Tableau (Web Data Connector), Python/pandas, Jupyter and reverse-ETL HTTP sources can all call it; see the SQL endpoint guide in the SemanticFed docs.") }), /* @__PURE__ */ x("pre", {
|
|
360
360
|
className: "overflow-x-auto rounded bg-muted p-3 font-mono text-[11px] text-foreground",
|
|
361
|
-
children: `mutation { semExecuteSql(input: { modelId: "${
|
|
361
|
+
children: `mutation { semExecuteSql(input: { modelId: "${R ?? "<model-id>"}", sql: "SELECT ..." }) { columns { name dataType } rows truncated } }`
|
|
362
362
|
})]
|
|
363
363
|
})] })
|
|
364
364
|
]
|