grafana/public/app/core/components/NodeGraphSettings.tsx
kay delaney 30dc0f56a4
Chore: Migrate more usage of v1 themes to v2 (#57680)
* Chore: Migrate more usage of v1 themes to v2

* Implement suggested changes
2022-11-02 10:25:08 +00:00

57 lines
1.5 KiB
TypeScript

import { css } from '@emotion/css';
import React from 'react';
import {
DataSourceJsonData,
DataSourcePluginOptionsEditorProps,
updateDatasourcePluginJsonDataOption,
} from '@grafana/data';
import { InlineField, InlineFieldRow, InlineSwitch } from '@grafana/ui';
export interface NodeGraphOptions {
enabled?: boolean;
}
export interface NodeGraphData extends DataSourceJsonData {
nodeGraph?: NodeGraphOptions;
}
interface Props extends DataSourcePluginOptionsEditorProps<NodeGraphData> {}
export function NodeGraphSettings({ options, onOptionsChange }: Props) {
return (
<div className={styles.container}>
<h3 className="page-heading">Node Graph</h3>
<InlineFieldRow className={styles.row}>
<InlineField
tooltip="Enables the Node Graph visualization in the trace viewer."
label="Enable Node Graph"
labelWidth={26}
>
<InlineSwitch
id="enableNodeGraph"
value={options.jsonData.nodeGraph?.enabled}
onChange={(event: React.SyntheticEvent<HTMLInputElement>) =>
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'nodeGraph', {
...options.jsonData.nodeGraph,
enabled: event.currentTarget.checked,
})
}
/>
</InlineField>
</InlineFieldRow>
</div>
);
}
const styles = {
container: css`
label: container;
width: 100%;
`,
row: css`
label: row;
align-items: baseline;
`,
};