Files
Ashley Harrison 38fc06a6ff Internationalisation: Mark up panel edit options (#107051)
* markup timeseries panel edit

* mark up matchers ui

* mark up bar chart

* mark up stat panel

* mark up gauge

* mark up bar gauge

* mark up table component

* mark up pie chart

* mark up state timeline

* mark up heatmap

* mark up status history

* mark up histogram

* mark up text panel

* mark up alert list

* mark up dashboard list

* mark up news panel

* mark up annolist

* mark up logs panel

* mark up node-graph

* mark up traces

* mark up trend

* mark up xychart

* fix build
2025-06-24 12:55:55 +01:00

109 lines
3.1 KiB
TypeScript

import { PanelPlugin, toOption } from '@grafana/data';
import { t } from '@grafana/i18n';
import { getTraceServiceNames, getTraceSpanNames } from '../../../features/explore/TraceView/utils/tags';
import { transformDataFrames } from '../../../features/explore/TraceView/utils/transform';
import { TagsEditor } from './TagsEditor';
import { TracesPanel } from './TracesPanel';
import { TracesSuggestionsSupplier } from './suggestions';
export const plugin = new PanelPlugin(TracesPanel)
.setPanelOptions((builder, context) => {
const category = [t('traces.category-span-filters', 'Span filters')];
const trace = transformDataFrames(context?.data?.[0]);
// Find
builder
.addTextInput({
path: 'spanFilters.query',
name: t('traces.name-find-in-trace', 'Find in trace'),
category,
})
.addBooleanSwitch({
path: 'spanFilters.matchesOnly',
name: t('traces.name-show-matches-only', 'Show matches only'),
defaultValue: false,
category,
})
.addBooleanSwitch({
path: 'spanFilters.criticalPathOnly',
name: t('traces.name-critical-path-only', 'Show critical path only'),
defaultValue: false,
category,
});
// Service name
builder
.addSelect({
path: 'spanFilters.serviceName',
name: t('traces.name-service-name', 'Service name'),
category,
settings: {
options: trace ? getTraceServiceNames(trace).map(toOption) : [],
allowCustomValue: true,
isClearable: true,
},
})
.addRadio({
path: 'spanFilters.serviceNameOperator',
name: t('traces.name-service-name-operator', 'Service name operator'),
defaultValue: '=',
settings: {
options: [
{ value: '=', label: '=' },
{ value: '!=', label: '!=' },
],
},
category,
});
// Span name
builder
.addSelect({
path: 'spanFilters.spanName',
name: t('traces.name-span-name', 'Span name'),
category,
settings: {
options: trace ? getTraceSpanNames(trace).map(toOption) : [],
allowCustomValue: true,
isClearable: true,
},
})
.addRadio({
path: 'spanFilters.spanNameOperator',
name: t('traces.name-span-name-operator', 'Span name operator'),
defaultValue: '=',
settings: {
options: [
{ value: '=', label: '=' },
{ value: '!=', label: '!=' },
],
},
category,
});
// Duration
builder
.addTextInput({
path: 'spanFilters.from',
name: t('traces.name-min-duration', 'Min duration'),
category,
})
.addTextInput({
path: 'spanFilters.to',
name: t('traces.name-max-duration', 'Max duration'),
category,
});
builder.addCustomEditor({
id: 'tags',
name: t('traces.name-tags', 'Tags'),
path: 'spanFilters',
category,
editor: TagsEditor,
defaultValue: undefined,
});
})
.setSuggestionsSupplier(new TracesSuggestionsSupplier());