SearchSettings.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { css } from '@emotion/css';
  2. import React from 'react';
  3. import { DataSourcePluginOptionsEditorProps, GrafanaTheme, updateDatasourcePluginJsonDataOption } from '@grafana/data';
  4. import { InlineField, InlineFieldRow, InlineSwitch, useStyles } from '@grafana/ui';
  5. import { TempoJsonData } from '../datasource';
  6. interface Props extends DataSourcePluginOptionsEditorProps<TempoJsonData> {}
  7. export function SearchSettings({ options, onOptionsChange }: Props) {
  8. const styles = useStyles(getStyles);
  9. return (
  10. <div className={styles.container}>
  11. <h3 className="page-heading">Search</h3>
  12. <InlineFieldRow className={styles.row}>
  13. <InlineField tooltip="Removes the Search tab from the Tempo query editor." label="Hide search" labelWidth={26}>
  14. <InlineSwitch
  15. id="hideSearch"
  16. value={options.jsonData.search?.hide}
  17. onChange={(event: React.SyntheticEvent<HTMLInputElement>) =>
  18. updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'search', {
  19. ...options.jsonData.search,
  20. hide: event.currentTarget.checked,
  21. })
  22. }
  23. />
  24. </InlineField>
  25. </InlineFieldRow>
  26. </div>
  27. );
  28. }
  29. const getStyles = (theme: GrafanaTheme) => ({
  30. container: css`
  31. label: container;
  32. width: 100%;
  33. `,
  34. row: css`
  35. label: row;
  36. align-items: baseline;
  37. `,
  38. });