2021-10-06 14:39:14 -05:00
|
|
|
import { css } from '@emotion/css';
|
2022-04-22 08:33:13 -05:00
|
|
|
import React from 'react';
|
|
|
|
|
2021-10-06 14:39:14 -05:00
|
|
|
import {
|
|
|
|
DataSourceJsonData,
|
|
|
|
DataSourcePluginOptionsEditorProps,
|
|
|
|
updateDatasourcePluginJsonDataOption,
|
|
|
|
} from '@grafana/data';
|
2022-11-02 05:25:08 -05:00
|
|
|
import { InlineField, InlineFieldRow, InlineSwitch } from '@grafana/ui';
|
2021-10-06 14:39:14 -05:00
|
|
|
|
|
|
|
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}>
|
2023-03-06 10:03:29 -06:00
|
|
|
<h3 className="page-heading">Node graph</h3>
|
2021-10-06 14:39:14 -05:00
|
|
|
<InlineFieldRow className={styles.row}>
|
2023-03-06 10:03:29 -06:00
|
|
|
<InlineField tooltip="Displays the node graph above the trace view" label="Enable node graph" labelWidth={26}>
|
2021-10-06 14:39:14 -05:00
|
|
|
<InlineSwitch
|
2021-12-17 12:49:21 -06:00
|
|
|
id="enableNodeGraph"
|
2021-10-06 14:39:14 -05:00
|
|
|
value={options.jsonData.nodeGraph?.enabled}
|
|
|
|
onChange={(event: React.SyntheticEvent<HTMLInputElement>) =>
|
|
|
|
updateDatasourcePluginJsonDataOption({ onOptionsChange, options }, 'nodeGraph', {
|
|
|
|
...options.jsonData.nodeGraph,
|
|
|
|
enabled: event.currentTarget.checked,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</InlineField>
|
|
|
|
</InlineFieldRow>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-11-02 05:25:08 -05:00
|
|
|
const styles = {
|
2021-10-06 14:39:14 -05:00
|
|
|
container: css`
|
|
|
|
label: container;
|
|
|
|
width: 100%;
|
|
|
|
`,
|
|
|
|
row: css`
|
|
|
|
label: row;
|
|
|
|
align-items: baseline;
|
|
|
|
`,
|
2022-11-02 05:25:08 -05:00
|
|
|
};
|