| 
									
										
										
										
											2021-10-07 03:39:14 +08:00
										 |  |  | import { css } from '@emotion/css'; | 
					
						
							| 
									
										
										
										
											2022-04-22 21:33:13 +08:00
										 |  |  | import React from 'react'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08:00
										 |  |  | import { | 
					
						
							|  |  |  |   DataSourceJsonData, | 
					
						
							|  |  |  |   DataSourcePluginOptionsEditorProps, | 
					
						
							|  |  |  |   updateDatasourcePluginJsonDataOption, | 
					
						
							|  |  |  | } from '@grafana/data'; | 
					
						
							| 
									
										
										
										
											2022-11-02 18:25:08 +08:00
										 |  |  | import { InlineField, InlineFieldRow, InlineSwitch } from '@grafana/ui'; | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08: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-07 00:03:29 +08:00
										 |  |  |       <h3 className="page-heading">Node graph</h3> | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08:00
										 |  |  |       <InlineFieldRow className={styles.row}> | 
					
						
							| 
									
										
										
										
											2023-03-16 16:49:40 +08:00
										 |  |  |         <InlineField | 
					
						
							|  |  |  |           tooltip="Displays the node graph above the trace view. Default: disabled" | 
					
						
							|  |  |  |           label="Enable node graph" | 
					
						
							|  |  |  |           labelWidth={26} | 
					
						
							|  |  |  |         > | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08:00
										 |  |  |           <InlineSwitch | 
					
						
							| 
									
										
										
										
											2021-12-18 02:49:21 +08:00
										 |  |  |             id="enableNodeGraph" | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08: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 18:25:08 +08:00
										 |  |  | const styles = { | 
					
						
							| 
									
										
										
										
											2021-10-07 03:39:14 +08:00
										 |  |  |   container: css`
 | 
					
						
							|  |  |  |     label: container; | 
					
						
							|  |  |  |     width: 100%; | 
					
						
							|  |  |  |   `,
 | 
					
						
							|  |  |  |   row: css`
 | 
					
						
							|  |  |  |     label: row; | 
					
						
							|  |  |  |     align-items: baseline; | 
					
						
							|  |  |  |   `,
 | 
					
						
							| 
									
										
										
										
											2022-11-02 18:25:08 +08:00
										 |  |  | }; |