@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBar.cjs","names":["RECEIVER_RUN","sourceChoice","shortOperation","durationOf","durationRequest","rangeOf","FilterBar","windowOf"],"sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { RECEIVER_RUN, sourceChoice } from \"./source\";\nimport { FilterBar, type FilterBarFilter, type FilterBarMultiFilter } from \"../../../components\";\nimport type { ModeFilter, Modes, SearchResult, SearchValues, Source } from \"./api\";\nimport { durationOf, durationRequest, MULTI_SPAN, rangeOf, shortOperation, windowOf } from \"./query\";\n\nfunction chooseSource(choice: string): SearchValues {\n if (choice === \"received\") return { source: \"records\", run: RECEIVER_RUN, index: undefined, format: undefined };\n return { source: choice, run: undefined, index: undefined, format: undefined };\n}\n\n/** Options for a filter, keeping its selected values listed while the result that suggests them loads. */\nfunction withSelected(options: { value: string; label: string; description?: string }[], selected: Modes | undefined) {\n const listed = new Set(options.map(option => option.value));\n return [...options, ...Object.keys(selected ?? {}).filter(value => !listed.has(value)).map(value => ({ value, label: value }))];\n}\n\n/** One line of trace filters: source, services, root operations, attributes, status, duration, span count and the time window. Any filter change returns to the first page. */\nexport function QueryBar({ value, onChange: change, onError, sources, runs, result, allowRecords = true, trailing, pinned = {} }: {\n value: SearchValues;\n onChange: (next: Partial<SearchValues>) => void;\n onError: (message: string) => void;\n sources: Source[];\n runs: string[];\n result?: SearchResult;\n allowRecords?: boolean;\n /** Rendered beside the time window, such as the in-flight search's timer. */\n trailing?: ReactNode;\n /** Filter entries the page fixes: shown among the selected values, but every change keeps them. */\n pinned?: SearchValues;\n}) {\n const onChange = (next: Partial<SearchValues>) => change({ ...next, offset: undefined });\n const choice = sourceChoice(value);\n const connection = sources.find(source => source.id === value.source && source.id !== \"records\");\n const multi = (key: ModeFilter, label: string, options: { value: string; label: string; description?: string }[], extra: Partial<FilterBarMultiFilter> = {}): FilterBarMultiFilter => {\n const locked = pinned[key] ?? {};\n const selected = { ...value[key], ...locked };\n return {\n ...extra, key, kind: \"multi\", label, value: selected, onChange: next => onChange({ [key]: { ...next, ...locked } }),\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n };\n };\n const filters: FilterBarFilter[] = [\n {\n key: \"source\", kind: \"enum\", label: \"Source\", required: true, value: choice, onChange: next => onChange(chooseSource(next)),\n options: [\n ...(runs.includes(RECEIVER_RUN) ? [{ value: \"received\", label: \"Received\" }] : []),\n ...(allowRecords ? [{ value: \"records\", label: \"Recorded\" }] : []),\n ...sources.filter(source => source.id !== \"records\").map(source => ({ value: source.id, label: source.name })),\n ],\n },\n multi(\"services\", \"Service\", (result?.services ?? []).map(service => ({ value: service, label: service }))),\n multi(\"operations\", \"Root operation\", (result?.rootOperations ?? []).map(({ operation }) => ({\n value: operation, label: shortOperation(operation), ...(operation !== shortOperation(operation) ? { description: operation } : {}),\n }))),\n multi(\"attributes\", \"Attributes\", (result?.attributes ?? []).map(({ value: expr, count }) => ({ value: expr, label: expr, description: `${count} traces` })), {\n allowCustomValue: true, placeholder: \"key=value\", description: \"Any span's attribute: key=value, key=prefix*, or a bare key to match its presence.\",\n }),\n multi(\"statuses\", \"Status\", [{ value: \"ok\", label: \"OK\" }, { value: \"error\", label: \"Error\" }]),\n { key: \"duration\", kind: \"duration\", label: \"Duration\", value: durationOf(value), onChange: next => onChange(durationRequest(next)), unit: \"s\" },\n { key: \"hide-single\", kind: \"boolean\", label: \"Hide single-span traces\", value: (value.minSpans ?? 0) >= MULTI_SPAN, onChange: hide => onChange({ minSpans: hide ? MULTI_SPAN : undefined }) },\n ];\n if (choice === \"records\") filters.push({\n key: \"run\", kind: \"enum\", label: \"Run\", value: value.run ?? \"\", onChange: run => onChange({ run: run || undefined }),\n options: [{ value: \"\", label: \"Every run\" }, ...runs.filter(run => run !== RECEIVER_RUN).map(run => ({ value: run }))],\n });\n if (connection) filters.push(\n { key: \"index\", kind: \"text\", label: \"Index\", value: value.index ?? \"\", onChange: index => onChange({ index: index || undefined }), placement: \"overflow\" },\n { key: \"format\", kind: \"enum\", label: \"Document format\", value: value.format ?? \"\", onChange: format => onChange({ format: format || undefined }), options: [{ value: \"\", label: \"Connection default\" }, { value: \"flat\" }, { value: \"jaeger\" }], placement: \"overflow\" },\n );\n const range = rangeOf(value);\n return (\n <FilterBar\n filters={filters}\n trailing={trailing}\n timeRange={{\n from: range.from, to: range.to, timeEnabled: true, emptyLabel: \"Last hour\",\n onApply: (from, to) => {\n try {\n onChange(windowOf(from, to, Date.now()));\n } catch (error) {\n onError(error instanceof Error ? error.message : String(error));\n }\n },\n }}\n />\n );\n}\n"],"mappings":";;;;;AAMA,SAAS,aAAa,QAA8B;CAClD,IAAI,WAAW,YAAY,OAAO;EAAE,QAAQ;EAAW,KAAKA,eAAAA;EAAc,OAAO,KAAA;EAAW,QAAQ,KAAA;CAAU;CAC9G,OAAO;EAAE,QAAQ;EAAQ,KAAK,KAAA;EAAW,OAAO,KAAA;EAAW,QAAQ,KAAA;CAAU;AAC/E;;AAGA,SAAS,aAAa,SAAmE,UAA6B;CACpH,MAAM,SAAS,IAAI,IAAI,QAAQ,KAAI,WAAU,OAAO,KAAK,CAAC;CAC1D,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,QAAO,UAAS,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAI,WAAU;EAAE;EAAO,OAAO;CAAM,EAAE,CAAC;AAChI;;AAGA,SAAgB,SAAS,EAAE,OAAO,UAAU,QAAQ,SAAS,SAAS,MAAM,QAAQ,eAAe,MAAM,UAAU,SAAS,CAAC,KAY1H;CACD,MAAM,YAAY,SAAgC,OAAO;EAAE,GAAG;EAAM,QAAQ,KAAA;CAAU,CAAC;CACvF,MAAM,SAASC,eAAAA,aAAa,KAAK;CACjC,MAAM,aAAa,QAAQ,MAAK,WAAU,OAAO,OAA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AAQ,UAAU,KAAA,EAAU,CAAC;EAAG,SAAS;GAAC;IAAE,OAAO;IAAI,OAAO;GAAqB;GAAG,EAAE,OAAO,OAAO;GAAG,EAAE,OAAO,SAAS;EAAC;EAAG,WAAW;CAAW,CAC1Q;CACA,MAAM,QAAQK,cAAAA,QAAQ,KAAK;CAC3B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;EACW;EACC;EACV,WAAW;GACT,MAAM,MAAM;GAAM,IAAI,MAAM;GAAI,aAAa;GAAM,YAAY;GAC/D,UAAU,MAAM,OAAO;IACrB,IAAI;KACF,SAASC,cAAAA,SAAS,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC;IACzC,SAAS,OAAO;KACd,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAChE;GACF;EACF;CACD,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"QueryBar.cjs","names":["RECEIVER_RUN","sourceChoice","shortOperation","durationOf","durationRequest","rangeOf","FilterBar","windowOf"],"sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { RECEIVER_RUN, sourceChoice } from \"./source\";\nimport { FilterBar, type FilterBarFilter, type FilterBarMultiFilter, type FilterTreeNode } from \"../../../components\";\nimport type { ModeFilter, Modes, SearchResult, SearchValues, Source } from \"./api\";\nimport { durationOf, durationRequest, MULTI_SPAN, rangeOf, shortOperation, windowOf } from \"./query\";\n\nfunction chooseSource(choice: string): SearchValues {\n if (choice === \"received\") return { source: \"records\", run: RECEIVER_RUN, index: undefined, format: undefined };\n return { source: choice, run: undefined, index: undefined, format: undefined };\n}\n\n/** Options for a filter, keeping its selected values listed while the result that suggests them loads. */\nfunction withSelected(options: { value: string; label: string; description?: string }[], selected: Modes | undefined) {\n const listed = new Set(options.map(option => option.value));\n return [...options, ...Object.keys(selected ?? {}).filter(value => !listed.has(value)).map(value => ({ value, label: value }))];\n}\n\n/** The attribute an expression names: `key`, `key=value` and `key=prefix*` all name `key`. */\nconst attributeKey = (expr: string) => expr.split(\"=\", 1)[0]!.trim();\n\n/** The suggested attributes as a tree of keys, each holding its values; a key selects its presence. Promoted keys have their own fields instead. */\nfunction attributeTree(suggested: SearchResult[\"attributes\"], promoted: ReadonlySet<string>): FilterTreeNode[] {\n const values = new Map<string, FilterTreeNode[]>();\n for (const { value: expr, count } of suggested) {\n const key = attributeKey(expr);\n if (promoted.has(key)) continue;\n const children = values.get(key) ?? [];\n values.set(key, children);\n if (expr !== key) children.push({ key: expr, label: expr.slice(key.length + 1), description: `${count} traces` });\n }\n return [...values].sort(([a], [b]) => a.localeCompare(b)).map(([key, children]) => ({ key, label: key, description: \"Has this attribute\", children }));\n}\n\n/** One line of trace filters: source, services, root operations, attributes, status, duration, span count and the time window. Any filter change returns to the first page. */\nexport function QueryBar({ value, onChange: change, onError, sources, runs, result, allowRecords = true, trailing, pinned = {} }: {\n value: SearchValues;\n onChange: (next: Partial<SearchValues>) => void;\n onError: (message: string) => void;\n sources: Source[];\n runs: string[];\n result?: SearchResult;\n allowRecords?: boolean;\n /** Rendered beside the time window, such as the in-flight search's timer. */\n trailing?: ReactNode;\n /** Filter entries the page fixes: shown among the selected values, but every change keeps them. */\n pinned?: SearchValues;\n}) {\n const onChange = (next: Partial<SearchValues>) => change({ ...next, offset: undefined });\n const choice = sourceChoice(value);\n const connection = sources.find(source => source.id === value.source && source.id !== \"records\");\n const multi = (key: ModeFilter, label: string, options: { value: string; label: string; description?: string }[], extra: Partial<FilterBarMultiFilter> = {}): FilterBarMultiFilter => {\n const locked = pinned[key] ?? {};\n const selected = { ...value[key], ...locked };\n return {\n ...extra, key, kind: \"multi\", label, value: selected, onChange: next => onChange({ [key]: { ...next, ...locked } }),\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n };\n };\n // Every chosen attribute key has its own field; the tree offers the rest. FilterBar applies staged\n // fields one onChange at a time within a render, so they all edit this one running copy.\n const attributeFilters = (): FilterBarFilter[] => {\n const locked = pinned.attributes ?? {};\n let current: Modes = { ...value.attributes, ...locked };\n const suggested = result?.attributes ?? [];\n const promoted = [...new Set(Object.keys(current).map(attributeKey))];\n const tree: FilterBarFilter = {\n key: \"attributes\", kind: \"tree\", label: \"Attributes\", value: {}, nodes: attributeTree(suggested, new Set(promoted)),\n description: \"Any span's attribute: a key matches its presence, a value matches exactly. A chosen attribute gets its own field.\",\n onChange: next => {\n current = { ...current, ...next };\n onChange({ attributes: current });\n },\n };\n return [tree, ...promoted.map((key): FilterBarFilter => {\n const ownEntries = (modes: Modes) => Object.fromEntries(Object.entries(modes).filter(([expr]) => attributeKey(expr) === key));\n const selected = ownEntries(current);\n const options = [\n { value: key, label: \"any value\", description: \"Has this attribute\" },\n ...suggested.filter(({ value: expr }) => expr !== key && attributeKey(expr) === key)\n .map(({ value: expr, count }) => ({ value: expr, label: expr.slice(key.length + 1), description: `${count} traces` })),\n ];\n return {\n key: `attribute:${key}`, kind: \"multi\", label: key, value: selected, allowCustomValue: true, placeholder: \"value or prefix*\",\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n onChange: next => {\n const typed = Object.entries(next).map(([expr, mode]) => [expr === key || expr.startsWith(`${key}=`) ? expr : `${key}=${expr}`, mode] as const);\n const others = Object.fromEntries(Object.entries(current).filter(([expr]) => attributeKey(expr) !== key));\n current = { ...others, ...Object.fromEntries(typed), ...ownEntries(locked) };\n onChange({ attributes: current });\n },\n };\n })];\n };\n const filters: FilterBarFilter[] = [\n {\n key: \"source\", kind: \"enum\", label: \"Source\", required: true, value: choice, onChange: next => onChange(chooseSource(next)),\n options: [\n ...(runs.includes(RECEIVER_RUN) ? [{ value: \"received\", label: \"Received\" }] : []),\n ...(allowRecords ? [{ value: \"records\", label: \"Recorded\" }] : []),\n ...sources.filter(source => source.id !== \"records\").map(source => ({ value: source.id, label: source.name })),\n ],\n },\n multi(\"services\", \"Service\", (result?.services ?? []).map(service => ({ value: service, label: service }))),\n multi(\"operations\", \"Root operation\", (result?.rootOperations ?? []).map(({ operation }) => ({\n value: operation, label: shortOperation(operation), ...(operation !== shortOperation(operation) ? { description: operation } : {}),\n }))),\n ...attributeFilters(),\n multi(\"statuses\", \"Status\", [{ value: \"ok\", label: \"OK\" }, { value: \"error\", label: \"Error\" }]),\n { key: \"duration\", kind: \"duration\", label: \"Duration\", value: durationOf(value), onChange: next => onChange(durationRequest(next)), unit: \"ms\" },\n { key: \"hide-single\", kind: \"boolean\", label: \"Hide single-span traces\", value: (value.minSpans ?? 0) >= MULTI_SPAN, onChange: hide => onChange({ minSpans: hide ? MULTI_SPAN : undefined }) },\n ];\n if (choice === \"records\") filters.push({\n key: \"run\", kind: \"enum\", label: \"Run\", value: value.run ?? \"\", onChange: run => onChange({ run: run || undefined }),\n options: [{ value: \"\", label: \"Every run\" }, ...runs.filter(run => run !== RECEIVER_RUN).map(run => ({ value: run }))],\n });\n if (connection) filters.push(\n { key: \"index\", kind: \"text\", label: \"Index\", value: value.index ?? \"\", onChange: index => onChange({ index: index || undefined }), placement: \"overflow\" },\n { key: \"format\", kind: \"enum\", label: \"Document format\", value: value.format ?? \"\", onChange: format => onChange({ format: format || undefined }), options: [{ value: \"\", label: \"Connection default\" }, { value: \"flat\" }, { value: \"jaeger\" }], placement: \"overflow\" },\n );\n const range = rangeOf(value);\n return (\n <FilterBar\n filters={filters}\n trailing={trailing}\n timeRange={{\n from: range.from, to: range.to, timeEnabled: true, emptyLabel: \"Last hour\",\n onApply: (from, to) => {\n try {\n onChange(windowOf(from, to, Date.now()));\n } catch (error) {\n onError(error instanceof Error ? error.message : String(error));\n }\n },\n }}\n />\n );\n}\n"],"mappings":";;;;;AAMA,SAAS,aAAa,QAA8B;CAClD,IAAI,WAAW,YAAY,OAAO;EAAE,QAAQ;EAAW,KAAKA,eAAAA;EAAc,OAAO,KAAA;EAAW,QAAQ,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,SAAQ,EAAE,OAAO,IAAI,EAAE,CAAC;CACvH,CAAC;CACD,IAAI,YAAY,QAAQ,KACtB;EAAE,KAAK;EAAS,MAAM;EAAQ,OAAO;EAAS,OAAO,MAAM,SAAS;EAAI,WAAU,UAAS,SAAS,EAAE,OAAO,SAAS,KAAA,EAAU,CAAC;EAAG,WAAW;CAAW,GAC1J;EAAE,KAAK;EAAU,MAAM;EAAQ,OAAO;EAAmB,OAAO,MAAM,UAAU;EAAI,WAAU,WAAU,SAAS,EAAE,QAAQ,UAAU,KAAA,EAAU,CAAC;EAAG,SAAS;GAAC;IAAE,OAAO;IAAI,OAAO;GAAqB;GAAG,EAAE,OAAO,OAAO;GAAG,EAAE,OAAO,SAAS;EAAC;EAAG,WAAW;CAAW,CAC1Q;CACA,MAAM,QAAQK,cAAAA,QAAQ,KAAK;CAC3B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,kBAAAA,WAAD;EACW;EACC;EACV,WAAW;GACT,MAAM,MAAM;GAAM,IAAI,MAAM;GAAI,aAAa;GAAM,YAAY;GAC/D,UAAU,MAAM,OAAO;IACrB,IAAI;KACF,SAASC,cAAAA,SAAS,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC;IACzC,SAAS,OAAO;KACd,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAChE;GACF;EACF;CACD,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBar.d.ts","sourceRoot":"","sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAqB,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"QueryBar.d.ts","sourceRoot":"","sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAqB,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AA8BnF,+KAA+K;AAC/K,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAmB,EAAE,QAAQ,EAAE,MAAW,EAAE,EAAE;IAChI,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAChD,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,mGAAmG;IACnG,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,+BA0FA"}
|
|
@@ -25,6 +25,29 @@ function withSelected(options, selected) {
|
|
|
25
25
|
label: value
|
|
26
26
|
}))];
|
|
27
27
|
}
|
|
28
|
+
/** The attribute an expression names: `key`, `key=value` and `key=prefix*` all name `key`. */
|
|
29
|
+
var attributeKey = (expr) => expr.split("=", 1)[0].trim();
|
|
30
|
+
/** The suggested attributes as a tree of keys, each holding its values; a key selects its presence. Promoted keys have their own fields instead. */
|
|
31
|
+
function attributeTree(suggested, promoted) {
|
|
32
|
+
const values = /* @__PURE__ */ new Map();
|
|
33
|
+
for (const { value: expr, count } of suggested) {
|
|
34
|
+
const key = attributeKey(expr);
|
|
35
|
+
if (promoted.has(key)) continue;
|
|
36
|
+
const children = values.get(key) ?? [];
|
|
37
|
+
values.set(key, children);
|
|
38
|
+
if (expr !== key) children.push({
|
|
39
|
+
key: expr,
|
|
40
|
+
label: expr.slice(key.length + 1),
|
|
41
|
+
description: `${count} traces`
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return [...values].sort(([a], [b]) => a.localeCompare(b)).map(([key, children]) => ({
|
|
45
|
+
key,
|
|
46
|
+
label: key,
|
|
47
|
+
description: "Has this attribute",
|
|
48
|
+
children
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
28
51
|
/** One line of trace filters: source, services, root operations, attributes, status, duration, span count and the time window. Any filter change returns to the first page. */
|
|
29
52
|
function QueryBar({ value, onChange: change, onError, sources, runs, result, allowRecords = true, trailing, pinned = {} }) {
|
|
30
53
|
const onChange = (next) => change({
|
|
@@ -56,6 +79,64 @@ function QueryBar({ value, onChange: change, onError, sources, runs, result, all
|
|
|
56
79
|
} : option)
|
|
57
80
|
};
|
|
58
81
|
};
|
|
82
|
+
const attributeFilters = () => {
|
|
83
|
+
const locked = pinned.attributes ?? {};
|
|
84
|
+
let current = {
|
|
85
|
+
...value.attributes,
|
|
86
|
+
...locked
|
|
87
|
+
};
|
|
88
|
+
const suggested = result?.attributes ?? [];
|
|
89
|
+
const promoted = [...new Set(Object.keys(current).map(attributeKey))];
|
|
90
|
+
return [{
|
|
91
|
+
key: "attributes",
|
|
92
|
+
kind: "tree",
|
|
93
|
+
label: "Attributes",
|
|
94
|
+
value: {},
|
|
95
|
+
nodes: attributeTree(suggested, new Set(promoted)),
|
|
96
|
+
description: "Any span's attribute: a key matches its presence, a value matches exactly. A chosen attribute gets its own field.",
|
|
97
|
+
onChange: (next) => {
|
|
98
|
+
current = {
|
|
99
|
+
...current,
|
|
100
|
+
...next
|
|
101
|
+
};
|
|
102
|
+
onChange({ attributes: current });
|
|
103
|
+
}
|
|
104
|
+
}, ...promoted.map((key) => {
|
|
105
|
+
const ownEntries = (modes) => Object.fromEntries(Object.entries(modes).filter(([expr]) => attributeKey(expr) === key));
|
|
106
|
+
const selected = ownEntries(current);
|
|
107
|
+
const options = [{
|
|
108
|
+
value: key,
|
|
109
|
+
label: "any value",
|
|
110
|
+
description: "Has this attribute"
|
|
111
|
+
}, ...suggested.filter(({ value: expr }) => expr !== key && attributeKey(expr) === key).map(({ value: expr, count }) => ({
|
|
112
|
+
value: expr,
|
|
113
|
+
label: expr.slice(key.length + 1),
|
|
114
|
+
description: `${count} traces`
|
|
115
|
+
}))];
|
|
116
|
+
return {
|
|
117
|
+
key: `attribute:${key}`,
|
|
118
|
+
kind: "multi",
|
|
119
|
+
label: key,
|
|
120
|
+
value: selected,
|
|
121
|
+
allowCustomValue: true,
|
|
122
|
+
placeholder: "value or prefix*",
|
|
123
|
+
options: withSelected(options, selected).map((option) => Object.hasOwn(locked, option.value) ? {
|
|
124
|
+
...option,
|
|
125
|
+
disabled: true,
|
|
126
|
+
description: "Pinned by this page"
|
|
127
|
+
} : option),
|
|
128
|
+
onChange: (next) => {
|
|
129
|
+
const typed = Object.entries(next).map(([expr, mode]) => [expr === key || expr.startsWith(`${key}=`) ? expr : `${key}=${expr}`, mode]);
|
|
130
|
+
current = {
|
|
131
|
+
...Object.fromEntries(Object.entries(current).filter(([expr]) => attributeKey(expr) !== key)),
|
|
132
|
+
...Object.fromEntries(typed),
|
|
133
|
+
...ownEntries(locked)
|
|
134
|
+
};
|
|
135
|
+
onChange({ attributes: current });
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
})];
|
|
139
|
+
};
|
|
59
140
|
const filters = [
|
|
60
141
|
{
|
|
61
142
|
key: "source",
|
|
@@ -88,15 +169,7 @@ function QueryBar({ value, onChange: change, onError, sources, runs, result, all
|
|
|
88
169
|
label: shortOperation(operation),
|
|
89
170
|
...operation !== shortOperation(operation) ? { description: operation } : {}
|
|
90
171
|
}))),
|
|
91
|
-
|
|
92
|
-
value: expr,
|
|
93
|
-
label: expr,
|
|
94
|
-
description: `${count} traces`
|
|
95
|
-
})), {
|
|
96
|
-
allowCustomValue: true,
|
|
97
|
-
placeholder: "key=value",
|
|
98
|
-
description: "Any span's attribute: key=value, key=prefix*, or a bare key to match its presence."
|
|
99
|
-
}),
|
|
172
|
+
...attributeFilters(),
|
|
100
173
|
multi("statuses", "Status", [{
|
|
101
174
|
value: "ok",
|
|
102
175
|
label: "OK"
|
|
@@ -110,7 +183,7 @@ function QueryBar({ value, onChange: change, onError, sources, runs, result, all
|
|
|
110
183
|
label: "Duration",
|
|
111
184
|
value: durationOf(value),
|
|
112
185
|
onChange: (next) => onChange(durationRequest(next)),
|
|
113
|
-
unit: "
|
|
186
|
+
unit: "ms"
|
|
114
187
|
},
|
|
115
188
|
{
|
|
116
189
|
key: "hide-single",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBar.js","names":[],"sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { RECEIVER_RUN, sourceChoice } from \"./source\";\nimport { FilterBar, type FilterBarFilter, type FilterBarMultiFilter } from \"../../../components\";\nimport type { ModeFilter, Modes, SearchResult, SearchValues, Source } from \"./api\";\nimport { durationOf, durationRequest, MULTI_SPAN, rangeOf, shortOperation, windowOf } from \"./query\";\n\nfunction chooseSource(choice: string): SearchValues {\n if (choice === \"received\") return { source: \"records\", run: RECEIVER_RUN, index: undefined, format: undefined };\n return { source: choice, run: undefined, index: undefined, format: undefined };\n}\n\n/** Options for a filter, keeping its selected values listed while the result that suggests them loads. */\nfunction withSelected(options: { value: string; label: string; description?: string }[], selected: Modes | undefined) {\n const listed = new Set(options.map(option => option.value));\n return [...options, ...Object.keys(selected ?? {}).filter(value => !listed.has(value)).map(value => ({ value, label: value }))];\n}\n\n/** One line of trace filters: source, services, root operations, attributes, status, duration, span count and the time window. Any filter change returns to the first page. */\nexport function QueryBar({ value, onChange: change, onError, sources, runs, result, allowRecords = true, trailing, pinned = {} }: {\n value: SearchValues;\n onChange: (next: Partial<SearchValues>) => void;\n onError: (message: string) => void;\n sources: Source[];\n runs: string[];\n result?: SearchResult;\n allowRecords?: boolean;\n /** Rendered beside the time window, such as the in-flight search's timer. */\n trailing?: ReactNode;\n /** Filter entries the page fixes: shown among the selected values, but every change keeps them. */\n pinned?: SearchValues;\n}) {\n const onChange = (next: Partial<SearchValues>) => change({ ...next, offset: undefined });\n const choice = sourceChoice(value);\n const connection = sources.find(source => source.id === value.source && source.id !== \"records\");\n const multi = (key: ModeFilter, label: string, options: { value: string; label: string; description?: string }[], extra: Partial<FilterBarMultiFilter> = {}): FilterBarMultiFilter => {\n const locked = pinned[key] ?? {};\n const selected = { ...value[key], ...locked };\n return {\n ...extra, key, kind: \"multi\", label, value: selected, onChange: next => onChange({ [key]: { ...next, ...locked } }),\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n };\n };\n const filters: FilterBarFilter[] = [\n {\n key: \"source\", kind: \"enum\", label: \"Source\", required: true, value: choice, onChange: next => onChange(chooseSource(next)),\n options: [\n ...(runs.includes(RECEIVER_RUN) ? [{ value: \"received\", label: \"Received\" }] : []),\n ...(allowRecords ? [{ value: \"records\", label: \"Recorded\" }] : []),\n ...sources.filter(source => source.id !== \"records\").map(source => ({ value: source.id, label: source.name })),\n ],\n },\n multi(\"services\", \"Service\", (result?.services ?? []).map(service => ({ value: service, label: service }))),\n multi(\"operations\", \"Root operation\", (result?.rootOperations ?? []).map(({ operation }) => ({\n value: operation, label: shortOperation(operation), ...(operation !== shortOperation(operation) ? { description: operation } : {}),\n }))),\n multi(\"attributes\", \"Attributes\", (result?.attributes ?? []).map(({ value: expr, count }) => ({ value: expr, label: expr, description: `${count} traces` })), {\n allowCustomValue: true, placeholder: \"key=value\", description: \"Any span's attribute: key=value, key=prefix*, or a bare key to match its presence.\",\n }),\n multi(\"statuses\", \"Status\", [{ value: \"ok\", label: \"OK\" }, { value: \"error\", label: \"Error\" }]),\n { key: \"duration\", kind: \"duration\", label: \"Duration\", value: durationOf(value), onChange: next => onChange(durationRequest(next)), unit: \"s\" },\n { key: \"hide-single\", kind: \"boolean\", label: \"Hide single-span traces\", value: (value.minSpans ?? 0) >= MULTI_SPAN, onChange: hide => onChange({ minSpans: hide ? MULTI_SPAN : undefined }) },\n ];\n if (choice === \"records\") filters.push({\n key: \"run\", kind: \"enum\", label: \"Run\", value: value.run ?? \"\", onChange: run => onChange({ run: run || undefined }),\n options: [{ value: \"\", label: \"Every run\" }, ...runs.filter(run => run !== RECEIVER_RUN).map(run => ({ value: run }))],\n });\n if (connection) filters.push(\n { key: \"index\", kind: \"text\", label: \"Index\", value: value.index ?? \"\", onChange: index => onChange({ index: index || undefined }), placement: \"overflow\" },\n { key: \"format\", kind: \"enum\", label: \"Document format\", value: value.format ?? \"\", onChange: format => onChange({ format: format || undefined }), options: [{ value: \"\", label: \"Connection default\" }, { value: \"flat\" }, { value: \"jaeger\" }], placement: \"overflow\" },\n );\n const range = rangeOf(value);\n return (\n <FilterBar\n filters={filters}\n trailing={trailing}\n timeRange={{\n from: range.from, to: range.to, timeEnabled: true, emptyLabel: \"Last hour\",\n onApply: (from, to) => {\n try {\n onChange(windowOf(from, to, Date.now()));\n } catch (error) {\n onError(error instanceof Error ? error.message : String(error));\n }\n },\n }}\n />\n );\n}\n"],"mappings":";;;;;AAMA,SAAS,aAAa,QAA8B;CAClD,IAAI,WAAW,YAAY,OAAO;EAAE,QAAQ;EAAW,KAAK;EAAc,OAAO,KAAA;EAAW,QAAQ,KAAA;CAAU;CAC9G,OAAO;EAAE,QAAQ;EAAQ,KAAK,KAAA;EAAW,OAAO,KAAA;EAAW,QAAQ,KAAA;CAAU;AAC/E;;AAGA,SAAS,aAAa,SAAmE,UAA6B;CACpH,MAAM,SAAS,IAAI,IAAI,QAAQ,KAAI,WAAU,OAAO,KAAK,CAAC;CAC1D,OAAO,CAAC,GAAG,SAAS,GAAG,OAAO,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,QAAO,UAAS,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,KAAI,WAAU;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YAAY,QAAQ,KACtB;EAAE,KAAK;EAAS,MAAM;EAAQ,OAAO;EAAS,OAAO,MAAM,SAAS;EAAI,WAAU,UAAS,SAAS,EAAE,OAAO,SAAS,KAAA,EAAU,CAAC;EAAG,WAAW;CAAW,GAC1J;EAAE,KAAK;EAAU,MAAM;EAAQ,OAAO;EAAmB,OAAO,MAAM,UAAU;EAAI,WAAU,WAAU,SAAS,EAAE,QAAQ,UAAU,KAAA,EAAU,CAAC;EAAG,SAAS;GAAC;IAAE,OAAO;IAAI,OAAO;GAAqB;GAAG,EAAE,OAAO,OAAO;GAAG,EAAE,OAAO,SAAS;EAAC;EAAG,WAAW;CAAW,CAC1Q;CACA,MAAM,QAAQ,QAAQ,KAAK;CAC3B,OACE,oBAAC,WAAD;EACW;EACC;EACV,WAAW;GACT,MAAM,MAAM;GAAM,IAAI,MAAM;GAAI,aAAa;GAAM,YAAY;GAC/D,UAAU,MAAM,OAAO;IACrB,IAAI;KACF,SAAS,SAAS,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC;IACzC,SAAS,OAAO;KACd,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAChE;GACF;EACF;CACD,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"QueryBar.js","names":[],"sources":["../../../../src/data/traces/otel/QueryBar.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { RECEIVER_RUN, sourceChoice } from \"./source\";\nimport { FilterBar, type FilterBarFilter, type FilterBarMultiFilter, type FilterTreeNode } from \"../../../components\";\nimport type { ModeFilter, Modes, SearchResult, SearchValues, Source } from \"./api\";\nimport { durationOf, durationRequest, MULTI_SPAN, rangeOf, shortOperation, windowOf } from \"./query\";\n\nfunction chooseSource(choice: string): SearchValues {\n if (choice === \"received\") return { source: \"records\", run: RECEIVER_RUN, index: undefined, format: undefined };\n return { source: choice, run: undefined, index: undefined, format: undefined };\n}\n\n/** Options for a filter, keeping its selected values listed while the result that suggests them loads. */\nfunction withSelected(options: { value: string; label: string; description?: string }[], selected: Modes | undefined) {\n const listed = new Set(options.map(option => option.value));\n return [...options, ...Object.keys(selected ?? {}).filter(value => !listed.has(value)).map(value => ({ value, label: value }))];\n}\n\n/** The attribute an expression names: `key`, `key=value` and `key=prefix*` all name `key`. */\nconst attributeKey = (expr: string) => expr.split(\"=\", 1)[0]!.trim();\n\n/** The suggested attributes as a tree of keys, each holding its values; a key selects its presence. Promoted keys have their own fields instead. */\nfunction attributeTree(suggested: SearchResult[\"attributes\"], promoted: ReadonlySet<string>): FilterTreeNode[] {\n const values = new Map<string, FilterTreeNode[]>();\n for (const { value: expr, count } of suggested) {\n const key = attributeKey(expr);\n if (promoted.has(key)) continue;\n const children = values.get(key) ?? [];\n values.set(key, children);\n if (expr !== key) children.push({ key: expr, label: expr.slice(key.length + 1), description: `${count} traces` });\n }\n return [...values].sort(([a], [b]) => a.localeCompare(b)).map(([key, children]) => ({ key, label: key, description: \"Has this attribute\", children }));\n}\n\n/** One line of trace filters: source, services, root operations, attributes, status, duration, span count and the time window. Any filter change returns to the first page. */\nexport function QueryBar({ value, onChange: change, onError, sources, runs, result, allowRecords = true, trailing, pinned = {} }: {\n value: SearchValues;\n onChange: (next: Partial<SearchValues>) => void;\n onError: (message: string) => void;\n sources: Source[];\n runs: string[];\n result?: SearchResult;\n allowRecords?: boolean;\n /** Rendered beside the time window, such as the in-flight search's timer. */\n trailing?: ReactNode;\n /** Filter entries the page fixes: shown among the selected values, but every change keeps them. */\n pinned?: SearchValues;\n}) {\n const onChange = (next: Partial<SearchValues>) => change({ ...next, offset: undefined });\n const choice = sourceChoice(value);\n const connection = sources.find(source => source.id === value.source && source.id !== \"records\");\n const multi = (key: ModeFilter, label: string, options: { value: string; label: string; description?: string }[], extra: Partial<FilterBarMultiFilter> = {}): FilterBarMultiFilter => {\n const locked = pinned[key] ?? {};\n const selected = { ...value[key], ...locked };\n return {\n ...extra, key, kind: \"multi\", label, value: selected, onChange: next => onChange({ [key]: { ...next, ...locked } }),\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n };\n };\n // Every chosen attribute key has its own field; the tree offers the rest. FilterBar applies staged\n // fields one onChange at a time within a render, so they all edit this one running copy.\n const attributeFilters = (): FilterBarFilter[] => {\n const locked = pinned.attributes ?? {};\n let current: Modes = { ...value.attributes, ...locked };\n const suggested = result?.attributes ?? [];\n const promoted = [...new Set(Object.keys(current).map(attributeKey))];\n const tree: FilterBarFilter = {\n key: \"attributes\", kind: \"tree\", label: \"Attributes\", value: {}, nodes: attributeTree(suggested, new Set(promoted)),\n description: \"Any span's attribute: a key matches its presence, a value matches exactly. A chosen attribute gets its own field.\",\n onChange: next => {\n current = { ...current, ...next };\n onChange({ attributes: current });\n },\n };\n return [tree, ...promoted.map((key): FilterBarFilter => {\n const ownEntries = (modes: Modes) => Object.fromEntries(Object.entries(modes).filter(([expr]) => attributeKey(expr) === key));\n const selected = ownEntries(current);\n const options = [\n { value: key, label: \"any value\", description: \"Has this attribute\" },\n ...suggested.filter(({ value: expr }) => expr !== key && attributeKey(expr) === key)\n .map(({ value: expr, count }) => ({ value: expr, label: expr.slice(key.length + 1), description: `${count} traces` })),\n ];\n return {\n key: `attribute:${key}`, kind: \"multi\", label: key, value: selected, allowCustomValue: true, placeholder: \"value or prefix*\",\n options: withSelected(options, selected).map(option => Object.hasOwn(locked, option.value) ? { ...option, disabled: true, description: \"Pinned by this page\" } : option),\n onChange: next => {\n const typed = Object.entries(next).map(([expr, mode]) => [expr === key || expr.startsWith(`${key}=`) ? expr : `${key}=${expr}`, mode] as const);\n const others = Object.fromEntries(Object.entries(current).filter(([expr]) => attributeKey(expr) !== key));\n current = { ...others, ...Object.fromEntries(typed), ...ownEntries(locked) };\n onChange({ attributes: current });\n },\n };\n })];\n };\n const filters: FilterBarFilter[] = [\n {\n key: \"source\", kind: \"enum\", label: \"Source\", required: true, value: choice, onChange: next => onChange(chooseSource(next)),\n options: [\n ...(runs.includes(RECEIVER_RUN) ? [{ value: \"received\", label: \"Received\" }] : []),\n ...(allowRecords ? [{ value: \"records\", label: \"Recorded\" }] : []),\n ...sources.filter(source => source.id !== \"records\").map(source => ({ value: source.id, label: source.name })),\n ],\n },\n multi(\"services\", \"Service\", (result?.services ?? []).map(service => ({ value: service, label: service }))),\n multi(\"operations\", \"Root operation\", (result?.rootOperations ?? []).map(({ operation }) => ({\n value: operation, label: shortOperation(operation), ...(operation !== shortOperation(operation) ? { description: operation } : {}),\n }))),\n ...attributeFilters(),\n multi(\"statuses\", \"Status\", [{ value: \"ok\", label: \"OK\" }, { value: \"error\", label: \"Error\" }]),\n { key: \"duration\", kind: \"duration\", label: \"Duration\", value: durationOf(value), onChange: next => onChange(durationRequest(next)), unit: \"ms\" },\n { key: \"hide-single\", kind: \"boolean\", label: \"Hide single-span traces\", value: (value.minSpans ?? 0) >= MULTI_SPAN, onChange: hide => onChange({ minSpans: hide ? MULTI_SPAN : undefined }) },\n ];\n if (choice === \"records\") filters.push({\n key: \"run\", kind: \"enum\", label: \"Run\", value: value.run ?? \"\", onChange: run => onChange({ run: run || undefined }),\n options: [{ value: \"\", label: \"Every run\" }, ...runs.filter(run => run !== RECEIVER_RUN).map(run => ({ value: run }))],\n });\n if (connection) filters.push(\n { key: \"index\", kind: \"text\", label: \"Index\", value: value.index ?? \"\", onChange: index => onChange({ index: index || undefined }), placement: \"overflow\" },\n { key: \"format\", kind: \"enum\", label: \"Document format\", value: value.format ?? \"\", onChange: format => onChange({ format: format || undefined }), options: [{ value: \"\", label: \"Connection default\" }, { value: \"flat\" }, { value: \"jaeger\" }], placement: \"overflow\" },\n );\n const range = rangeOf(value);\n return (\n <FilterBar\n filters={filters}\n trailing={trailing}\n timeRange={{\n from: range.from, to: range.to, timeEnabled: true, emptyLabel: \"Last hour\",\n onApply: (from, to) => {\n try {\n onChange(windowOf(from, to, Date.now()));\n } catch (error) {\n onError(error instanceof Error ? error.message : String(error));\n }\n },\n }}\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GAAE,OAAO;GAAI,OAAO;EAAY,GAAG,GAAG,KAAK,QAAO,QAAO,QAAQ,YAAY,CAAC,CAAC,KAAI,SAAQ,EAAE,OAAO,IAAI,EAAE,CAAC;CACvH,CAAC;CACD,IAAI,YAAY,QAAQ,KACtB;EAAE,KAAK;EAAS,MAAM;EAAQ,OAAO;EAAS,OAAO,MAAM,SAAS;EAAI,WAAU,UAAS,SAAS,EAAE,OAAO,SAAS,KAAA,EAAU,CAAC;EAAG,WAAW;CAAW,GAC1J;EAAE,KAAK;EAAU,MAAM;EAAQ,OAAO;EAAmB,OAAO,MAAM,UAAU;EAAI,WAAU,WAAU,SAAS,EAAE,QAAQ,UAAU,KAAA,EAAU,CAAC;EAAG,SAAS;GAAC;IAAE,OAAO;IAAI,OAAO;GAAqB;GAAG,EAAE,OAAO,OAAO;GAAG,EAAE,OAAO,SAAS;EAAC;EAAG,WAAW;CAAW,CAC1Q;CACA,MAAM,QAAQ,QAAQ,KAAK;CAC3B,OACE,oBAAC,WAAD;EACW;EACC;EACV,WAAW;GACT,MAAM,MAAM;GAAM,IAAI,MAAM;GAAI,aAAa;GAAM,YAAY;GAC/D,UAAU,MAAM,OAAO;IACrB,IAAI;KACF,SAAS,SAAS,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC;IACzC,SAAS,OAAO;KACd,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;IAChE;GACF;EACF;CACD,CAAA;AAEL"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const require_result_model = require("./result-model.cjs");
|
|
2
2
|
const require_Badge = require("../../Badge.cjs");
|
|
3
3
|
const require_DataTable = require("../../DataTable.cjs");
|
|
4
|
+
const require_UiFileSpreadsheet = require("../../../icons/components/UiFileSpreadsheet.cjs");
|
|
5
|
+
const require_UiJson = require("../../../icons/components/UiJson.cjs");
|
|
6
|
+
const require_download_text = require("../../../jvm/threads/download-text.cjs");
|
|
7
|
+
const require_TagList = require("../../cells/TagList.cjs");
|
|
8
|
+
const require_tag_utils = require("../../cells/tag-utils.cjs");
|
|
4
9
|
const require_api = require("./api.cjs");
|
|
5
10
|
const require_query = require("./query.cjs");
|
|
6
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -92,8 +97,45 @@ function Scatter({ traces, onOpen }) {
|
|
|
92
97
|
]
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
var CSV_COLUMNS = [
|
|
101
|
+
"traceId",
|
|
102
|
+
"operation",
|
|
103
|
+
"service",
|
|
104
|
+
"scope",
|
|
105
|
+
"startedAt",
|
|
106
|
+
"durationMs",
|
|
107
|
+
"spanCount",
|
|
108
|
+
"errors",
|
|
109
|
+
"services",
|
|
110
|
+
"tags",
|
|
111
|
+
"processTags"
|
|
112
|
+
];
|
|
113
|
+
/** RFC 4180 CSV of the traces; a list cell joins its entries with `;`, a tag cell as `key=value`. */
|
|
114
|
+
function tracesCsv(traces) {
|
|
115
|
+
const cell = (value) => {
|
|
116
|
+
const text = Array.isArray(value) ? value.join(";") : value && typeof value === "object" ? Object.entries(value).map(([key, entry]) => `${key}=${entry}`).join(";") : value === void 0 ? "" : String(value);
|
|
117
|
+
return /[",\n\r]/.test(text) ? `"${text.replaceAll("\"", "\"\"")}"` : text;
|
|
118
|
+
};
|
|
119
|
+
return [CSV_COLUMNS.join(","), ...traces.map((trace) => CSV_COLUMNS.map((column) => cell(trace[column])).join(","))].join("\n");
|
|
120
|
+
}
|
|
121
|
+
/** The column menu's downloads of the listed traces. */
|
|
122
|
+
var downloadActions = (traces) => [{
|
|
123
|
+
id: "download-json",
|
|
124
|
+
label: "JSON",
|
|
125
|
+
icon: require_UiJson.UiJson,
|
|
126
|
+
onSelect: () => require_download_text.downloadText("traces.json", JSON.stringify(traces, null, 2))
|
|
127
|
+
}, {
|
|
128
|
+
id: "download-csv",
|
|
129
|
+
label: "CSV",
|
|
130
|
+
icon: require_UiFileSpreadsheet.UiFileSpreadsheet,
|
|
131
|
+
onSelect: () => require_download_text.downloadText("traces.csv", tracesCsv(traces))
|
|
132
|
+
}];
|
|
133
|
+
/**
|
|
134
|
+
* The traces, newest first: what ran, in which service and scope, its root span's tags, when, how long against the
|
|
135
|
+
* slowest, and its span count. The root's process tags are a column the menu reveals. Given `attributeFilter`, including
|
|
136
|
+
* or excluding a tag filters the search by that `key=value`, beside the attributes it already filters by.
|
|
137
|
+
*/
|
|
138
|
+
function ResultTable({ traces, href, onOpen, now, attributeFilter, tableProps = {} }) {
|
|
97
139
|
const slowest = Math.max(1, ...traces.map((trace) => trace.durationMs));
|
|
98
140
|
const columns = [
|
|
99
141
|
{
|
|
@@ -130,6 +172,26 @@ function ResultTable({ traces, href, onOpen, now, tableProps = {} }) {
|
|
|
130
172
|
]
|
|
131
173
|
})
|
|
132
174
|
},
|
|
175
|
+
{
|
|
176
|
+
key: "service",
|
|
177
|
+
label: "Service"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
key: "scope",
|
|
181
|
+
label: "Scope"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "tags",
|
|
185
|
+
label: "Tags",
|
|
186
|
+
kind: "tags",
|
|
187
|
+
minWidth: 240
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
key: "processTags",
|
|
191
|
+
label: "Process tags",
|
|
192
|
+
kind: "tags",
|
|
193
|
+
minWidth: 240
|
|
194
|
+
},
|
|
133
195
|
{
|
|
134
196
|
key: "startedAt",
|
|
135
197
|
label: "Started",
|
|
@@ -168,18 +230,24 @@ function ResultTable({ traces, href, onOpen, now, tableProps = {} }) {
|
|
|
168
230
|
align: "right"
|
|
169
231
|
}
|
|
170
232
|
];
|
|
233
|
+
const table = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_DataTable.DataTable, {
|
|
234
|
+
...tableProps,
|
|
235
|
+
data: traces,
|
|
236
|
+
columns,
|
|
237
|
+
defaultHiddenColumns: ["processTags"],
|
|
238
|
+
menuActions: downloadActions(traces),
|
|
239
|
+
getRowId: (trace) => trace.traceId,
|
|
240
|
+
autoFilter: false,
|
|
241
|
+
getRowHref: (trace) => href(trace.traceId),
|
|
242
|
+
onRowClick: (trace) => onOpen(trace.traceId),
|
|
243
|
+
emptyMessage: "No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces."
|
|
244
|
+
});
|
|
171
245
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
172
|
-
className: "flex h-[28rem] min-
|
|
173
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
getRowId: (trace) => trace.traceId,
|
|
178
|
-
autoFilter: false,
|
|
179
|
-
getRowHref: (trace) => href(trace.traceId),
|
|
180
|
-
onRowClick: (trace) => onOpen(trace.traceId),
|
|
181
|
-
emptyMessage: "No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces."
|
|
182
|
-
})
|
|
246
|
+
className: "flex min-h-[28rem] min-w-0 flex-1 flex-col",
|
|
247
|
+
children: attributeFilter ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_TagList.TagActionsProvider, {
|
|
248
|
+
value: require_tag_utils.tagActionsFromRecord(attributeFilter.attributes, attributeFilter.onChange),
|
|
249
|
+
children: table
|
|
250
|
+
}) : table
|
|
183
251
|
});
|
|
184
252
|
}
|
|
185
253
|
exports.ResultSummary = ResultSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraceResults.cjs","names":["niceStep","duration","shortOperation","Badge","ago","DataTable"],"sources":["../../../../src/data/traces/otel/TraceResults.tsx"],"sourcesContent":["import { ago, niceStep } from \"./result-model\";\nimport { Badge } from \"../../Badge\";\nimport { DataTable, type DataTableColumn, type DataTableProps } from \"../../DataTable\";\nimport { duration, type SearchResult, type Summary } from \"./api\";\nimport { shortOperation } from \"./query\";\n\nconst startMs = (trace: Summary) => Date.parse(trace.startedAt);\nconst clock = (ms: number) => new Date(ms).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" });\n\n/** How many traces match, newest first; the table pages through them. */\nexport function ResultSummary({ result }: { result: SearchResult }) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-medium text-foreground\">{result.total.toLocaleString()}</span> {result.total === 1 ? \"trace matches\" : \"traces match\"} · newest first\n </p>\n );\n}\n\n/** Each trace by when it started and how long it took, dot size by span count. */\nexport function Scatter({ traces, onOpen }: { traces: Summary[]; onOpen: (id: string) => void }) {\n const starts = traces.map(startMs);\n const t0 = Math.min(...starts);\n const span = Math.max(...starts) - t0;\n const slowest = Math.max(...traces.map(trace => trace.durationMs)) || 1;\n const step = niceStep(slowest, 4);\n const top = Math.ceil((slowest * 1.05) / step) * step;\n const yTicks = Array.from({ length: Math.round(top / step) + 1 }, (_, i) => i * step);\n // Traces that all started together sit mid-axis under one tick.\n const xTicks = span === 0 ? [0.5] : [0, 0.25, 0.5, 0.75, 1];\n const x = (ms: number) => (span === 0 ? 0.5 : (ms - t0) / span);\n return (\n <figure className=\"rounded-lg border border-border p-density-2\" aria-label=\"Duration over time\">\n <figcaption className=\"mb-1 flex items-center gap-3 text-xs text-muted-foreground\">\n <span className=\"font-medium text-foreground\">Duration over time</span>\n <span>dot size = span count · click to open</span>\n </figcaption>\n <div className=\"relative ml-[4.5rem] mr-2 mt-3.5 h-[180px]\">\n {yTicks.map(y => (\n <div key={y} className=\"absolute inset-x-0 border-t border-border/60\" style={{ bottom: `${(y / top) * 100}%` }}>\n <span className=\"absolute right-full -translate-y-1/2 whitespace-nowrap pr-1.5 text-xs tabular-nums text-muted-foreground\">{y === 0 ? \"0\" : duration(y)}</span>\n </div>\n ))}\n {traces.map(trace => {\n const size = 6 + Math.log2(trace.spanCount) * 1.6;\n const label = `${shortOperation(trace.operation)}, ${duration(trace.durationMs)}, ${trace.spanCount} spans at ${clock(startMs(trace))}`;\n return (\n <button\n key={trace.traceId}\n type=\"button\"\n aria-label={label}\n title={label}\n onClick={() => onOpen(trace.traceId)}\n className={`absolute -translate-x-1/2 translate-y-1/2 rounded-full opacity-75 hover:ring-2 hover:ring-ring ${trace.errors > 0 ? \"bg-destructive\" : trace.spanCount > 1 ? \"bg-primary\" : \"bg-muted-foreground\"}`}\n style={{ left: `${x(startMs(trace)) * 100}%`, bottom: `${(trace.durationMs / top) * 100}%`, width: size, height: size }}\n />\n );\n })}\n </div>\n <div className=\"relative ml-[4.5rem] mr-2 mt-1 h-4 text-xs tabular-nums text-muted-foreground\">\n {xTicks.map((fraction, i) => (\n <span key={fraction} className={`absolute whitespace-nowrap ${xTicks.length > 1 && i === 0 ? \"\" : xTicks.length > 1 && i === xTicks.length - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\"}`} style={{ left: `${fraction * 100}%` }}>\n {clock(t0 + fraction * span)}\n </span>\n ))}\n </div>\n </figure>\n );\n}\n\n/** The traces, newest first: what ran, when, how long against the slowest, and its span count. */\nexport function ResultTable({ traces, href, onOpen, now, tableProps = {} }: { traces: Summary[]; href: (id: string) => string; onOpen: (id: string) => void; now: number; tableProps?: Pick<DataTableProps<Summary>, \"externalFilters\" | \"externalSearch\" | \"externalTimeRange\" | \"pagination\" | \"infinite\" | \"loading\"> }) {\n const slowest = Math.max(1, ...traces.map(trace => trace.durationMs));\n const columns: DataTableColumn<Summary>[] = [\n {\n key: \"operation\",\n label: \"Trace\",\n grow: true,\n minWidth: 320,\n render: (_, trace) => (\n <span className=\"flex min-w-0 items-center gap-2\" title={trace.operation}>\n <span className=\"shrink-0 font-medium\">{shortOperation(trace.operation) || trace.traceId}</span>\n <code className=\"text-xs text-muted-foreground\">{trace.traceId.slice(0, 8)}</code>\n {trace.services.length > 1 && <span className=\"truncate text-xs text-muted-foreground\">{trace.services.join(\" → \")}</span>}\n {trace.errors > 0 && <Badge size=\"sm\" tone=\"danger\" variant=\"soft\">{trace.errors} {trace.errors === 1 ? \"error\" : \"errors\"}</Badge>}\n </span>\n ),\n },\n {\n key: \"startedAt\",\n label: \"Started\",\n render: (_, trace) => <span className=\"whitespace-nowrap tabular-nums\">{clock(startMs(trace))} <span className=\"text-muted-foreground\">{ago(now - startMs(trace))}</span></span>,\n },\n {\n key: \"durationMs\",\n label: \"Duration\",\n render: (_, trace) => (\n <span className=\"flex items-center gap-2\">\n <span className=\"relative h-1.5 w-24 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-primary\" style={{ width: `${(trace.durationMs / slowest) * 100}%` }} />\n </span>\n <span className=\"tabular-nums\">{duration(trace.durationMs)}</span>\n </span>\n ),\n },\n { key: \"spanCount\", label: \"Spans\", align: \"right\" },\n ];\n return (\n <div className=\"flex h-[28rem] min-h-0 flex-col\">\n <DataTable\n {...tableProps}\n data={traces}\n columns={columns}\n getRowId={trace => trace.traceId}\n autoFilter={false}\n getRowHref={trace => href(trace.traceId)}\n onRowClick={trace => onOpen(trace.traceId)}\n emptyMessage=\"No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces.\"\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAMA,IAAM,WAAW,UAAmB,KAAK,MAAM,MAAM,SAAS;AAC9D,IAAM,SAAS,OAAe,IAAI,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG;CAAE,MAAM;CAAW,QAAQ;CAAW,QAAQ;AAAU,CAAC;;AAG3H,SAAgB,cAAc,EAAE,UAAoC;CAClE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;EAAG,WAAU;EAAb,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAA+B,UAAA,OAAO,MAAM,eAAe;GAAQ,CAAA;GAAC;GAAE,OAAO,UAAU,IAAI,kBAAkB;GAAe;EAC3I;;AAEP;;AAGA,SAAgB,QAAQ,EAAE,QAAQ,UAA+D;CAC/F,MAAM,SAAS,OAAO,IAAI,OAAO;CACjC,MAAM,KAAK,KAAK,IAAI,GAA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M,UAAU;IAAQ,CAAA,CAC7D;;EAEV;EACA;GAAE,KAAK;GAAa,OAAO;GAAS,OAAO;EAAQ;CACrD;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACI,kBAAAA,WAAD;GACE,GAAI;GACJ,MAAM;GACG;GACT,WAAU,UAAS,MAAM;GACzB,YAAY;GACZ,aAAY,UAAS,KAAK,MAAM,OAAO;GACvC,aAAY,UAAS,OAAO,MAAM,OAAO;GACzC,cAAa;EACd,CAAA;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"TraceResults.cjs","names":["niceStep","duration","shortOperation","UiJson","downloadText","UiFileSpreadsheet","Badge","ago","DataTable","TagActionsProvider","tagActionsFromRecord"],"sources":["../../../../src/data/traces/otel/TraceResults.tsx"],"sourcesContent":["import { ago, niceStep } from \"./result-model\";\nimport { Badge } from \"../../Badge\";\nimport { DataTable, type DataTableColumn, type DataTableMenuAction, type DataTableProps } from \"../../DataTable\";\nimport { UiFileSpreadsheet, UiJson } from \"../../../icons\";\nimport { downloadText } from \"../../../jvm/threads/download-text\";\nimport { TagActionsProvider } from \"../../cells/TagList\";\nimport { tagActionsFromRecord } from \"../../cells/tag-utils\";\nimport { duration, type Modes, type SearchResult, type Summary } from \"./api\";\nimport { shortOperation } from \"./query\";\n\nconst startMs = (trace: Summary) => Date.parse(trace.startedAt);\nconst clock = (ms: number) => new Date(ms).toLocaleTimeString([], { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" });\n\n/** How many traces match, newest first; the table pages through them. */\nexport function ResultSummary({ result }: { result: SearchResult }) {\n return (\n <p className=\"text-sm text-muted-foreground\">\n <span className=\"font-medium text-foreground\">{result.total.toLocaleString()}</span> {result.total === 1 ? \"trace matches\" : \"traces match\"} · newest first\n </p>\n );\n}\n\n/** Each trace by when it started and how long it took, dot size by span count. */\nexport function Scatter({ traces, onOpen }: { traces: Summary[]; onOpen: (id: string) => void }) {\n const starts = traces.map(startMs);\n const t0 = Math.min(...starts);\n const span = Math.max(...starts) - t0;\n const slowest = Math.max(...traces.map(trace => trace.durationMs)) || 1;\n const step = niceStep(slowest, 4);\n const top = Math.ceil((slowest * 1.05) / step) * step;\n const yTicks = Array.from({ length: Math.round(top / step) + 1 }, (_, i) => i * step);\n // Traces that all started together sit mid-axis under one tick.\n const xTicks = span === 0 ? [0.5] : [0, 0.25, 0.5, 0.75, 1];\n const x = (ms: number) => (span === 0 ? 0.5 : (ms - t0) / span);\n return (\n <figure className=\"rounded-lg border border-border p-density-2\" aria-label=\"Duration over time\">\n <figcaption className=\"mb-1 flex items-center gap-3 text-xs text-muted-foreground\">\n <span className=\"font-medium text-foreground\">Duration over time</span>\n <span>dot size = span count · click to open</span>\n </figcaption>\n <div className=\"relative ml-[4.5rem] mr-2 mt-3.5 h-[180px]\">\n {yTicks.map(y => (\n <div key={y} className=\"absolute inset-x-0 border-t border-border/60\" style={{ bottom: `${(y / top) * 100}%` }}>\n <span className=\"absolute right-full -translate-y-1/2 whitespace-nowrap pr-1.5 text-xs tabular-nums text-muted-foreground\">{y === 0 ? \"0\" : duration(y)}</span>\n </div>\n ))}\n {traces.map(trace => {\n const size = 6 + Math.log2(trace.spanCount) * 1.6;\n const label = `${shortOperation(trace.operation)}, ${duration(trace.durationMs)}, ${trace.spanCount} spans at ${clock(startMs(trace))}`;\n return (\n <button\n key={trace.traceId}\n type=\"button\"\n aria-label={label}\n title={label}\n onClick={() => onOpen(trace.traceId)}\n className={`absolute -translate-x-1/2 translate-y-1/2 rounded-full opacity-75 hover:ring-2 hover:ring-ring ${trace.errors > 0 ? \"bg-destructive\" : trace.spanCount > 1 ? \"bg-primary\" : \"bg-muted-foreground\"}`}\n style={{ left: `${x(startMs(trace)) * 100}%`, bottom: `${(trace.durationMs / top) * 100}%`, width: size, height: size }}\n />\n );\n })}\n </div>\n <div className=\"relative ml-[4.5rem] mr-2 mt-1 h-4 text-xs tabular-nums text-muted-foreground\">\n {xTicks.map((fraction, i) => (\n <span key={fraction} className={`absolute whitespace-nowrap ${xTicks.length > 1 && i === 0 ? \"\" : xTicks.length > 1 && i === xTicks.length - 1 ? \"-translate-x-full\" : \"-translate-x-1/2\"}`} style={{ left: `${fraction * 100}%` }}>\n {clock(t0 + fraction * span)}\n </span>\n ))}\n </div>\n </figure>\n );\n}\n\nconst CSV_COLUMNS = [\"traceId\", \"operation\", \"service\", \"scope\", \"startedAt\", \"durationMs\", \"spanCount\", \"errors\", \"services\", \"tags\", \"processTags\"] as const;\n\n/** RFC 4180 CSV of the traces; a list cell joins its entries with `;`, a tag cell as `key=value`. */\nfunction tracesCsv(traces: Summary[]): string {\n const cell = (value: unknown) => {\n const text = Array.isArray(value) ? value.join(\";\")\n : value && typeof value === \"object\" ? Object.entries(value).map(([key, entry]) => `${key}=${entry}`).join(\";\")\n : value === undefined ? \"\" : String(value);\n return /[\",\\n\\r]/.test(text) ? `\"${text.replaceAll('\"', '\"\"')}\"` : text;\n };\n return [CSV_COLUMNS.join(\",\"), ...traces.map(trace => CSV_COLUMNS.map(column => cell(trace[column])).join(\",\"))].join(\"\\n\");\n}\n\n/** The column menu's downloads of the listed traces. */\nconst downloadActions = (traces: Summary[]): DataTableMenuAction[] => [\n { id: \"download-json\", label: \"JSON\", icon: UiJson, onSelect: () => downloadText(\"traces.json\", JSON.stringify(traces, null, 2)) },\n { id: \"download-csv\", label: \"CSV\", icon: UiFileSpreadsheet, onSelect: () => downloadText(\"traces.csv\", tracesCsv(traces)) },\n];\n\n/**\n * The traces, newest first: what ran, in which service and scope, its root span's tags, when, how long against the\n * slowest, and its span count. The root's process tags are a column the menu reveals. Given `attributeFilter`, including\n * or excluding a tag filters the search by that `key=value`, beside the attributes it already filters by.\n */\nexport function ResultTable({ traces, href, onOpen, now, attributeFilter, tableProps = {} }: {\n traces: Summary[]; href: (id: string) => string; onOpen: (id: string) => void; now: number;\n attributeFilter?: { attributes: Modes; onChange: (attributes: Modes) => void };\n tableProps?: Pick<DataTableProps<Summary>, \"externalFilters\" | \"externalSearch\" | \"externalTimeRange\" | \"pagination\" | \"infinite\" | \"loading\">;\n}) {\n const slowest = Math.max(1, ...traces.map(trace => trace.durationMs));\n const columns: DataTableColumn<Summary>[] = [\n {\n key: \"operation\",\n label: \"Trace\",\n grow: true,\n minWidth: 320,\n render: (_, trace) => (\n <span className=\"flex min-w-0 items-center gap-2\" title={trace.operation}>\n <span className=\"shrink-0 font-medium\">{shortOperation(trace.operation) || trace.traceId}</span>\n <code className=\"text-xs text-muted-foreground\">{trace.traceId.slice(0, 8)}</code>\n {trace.services.length > 1 && <span className=\"truncate text-xs text-muted-foreground\">{trace.services.join(\" → \")}</span>}\n {trace.errors > 0 && <Badge size=\"sm\" tone=\"danger\" variant=\"soft\">{trace.errors} {trace.errors === 1 ? \"error\" : \"errors\"}</Badge>}\n </span>\n ),\n },\n { key: \"service\", label: \"Service\" },\n { key: \"scope\", label: \"Scope\" },\n { key: \"tags\", label: \"Tags\", kind: \"tags\", minWidth: 240 },\n { key: \"processTags\", label: \"Process tags\", kind: \"tags\", minWidth: 240 },\n {\n key: \"startedAt\",\n label: \"Started\",\n render: (_, trace) => <span className=\"whitespace-nowrap tabular-nums\">{clock(startMs(trace))} <span className=\"text-muted-foreground\">{ago(now - startMs(trace))}</span></span>,\n },\n {\n key: \"durationMs\",\n label: \"Duration\",\n render: (_, trace) => (\n <span className=\"flex items-center gap-2\">\n <span className=\"relative h-1.5 w-24 rounded-full bg-muted\">\n <span className=\"absolute inset-y-0 left-0 rounded-full bg-primary\" style={{ width: `${(trace.durationMs / slowest) * 100}%` }} />\n </span>\n <span className=\"tabular-nums\">{duration(trace.durationMs)}</span>\n </span>\n ),\n },\n { key: \"spanCount\", label: \"Spans\", align: \"right\" },\n ];\n const table = (\n <DataTable\n {...tableProps}\n data={traces}\n columns={columns}\n defaultHiddenColumns={[\"processTags\"]}\n menuActions={downloadActions(traces)}\n getRowId={trace => trace.traceId}\n autoFilter={false}\n getRowHref={trace => href(trace.traceId)}\n onRowClick={trace => onOpen(trace.traceId)}\n emptyMessage=\"No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces.\"\n />\n );\n return (\n <div className=\"flex min-h-[28rem] min-w-0 flex-1 flex-col\">\n {attributeFilter\n ? <TagActionsProvider value={tagActionsFromRecord(attributeFilter.attributes, attributeFilter.onChange)}>{table}</TagActionsProvider>\n : table}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAM,WAAW,UAAmB,KAAK,MAAM,MAAM,SAAS;AAC9D,IAAM,SAAS,OAAe,IAAI,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG;CAAE,MAAM;CAAW,QAAQ;CAAW,QAAQ;AAAU,CAAC;;AAG3H,SAAgB,cAAc,EAAE,UAAoC;CAClE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;EAAG,WAAU;EAAb,UAAA;GACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAAM,WAAU;IAA+B,UAAA,OAAO,MAAM,eAAe;GAAQ,CAAA;GAAC;GAAE,OAAO,UAAU,IAAI,kBAAkB;GAAe;EAC3I;;AAEP;;AAGA,SAAgB,QAAQ,EAAE,QAAQ,UAA+D;CAC/F,MAAM,SAAS,OAAO,IAAI,OAAO;CACjC,MAAM,KAAK,KAAK,IAAI,GAAG,MAAM;CAC7B,MAAM,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI;CACnC,MAAM,UAAU,KAAK,IAAI,GAAG,OAAO,KAAI,UAAS,MAAM,UAAU,CAAC,KAAK;CACtE,MAAM,OAAOA,qBAAAA,SAAS,SAAS,CAAC;CAChC,MAAM,MAAM,KAAK,KAAM,UAAU,OAAQ,IAAI,IAAI;CACjD,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,IAAI;CAEpF,MAAM,SAAS,SAA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BAAA,IAAA,CAACC,gBAAAA,oBAAD;GAAoB,OAAOC,kBAAAA,qBAAqB,gBAAgB,YAAY,gBAAgB,QAAQ;GAAI,UAAA;EAA0B,CAAA,IAClI;CACD,CAAA;AAET"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataTableProps } from '../../DataTable.js';
|
|
2
|
-
import { SearchResult, Summary } from './api.js';
|
|
2
|
+
import { Modes, SearchResult, Summary } from './api.js';
|
|
3
3
|
/** How many traces match, newest first; the table pages through them. */
|
|
4
4
|
export declare function ResultSummary({ result }: {
|
|
5
5
|
result: SearchResult;
|
|
@@ -9,12 +9,20 @@ export declare function Scatter({ traces, onOpen }: {
|
|
|
9
9
|
traces: Summary[];
|
|
10
10
|
onOpen: (id: string) => void;
|
|
11
11
|
}): import("react").JSX.Element;
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The traces, newest first: what ran, in which service and scope, its root span's tags, when, how long against the
|
|
14
|
+
* slowest, and its span count. The root's process tags are a column the menu reveals. Given `attributeFilter`, including
|
|
15
|
+
* or excluding a tag filters the search by that `key=value`, beside the attributes it already filters by.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ResultTable({ traces, href, onOpen, now, attributeFilter, tableProps }: {
|
|
14
18
|
traces: Summary[];
|
|
15
19
|
href: (id: string) => string;
|
|
16
20
|
onOpen: (id: string) => void;
|
|
17
21
|
now: number;
|
|
22
|
+
attributeFilter?: {
|
|
23
|
+
attributes: Modes;
|
|
24
|
+
onChange: (attributes: Modes) => void;
|
|
25
|
+
};
|
|
18
26
|
tableProps?: Pick<DataTableProps<Summary>, "externalFilters" | "externalSearch" | "externalTimeRange" | "pagination" | "infinite" | "loading">;
|
|
19
27
|
}): import("react").JSX.Element;
|
|
20
28
|
//# sourceMappingURL=TraceResults.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraceResults.d.ts","sourceRoot":"","sources":["../../../../src/data/traces/otel/Tra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
import { ago, niceStep } from "./result-model.js";
|
|
2
2
|
import { Badge } from "../../Badge.js";
|
|
3
3
|
import { DataTable } from "../../DataTable.js";
|
|
4
|
+
import { UiFileSpreadsheet } from "../../../icons/components/UiFileSpreadsheet.js";
|
|
5
|
+
import { UiJson } from "../../../icons/components/UiJson.js";
|
|
6
|
+
import { downloadText } from "../../../jvm/threads/download-text.js";
|
|
7
|
+
import { TagActionsProvider } from "../../cells/TagList.js";
|
|
8
|
+
import { tagActionsFromRecord } from "../../cells/tag-utils.js";
|
|
4
9
|
import { duration } from "./api.js";
|
|
5
10
|
import { shortOperation } from "./query.js";
|
|
6
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -92,8 +97,45 @@ function Scatter({ traces, onOpen }) {
|
|
|
92
97
|
]
|
|
93
98
|
});
|
|
94
99
|
}
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
var CSV_COLUMNS = [
|
|
101
|
+
"traceId",
|
|
102
|
+
"operation",
|
|
103
|
+
"service",
|
|
104
|
+
"scope",
|
|
105
|
+
"startedAt",
|
|
106
|
+
"durationMs",
|
|
107
|
+
"spanCount",
|
|
108
|
+
"errors",
|
|
109
|
+
"services",
|
|
110
|
+
"tags",
|
|
111
|
+
"processTags"
|
|
112
|
+
];
|
|
113
|
+
/** RFC 4180 CSV of the traces; a list cell joins its entries with `;`, a tag cell as `key=value`. */
|
|
114
|
+
function tracesCsv(traces) {
|
|
115
|
+
const cell = (value) => {
|
|
116
|
+
const text = Array.isArray(value) ? value.join(";") : value && typeof value === "object" ? Object.entries(value).map(([key, entry]) => `${key}=${entry}`).join(";") : value === void 0 ? "" : String(value);
|
|
117
|
+
return /[",\n\r]/.test(text) ? `"${text.replaceAll("\"", "\"\"")}"` : text;
|
|
118
|
+
};
|
|
119
|
+
return [CSV_COLUMNS.join(","), ...traces.map((trace) => CSV_COLUMNS.map((column) => cell(trace[column])).join(","))].join("\n");
|
|
120
|
+
}
|
|
121
|
+
/** The column menu's downloads of the listed traces. */
|
|
122
|
+
var downloadActions = (traces) => [{
|
|
123
|
+
id: "download-json",
|
|
124
|
+
label: "JSON",
|
|
125
|
+
icon: UiJson,
|
|
126
|
+
onSelect: () => downloadText("traces.json", JSON.stringify(traces, null, 2))
|
|
127
|
+
}, {
|
|
128
|
+
id: "download-csv",
|
|
129
|
+
label: "CSV",
|
|
130
|
+
icon: UiFileSpreadsheet,
|
|
131
|
+
onSelect: () => downloadText("traces.csv", tracesCsv(traces))
|
|
132
|
+
}];
|
|
133
|
+
/**
|
|
134
|
+
* The traces, newest first: what ran, in which service and scope, its root span's tags, when, how long against the
|
|
135
|
+
* slowest, and its span count. The root's process tags are a column the menu reveals. Given `attributeFilter`, including
|
|
136
|
+
* or excluding a tag filters the search by that `key=value`, beside the attributes it already filters by.
|
|
137
|
+
*/
|
|
138
|
+
function ResultTable({ traces, href, onOpen, now, attributeFilter, tableProps = {} }) {
|
|
97
139
|
const slowest = Math.max(1, ...traces.map((trace) => trace.durationMs));
|
|
98
140
|
const columns = [
|
|
99
141
|
{
|
|
@@ -130,6 +172,26 @@ function ResultTable({ traces, href, onOpen, now, tableProps = {} }) {
|
|
|
130
172
|
]
|
|
131
173
|
})
|
|
132
174
|
},
|
|
175
|
+
{
|
|
176
|
+
key: "service",
|
|
177
|
+
label: "Service"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
key: "scope",
|
|
181
|
+
label: "Scope"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
key: "tags",
|
|
185
|
+
label: "Tags",
|
|
186
|
+
kind: "tags",
|
|
187
|
+
minWidth: 240
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
key: "processTags",
|
|
191
|
+
label: "Process tags",
|
|
192
|
+
kind: "tags",
|
|
193
|
+
minWidth: 240
|
|
194
|
+
},
|
|
133
195
|
{
|
|
134
196
|
key: "startedAt",
|
|
135
197
|
label: "Started",
|
|
@@ -168,18 +230,24 @@ function ResultTable({ traces, href, onOpen, now, tableProps = {} }) {
|
|
|
168
230
|
align: "right"
|
|
169
231
|
}
|
|
170
232
|
];
|
|
233
|
+
const table = /* @__PURE__ */ jsx(DataTable, {
|
|
234
|
+
...tableProps,
|
|
235
|
+
data: traces,
|
|
236
|
+
columns,
|
|
237
|
+
defaultHiddenColumns: ["processTags"],
|
|
238
|
+
menuActions: downloadActions(traces),
|
|
239
|
+
getRowId: (trace) => trace.traceId,
|
|
240
|
+
autoFilter: false,
|
|
241
|
+
getRowHref: (trace) => href(trace.traceId),
|
|
242
|
+
onRowClick: (trace) => onOpen(trace.traceId),
|
|
243
|
+
emptyMessage: "No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces."
|
|
244
|
+
});
|
|
171
245
|
return /* @__PURE__ */ jsx("div", {
|
|
172
|
-
className: "flex h-[28rem] min-
|
|
173
|
-
children: /* @__PURE__ */ jsx(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
getRowId: (trace) => trace.traceId,
|
|
178
|
-
autoFilter: false,
|
|
179
|
-
getRowHref: (trace) => href(trace.traceId),
|
|
180
|
-
onRowClick: (trace) => onOpen(trace.traceId),
|
|
181
|
-
emptyMessage: "No traces match. Widen the time range, clear the duration or attribute filters, or show single-span traces."
|
|
182
|
-
})
|
|
246
|
+
className: "flex min-h-[28rem] min-w-0 flex-1 flex-col",
|
|
247
|
+
children: attributeFilter ? /* @__PURE__ */ jsx(TagActionsProvider, {
|
|
248
|
+
value: tagActionsFromRecord(attributeFilter.attributes, attributeFilter.onChange),
|
|
249
|
+
children: table
|
|
250
|
+
}) : table
|
|
183
251
|
});
|
|
184
252
|
}
|
|
185
253
|
export { ResultSummary, ResultTable, Scatter };
|