2021-09-27 08:22:49 -05:00
|
|
|
import { css } from '@emotion/css';
|
2022-04-22 08:33:13 -05:00
|
|
|
import React from 'react';
|
|
|
|
|
2021-09-27 08:22:49 -05:00
|
|
|
import { DataSourcePluginOptionsEditorProps, GrafanaTheme, updateDatasourcePluginJsonDataOption } from '@grafana/data';
|
|
|
|
import { InlineField, InlineFieldRow, InlineSwitch, useStyles } from '@grafana/ui';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2021-10-06 14:39:14 -05:00
|
|
|
import { TempoJsonData } from '../datasource';
|
2021-09-27 08:22:49 -05:00
|
|
|
|
|
|
|
interface Props extends DataSourcePluginOptionsEditorProps<TempoJsonData> {}
|
|
|
|
|
|
|
|
export function SearchSettings({ options, onOptionsChange }: Props) {
|
|
|
|
const styles = useStyles(getStyles);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.container}>
|
|
|
|
<h3 className="page-heading">Search</h3>
|
|
|
|
<InlineFieldRow className={styles.row}>
|
|
|
|
<InlineField tooltip="Removes the Search tab from the Tempo query editor." label="Hide search" labelWidth={26}>
|
|
|
|
<InlineSwitch
|
2021-12-17 12:49:21 -06:00
|
|
|
id="hideSearch"
|
2021-09-27 08:22:49 -05:00
|
|
|
value={options.jsonData.search?.hide}
|
|
|
|
onChange={(event: React.SyntheticEvent<HTMLInputElement>) =>
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'search', {
|
|
|
|
...options.jsonData.search,
|
|
|
|
hide: event.currentTarget.checked,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</InlineField>
|
|
|
|
</InlineFieldRow>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const getStyles = (theme: GrafanaTheme) => ({
|
|
|
|
container: css`
|
|
|
|
label: container;
|
|
|
|
width: 100%;
|
|
|
|
`,
|
|
|
|
row: css`
|
|
|
|
label: row;
|
|
|
|
align-items: baseline;
|
|
|
|
`,
|
|
|
|
});
|