mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add tracing config sub sections * Export common sections and update divider in additional settings section * Max width and margin bottom * Add feature name to config link * Update SpanBarSettings * remove import
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
import React from 'react';
|
|
import useAsync from 'react-use/lib/useAsync';
|
|
|
|
import { DataSourcePluginOptionsEditorProps, updateDatasourcePluginJsonDataOption } from '@grafana/data';
|
|
import { getDataSourceSrv } from '@grafana/runtime';
|
|
import { InlineField, InlineFieldRow, InlineSwitch, useStyles2 } from '@grafana/ui';
|
|
|
|
import { TempoDatasource } from '../datasource';
|
|
import { TempoJsonData } from '../types';
|
|
|
|
import { getStyles } from './QuerySettings';
|
|
import { TraceQLSearchTags } from './TraceQLSearchTags';
|
|
|
|
interface Props extends DataSourcePluginOptionsEditorProps<TempoJsonData> {}
|
|
|
|
export function TraceQLSearchSettings({ options, onOptionsChange }: Props) {
|
|
const styles = useStyles2(getStyles);
|
|
const dataSourceSrv = getDataSourceSrv();
|
|
const fetchDatasource = async () => {
|
|
return (await dataSourceSrv.get({ type: options.type, uid: options.uid })) as TempoDatasource;
|
|
};
|
|
|
|
const { value: datasource } = useAsync(fetchDatasource, [dataSourceSrv, options]);
|
|
|
|
return (
|
|
<div className={styles.container}>
|
|
<InlineFieldRow className={styles.row}>
|
|
<InlineField tooltip="Removes the search tab from the query editor" label="Hide search" labelWidth={26}>
|
|
<InlineSwitch
|
|
id="hideSearch"
|
|
value={options.jsonData.search?.hide}
|
|
onChange={(event: React.SyntheticEvent<HTMLInputElement>) =>
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'search', {
|
|
...options.jsonData.search,
|
|
hide: event.currentTarget.checked,
|
|
})
|
|
}
|
|
/>
|
|
</InlineField>
|
|
</InlineFieldRow>
|
|
<InlineFieldRow className={styles.row}>
|
|
<InlineField tooltip="Configures which fields are available in the UI" label="Static filters" labelWidth={26}>
|
|
<TraceQLSearchTags datasource={datasource} options={options} onOptionsChange={onOptionsChange} />
|
|
</InlineField>
|
|
</InlineFieldRow>
|
|
</div>
|
|
);
|
|
}
|