@flanksource/clicky-ui 0.3.84 → 0.3.86
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/components/Combobox.cjs +8 -6
- package/dist/components/Combobox.cjs.map +1 -1
- package/dist/components/Combobox.d.ts.map +1 -1
- package/dist/components/Combobox.js +8 -6
- package/dist/components/Combobox.js.map +1 -1
- package/dist/components/ComboboxMenu.cjs +7 -4
- package/dist/components/ComboboxMenu.cjs.map +1 -1
- package/dist/components/ComboboxMenu.d.ts +3 -2
- package/dist/components/ComboboxMenu.d.ts.map +1 -1
- package/dist/components/ComboboxMenu.js +7 -4
- package/dist/components/ComboboxMenu.js.map +1 -1
- package/dist/components/FilterBar.cjs +64 -47
- package/dist/components/FilterBar.cjs.map +1 -1
- package/dist/components/FilterBar.d.ts +20 -2
- package/dist/components/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar.js +63 -46
- package/dist/components/FilterBar.js.map +1 -1
- package/dist/components/TimeRange.cjs +156 -128
- package/dist/components/TimeRange.cjs.map +1 -1
- package/dist/components/TimeRange.d.ts +8 -1
- package/dist/components/TimeRange.d.ts.map +1 -1
- package/dist/components/TimeRange.js +156 -128
- package/dist/components/TimeRange.js.map +1 -1
- package/dist/components/combobox-types.d.ts +5 -0
- package/dist/components/combobox-types.d.ts.map +1 -1
- package/dist/components/filter-bar-context.cjs.map +1 -1
- package/dist/components/filter-bar-context.d.ts +2 -0
- package/dist/components/filter-bar-context.d.ts.map +1 -1
- package/dist/components/filter-bar-context.js.map +1 -1
- package/dist/components/filter-bar-field-utils.cjs +18 -4
- package/dist/components/filter-bar-field-utils.cjs.map +1 -1
- package/dist/components/filter-bar-field-utils.d.ts +3 -2
- package/dist/components/filter-bar-field-utils.d.ts.map +1 -1
- package/dist/components/filter-bar-field-utils.js +19 -5
- package/dist/components/filter-bar-field-utils.js.map +1 -1
- package/dist/components/filter-bar-menu.cjs +189 -0
- package/dist/components/filter-bar-menu.cjs.map +1 -0
- package/dist/components/filter-bar-menu.d.ts +25 -0
- package/dist/components/filter-bar-menu.d.ts.map +1 -0
- package/dist/components/filter-bar-menu.js +189 -0
- package/dist/components/filter-bar-menu.js.map +1 -0
- package/dist/components/filter-bar-multi.cjs +1 -1
- package/dist/components/filter-bar-multi.cjs.map +1 -1
- package/dist/components/filter-bar-multi.js +2 -2
- package/dist/components/filter-bar-multi.js.map +1 -1
- package/dist/components/filter-bar-popup.cjs +37 -0
- package/dist/components/filter-bar-popup.cjs.map +1 -0
- package/dist/components/filter-bar-popup.d.ts +32 -0
- package/dist/components/filter-bar-popup.d.ts.map +1 -0
- package/dist/components/filter-bar-popup.js +37 -0
- package/dist/components/filter-bar-popup.js.map +1 -0
- package/dist/components/filter-bar-tree.cjs +1 -1
- package/dist/components/filter-bar-tree.cjs.map +1 -1
- package/dist/components/filter-bar-tree.js +2 -2
- package/dist/components/filter-bar-tree.js.map +1 -1
- package/dist/components/json-schema-form-table-array.cjs +5 -3
- package/dist/components/json-schema-form-table-array.cjs.map +1 -1
- package/dist/components/json-schema-form-table-array.d.ts.map +1 -1
- package/dist/components/json-schema-form-table-array.js +5 -3
- package/dist/components/json-schema-form-table-array.js.map +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/connections/ConnectionPicker.cjs +6 -2
- package/dist/connections/ConnectionPicker.cjs.map +1 -1
- package/dist/connections/ConnectionPicker.d.ts.map +1 -1
- package/dist/connections/ConnectionPicker.js +6 -2
- package/dist/connections/ConnectionPicker.js.map +1 -1
- package/dist/connections/CreateConnectionDialog.cjs +8 -21
- package/dist/connections/CreateConnectionDialog.cjs.map +1 -1
- package/dist/connections/CreateConnectionDialog.d.ts +2 -1
- package/dist/connections/CreateConnectionDialog.d.ts.map +1 -1
- package/dist/connections/CreateConnectionDialog.js +8 -21
- package/dist/connections/CreateConnectionDialog.js.map +1 -1
- package/dist/data/ExpandableMarkdown.cjs +59 -0
- package/dist/data/ExpandableMarkdown.cjs.map +1 -0
- package/dist/data/ExpandableMarkdown.d.ts +17 -0
- package/dist/data/ExpandableMarkdown.d.ts.map +1 -0
- package/dist/data/ExpandableMarkdown.js +59 -0
- package/dist/data/ExpandableMarkdown.js.map +1 -0
- package/dist/data/MultiGaugeBar.cjs +49 -21
- package/dist/data/MultiGaugeBar.cjs.map +1 -1
- package/dist/data/MultiGaugeBar.d.ts +5 -2
- package/dist/data/MultiGaugeBar.d.ts.map +1 -1
- package/dist/data/MultiGaugeBar.js +49 -21
- package/dist/data/MultiGaugeBar.js.map +1 -1
- package/dist/data/flow-node/BoxNode.cjs +45 -0
- package/dist/data/flow-node/BoxNode.cjs.map +1 -0
- package/dist/data/flow-node/BoxNode.d.ts +28 -0
- package/dist/data/flow-node/BoxNode.d.ts.map +1 -0
- package/dist/data/flow-node/BoxNode.js +45 -0
- package/dist/data/flow-node/BoxNode.js.map +1 -0
- package/dist/data/flow-node/FlowMetrics.cjs +208 -0
- package/dist/data/flow-node/FlowMetrics.cjs.map +1 -0
- package/dist/data/flow-node/FlowMetrics.d.ts +60 -0
- package/dist/data/flow-node/FlowMetrics.d.ts.map +1 -0
- package/dist/data/flow-node/FlowMetrics.js +206 -0
- package/dist/data/flow-node/FlowMetrics.js.map +1 -0
- package/dist/data/flow-node/WorkloadNode.cjs +63 -0
- package/dist/data/flow-node/WorkloadNode.cjs.map +1 -0
- package/dist/data/flow-node/WorkloadNode.d.ts +42 -0
- package/dist/data/flow-node/WorkloadNode.d.ts.map +1 -0
- package/dist/data/flow-node/WorkloadNode.js +63 -0
- package/dist/data/flow-node/WorkloadNode.js.map +1 -0
- package/dist/data/flow-node/index.d.ts +5 -0
- package/dist/data/flow-node/index.d.ts.map +1 -0
- package/dist/data/flow-node/latency.cjs +37 -0
- package/dist/data/flow-node/latency.cjs.map +1 -0
- package/dist/data/flow-node/latency.d.ts +13 -0
- package/dist/data/flow-node/latency.d.ts.map +1 -0
- package/dist/data/flow-node/latency.js +35 -0
- package/dist/data/flow-node/latency.js.map +1 -0
- package/dist/data/traces/index.d.ts +1 -0
- package/dist/data/traces/index.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.cjs +4 -7
- package/dist/data/traces/otel/OtelTraceDetail.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceDetail.js +4 -7
- package/dist/data/traces/otel/OtelTraceDetail.js.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.cjs +90 -56
- package/dist/data/traces/otel/OtelTraceSearch.cjs.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.d.ts.map +1 -1
- package/dist/data/traces/otel/OtelTraceSearch.js +91 -57
- package/dist/data/traces/otel/OtelTraceSearch.js.map +1 -1
- package/dist/data/traces/otel/QueryBar.cjs +83 -10
- package/dist/data/traces/otel/QueryBar.cjs.map +1 -1
- package/dist/data/traces/otel/QueryBar.d.ts.map +1 -1
- package/dist/data/traces/otel/QueryBar.js +83 -10
- package/dist/data/traces/otel/QueryBar.js.map +1 -1
- package/dist/data/traces/otel/TraceResults.cjs +81 -13
- package/dist/data/traces/otel/TraceResults.cjs.map +1 -1
- package/dist/data/traces/otel/TraceResults.d.ts +11 -3
- package/dist/data/traces/otel/TraceResults.d.ts.map +1 -1
- package/dist/data/traces/otel/TraceResults.js +81 -13
- package/dist/data/traces/otel/TraceResults.js.map +1 -1
- package/dist/data/traces/otel/api.cjs.map +1 -1
- package/dist/data/traces/otel/api.d.ts +14 -0
- package/dist/data/traces/otel/api.d.ts.map +1 -1
- package/dist/data/traces/otel/api.js.map +1 -1
- package/dist/data/traces/otel/query.cjs +2 -2
- package/dist/data/traces/otel/query.cjs.map +1 -1
- package/dist/data/traces/otel/query.d.ts +1 -1
- package/dist/data/traces/otel/query.d.ts.map +1 -1
- package/dist/data/traces/otel/query.js +2 -2
- package/dist/data/traces/otel/query.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.cjs.map +1 -1
- package/dist/data/version-info.js +3 -3
- package/dist/data/version-info.js.map +1 -1
- package/dist/data/workload-panel/MemoryStack.cjs +38 -1
- package/dist/data/workload-panel/MemoryStack.cjs.map +1 -1
- package/dist/data/workload-panel/MemoryStack.d.ts.map +1 -1
- package/dist/data/workload-panel/MemoryStack.js +38 -1
- package/dist/data/workload-panel/MemoryStack.js.map +1 -1
- package/dist/data.cjs +18 -1
- package/dist/data.d.ts +2 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +8 -2
- package/dist/file-findings/AnnotatedCode.cjs +18 -2
- package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
- package/dist/file-findings/AnnotatedCode.d.ts +2 -0
- package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
- package/dist/file-findings/AnnotatedCode.js +18 -2
- package/dist/file-findings/AnnotatedCode.js.map +1 -1
- package/dist/file-findings/FileFindingsView.cjs.map +1 -1
- package/dist/file-findings/FileFindingsView.d.ts +2 -0
- package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
- package/dist/file-findings/FileFindingsView.js.map +1 -1
- package/dist/file-findings/file-review/FileReview.cjs +2 -1
- package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
- package/dist/file-findings/file-review/FileReview.d.ts +3 -1
- package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
- package/dist/file-findings/file-review/FileReview.js +2 -1
- package/dist/file-findings/file-review/FileReview.js.map +1 -1
- package/dist/index.cjs +18 -1
- package/dist/index.js +8 -2
- package/dist/profiles/editor/profileEditor.cjs +29 -30
- package/dist/profiles/editor/profileEditor.cjs.map +1 -1
- package/dist/profiles/editor/profileEditor.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditor.js +29 -30
- package/dist/profiles/editor/profileEditor.js.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.cjs +44 -43
- package/dist/profiles/editor/profileEditorPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.d.ts +10 -5
- package/dist/profiles/editor/profileEditorPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileEditorPreview.js +44 -43
- package/dist/profiles/editor/profileEditorPreview.js.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.cjs +153 -48
- package/dist/profiles/editor/profileMappingPreview.cjs.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.d.ts +16 -2
- package/dist/profiles/editor/profileMappingPreview.d.ts.map +1 -1
- package/dist/profiles/editor/profileMappingPreview.js +155 -50
- package/dist/profiles/editor/profileMappingPreview.js.map +1 -1
- package/dist/profiles/editor/sampleError.cjs +29 -0
- package/dist/profiles/editor/sampleError.cjs.map +1 -0
- package/dist/profiles/editor/sampleError.d.ts +16 -0
- package/dist/profiles/editor/sampleError.d.ts.map +1 -0
- package/dist/profiles/editor/sampleError.js +27 -0
- package/dist/profiles/editor/sampleError.js.map +1 -0
- package/dist/profiles/query/profileSampleResult.cjs.map +1 -1
- package/dist/profiles/query/profileSampleResult.d.ts +2 -0
- package/dist/profiles/query/profileSampleResult.d.ts.map +1 -1
- package/dist/profiles/query/profileSampleResult.js.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.cjs +1 -0
- package/dist/profiles/wizard/profileWizardQueryStep.cjs.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts +2 -0
- package/dist/profiles/wizard/profileWizardQueryStep.d.ts.map +1 -1
- package/dist/profiles/wizard/profileWizardQueryStep.js +1 -0
- package/dist/profiles/wizard/profileWizardQueryStep.js.map +1 -1
- package/dist/react-grab/core/index.js +1 -1
- package/dist/react-grab/{core-BERtFDWh.js → core-BK5CU6Lb.js} +2 -2
- package/dist/react-grab/index.js +1 -1
- package/dist/react-grab/{renderer-KT3FY3K2.js → renderer-DcHrsQ8k.js} +1 -1
- package/dist/rpc/apiClient.cjs +12 -15
- package/dist/rpc/apiClient.cjs.map +1 -1
- package/dist/rpc/apiClient.js +12 -15
- package/dist/rpc/apiClient.js.map +1 -1
- package/dist/runtime/barrels.json +6481 -6441
- package/dist/runtime/importmap.json +2198 -2190
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -4,19 +4,33 @@ import { profileSpans } from "../../data/traces/otel/profile-spans.js";
|
|
|
4
4
|
import { profileTraceListing } from "../../data/traces/otel/profile-listing.js";
|
|
5
5
|
import { Clicky } from "../../data/Clicky.js";
|
|
6
6
|
import { Callout } from "../../data/Callout.js";
|
|
7
|
+
import { cn } from "../../lib/utils.js";
|
|
7
8
|
import { profileApiPath } from "../profileApi.js";
|
|
8
|
-
import {
|
|
9
|
-
import { Fragment
|
|
9
|
+
import { PAYLOAD_TOO_LARGE, SAMPLE_EXPIRED, parseSampleError } from "./sampleError.js";
|
|
10
|
+
import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
// src/profiles/editor/profileMappingPreview.tsx
|
|
11
|
-
|
|
13
|
+
var UNRESOLVED_REASONS = /* @__PURE__ */ new Set(["no_source", "no_value"]);
|
|
14
|
+
function ProfileMappingPreview({ profile, sampleId, onNormalized, filters, stale = false, onSampleExpired, onSelectColumn, onStatusChange }) {
|
|
12
15
|
const normalizedCallback = useRef(onNormalized);
|
|
13
|
-
|
|
16
|
+
const expiredCallback = useRef(onSampleExpired);
|
|
17
|
+
const statusCallback = useRef(onStatusChange);
|
|
14
18
|
const [result, setResult] = useState();
|
|
15
19
|
const filtersRef = useRef(filters);
|
|
16
|
-
|
|
20
|
+
useLayoutEffect(() => {
|
|
21
|
+
normalizedCallback.current = onNormalized;
|
|
22
|
+
expiredCallback.current = onSampleExpired;
|
|
23
|
+
statusCallback.current = onStatusChange;
|
|
24
|
+
filtersRef.current = filters;
|
|
25
|
+
}, [
|
|
26
|
+
onNormalized,
|
|
27
|
+
onSampleExpired,
|
|
28
|
+
onStatusChange,
|
|
29
|
+
filters
|
|
30
|
+
]);
|
|
17
31
|
const filterConfig = useMemo(() => filters && result?.resultColumns ? serverFiltersToFilterBar(result.resultColumns, filters.selection, filters.onChange, filters.lookupValues ? { lookupValues: filters.lookupValues } : {}) : void 0, [filters, result]);
|
|
18
|
-
const idle =
|
|
19
|
-
const [
|
|
32
|
+
const idle = !sampleId;
|
|
33
|
+
const [failure, setFailure] = useState();
|
|
20
34
|
const [pending, setPending] = useState(false);
|
|
21
35
|
const [trace, setTrace] = useState();
|
|
22
36
|
const [span, setSpan] = useState();
|
|
@@ -32,13 +46,12 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
32
46
|
ignore: profile.ignore,
|
|
33
47
|
filters: profile.filters
|
|
34
48
|
},
|
|
35
|
-
|
|
49
|
+
sampleId
|
|
36
50
|
});
|
|
37
51
|
useEffect(() => {
|
|
38
52
|
if (idle) return;
|
|
39
53
|
const controller = new AbortController();
|
|
40
54
|
setPending(true);
|
|
41
|
-
setError("");
|
|
42
55
|
const timer = setTimeout(() => {
|
|
43
56
|
(async () => {
|
|
44
57
|
try {
|
|
@@ -48,16 +61,25 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
48
61
|
body,
|
|
49
62
|
signal: controller.signal
|
|
50
63
|
});
|
|
51
|
-
if (!response.ok)
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
const error = parseSampleError(await response.text());
|
|
66
|
+
if (controller.signal.aborted) return;
|
|
67
|
+
setFailure(error);
|
|
68
|
+
if (error.code === "sample_expired") expiredCallback.current?.();
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
52
71
|
const next = await response.json();
|
|
53
72
|
if (!next.document?.node) throw new Error("the mapping response carried no rendered document");
|
|
54
73
|
if (filtersRef.current && !Array.isArray(next.resultColumns)) throw new Error("the mapping response carried no resultColumns to build filters from");
|
|
74
|
+
const unknown = next.unresolvedColumns?.find((column) => !UNRESOLVED_REASONS.has(column.reason));
|
|
75
|
+
if (unknown) throw new Error(`the mapping response gave column ${unknown.name} an unknown unresolved reason ${String(unknown.reason)}`);
|
|
55
76
|
if (!controller.signal.aborted) {
|
|
56
77
|
setResult(next);
|
|
78
|
+
setFailure(void 0);
|
|
57
79
|
normalizedCallback.current?.(next.normalizedRows, next.availableColumns);
|
|
58
80
|
}
|
|
59
81
|
} catch (error) {
|
|
60
|
-
if (!controller.signal.aborted)
|
|
82
|
+
if (!controller.signal.aborted) setFailure({ message: error instanceof Error ? error.message : String(error) });
|
|
61
83
|
} finally {
|
|
62
84
|
if (!controller.signal.aborted) setPending(false);
|
|
63
85
|
}
|
|
@@ -68,56 +90,72 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
68
90
|
controller.abort();
|
|
69
91
|
};
|
|
70
92
|
}, [body, idle]);
|
|
93
|
+
const resampling = failure?.code === "sample_expired" && Boolean(onSampleExpired);
|
|
94
|
+
const status = idle ? "idle" : failure && !resampling ? "failed" : pending || !result || resampling ? "updating" : "ready";
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
statusCallback.current?.(status);
|
|
97
|
+
}, [status]);
|
|
71
98
|
if (idle) return /* @__PURE__ */ jsx("p", { children: "Run a sample in Query to preview mappings." });
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
const notice = failure ? /* @__PURE__ */ jsx(MappingFailure, {
|
|
100
|
+
failure,
|
|
101
|
+
kept: Boolean(result),
|
|
102
|
+
resampling
|
|
103
|
+
}) : null;
|
|
104
|
+
if (!result) return notice ?? /* @__PURE__ */ jsx("p", {
|
|
77
105
|
role: "status",
|
|
78
106
|
children: "Updating mapping preview…"
|
|
79
107
|
});
|
|
80
|
-
|
|
108
|
+
if (pending && !failure && profile.render === "traces") return /* @__PURE__ */ jsx("p", {
|
|
81
109
|
role: "status",
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"No sampled row has a value for ",
|
|
90
|
-
result.unresolvedColumns.join(", "),
|
|
91
|
-
". They fill in once the data carries their source; otherwise check where they read from."
|
|
92
|
-
]
|
|
93
|
-
})
|
|
110
|
+
children: "Updating mapping preview…"
|
|
111
|
+
});
|
|
112
|
+
const dimmed = stale || Boolean(failure);
|
|
113
|
+
const unresolved = result.unresolvedColumns?.length ? /* @__PURE__ */ jsx(UnresolvedColumns, {
|
|
114
|
+
columns: result.unresolvedColumns,
|
|
115
|
+
dimmed,
|
|
116
|
+
...onSelectColumn ? { onSelectColumn } : {}
|
|
94
117
|
}) : null;
|
|
95
118
|
if (profile.render !== "traces") return /* @__PURE__ */ jsxs("div", {
|
|
96
119
|
"aria-busy": pending,
|
|
97
120
|
className: "flex h-full min-h-0 flex-col",
|
|
98
|
-
children: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
121
|
+
children: [
|
|
122
|
+
notice,
|
|
123
|
+
unresolved,
|
|
124
|
+
/* @__PURE__ */ jsx(Clicky, {
|
|
125
|
+
data: result.document.node,
|
|
126
|
+
className: cn("flex min-h-0 flex-1 flex-col", dimmed && "opacity-50"),
|
|
127
|
+
...filterConfig?.filters.length ? { externalFilters: filterConfig.filters } : {},
|
|
128
|
+
...filterConfig?.timeRange ? { timeRange: filterConfig.timeRange } : {}
|
|
129
|
+
})
|
|
130
|
+
]
|
|
104
131
|
});
|
|
105
132
|
try {
|
|
106
|
-
return /* @__PURE__ */ jsxs(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
133
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
134
|
+
"aria-busy": pending,
|
|
135
|
+
className: "flex h-full min-h-0 flex-col",
|
|
136
|
+
children: [
|
|
137
|
+
notice,
|
|
138
|
+
unresolved,
|
|
139
|
+
/* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: cn("min-h-0 flex-1", dimmed && "opacity-50"),
|
|
141
|
+
children: /* @__PURE__ */ jsx(OtelTraceTable, {
|
|
142
|
+
spans: profileSpans(result.rows),
|
|
143
|
+
listing: {
|
|
144
|
+
...profileTraceListing(result.rows, result.document.node),
|
|
145
|
+
linkRows: false
|
|
146
|
+
},
|
|
147
|
+
onSelectTrace: (id) => {
|
|
148
|
+
setTrace(id);
|
|
149
|
+
setSpan(void 0);
|
|
150
|
+
},
|
|
151
|
+
onSelectSpan: setSpan,
|
|
152
|
+
traceHref: (id) => `#trace=${encodeURIComponent(id)}`,
|
|
153
|
+
...trace ? { selectedTraceId: trace } : {},
|
|
154
|
+
...span ? { selectedSpanId: span } : {}
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
});
|
|
121
159
|
} catch (error) {
|
|
122
160
|
return /* @__PURE__ */ jsxs("p", {
|
|
123
161
|
role: "alert",
|
|
@@ -129,6 +167,73 @@ function ProfileMappingPreview({ profile, rows, onNormalized, filters }) {
|
|
|
129
167
|
});
|
|
130
168
|
}
|
|
131
169
|
}
|
|
170
|
+
var FAILURE_TITLES = {
|
|
171
|
+
[SAMPLE_EXPIRED]: "Sample expired",
|
|
172
|
+
[PAYLOAD_TOO_LARGE]: "Preview request too large"
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* What went wrong, in the service's words, with its hint and with what the
|
|
176
|
+
* pane still shows. An expired sample the editor is replacing is a status, not
|
|
177
|
+
* an alert: nothing is wrong with the draft.
|
|
178
|
+
*/
|
|
179
|
+
function MappingFailure({ failure, kept, resampling }) {
|
|
180
|
+
const title = failure.code && FAILURE_TITLES[failure.code] || "Preview failed";
|
|
181
|
+
return /* @__PURE__ */ jsx("div", {
|
|
182
|
+
role: resampling ? "status" : "alert",
|
|
183
|
+
"aria-label": resampling ? title : void 0,
|
|
184
|
+
className: "shrink-0",
|
|
185
|
+
children: /* @__PURE__ */ jsxs(Callout, {
|
|
186
|
+
variant: resampling ? "note" : "caution",
|
|
187
|
+
label: title,
|
|
188
|
+
className: "my-0 mb-2",
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsxs("p", { children: ["Cannot preview mappings: ", failure.message] }),
|
|
191
|
+
failure.hint ? /* @__PURE__ */ jsx("p", { children: failure.hint }) : null,
|
|
192
|
+
resampling ? /* @__PURE__ */ jsx("p", { children: "Sampling again…" }) : null,
|
|
193
|
+
kept ? /* @__PURE__ */ jsx("p", {
|
|
194
|
+
className: "text-muted-foreground",
|
|
195
|
+
children: "The table below is the last preview that succeeded."
|
|
196
|
+
}) : null
|
|
197
|
+
]
|
|
198
|
+
})
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function UnresolvedColumns({ columns, dimmed, onSelectColumn }) {
|
|
202
|
+
const names = (list) => list.map((column, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 ? ", " : null, onSelectColumn ? /* @__PURE__ */ jsx("button", {
|
|
203
|
+
type: "button",
|
|
204
|
+
className: "font-medium underline underline-offset-2",
|
|
205
|
+
onClick: () => onSelectColumn(column.name),
|
|
206
|
+
children: column.name
|
|
207
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
208
|
+
className: "font-medium",
|
|
209
|
+
children: column.name
|
|
210
|
+
})] }, column.name));
|
|
211
|
+
const noSource = columns.filter((column) => column.reason === "no_source");
|
|
212
|
+
const noValue = columns.filter((column) => column.reason === "no_value");
|
|
213
|
+
return /* @__PURE__ */ jsx("div", {
|
|
214
|
+
role: "status",
|
|
215
|
+
"aria-label": "Unresolved columns",
|
|
216
|
+
className: cn("shrink-0", dimmed && "opacity-50"),
|
|
217
|
+
children: /* @__PURE__ */ jsxs(Callout, {
|
|
218
|
+
variant: "warning",
|
|
219
|
+
label: "No sampled values",
|
|
220
|
+
className: "my-0 mb-2",
|
|
221
|
+
children: [noSource.length ? /* @__PURE__ */ jsxs("p", { children: [
|
|
222
|
+
names(noSource),
|
|
223
|
+
" ",
|
|
224
|
+
noSource.length === 1 ? "has" : "have",
|
|
225
|
+
" no source yet: pick a field or write an expression for",
|
|
226
|
+
" ",
|
|
227
|
+
noSource.length === 1 ? "it" : "them",
|
|
228
|
+
"."
|
|
229
|
+
] }) : null, noValue.length ? /* @__PURE__ */ jsxs("p", { children: [
|
|
230
|
+
"No sampled row has a value for ",
|
|
231
|
+
names(noValue),
|
|
232
|
+
". They fill in once the data carries what they read; otherwise check their source."
|
|
233
|
+
] }) : null]
|
|
234
|
+
})
|
|
235
|
+
});
|
|
236
|
+
}
|
|
132
237
|
export { ProfileMappingPreview };
|
|
133
238
|
|
|
134
239
|
//# sourceMappingURL=profileMappingPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileMappingPreview.js","names":["_Fragment"],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\nexport function ProfileMappingPreview({\n profile,\n rows,\n onNormalized,\n filters,\n}: {\n profile: ProfileWizardDraft;\n rows: Record<string, unknown>[];\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n}) {\n const normalizedCallback = useRef(onNormalized);\n normalizedCallback.current = onNormalized;\n const [result, setResult] = useState<{\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n }>();\n const filtersRef = useRef(filters);\n filtersRef.current = filters;\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n // A filtered sample may legitimately be empty, and its filter bar is how the\n // filter is cleared, so a preview that offers filters renders zero rows too.\n const idle = rows.length === 0 && !filters;\n const [error, setError] = useState(\"\");\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n rows,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n setError(\"\");\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) throw new Error(await response.text());\n const next = (await response.json()) as {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: string[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n if (!controller.signal.aborted) {\n setResult(next);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setError(error instanceof Error ? error.message : String(error));\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n if (error) return <p role=\"alert\">Cannot preview mappings: {error}</p>;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result || (pending && profile.render === \"traces\"))\n return <p role=\"status\">Updating mapping preview…</p>;\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <div role=\"status\" aria-label=\"Unresolved columns\" className=\"shrink-0\">\n <Callout\n variant=\"warning\"\n label=\"No sampled values\"\n className=\"my-0 mb-2\"\n >\n No sampled row has a value for {result.unresolvedColumns.join(\", \")}.\n They fill in once the data carries their source; otherwise check where\n they read from.\n </Callout>\n </div>\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {unresolved}\n <Clicky\n data={result.document.node}\n className=\"flex min-h-0 flex-1 flex-col\"\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <>\n {unresolved}\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n"],"mappings":";;;;;;;;;;AAoCA,SAAgB,sBAAsB,EACpC,SACA,MACA,cACA,WASC;CACD,MAAM,qBAAqB,OAAO,YAAY;CAC9C,mBAAmB,UAAU;CAC7B,MAAM,CAAC,QAAQ,aAAa,SAKzB;CACH,MAAM,aAAa,OAAO,OAAO;CACjC,WAAW,UAAU;CACrB,MAAM,eAAe,cAEjB,WAAW,QAAQ,gBACf,yBACE,OAAO,eACP,QAAQ,WACR,QAAQ,UACR,QAAQ,eAAe,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC,CACnE,IACA,KAAA,GACN,CAAC,SAAS,MAAM,CAClB;CAGA,MAAM,OAAO,KAAK,WAAW,KAAK,CAAC;CACnC,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAiB;CAC3C,MAAM,CAAC,MAAM,WAAW,SAAiB;CACzC,MAAM,OAAO,KAAK,UAAU;EAC1B,SAAS;GACP,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;GACjB,SAAS,QAAQ;GACjB,QAAQ,QAAQ;GAChB,SAAS,QAAQ;EACnB;EACA;CACF,CAAC;CACD,gBAAgB;EACd,IAAI,MAAM;EACV,MAAM,aAAa,IAAI,gBAAgB;EACvC,WAAW,IAAI;EACf,SAAS,EAAE;EACX,MAAM,QAAQ,iBAAiB;GAC7B,CAAM,YAAY;IAChB,IAAI;KACF,MAAM,WAAW,MAAM,MACrB,eAAe,wBAAwB,GACvC;MACE,QAAQ;MACR,SAA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AC,OAAD;EAAK,aAAW;EAAS,WAAU;EAAnC,UAAA,CACG,YACD,oBAAC,QAAD;GACE,MAAM,OAAO,SAAS;GACtB,WAAU;GACV,GAAK,cAAc,QAAQ,SACvB,EAAE,iBAAiB,aAAa,QAAQ,IACxC,CAAC;GACL,GAAK,cAAc,YACf,EAAE,WAAW,aAAa,UAAU,IACpC,CAAC;EACN,CAAA,CACE;;CAET,IAAI;EACF,OACE,qBAAAA,YAAA,EAAA,UAAA,CACG,YACD,oBAAC,gBAAD;GACE,OAAO,aAAa,OAAO,IAAI;GAC/B,SAAS;IACP,GAAG,oBAAoB,OAAO,MAAM,OAAO,SAAS,IAAI;IACxD,UAAU;GACZ;GACA,gBAAgB,OAAO;IACrB,SAAS,EAAE;IACX,QAAQ,KAAA,CAAS;GACnB;GACA,cAAc;GACd,YAAY,OAAO,UAAU,mBAAmB,EAAE;GAClD,GAAK,QAAQ,EAAE,iBAAiB,MAAM,IAAI,CAAC;GAC3C,GAAK,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;EACzC,CAAA,CACD,EAAA,CAAA;CAEN,SAAS,OAAO;EACd,OACE,qBAAC,KAAD;GAAG,MAAK;GAAR,UAAA;IAAgB;IACS;IACtB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GACrD;;CAEP;AACF"}
|
|
1
|
+
{"version":3,"file":"profileMappingPreview.js","names":[],"sources":["../../../src/profiles/editor/profileMappingPreview.tsx"],"sourcesContent":["import {\n Fragment,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n useRef,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n} from \"react\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\nimport type { DataTableFilterSelection } from \"../../data/data-table-filter-values\";\nimport {\n serverFiltersToFilterBar,\n type DataTableFilterLookup,\n type DataTableServerColumn,\n} from \"../../data/data-table-server-filters\";\nimport { OtelTraceTable } from \"../../data/traces/otel/OtelTraceTable\";\nimport { profileSpans } from \"../../data/traces/otel/profile-spans\";\nimport { profileTraceListing } from \"../../data/traces/otel/profile-listing\";\nimport { Clicky, type ClickyNode } from \"../../data/Clicky\";\nimport { Callout } from \"../../data/Callout\";\nimport { cn } from \"../../lib/utils\";\nimport { profileApiPath } from \"../profileApi\";\nimport type { ProfileWizardDraft } from \"../wizard/profileWizardModel\";\nimport { parseSampleError, PAYLOAD_TOO_LARGE, SAMPLE_EXPIRED, type SampleError } from \"./sampleError\";\n\n/**\n * The filters a table preview offers. The controls are the ones the service\n * describes for the draft's columns (the result columns of the mapping\n * response), built by the same serverFiltersToFilterBar the profile query\n * results use; applying one is the caller's to do, server-side, by sampling\n * again — the table never filters the rows it was given.\n */\nexport type ProfileMappingFilters = {\n selection: DataTableFilterSelection;\n onChange: Dispatch<SetStateAction<DataTableFilterSelection>>;\n lookupValues?: DataTableFilterLookup;\n};\n\n/** Where the preview stands, for a caller that summarises it elsewhere. */\nexport type ProfileMappingPreviewStatus = \"idle\" | \"updating\" | \"ready\" | \"failed\";\n\n/** Why the service found no sampled value for a declared column. */\ntype UnresolvedColumn = { name: string; reason: \"no_source\" | \"no_value\" };\n\ntype MappingResult = {\n rows: Record<string, unknown>[];\n resultColumns?: DataTableServerColumn[];\n document: { node: ClickyNode };\n unresolvedColumns?: UnresolvedColumn[];\n};\n\nconst UNRESOLVED_REASONS = new Set([\"no_source\", \"no_value\"]);\n\nexport function ProfileMappingPreview({\n profile,\n sampleId,\n onNormalized,\n filters,\n stale = false,\n onSampleExpired,\n onSelectColumn,\n onStatusChange,\n}: {\n profile: ProfileWizardDraft;\n /**\n * The sample /profile/sample retained. The service maps its rows where they\n * are: they are its own output, often megabytes of documents, and sending\n * them back on every edit overran the request limit.\n */\n sampleId: string | undefined;\n onNormalized?: (\n rows: Record<string, unknown>[],\n columns: ProfileColumn[]\n ) => void;\n filters?: ProfileMappingFilters;\n /** The rows shown are not the ones last asked for; they are dimmed. */\n stale?: boolean;\n /** The service no longer holds the sample: sample again. */\n onSampleExpired?: () => void;\n /** Opens a column the unresolved-columns warning names. */\n onSelectColumn?: (name: string) => void;\n onStatusChange?: (status: ProfileMappingPreviewStatus) => void;\n}) {\n const normalizedCallback = useRef(onNormalized);\n const expiredCallback = useRef(onSampleExpired);\n const statusCallback = useRef(onStatusChange);\n const [result, setResult] = useState<MappingResult>();\n const filtersRef = useRef(filters);\n useLayoutEffect(() => {\n normalizedCallback.current = onNormalized;\n expiredCallback.current = onSampleExpired;\n statusCallback.current = onStatusChange;\n filtersRef.current = filters;\n }, [onNormalized, onSampleExpired, onStatusChange, filters]);\n const filterConfig = useMemo(\n () =>\n filters && result?.resultColumns\n ? serverFiltersToFilterBar(\n result.resultColumns,\n filters.selection,\n filters.onChange,\n filters.lookupValues ? { lookupValues: filters.lookupValues } : {}\n )\n : undefined,\n [filters, result]\n );\n const idle = !sampleId;\n const [failure, setFailure] = useState<SampleError>();\n const [pending, setPending] = useState(false);\n const [trace, setTrace] = useState<string>();\n const [span, setSpan] = useState<string>();\n const body = JSON.stringify({\n profile: {\n profile: profile.profile,\n provider: profile.provider,\n spans: profile.spans,\n search: profile.search,\n render: profile.render,\n columns: profile.columns,\n aliases: profile.aliases,\n ignore: profile.ignore,\n filters: profile.filters,\n },\n sampleId,\n });\n useEffect(() => {\n if (idle) return;\n const controller = new AbortController();\n setPending(true);\n const timer = setTimeout(() => {\n void (async () => {\n try {\n const response = await fetch(\n profileApiPath(\"profile/sample/mapping\"),\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body,\n signal: controller.signal,\n }\n );\n if (!response.ok) {\n const error = parseSampleError(await response.text());\n if (controller.signal.aborted) return;\n setFailure(error);\n if (error.code === SAMPLE_EXPIRED) expiredCallback.current?.();\n return;\n }\n const next = (await response.json()) as MappingResult & {\n normalizedRows: Record<string, unknown>[];\n availableColumns: ProfileColumn[];\n };\n if (!next.document?.node)\n throw new Error(\n \"the mapping response carried no rendered document\"\n );\n if (filtersRef.current && !Array.isArray(next.resultColumns))\n throw new Error(\n \"the mapping response carried no resultColumns to build filters from\"\n );\n const unknown = next.unresolvedColumns?.find((column) => !UNRESOLVED_REASONS.has(column.reason));\n if (unknown)\n throw new Error(\n `the mapping response gave column ${unknown.name} an unknown unresolved reason ${String(unknown.reason)}`\n );\n if (!controller.signal.aborted) {\n setResult(next);\n setFailure(undefined);\n normalizedCallback.current?.(\n next.normalizedRows,\n next.availableColumns\n );\n }\n } catch (error) {\n if (!controller.signal.aborted)\n setFailure({ message: error instanceof Error ? error.message : String(error) });\n } finally {\n if (!controller.signal.aborted) setPending(false);\n }\n })();\n }, 250);\n return () => {\n clearTimeout(timer);\n controller.abort();\n };\n }, [body, idle]);\n // An expired sample the caller is replacing is an update in progress, not a\n // failure the author has to act on.\n const resampling = failure?.code === SAMPLE_EXPIRED && Boolean(onSampleExpired);\n const status: ProfileMappingPreviewStatus = idle\n ? \"idle\"\n : failure && !resampling\n ? \"failed\"\n : pending || !result || resampling\n ? \"updating\"\n : \"ready\";\n useEffect(() => {\n statusCallback.current?.(status);\n }, [status]);\n\n if (idle) return <p>Run a sample in Query to preview mappings.</p>;\n const notice = failure ? (\n <MappingFailure failure={failure} kept={Boolean(result)} resampling={resampling} />\n ) : null;\n // A table keeps showing the last rendering while an edit is remapped, so the\n // preview updates in place instead of blinking to a status line per keystroke.\n if (!result)\n return notice ?? <p role=\"status\">Updating mapping preview…</p>;\n if (pending && !failure && profile.render === \"traces\")\n return <p role=\"status\">Updating mapping preview…</p>;\n // Everything under a failure describes the last preview that succeeded.\n const dimmed = stale || Boolean(failure);\n // The service names the declared columns no sampled row has a value for. That\n // is a warning, never a refusal: the data may simply not carry them yet.\n const unresolved = result.unresolvedColumns?.length ? (\n <UnresolvedColumns\n columns={result.unresolvedColumns}\n dimmed={dimmed}\n {...(onSelectColumn ? { onSelectColumn } : {})}\n />\n ) : null;\n if (profile.render !== \"traces\")\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {notice}\n {unresolved}\n <Clicky\n data={result.document.node}\n className={cn(\"flex min-h-0 flex-1 flex-col\", dimmed && \"opacity-50\")}\n {...(filterConfig?.filters.length\n ? { externalFilters: filterConfig.filters }\n : {})}\n {...(filterConfig?.timeRange\n ? { timeRange: filterConfig.timeRange }\n : {})}\n />\n </div>\n );\n try {\n return (\n <div aria-busy={pending} className=\"flex h-full min-h-0 flex-col\">\n {notice}\n {unresolved}\n <div className={cn(\"min-h-0 flex-1\", dimmed && \"opacity-50\")}>\n <OtelTraceTable\n spans={profileSpans(result.rows)}\n listing={{\n ...profileTraceListing(result.rows, result.document.node),\n linkRows: false,\n }}\n onSelectTrace={(id) => {\n setTrace(id);\n setSpan(undefined);\n }}\n onSelectSpan={setSpan}\n traceHref={(id) => `#trace=${encodeURIComponent(id)}`}\n {...(trace ? { selectedTraceId: trace } : {})}\n {...(span ? { selectedSpanId: span } : {})}\n />\n </div>\n </div>\n );\n } catch (error) {\n return (\n <p role=\"alert\">\n Cannot preview traces:{\" \"}\n {error instanceof Error ? error.message : String(error)}\n </p>\n );\n }\n}\n\nconst FAILURE_TITLES: Record<string, string> = {\n [SAMPLE_EXPIRED]: \"Sample expired\",\n [PAYLOAD_TOO_LARGE]: \"Preview request too large\",\n};\n\n/**\n * What went wrong, in the service's words, with its hint and with what the\n * pane still shows. An expired sample the editor is replacing is a status, not\n * an alert: nothing is wrong with the draft.\n */\nfunction MappingFailure({\n failure,\n kept,\n resampling,\n}: {\n failure: SampleError;\n kept: boolean;\n resampling: boolean;\n}) {\n const title = (failure.code && FAILURE_TITLES[failure.code]) || \"Preview failed\";\n return (\n <div\n role={resampling ? \"status\" : \"alert\"}\n aria-label={resampling ? title : undefined}\n className=\"shrink-0\"\n >\n <Callout variant={resampling ? \"note\" : \"caution\"} label={title} className=\"my-0 mb-2\">\n <p>Cannot preview mappings: {failure.message}</p>\n {failure.hint ? <p>{failure.hint}</p> : null}\n {resampling ? <p>Sampling again…</p> : null}\n {kept ? (\n <p className=\"text-muted-foreground\">\n The table below is the last preview that succeeded.\n </p>\n ) : null}\n </Callout>\n </div>\n );\n}\n\nfunction UnresolvedColumns({\n columns,\n dimmed,\n onSelectColumn,\n}: {\n columns: UnresolvedColumn[];\n dimmed: boolean;\n onSelectColumn?: (name: string) => void;\n}) {\n const names = (list: UnresolvedColumn[]): ReactNode =>\n list.map((column, index) => (\n <Fragment key={column.name}>\n {index > 0 ? \", \" : null}\n {onSelectColumn ? (\n <button\n type=\"button\"\n className=\"font-medium underline underline-offset-2\"\n onClick={() => onSelectColumn(column.name)}\n >\n {column.name}\n </button>\n ) : (\n <span className=\"font-medium\">{column.name}</span>\n )}\n </Fragment>\n ));\n const noSource = columns.filter((column) => column.reason === \"no_source\");\n const noValue = columns.filter((column) => column.reason === \"no_value\");\n return (\n <div role=\"status\" aria-label=\"Unresolved columns\" className={cn(\"shrink-0\", dimmed && \"opacity-50\")}>\n <Callout variant=\"warning\" label=\"No sampled values\" className=\"my-0 mb-2\">\n {noSource.length ? (\n <p>\n {names(noSource)} {noSource.length === 1 ? \"has\" : \"have\"} no source\n yet: pick a field or write an expression for{\" \"}\n {noSource.length === 1 ? \"it\" : \"them\"}.\n </p>\n ) : null}\n {noValue.length ? (\n <p>\n No sampled row has a value for {names(noValue)}. They fill in once\n the data carries what they read; otherwise check their source.\n </p>\n ) : null}\n </Callout>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAsDA,IAAM,qCAAqB,IAAI,IAAI,CAAC,aAAa,UAAU,CAAC;AAE5D,SAAgB,sBAAsB,EACpC,SACA,UACA,cACA,SACA,QAAQ,OACR,iBACA,gBACA,kBAqBC;CACD,MAAM,qBAAqB,OAAO,YAAY;CAC9C,MAAM,kBAAkB,OAAO,eAAe;CAC9C,MAAM,iBAAiB,OAAO,cAAc;CAC5C,MAAM,CAAC,QAAQ,aAAa,SAAwB;CACpD,MAAM,aAAa,OAAO,OAAO;CACjC,sBAAsB;EACpB,mBAAmB,UAAU;EAC7B,gBAAgB,UAAU;EAC1B,eAAe,UAAU;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AS,WAAW,IAAI,QAAQ;IAAO;IACb;IAC5C,SAAS,WAAW,IAAI,OAAO;IAAO;GACtC,EAAA,CAAA,IACD,MACH,QAAQ,SACP,qBAAC,KAAD,EAAA,UAAA;IAAG;IAC+B,MAAM,OAAO;IAAE;GAE9C,EAAA,CAAA,IACD,IACG;;CACN,CAAA;AAET"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/profiles/editor/sampleError.ts
|
|
2
|
+
/** The codes the profile service's sample endpoints put on a JSON error. */
|
|
3
|
+
var SAMPLE_EXPIRED = "sample_expired";
|
|
4
|
+
var PAYLOAD_TOO_LARGE = "payload_too_large";
|
|
5
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
/**
|
|
7
|
+
* Reads a sample endpoint's error body. The service answers with JSON
|
|
8
|
+
* (`{error, code, hint}`); anything else is plain text, which is then the
|
|
9
|
+
* message as it stands.
|
|
10
|
+
*/
|
|
11
|
+
function parseSampleError(body) {
|
|
12
|
+
let parsed;
|
|
13
|
+
try {
|
|
14
|
+
parsed = JSON.parse(body);
|
|
15
|
+
} catch {
|
|
16
|
+
return { message: body };
|
|
17
|
+
}
|
|
18
|
+
if (!isRecord(parsed) || typeof parsed.error !== "string") return { message: body };
|
|
19
|
+
return {
|
|
20
|
+
message: parsed.error,
|
|
21
|
+
...typeof parsed.code === "string" ? { code: parsed.code } : {},
|
|
22
|
+
...typeof parsed.hint === "string" && parsed.hint ? { hint: parsed.hint } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.PAYLOAD_TOO_LARGE = PAYLOAD_TOO_LARGE;
|
|
26
|
+
exports.SAMPLE_EXPIRED = SAMPLE_EXPIRED;
|
|
27
|
+
exports.parseSampleError = parseSampleError;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=sampleError.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleError.cjs","names":[],"sources":["../../../src/profiles/editor/sampleError.ts"],"sourcesContent":["/** The codes the profile service's sample endpoints put on a JSON error. */\nexport const SAMPLE_EXPIRED = \"sample_expired\";\nexport const PAYLOAD_TOO_LARGE = \"payload_too_large\";\n\n/** A failed sample request as the profile service describes it. */\nexport type SampleError = {\n message: string;\n code?: string;\n hint?: string;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Reads a sample endpoint's error body. The service answers with JSON\n * (`{error, code, hint}`); anything else is plain text, which is then the\n * message as it stands.\n */\nexport function parseSampleError(body: string): SampleError {\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n return { message: body };\n }\n if (!isRecord(parsed) || typeof parsed.error !== \"string\") return { message: body };\n return {\n message: parsed.error,\n ...(typeof parsed.code === \"string\" ? { code: parsed.code } : {}),\n ...(typeof parsed.hint === \"string\" && parsed.hint ? { hint: parsed.hint } : {}),\n };\n}\n"],"mappings":";;AACA,IAAa,iBAAiB;AAC9B,IAAa,oBAAoB;AASjC,IAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;;;;AAOrE,SAAgB,iBAAiB,MAA2B;CAC1D,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MAAM,IAAI;CAC1B,QAAQ;EACN,OAAO,EAAE,SAAS,KAAK;CACzB;CACA,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,UAAU,UAAU,OAAO,EAAE,SAAS,KAAK;CAClF,OAAO;EACL,SAAS,OAAO;EAChB,GAAI,OAAO,OAAO,SAAS,WAAW,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;EAC/D,GAAI,OAAO,OAAO,SAAS,YAAY,OAAO,OAAO,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;CAChF;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The codes the profile service's sample endpoints put on a JSON error. */
|
|
2
|
+
export declare const SAMPLE_EXPIRED = "sample_expired";
|
|
3
|
+
export declare const PAYLOAD_TOO_LARGE = "payload_too_large";
|
|
4
|
+
/** A failed sample request as the profile service describes it. */
|
|
5
|
+
export type SampleError = {
|
|
6
|
+
message: string;
|
|
7
|
+
code?: string;
|
|
8
|
+
hint?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Reads a sample endpoint's error body. The service answers with JSON
|
|
12
|
+
* (`{error, code, hint}`); anything else is plain text, which is then the
|
|
13
|
+
* message as it stands.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseSampleError(body: string): SampleError;
|
|
16
|
+
//# sourceMappingURL=sampleError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleError.d.ts","sourceRoot":"","sources":["../../../src/profiles/editor/sampleError.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,mEAAmE;AACnE,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAKF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAa1D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/profiles/editor/sampleError.ts
|
|
2
|
+
/** The codes the profile service's sample endpoints put on a JSON error. */
|
|
3
|
+
var SAMPLE_EXPIRED = "sample_expired";
|
|
4
|
+
var PAYLOAD_TOO_LARGE = "payload_too_large";
|
|
5
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
/**
|
|
7
|
+
* Reads a sample endpoint's error body. The service answers with JSON
|
|
8
|
+
* (`{error, code, hint}`); anything else is plain text, which is then the
|
|
9
|
+
* message as it stands.
|
|
10
|
+
*/
|
|
11
|
+
function parseSampleError(body) {
|
|
12
|
+
let parsed;
|
|
13
|
+
try {
|
|
14
|
+
parsed = JSON.parse(body);
|
|
15
|
+
} catch {
|
|
16
|
+
return { message: body };
|
|
17
|
+
}
|
|
18
|
+
if (!isRecord(parsed) || typeof parsed.error !== "string") return { message: body };
|
|
19
|
+
return {
|
|
20
|
+
message: parsed.error,
|
|
21
|
+
...typeof parsed.code === "string" ? { code: parsed.code } : {},
|
|
22
|
+
...typeof parsed.hint === "string" && parsed.hint ? { hint: parsed.hint } : {}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export { PAYLOAD_TOO_LARGE, SAMPLE_EXPIRED, parseSampleError };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=sampleError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sampleError.js","names":[],"sources":["../../../src/profiles/editor/sampleError.ts"],"sourcesContent":["/** The codes the profile service's sample endpoints put on a JSON error. */\nexport const SAMPLE_EXPIRED = \"sample_expired\";\nexport const PAYLOAD_TOO_LARGE = \"payload_too_large\";\n\n/** A failed sample request as the profile service describes it. */\nexport type SampleError = {\n message: string;\n code?: string;\n hint?: string;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Reads a sample endpoint's error body. The service answers with JSON\n * (`{error, code, hint}`); anything else is plain text, which is then the\n * message as it stands.\n */\nexport function parseSampleError(body: string): SampleError {\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n return { message: body };\n }\n if (!isRecord(parsed) || typeof parsed.error !== \"string\") return { message: body };\n return {\n message: parsed.error,\n ...(typeof parsed.code === \"string\" ? { code: parsed.code } : {}),\n ...(typeof parsed.hint === \"string\" && parsed.hint ? { hint: parsed.hint } : {}),\n };\n}\n"],"mappings":";;AACA,IAAa,iBAAiB;AAC9B,IAAa,oBAAoB;AASjC,IAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;;;;AAOrE,SAAgB,iBAAiB,MAA2B;CAC1D,IAAI;CACJ,IAAI;EACF,SAAS,KAAK,MAAM,IAAI;CAC1B,QAAQ;EACN,OAAO,EAAE,SAAS,KAAK;CACzB;CACA,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,UAAU,UAAU,OAAO,EAAE,SAAS,KAAK;CAClF,OAAO;EACL,SAAS,OAAO;EAChB,GAAI,OAAO,OAAO,SAAS,WAAW,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;EAC/D,GAAI,OAAO,OAAO,SAAS,YAAY,OAAO,OAAO,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;CAChF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSampleResult.cjs","names":[],"sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n mappingInputRows: Record<string, unknown>[];\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"profileSampleResult.cjs","names":[],"sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n mappingInputRows: Record<string, unknown>[];\n /** The id the service retained mappingInputRows under, for the mapping preview. */\n sampleId: string;\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"mappings":";AAaA,SAAgB,yBACd,UACoB;CACpB,IAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GACvC,MAAM,IAAI,MAAM,kDAAkD;CAEpE,MAAM,SAAS;EACb,GAAG;EACH,SAAS,SAAS;CACpB;CAIA,OAAO,OAAO;CACd,OAAO,OAAO;CACd,OAAO;AACT;AAEA,SAAgB,2BACd,UACiB;CACjB,IAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GACvC,MAAM,IAAI,MAAM,kDAAkD;CAEpE,MAAM,aAAa,IAAI,IACrB,SAAS,cACN,QAAQ,WAAW,OAAO,cAAc,KAAA,CAAS,CAAC,CAClD,KAAK,WAAW,OAAO,IAAI,CAChC;CACA,OAAO,SAAS,QAAQ,QAAQ,WAAW,WAAW,IAAI,OAAO,IAAI,CAAC;AACxE"}
|
|
@@ -3,6 +3,8 @@ import { QueryBrowserResult } from '../../data/query-browser/QueryBrowser.types.
|
|
|
3
3
|
import { ProfileColumn } from '../wizard/profileWizardModel.js';
|
|
4
4
|
export type ProfileSampleResponse = Omit<QueryBrowserResult, "columns"> & {
|
|
5
5
|
mappingInputRows: Record<string, unknown>[];
|
|
6
|
+
/** The id the service retained mappingInputRows under, for the mapping preview. */
|
|
7
|
+
sampleId: string;
|
|
6
8
|
columns: ProfileColumn[];
|
|
7
9
|
resultColumns?: DataTableServerColumn[];
|
|
8
10
|
renderedQuery: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSampleResult.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/profileSampleResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IACxE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC5C,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,qBAAqB,GAC9B,kBAAkB,CAcpB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,qBAAqB,GAC9B,aAAa,EAAE,CAUjB"}
|
|
1
|
+
{"version":3,"file":"profileSampleResult.d.ts","sourceRoot":"","sources":["../../../src/profiles/query/profileSampleResult.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IACxE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC5C,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACxC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,qBAAqB,GAC9B,kBAAkB,CAcpB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,qBAAqB,GAC9B,aAAa,EAAE,CAUjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileSampleResult.js","names":[],"sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n mappingInputRows: Record<string, unknown>[];\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"profileSampleResult.js","names":[],"sources":["../../../src/profiles/query/profileSampleResult.ts"],"sourcesContent":["import type { DataTableServerColumn } from \"../../data/data-table-server-filters\";\nimport type { QueryBrowserResult } from \"../../data/query-browser/QueryBrowser.types\";\nimport type { ProfileColumn } from \"../wizard/profileWizardModel\";\n\nexport type ProfileSampleResponse = Omit<QueryBrowserResult, \"columns\"> & {\n mappingInputRows: Record<string, unknown>[];\n /** The id the service retained mappingInputRows under, for the mapping preview. */\n sampleId: string;\n columns: ProfileColumn[];\n resultColumns?: DataTableServerColumn[];\n renderedQuery: string;\n};\n\nexport function profileSampleQueryResult(\n response: ProfileSampleResponse,\n): QueryBrowserResult {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const result = {\n ...response,\n columns: response.resultColumns,\n } as QueryBrowserResult & {\n resultColumns?: DataTableServerColumn[];\n renderedQuery?: string;\n };\n delete result.resultColumns;\n delete result.renderedQuery;\n return result;\n}\n\nexport function profileSampleFilterColumns(\n response: ProfileSampleResponse,\n): ProfileColumn[] {\n if (!Array.isArray(response.resultColumns)) {\n throw new Error(\"Profile sample response is missing resultColumns\");\n }\n const filterable = new Set(\n response.resultColumns\n .filter((column) => column.filterKey !== undefined)\n .map((column) => column.name),\n );\n return response.columns.filter((column) => filterable.has(column.name));\n}\n"],"mappings":";AAaA,SAAgB,yBACd,UACoB;CACpB,IAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GACvC,MAAM,IAAI,MAAM,kDAAkD;CAEpE,MAAM,SAAS;EACb,GAAG;EACH,SAAS,SAAS;CACpB;CAIA,OAAO,OAAO;CACd,OAAO,OAAO;CACd,OAAO;AACT;AAEA,SAAgB,2BACd,UACiB;CACjB,IAAI,CAAC,MAAM,QAAQ,SAAS,aAAa,GACvC,MAAM,IAAI,MAAM,kDAAkD;CAEpE,MAAM,aAAa,IAAI,IACrB,SAAS,cACN,QAAQ,WAAW,OAAO,cAAc,KAAA,CAAS,CAAC,CAClD,KAAK,WAAW,OAAO,IAAI,CAChC;CACA,OAAO,SAAS,QAAQ,QAAQ,WAAW,WAAW,IAAI,OAAO,IAAI,CAAC;AACxE"}
|
|
@@ -210,6 +210,7 @@ function ProfileWizardQueryStep({ connectionID, draft, discovered, onDraftChange
|
|
|
210
210
|
filterColumns.current = require_profileSampleResult.profileSampleFilterColumns(result);
|
|
211
211
|
onSample({
|
|
212
212
|
mappingInputRows: result.mappingInputRows,
|
|
213
|
+
sampleId: result.sampleId,
|
|
213
214
|
columns: result.columns ?? [],
|
|
214
215
|
rows: result.rows ?? [],
|
|
215
216
|
sourceDraft: nextDraft
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizardQueryStep.cjs","names":["useMemo","useState","useRef","useProfileInspection","supportsQueryBuilder","mergeProviderOptions","useCallback","profileWizardErrorMessage","ConnectionQueryWorkspace","queryBrowserOptionsSchema","defaultParamValues","paramRoles","withProfileLimits","lookupProfileSampleFilterValues","fetchJSON","profileApiPath","debugCaptureHeaders","profileSamplePayload","profileSampleFilterColumns","profileSampleQueryResult"],"sources":["../../../src/profiles/wizard/profileWizardQueryStep.tsx"],"sourcesContent":["import { debugCaptureHeaders } from \"../../data/debugConsoleSignal\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n fetchJSON,\n mergeProviderOptions,\n queryBrowserOptionsSchema,\n} from \"../connections/connectionBrowserModel\";\nimport { ConnectionQueryWorkspace } from \"../connections/connectionQueryWorkspace\";\nimport { useProfileInspection } from \"./useProfileInspection\";\nimport { profileApiPath } from \"../profileApi\";\nimport { profileSamplePayload } from \"../query/profileSamplePayload\";\nimport { lookupProfileSampleFilterValues } from \"../query/profileSampleFilterLookup\";\nimport {\n profileSampleFilterColumns,\n profileSampleQueryResult,\n type ProfileSampleResponse,\n} from \"../query/profileSampleResult\";\nimport type { EsSearch } from \"../elasticsearch/esQueryBuilderModel\";\nimport {\n profileWizardErrorMessage,\n withProfileLimits,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport { supportsQueryBuilder } from \"../connections/connectionQueryWorkspaceModel\";\nimport {\n defaultParamValues,\n paramRoles,\n} from \"../elasticsearch/esQueryBuilderForm\";\n\n/** What a sample yields: the discovered column shape plus the rows it came\n * from, so the editor can preview the configured columns against real data. */\nexport type ProfileSample = {\n mappingInputRows?: Record<string, unknown>[];\n columns: ProfileColumn[];\n rows: Record<string, unknown>[];\n sourceDraft: ProfileWizardDraft;\n};\n\ntype ProfileWizardQueryStepProps = {\n connectionID: string;\n draft: ProfileWizardDraft;\n discovered: ProfileColumn[];\n onDraftChange: (draft: ProfileWizardDraft) => void;\n onSample: (sample: ProfileSample) => void;\n /** Where the query workspace's Run button renders; omitted keeps it in the query header. */\n runSlot?: HTMLElement | null | undefined;\n /**\n * The option keys the host renders itself (the editor's Source card shows the\n * document format and span fields), so the options form leaves them out.\n */\n omitOptions?: string[];\n};\n\nexport function ProfileWizardQueryStep({\n connectionID,\n draft,\n discovered,\n onDraftChange,\n onSample,\n runSlot,\n omitOptions = [],\n}: ProfileWizardQueryStepProps) {\n const providerOptions = useMemo(\n () => ({ ...draft.provider?.options }),\n [draft.provider?.options],\n );\n const [query, setQuery] = useState(draft.query ?? \"\");\n const [liveOptions, setLiveOptions] = useState(providerOptions);\n const [catalogOptions, setCatalogOptions] = useState<Record<string, unknown>>(\n {},\n );\n const [selectedDatabase, setSelectedDatabase] = useState(\"\");\n const filterColumns = useRef<ProfileColumn[]>([]);\n const { baseUrl, descriptor, inspection } = useProfileInspection({\n connectionID,\n providerOptions,\n liveOptions,\n selectedDatabase,\n });\n\n // The starter query is for a source whose artifact is the query. Where the\n // workspace builds filters instead, the specification is the artifact and a\n // query seeded beside it would be the pair the server rejects.\n const rawArtifact =\n descriptor.data !== undefined && !supportsQueryBuilder(descriptor.data);\n useEffect(() => {\n if (rawArtifact && !query && descriptor.data?.defaultQuery) {\n setQuery(descriptor.data.defaultQuery);\n onDraftChange({ ...draft, query: descriptor.data.defaultQuery });\n }\n }, [descriptor.data?.defaultQuery, draft, onDraftChange, query, rawArtifact]);\n\n const browserOptions = useMemo(\n () =>\n mergeProviderOptions({\n layers: [\n descriptor.data?.initialOptions,\n providerOptions,\n catalogOptions,\n ],\n database: inspection.sqlDatabase,\n keepTargetKind: true,\n }),\n [\n catalogOptions,\n descriptor.data?.initialOptions,\n inspection.sqlDatabase,\n providerOptions,\n ],\n );\n const effectiveOptions = useCallback(\n (options: Record<string, unknown>) =>\n mergeProviderOptions({\n layers: [providerOptions, catalogOptions, options],\n database: inspection.sqlDatabase,\n }),\n [catalogOptions, inspection.sqlDatabase, providerOptions],\n );\n\n if (descriptor.isLoading) {\n return <QueryStepMessage>Loading connection browser…</QueryStepMessage>;\n }\n if (descriptor.isError) {\n return (\n <QueryStepMessage error>\n {profileWizardErrorMessage(\n descriptor.error,\n \"Unable to load this connection browser\",\n )}\n </QueryStepMessage>\n );\n }\n if (!descriptor.data) {\n return (\n <QueryStepMessage>\n This saved connection does not expose a query browser.\n </QueryStepMessage>\n );\n }\n\n return (\n <div className=\"flex min-h-[32rem] min-w-0 flex-1 flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-4 rounded-lg border bg-muted/30 px-4 py-3\">\n <div>\n <p className=\"text-sm font-medium\">\n Explore the source, then run a sample\n </p>\n <p className=\"text-xs text-muted-foreground\">\n Sampling discovers fields without saving the profile.\n </p>\n </div>\n <span className=\"shrink-0 rounded-full bg-background px-3 py-1 text-xs font-medium text-muted-foreground\">\n {discovered.length\n ? `${discovered.length} fields discovered`\n : \"No sample yet\"}\n </span>\n </div>\n <ConnectionQueryWorkspace\n id={`profile-wizard:${connectionID}`}\n title=\"Profile query\"\n runSlot={runSlot}\n descriptor={descriptor.data}\n inspection={inspection}\n onDatabaseChange={setSelectedDatabase}\n query={query}\n options={browserOptions}\n optionsSchema={queryBrowserOptionsSchema(\n descriptor.data,\n { omitKeys: omitOptions },\n )}\n search={providerOptions.search as EsSearch | undefined}\n onSearchChange={(transition) => {\n // Built from the merged options so a delete actually removes the key\n // rather than being reinstated by a lower layer on the next merge.\n const options = effectiveOptions(liveOptions);\n if (transition.search) options.search = transition.search;\n else delete options.search;\n setQuery(transition.query);\n onDraftChange({\n ...draft,\n query: transition.query,\n provider: { ...draft.provider, options },\n });\n }}\n params={draft.params ?? []}\n onParamMappingChange={(edit) => {\n const options = effectiveOptions(liveOptions);\n options.search = edit.search;\n setQuery(\"\");\n onDraftChange({\n ...draft,\n query: \"\",\n params: edit.params,\n provider: { ...draft.provider, options },\n });\n }}\n paramValues={defaultParamValues(draft.params)}\n paramRoles={paramRoles(draft.params)}\n {...(draft.limits ? { limits: draft.limits } : {})}\n onLimitsChange={(limits) =>\n onDraftChange(withProfileLimits(draft, limits))\n }\n compileBaseUrl={baseUrl}\n className=\"min-h-0 flex-1\"\n onQueryChange={(nextQuery) => {\n setQuery(nextQuery);\n onDraftChange({ ...draft, query: nextQuery });\n }}\n onOptionsChange={(options) => {\n setLiveOptions(options);\n onDraftChange({\n ...draft,\n provider: {\n ...draft.provider,\n options: effectiveOptions(options),\n },\n });\n }}\n onCatalogSelect={(node) => {\n const nextQuery = node.query ?? query;\n const nextOptions = node.options ?? {};\n setQuery(nextQuery);\n setCatalogOptions(nextOptions);\n setLiveOptions({ ...browserOptions, ...nextOptions });\n onDraftChange({\n ...draft,\n query: nextQuery,\n provider: {\n ...draft.provider,\n options: effectiveOptions({ ...browserOptions, ...nextOptions }),\n },\n });\n }}\n lookupFilterValues={(request) =>\n lookupProfileSampleFilterValues({\n draft: {\n ...draft,\n query: request.query,\n provider: {\n ...draft.provider,\n options: effectiveOptions(request.options),\n },\n },\n params: defaultParamValues(draft.params),\n filterColumns: filterColumns.current,\n request,\n })\n }\n execute={async (request) => {\n const nextDraft = {\n ...draft,\n query: request.query,\n provider: {\n ...draft.provider,\n options: effectiveOptions(request.options),\n },\n };\n onDraftChange(nextDraft);\n const result = await fetchJSON<ProfileSampleResponse>(\n profileApiPath(\"profile/sample\"),\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...debugCaptureHeaders(),\n },\n body: JSON.stringify(\n profileSamplePayload({\n draft: nextDraft,\n request,\n params: defaultParamValues(nextDraft.params),\n filterColumns: filterColumns.current,\n }),\n ),\n },\n );\n filterColumns.current = profileSampleFilterColumns(result);\n onSample({\n mappingInputRows: result.mappingInputRows,\n columns: result.columns ?? [],\n rows: result.rows ?? [],\n sourceDraft: nextDraft,\n });\n return profileSampleQueryResult(result);\n }}\n />\n </div>\n );\n}\n\nfunction QueryStepMessage({\n children,\n error = false,\n}: {\n children: ReactNode;\n error?: boolean;\n}) {\n return (\n <div\n className={`grid min-h-96 flex-1 place-items-center rounded-xl border border-dashed p-8 text-sm ${error ? \"border-destructive/40 text-destructive\" : \"text-muted-foreground\"}`}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA6DA,SAAgB,uBAAuB,EACrC,cACA,OACA,YACA,eACA,UACA,SACA,cAAc,CAAC,KACe;CAC9B,MAAM,mBAAA,GAAkBA,MAAAA,QAAAA,QACf,EAAE,GAAG,MAAM,UAAU,QAAQ,IACpC,CAAC,MAAM,UAAU,OAAO,CAC1B;CACA,MAAM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;GAEH,SAAS,OAAO,YAAY;IAC1B,MAAM,YAAY;KAChB,GAAG;KACH,OAAO,QAAQ;KACf,UAAU;MACR,GAAG,MAAM;MACT,SAAS,iBAAiB,QAAQ,OAAO;KAC3C;IACF;IACA,cAAc,SAAS;IACvB,MAAM,SAAS,MAAMI,+BAAAA,UACnBC,mBAAAA,eAAe,gBAAgB,GAC/B;KACE,QAAQ;KACR,SAAS;MACP,gBAAgB;MAChB,GAAGC,2BAAAA,oBAAoB;KACzB;KACA,MAAM,KAAK,UACTC,6BAAAA,qBAAqB;MACnB,OAAO;MACP;MACA,QAAQP,2BAAAA,mBAAmB,UAAU,MAAM;MAC3C,eAAe,cAAc;KAC/B,CAAC,CACH;IACF,CACF;IACA,cAAc,UAAUQ,4BAAAA,2BAA2B,MAAM;IACzD,SAAS;KACP,kBAAkB,OAAO;KACzB,SAAS,OAAO,WAAW,CAAC;KAC5B,MAAM,OAAO,QAAQ,CAAC;KACtB,aAAa;IACf,CAAC;IACD,OAAOC,4BAAAA,yBAAyB,MAAM;GACxC;EACD,CAAA,CACE;;AAET;AAEA,SAAS,iBAAiB,EACxB,UACA,QAAQ,SAIP;CACD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,WAAW,uFAAuF,QAAQ,2CAA2C;EAEpJ;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"profileWizardQueryStep.cjs","names":["useMemo","useState","useRef","useProfileInspection","supportsQueryBuilder","mergeProviderOptions","useCallback","profileWizardErrorMessage","ConnectionQueryWorkspace","queryBrowserOptionsSchema","defaultParamValues","paramRoles","withProfileLimits","lookupProfileSampleFilterValues","fetchJSON","profileApiPath","debugCaptureHeaders","profileSamplePayload","profileSampleFilterColumns","profileSampleQueryResult"],"sources":["../../../src/profiles/wizard/profileWizardQueryStep.tsx"],"sourcesContent":["import { debugCaptureHeaders } from \"../../data/debugConsoleSignal\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n fetchJSON,\n mergeProviderOptions,\n queryBrowserOptionsSchema,\n} from \"../connections/connectionBrowserModel\";\nimport { ConnectionQueryWorkspace } from \"../connections/connectionQueryWorkspace\";\nimport { useProfileInspection } from \"./useProfileInspection\";\nimport { profileApiPath } from \"../profileApi\";\nimport { profileSamplePayload } from \"../query/profileSamplePayload\";\nimport { lookupProfileSampleFilterValues } from \"../query/profileSampleFilterLookup\";\nimport {\n profileSampleFilterColumns,\n profileSampleQueryResult,\n type ProfileSampleResponse,\n} from \"../query/profileSampleResult\";\nimport type { EsSearch } from \"../elasticsearch/esQueryBuilderModel\";\nimport {\n profileWizardErrorMessage,\n withProfileLimits,\n type ProfileColumn,\n type ProfileWizardDraft,\n} from \"./profileWizardModel\";\nimport { supportsQueryBuilder } from \"../connections/connectionQueryWorkspaceModel\";\nimport {\n defaultParamValues,\n paramRoles,\n} from \"../elasticsearch/esQueryBuilderForm\";\n\n/** What a sample yields: the discovered column shape plus the rows it came\n * from, so the editor can preview the configured columns against real data. */\nexport type ProfileSample = {\n mappingInputRows?: Record<string, unknown>[];\n /** The id the service retained mappingInputRows under, for the mapping preview. */\n sampleId?: string;\n columns: ProfileColumn[];\n rows: Record<string, unknown>[];\n sourceDraft: ProfileWizardDraft;\n};\n\ntype ProfileWizardQueryStepProps = {\n connectionID: string;\n draft: ProfileWizardDraft;\n discovered: ProfileColumn[];\n onDraftChange: (draft: ProfileWizardDraft) => void;\n onSample: (sample: ProfileSample) => void;\n /** Where the query workspace's Run button renders; omitted keeps it in the query header. */\n runSlot?: HTMLElement | null | undefined;\n /**\n * The option keys the host renders itself (the editor's Source card shows the\n * document format and span fields), so the options form leaves them out.\n */\n omitOptions?: string[];\n};\n\nexport function ProfileWizardQueryStep({\n connectionID,\n draft,\n discovered,\n onDraftChange,\n onSample,\n runSlot,\n omitOptions = [],\n}: ProfileWizardQueryStepProps) {\n const providerOptions = useMemo(\n () => ({ ...draft.provider?.options }),\n [draft.provider?.options],\n );\n const [query, setQuery] = useState(draft.query ?? \"\");\n const [liveOptions, setLiveOptions] = useState(providerOptions);\n const [catalogOptions, setCatalogOptions] = useState<Record<string, unknown>>(\n {},\n );\n const [selectedDatabase, setSelectedDatabase] = useState(\"\");\n const filterColumns = useRef<ProfileColumn[]>([]);\n const { baseUrl, descriptor, inspection } = useProfileInspection({\n connectionID,\n providerOptions,\n liveOptions,\n selectedDatabase,\n });\n\n // The starter query is for a source whose artifact is the query. Where the\n // workspace builds filters instead, the specification is the artifact and a\n // query seeded beside it would be the pair the server rejects.\n const rawArtifact =\n descriptor.data !== undefined && !supportsQueryBuilder(descriptor.data);\n useEffect(() => {\n if (rawArtifact && !query && descriptor.data?.defaultQuery) {\n setQuery(descriptor.data.defaultQuery);\n onDraftChange({ ...draft, query: descriptor.data.defaultQuery });\n }\n }, [descriptor.data?.defaultQuery, draft, onDraftChange, query, rawArtifact]);\n\n const browserOptions = useMemo(\n () =>\n mergeProviderOptions({\n layers: [\n descriptor.data?.initialOptions,\n providerOptions,\n catalogOptions,\n ],\n database: inspection.sqlDatabase,\n keepTargetKind: true,\n }),\n [\n catalogOptions,\n descriptor.data?.initialOptions,\n inspection.sqlDatabase,\n providerOptions,\n ],\n );\n const effectiveOptions = useCallback(\n (options: Record<string, unknown>) =>\n mergeProviderOptions({\n layers: [providerOptions, catalogOptions, options],\n database: inspection.sqlDatabase,\n }),\n [catalogOptions, inspection.sqlDatabase, providerOptions],\n );\n\n if (descriptor.isLoading) {\n return <QueryStepMessage>Loading connection browser…</QueryStepMessage>;\n }\n if (descriptor.isError) {\n return (\n <QueryStepMessage error>\n {profileWizardErrorMessage(\n descriptor.error,\n \"Unable to load this connection browser\",\n )}\n </QueryStepMessage>\n );\n }\n if (!descriptor.data) {\n return (\n <QueryStepMessage>\n This saved connection does not expose a query browser.\n </QueryStepMessage>\n );\n }\n\n return (\n <div className=\"flex min-h-[32rem] min-w-0 flex-1 flex-col gap-3\">\n <div className=\"flex items-center justify-between gap-4 rounded-lg border bg-muted/30 px-4 py-3\">\n <div>\n <p className=\"text-sm font-medium\">\n Explore the source, then run a sample\n </p>\n <p className=\"text-xs text-muted-foreground\">\n Sampling discovers fields without saving the profile.\n </p>\n </div>\n <span className=\"shrink-0 rounded-full bg-background px-3 py-1 text-xs font-medium text-muted-foreground\">\n {discovered.length\n ? `${discovered.length} fields discovered`\n : \"No sample yet\"}\n </span>\n </div>\n <ConnectionQueryWorkspace\n id={`profile-wizard:${connectionID}`}\n title=\"Profile query\"\n runSlot={runSlot}\n descriptor={descriptor.data}\n inspection={inspection}\n onDatabaseChange={setSelectedDatabase}\n query={query}\n options={browserOptions}\n optionsSchema={queryBrowserOptionsSchema(\n descriptor.data,\n { omitKeys: omitOptions },\n )}\n search={providerOptions.search as EsSearch | undefined}\n onSearchChange={(transition) => {\n // Built from the merged options so a delete actually removes the key\n // rather than being reinstated by a lower layer on the next merge.\n const options = effectiveOptions(liveOptions);\n if (transition.search) options.search = transition.search;\n else delete options.search;\n setQuery(transition.query);\n onDraftChange({\n ...draft,\n query: transition.query,\n provider: { ...draft.provider, options },\n });\n }}\n params={draft.params ?? []}\n onParamMappingChange={(edit) => {\n const options = effectiveOptions(liveOptions);\n options.search = edit.search;\n setQuery(\"\");\n onDraftChange({\n ...draft,\n query: \"\",\n params: edit.params,\n provider: { ...draft.provider, options },\n });\n }}\n paramValues={defaultParamValues(draft.params)}\n paramRoles={paramRoles(draft.params)}\n {...(draft.limits ? { limits: draft.limits } : {})}\n onLimitsChange={(limits) =>\n onDraftChange(withProfileLimits(draft, limits))\n }\n compileBaseUrl={baseUrl}\n className=\"min-h-0 flex-1\"\n onQueryChange={(nextQuery) => {\n setQuery(nextQuery);\n onDraftChange({ ...draft, query: nextQuery });\n }}\n onOptionsChange={(options) => {\n setLiveOptions(options);\n onDraftChange({\n ...draft,\n provider: {\n ...draft.provider,\n options: effectiveOptions(options),\n },\n });\n }}\n onCatalogSelect={(node) => {\n const nextQuery = node.query ?? query;\n const nextOptions = node.options ?? {};\n setQuery(nextQuery);\n setCatalogOptions(nextOptions);\n setLiveOptions({ ...browserOptions, ...nextOptions });\n onDraftChange({\n ...draft,\n query: nextQuery,\n provider: {\n ...draft.provider,\n options: effectiveOptions({ ...browserOptions, ...nextOptions }),\n },\n });\n }}\n lookupFilterValues={(request) =>\n lookupProfileSampleFilterValues({\n draft: {\n ...draft,\n query: request.query,\n provider: {\n ...draft.provider,\n options: effectiveOptions(request.options),\n },\n },\n params: defaultParamValues(draft.params),\n filterColumns: filterColumns.current,\n request,\n })\n }\n execute={async (request) => {\n const nextDraft = {\n ...draft,\n query: request.query,\n provider: {\n ...draft.provider,\n options: effectiveOptions(request.options),\n },\n };\n onDraftChange(nextDraft);\n const result = await fetchJSON<ProfileSampleResponse>(\n profileApiPath(\"profile/sample\"),\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...debugCaptureHeaders(),\n },\n body: JSON.stringify(\n profileSamplePayload({\n draft: nextDraft,\n request,\n params: defaultParamValues(nextDraft.params),\n filterColumns: filterColumns.current,\n }),\n ),\n },\n );\n filterColumns.current = profileSampleFilterColumns(result);\n onSample({\n mappingInputRows: result.mappingInputRows,\n sampleId: result.sampleId,\n columns: result.columns ?? [],\n rows: result.rows ?? [],\n sourceDraft: nextDraft,\n });\n return profileSampleQueryResult(result);\n }}\n />\n </div>\n );\n}\n\nfunction QueryStepMessage({\n children,\n error = false,\n}: {\n children: ReactNode;\n error?: boolean;\n}) {\n return (\n <div\n className={`grid min-h-96 flex-1 place-items-center rounded-xl border border-dashed p-8 text-sm ${error ? \"border-destructive/40 text-destructive\" : \"text-muted-foreground\"}`}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+DA,SAAgB,uBAAuB,EACrC,cACA,OACA,YACA,eACA,UACA,SACA,cAAc,CAAC,KACe;CAC9B,MAAM,mBAAA,GAAkBA,MAAAA,QAAAA,QACf,EAAE,GAAG,MAAM,UAAU,QAAQ,IACpC,CA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AM;IACvC,eAAe,cAAc;IAC7B;GACF,CAAC;GAEH,SAAS,OAAO,YAAY;IAC1B,MAAM,YAAY;KAChB,GAAG;KACH,OAAO,QAAQ;KACf,UAAU;MACR,GAAG,MAAM;MACT,SAAS,iBAAiB,QAAQ,OAAO;KAC3C;IACF;IACA,cAAc,SAAS;IACvB,MAAM,SAAS,MAAMI,+BAAAA,UACnBC,mBAAAA,eAAe,gBAAgB,GAC/B;KACE,QAAQ;KACR,SAAS;MACP,gBAAgB;MAChB,GAAGC,2BAAAA,oBAAoB;KACzB;KACA,MAAM,KAAK,UACTC,6BAAAA,qBAAqB;MACnB,OAAO;MACP;MACA,QAAQP,2BAAAA,mBAAmB,UAAU,MAAM;MAC3C,eAAe,cAAc;KAC/B,CAAC,CACH;IACF,CACF;IACA,cAAc,UAAUQ,4BAAAA,2BAA2B,MAAM;IACzD,SAAS;KACP,kBAAkB,OAAO;KACzB,UAAU,OAAO;KACjB,SAAS,OAAO,WAAW,CAAC;KAC5B,MAAM,OAAO,QAAQ,CAAC;KACtB,aAAa;IACf,CAAC;IACD,OAAOC,4BAAAA,yBAAyB,MAAM;GACxC;EACD,CAAA,CACE;;AAET;AAEA,SAAS,iBAAiB,EACxB,UACA,QAAQ,SAIP;CACD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,WAAW,uFAAuF,QAAQ,2CAA2C;EAEpJ;CACE,CAAA;AAET"}
|
|
@@ -3,6 +3,8 @@ import { ProfileColumn, ProfileWizardDraft } from './profileWizardModel.js';
|
|
|
3
3
|
* from, so the editor can preview the configured columns against real data. */
|
|
4
4
|
export type ProfileSample = {
|
|
5
5
|
mappingInputRows?: Record<string, unknown>[];
|
|
6
|
+
/** The id the service retained mappingInputRows under, for the mapping preview. */
|
|
7
|
+
sampleId?: string;
|
|
6
8
|
columns: ProfileColumn[];
|
|
7
9
|
rows: Record<string, unknown>[];
|
|
8
10
|
sourceDraft: ProfileWizardDraft;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profileWizardQueryStep.d.ts","sourceRoot":"","sources":["../../../src/profiles/wizard/profileWizardQueryStep.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAO9B;gFACgF;AAChF,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC7C,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,4FAA4F;IAC5F,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,KAAK,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,OAAO,EACP,WAAgB,GACjB,EAAE,2BAA2B,+
|
|
1
|
+
{"version":3,"file":"profileWizardQueryStep.d.ts","sourceRoot":"","sources":["../../../src/profiles/wizard/profileWizardQueryStep.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAO9B;gFACgF;AAChF,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C,4FAA4F;IAC5F,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,KAAK,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,OAAO,EACP,WAAgB,GACjB,EAAE,2BAA2B,+BAoO7B"}
|
|
@@ -210,6 +210,7 @@ function ProfileWizardQueryStep({ connectionID, draft, discovered, onDraftChange
|
|
|
210
210
|
filterColumns.current = profileSampleFilterColumns(result);
|
|
211
211
|
onSample({
|
|
212
212
|
mappingInputRows: result.mappingInputRows,
|
|
213
|
+
sampleId: result.sampleId,
|
|
213
214
|
columns: result.columns ?? [],
|
|
214
215
|
rows: result.rows ?? [],
|
|
215
216
|
sourceDraft: nextDraft
|