1
1
import { css } from '@emotion/css' ;
2
2
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk' ;
3
- import { DataSourcePluginOptionsEditorProps , /*DataSourceSettings,*/ GrafanaTheme2 } from '@grafana/data' ;
3
+ import { DataSourcePluginOptionsEditorProps , GrafanaTheme2 } from '@grafana/data' ;
4
4
import { ConfigSection , DataSourceDescription } from '@grafana/experimental' ;
5
5
import { config } from '@grafana/runtime' ;
6
6
import { Alert , DataSourceHttpSettings , FieldValidationMessage , useTheme2 } from '@grafana/ui' ;
7
- // import { config } from 'app/core/config';
8
7
import React , { useRef } from 'react' ;
9
8
10
9
import { PromOptions } from '../types' ;
11
10
12
11
import { AlertingSettingsOverhaul } from './AlertingSettingsOverhaul' ;
13
- // import { AzureAuthSettings } from './AzureAuthSettings';
14
- // import { hasCredentials, resetCredentials, setDefaultCredentials } from './AzureCredentialsConfig';
15
12
import { DataSourcehttpSettingsOverhaul } from './DataSourceHttpSettingsOverhaul' ;
16
13
import { PromSettings } from './PromSettings' ;
17
14
import { AdvancedHttpSettings } from './overhaul/AdvancedHttpSettings' ;
@@ -23,20 +20,6 @@ export type Props = DataSourcePluginOptionsEditorProps<PromOptions>;
23
20
24
21
export const ConfigEditor = ( props : Props ) => {
25
22
const { options, onOptionsChange } = props ;
26
-
27
- const prometheusConfigOverhaulAuth = true //config.featureToggles.prometheusConfigOverhaulAuth;
28
-
29
- // use ref so this is evaluated only first time it renders and the select does not disappear suddenly.
30
- const showAccessOptions = useRef ( props . options . access === 'direct' ) ;
31
-
32
- // const azureAuthSettings = {
33
- // azureAuthSupported: config.azureAuthEnabled,
34
- // getAzureAuthEnabled: (config: DataSourceSettings<any, any>): boolean => hasCredentials(config),
35
- // setAzureAuthEnabled: (config: DataSourceSettings<any, any>, enabled: boolean) =>
36
- // enabled ? setDefaultCredentials(config) : resetCredentials(config),
37
- // azureSettingsUI: AzureAuthSettings,
38
- // };
39
-
40
23
const theme = useTheme2 ( ) ;
41
24
const styles = overhaulStyles ( theme ) ;
42
25
@@ -46,68 +29,33 @@ export const ConfigEditor = (props: Props) => {
46
29
< Alert title = "Error" severity = "error" >
47
30
Browser access mode in the Prometheus data source is no longer available. Switch to server access mode.
48
31
</ Alert >
49
- ) }
50
- { /* WRAP IN FEATURE TOGGLE */ }
51
- { prometheusConfigOverhaulAuth ? (
52
- < >
53
- < DataSourceDescription
54
- dataSourceName = "Prometheus"
55
- docsLink = "https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/"
56
- />
57
- < hr className = { `${ styles . hrTopSpace } ${ styles . hrBottomSpace } ` } />
58
- < DataSourcehttpSettingsOverhaul
59
- options = { options }
60
- onOptionsChange = { onOptionsChange }
61
- // azureAuthSettings={azureAuthSettings}
62
- sigV4AuthToggleEnabled = { config . sigV4AuthEnabled }
63
- renderSigV4Editor = { < SIGV4ConnectionConfig { ...props } > </ SIGV4ConnectionConfig > }
64
- secureSocksDSProxyEnabled = { true } //config.secureSocksDSProxyEnabled }
65
- />
66
- </ >
67
- ) : (
68
- < DataSourceHttpSettings
69
- defaultUrl = "http://localhost:9090"
70
- dataSourceConfig = { options }
71
- showAccessOptions = { showAccessOptions . current }
32
+ ) }
33
+ < DataSourceDescription
34
+ dataSourceName = "Prometheus"
35
+ docsLink = "https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/"
36
+ />
37
+ < hr className = { `${ styles . hrTopSpace } ${ styles . hrBottomSpace } ` } />
38
+ < DataSourcehttpSettingsOverhaul
39
+ options = { options }
40
+ onOptionsChange = { onOptionsChange }
41
+ sigV4AuthToggleEnabled = { config . sigV4AuthEnabled }
42
+ renderSigV4Editor = { < SIGV4ConnectionConfig { ...props } > </ SIGV4ConnectionConfig > }
43
+ secureSocksDSProxyEnabled = { config . secureSocksDSProxyEnabled }
44
+ />
45
+ < hr />
46
+ < ConfigSection
47
+ className = { styles . advancedSettings }
48
+ title = "Advanced settings"
49
+ description = "Additional settings are optional settings that can be configured for more control over your data source."
50
+ >
51
+ < AdvancedHttpSettings
52
+ className = { styles . advancedHTTPSettingsMargin }
53
+ config = { options }
72
54
onChange = { onOptionsChange }
73
- sigV4AuthToggleEnabled = { config . sigV4AuthEnabled }
74
- // azureAuthSettings={azureAuthSettings}
75
- renderSigV4Editor = { < SIGV4ConnectionConfig { ...props } > </ SIGV4ConnectionConfig > }
76
- secureSocksDSProxyEnabled = { config . secureSocksDSProxyEnabled }
77
- urlLabel = "Prometheus server URL"
78
- urlDocs = { docsTip ( ) }
79
55
/>
80
- ) }
81
- { prometheusConfigOverhaulAuth ? (
82
- < >
83
- < hr />
84
- < ConfigSection
85
- className = { styles . advancedSettings }
86
- title = "Advanced settings"
87
- description = "Additional settings are optional settings that can be configured for more control over your data source."
88
- >
89
- < AdvancedHttpSettings
90
- className = { styles . advancedHTTPSettingsMargin }
91
- config = { options }
92
- onChange = { onOptionsChange }
93
- />
94
- < AlertingSettingsOverhaul < PromOptions > options = { options } onOptionsChange = { onOptionsChange } />
95
- < PromSettings options = { options } onOptionsChange = { onOptionsChange } />
96
- </ ConfigSection >
97
- </ >
98
- ) : (
99
- < >
100
- < hr className = { styles . hrTopSpace } />
101
- < h3 className = { styles . sectionHeaderPadding } > Additional settings</ h3 >
102
- < p className = { `${ styles . secondaryGrey } ${ styles . subsectionText } ` } >
103
- Additional settings are optional settings that can be configured for more control over your data source.
104
- </ p >
105
-
106
- < AlertingSettingsOverhaul < PromOptions > options = { options } onOptionsChange = { onOptionsChange } />
107
-
108
- < PromSettings options = { options } onOptionsChange = { onOptionsChange } />
109
- </ >
110
- ) }
56
+ < AlertingSettingsOverhaul < PromOptions > options = { options } onOptionsChange = { onOptionsChange } />
57
+ < PromSettings options = { options } onOptionsChange = { onOptionsChange } />
58
+ </ ConfigSection >
111
59
</ >
112
60
) ;
113
61
} ;
0 commit comments