import { css } from '@emotion/css'; import React from 'react'; import { DataSourcePluginOptionsEditorProps, GrafanaTheme, updateDatasourcePluginJsonDataOption } from '@grafana/data'; import { DataSourcePicker } from '@grafana/runtime'; import { Button, InlineField, InlineFieldRow, useStyles } from '@grafana/ui'; import { TempoJsonData } from '../datasource'; interface Props extends DataSourcePluginOptionsEditorProps {} export function LokiSearchSettings({ options, onOptionsChange }: Props) { const styles = useStyles(getStyles); // Default to the trace to logs datasource if configured and loki search was enabled // but only if jsonData.lokiSearch hasn't been set const legacyDatasource = options.jsonData.tracesToLogs?.lokiSearch !== false ? options.jsonData.tracesToLogs?.datasourceUid : undefined; if (legacyDatasource && options.jsonData.lokiSearch === undefined) { updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'lokiSearch', { datasourceUid: legacyDatasource, }); } return (

Loki Search

Select a Loki datasource to search for traces. Derived fields must be configured in the Loki data source.
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'lokiSearch', { datasourceUid: ds.uid, }) } /> {options.jsonData.lokiSearch?.datasourceUid ? ( ) : null}
); } const getStyles = (theme: GrafanaTheme) => ({ infoText: css` label: infoText; padding-bottom: ${theme.spacing.md}; color: ${theme.colors.textSemiWeak}; `, row: css` label: row; align-items: baseline; `, });