diff --git a/public/app/plugins/datasource/influxdb/components/editor/config/InfluxInfluxQLConfig.tsx b/public/app/plugins/datasource/influxdb/components/editor/config/InfluxInfluxQLConfig.tsx index 4ac55ca9139..d95d9bdf789 100644 --- a/public/app/plugins/datasource/influxdb/components/editor/config/InfluxInfluxQLConfig.tsx +++ b/public/app/plugins/datasource/influxdb/components/editor/config/InfluxInfluxQLConfig.tsx @@ -1,3 +1,4 @@ +import { css } from '@emotion/css'; import { uniqueId } from 'lodash'; import React from 'react'; @@ -10,22 +11,25 @@ import { SelectableValue, updateDatasourcePluginResetOption, } from '@grafana/data'; -import { Alert, InlineFormLabel, LegacyForms, Select } from '@grafana/ui'; +import { GrafanaTheme2 } from '@grafana/data/src/themes'; +import { Alert, Field, InlineLabel, Input, SecretInput, Select, useStyles2 } from '@grafana/ui'; import { InfluxOptions, InfluxSecureJsonData } from '../../../types'; -const { Input, SecretFormField } = LegacyForms; - const httpModes: SelectableValue[] = [ { label: 'GET', value: 'GET' }, { label: 'POST', value: 'POST' }, ]; +const WIDTH_SHORT = 20; + export type Props = DataSourcePluginOptionsEditorProps; export const InfluxInfluxQLConfig = (props: Props) => { const { options, onOptionsChange } = props; const { database, jsonData, secureJsonData, secureJsonFields } = options; + const styles = useStyles2(getStyles); + const htmlPrefix = uniqueId('influxdb-influxql-config'); return ( @@ -41,100 +45,108 @@ export const InfluxInfluxQLConfig = (props: Props) => { To support data isolation and security, make sure appropriate permissions are configured in InfluxDB.

-
-
- - Database - -
- { - onOptionsChange({ - ...options, - database: '', - jsonData: { - ...jsonData, - dbName: event.target.value, - }, - }); - }} - /> -
-
-
-
-
- - User - -
- -
-
-
-
-
- updateDatasourcePluginResetOption(props, 'password')} - onChange={onUpdateDatasourceSecureJsonDataOption(props, 'password')} - /> -
-
-
-
- Database} + className={styles.horizontalField} + htmlFor={`${htmlPrefix}-db`} + > + { + onOptionsChange({ + ...options, + database: '', + jsonData: { + ...jsonData, + dbName: event.currentTarget.value, + }, + }); + }} + /> + + User} + className={styles.horizontalField} + htmlFor={`${htmlPrefix}-user`} + > + + + Password} + className={styles.horizontalField} + > + updateDatasourcePluginResetOption(props, 'password')} + onChange={onUpdateDatasourceSecureJsonDataOption(props, 'password')} + /> + + HTTP Method - - httpMode.value === options.jsonData.httpMode)} + options={httpModes} + defaultValue={options.jsonData.httpMode} + onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'httpMode')} + /> + -
-
- Min time interval - -
- -
-
-
+ + } + className={styles.horizontalField} + > + + ); }; + +const getStyles = (theme: GrafanaTheme2) => ({ + horizontalField: css({ + justifyContent: 'initial', + margin: `0 ${theme.spacing(0.5)} ${theme.spacing(0.5)} 0`, + }), +});