grafana/public/app/core/components/NodeGraphSettings.tsx
Josh Hunt 3c6e0e8ef8
Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00

60 lines
1.6 KiB
TypeScript

import { css } from '@emotion/css';
import React from 'react';
import {
DataSourceJsonData,
DataSourcePluginOptionsEditorProps,
GrafanaTheme,
updateDatasourcePluginJsonDataOption,
} from '@grafana/data';
import { InlineField, InlineFieldRow, InlineSwitch, useStyles } 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) {
const styles = useStyles(getStyles);
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 getStyles = (theme: GrafanaTheme) => ({
container: css`
label: container;
width: 100%;
`,
row: css`
label: row;
align-items: baseline;
`,
});