diff --git a/public/app/plugins/datasource/prometheus/config_ctrl.ts b/public/app/plugins/datasource/prometheus/config_ctrl.ts deleted file mode 100644 index 0385b92f3f5..00000000000 --- a/public/app/plugins/datasource/prometheus/config_ctrl.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class PrometheusConfigCtrl { - static templateUrl = 'public/app/plugins/datasource/prometheus/partials/config.html'; - current: any; - - /** @ngInject */ - constructor($scope: any) { - this.current.jsonData.httpMethod = this.current.jsonData.httpMethod || 'GET'; - } -} diff --git a/public/app/plugins/datasource/prometheus/configuration/ConfigEditor.tsx b/public/app/plugins/datasource/prometheus/configuration/ConfigEditor.tsx new file mode 100644 index 00000000000..7053115d4ce --- /dev/null +++ b/public/app/plugins/datasource/prometheus/configuration/ConfigEditor.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import { DataSourceHttpSettings } from '@grafana/ui'; +import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; +import { PromSettings } from './PromSettings'; +import { PromOptions } from '../types'; + +export type Props = DataSourcePluginOptionsEditorProps; +export const ConfigEditor = (props: Props) => { + const { options, onOptionsChange } = props; + return ( + <> + + + + + ); +}; diff --git a/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx b/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx new file mode 100644 index 00000000000..54546e534f0 --- /dev/null +++ b/public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx @@ -0,0 +1,122 @@ +import React, { SyntheticEvent } from 'react'; +import { EventsWithValidation, FormField, FormLabel, Input, regexValidation, Select } from '@grafana/ui'; +import { DataSourceSettings } from '@grafana/data'; +import { PromOptions } from '../types'; + +const httpOptions = [{ value: 'GET', label: 'GET' }, { value: 'POST', label: 'POST' }]; + +type Props = { + value: DataSourceSettings; + onChange: (value: DataSourceSettings) => void; +}; + +export const PromSettings = (props: Props) => { + const { value, onChange } = props; + + return ( + <> +
+
+
+ + } + tooltip="Set this to your global scrape interval defined in your Prometheus config file. This will be used as a lower limit for the + Prometheus step query parameter." + /> +
+
+
+
+ + } + tooltip="Set the Prometheus query timeout." + /> +
+
+
+ + HTTP Method + + - - Set this to your global scrape interval defined in your Prometheus config file. This will be used as a lower limit for the - Prometheus step query parameter. - -
-
- -
-
- Query timeout - - - Set the Prometheus query timeout. - -
-
- -
- -
- - - Specify the HTTP Method to query Prometheus. (POST is only available in Prometheus >= v2.1.0) - -
-
- - -

Misc

-
-
-
- Custom query parameters - - - Add Custom parameters to Prometheus or Thanos queries. - -
-
-
- -