Skip to content

Commit e703d1f

Browse files
committed
remove promConfigOverhaul feature toggle logic
1 parent eae70b8 commit e703d1f

File tree

2 files changed

+26
-82
lines changed

2 files changed

+26
-82
lines changed

src/configuration/AlertingSettingsOverhaul.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { cx } from '@emotion/css';
22
import { DataSourceJsonData, DataSourcePluginOptionsEditorProps } from '@grafana/data';
33
import { ConfigSubSection } from '@grafana/experimental';
4-
// import { config } from '@grafana/runtime';
54
import { InlineField, Switch, useTheme2 } from '@grafana/ui';
65
import React from 'react';
76

@@ -23,9 +22,6 @@ export function AlertingSettingsOverhaul<T extends AlertingConfig>({
2322
// @ts-ignore
2423
const styles = overhaulStyles(theme);
2524

26-
// turned on by default
27-
// const prometheusConfigOverhaulAuth = config.featureToggles.prometheusConfigOverhaulAuth;
28-
2925
return (
3026
<ConfigSubSection
3127
title="Alerting"

src/configuration/ConfigEditor.tsx

Lines changed: 26 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import { css } from '@emotion/css';
22
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
3-
import { DataSourcePluginOptionsEditorProps, /*DataSourceSettings,*/ GrafanaTheme2 } from '@grafana/data';
3+
import { DataSourcePluginOptionsEditorProps, GrafanaTheme2 } from '@grafana/data';
44
import { ConfigSection, DataSourceDescription } from '@grafana/experimental';
55
import { config } from '@grafana/runtime';
66
import { Alert, DataSourceHttpSettings, FieldValidationMessage, useTheme2 } from '@grafana/ui';
7-
// import { config } from 'app/core/config';
87
import React, { useRef } from 'react';
98

109
import { PromOptions } from '../types';
1110

1211
import { AlertingSettingsOverhaul } from './AlertingSettingsOverhaul';
13-
// import { AzureAuthSettings } from './AzureAuthSettings';
14-
// import { hasCredentials, resetCredentials, setDefaultCredentials } from './AzureCredentialsConfig';
1512
import { DataSourcehttpSettingsOverhaul } from './DataSourceHttpSettingsOverhaul';
1613
import { PromSettings } from './PromSettings';
1714
import { AdvancedHttpSettings } from './overhaul/AdvancedHttpSettings';
@@ -23,20 +20,6 @@ export type Props = DataSourcePluginOptionsEditorProps<PromOptions>;
2320

2421
export const ConfigEditor = (props: Props) => {
2522
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-
4023
const theme = useTheme2();
4124
const styles = overhaulStyles(theme);
4225

@@ -46,68 +29,33 @@ export const ConfigEditor = (props: Props) => {
4629
<Alert title="Error" severity="error">
4730
Browser access mode in the Prometheus data source is no longer available. Switch to server access mode.
4831
</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}
7254
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()}
7955
/>
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>
11159
</>
11260
);
11361
};

0 commit comments

Comments
 (0)