From 4159f47df011c2c9dbeb517e7a9be4202c39acdf Mon Sep 17 00:00:00 2001
From: Daniel Benjamin
Date: Wed, 8 Nov 2023 17:45:03 +0100
Subject: [PATCH] chore: Remove gh-form and LegacyForms from
InfluxInfluxQLConfig (#76497)
* chore: Remove gh-form and LegacyForms from InfluxInfluxQLConfig
* chore: Refactor InfluxInfluxQLConfig component UI to use Field
---
.../editor/config/InfluxInfluxQLConfig.tsx | 190 ++++++++++--------
1 file changed, 101 insertions(+), 89 deletions(-)
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,
- },
- });
- }}
- />
-
-
-
-
-
-
- updateDatasourcePluginResetOption(props, 'password')}
- onChange={onUpdateDatasourceSecureJsonDataOption(props, 'password')}
- />
-
-
-
+
+ }
+ htmlFor={`${htmlPrefix}-http-method`}
+ className={styles.horizontalField}
+ >
+