From 4ae1774e1f14ea6185a9e9a7149f0547a3995dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Fern=C3=A1ndez?= Date: Tue, 11 Nov 2025 15:58:16 +0100 Subject: [PATCH] Chore: remove `gf-form` in grafana-ui components (#113659) --- eslint-suppressions.json | 18 ----- .../DataSourceSettings/AlertingSettings.tsx | 57 ++++++++------- .../CustomHeadersSettings.tsx | 44 +++++++----- .../SecureSocksProxySettings.tsx | 52 +++++++------- .../DataSourceSettings/TLSAuthSettings.tsx | 70 +++++++++---------- .../src/components/Forms/InlineFieldRow.mdx | 2 +- 6 files changed, 120 insertions(+), 123 deletions(-) diff --git a/eslint-suppressions.json b/eslint-suppressions.json index e06e54eec9e..49c9998a315 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -602,32 +602,14 @@ "count": 1 } }, - "packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx": { - "no-restricted-syntax": { - "count": 3 - } - }, "packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx": { "@typescript-eslint/no-explicit-any": { "count": 2 }, - "no-restricted-syntax": { - "count": 3 - }, "react-prefer-function-component/react-prefer-function-component": { "count": 1 } }, - "packages/grafana-ui/src/components/DataSourceSettings/SecureSocksProxySettings.tsx": { - "no-restricted-syntax": { - "count": 3 - } - }, - "packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx": { - "no-restricted-syntax": { - "count": 3 - } - }, "packages/grafana-ui/src/components/DataSourceSettings/types.ts": { "@typescript-eslint/no-explicit-any": { "count": 2 diff --git a/packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx index a71a5979f58..98570eb2e15 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/AlertingSettings.tsx @@ -3,6 +3,8 @@ import { t, Trans } from '@grafana/i18n'; import { InlineSwitch } from '../../components/Switch/Switch'; import { InlineField } from '../Forms/InlineField'; +import { Box } from '../Layout/Box/Box'; +import { Stack } from '../Layout/Stack/Stack'; export interface Props extends Pick, 'options' | 'onOptionsChange'> {} @@ -17,31 +19,36 @@ export function AlertingSettings({ options, onOptionsC

Alerting

-
-
-
- - - onOptionsChange({ - ...options, - jsonData: { ...options.jsonData, manageAlerts: event!.currentTarget.checked }, - }) - } - /> - -
-
-
+ + + + + + + onOptionsChange({ + ...options, + jsonData: { ...options.jsonData, manageAlerts: event!.currentTarget.checked }, + }) + } + /> + + + + + ); } diff --git a/packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx index 49e2abf2a2a..d7d94b186c2 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/CustomHeadersSettings.tsx @@ -9,6 +9,8 @@ import { useStyles2 } from '../../themes/ThemeContext'; import { Button } from '../Button/Button'; import { FormField } from '../FormField/FormField'; import { Icon } from '../Icon/Icon'; +import { Box } from '../Layout/Box/Box'; +import { Stack } from '../Layout/Stack/Stack'; import { SecretFormField } from '../SecretFormField/SecretFormField'; export interface CustomHeader { @@ -199,12 +201,14 @@ export class CustomHeadersSettings extends PureComponent { const { dataSourceConfig } = this.props; return ( -
-
-
- Custom HTTP Headers -
-
+ + + +
+ Custom HTTP Headers +
+
+
{headers.map((header, i) => ( { ))}
{!dataSourceConfig.readOnly && ( -
- -
+ + + + + )} -
+ ); } } diff --git a/packages/grafana-ui/src/components/DataSourceSettings/SecureSocksProxySettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/SecureSocksProxySettings.tsx index 6004fff49e6..d8708ddb470 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/SecureSocksProxySettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/SecureSocksProxySettings.tsx @@ -3,6 +3,8 @@ import { t, Trans } from '@grafana/i18n'; import { InlineSwitch } from '../../components/Switch/Switch'; import { InlineField } from '../Forms/InlineField'; +import { Box } from '../Layout/Box/Box'; +import { Stack } from '../Layout/Stack/Stack'; export interface Props extends Pick, 'options' | 'onOptionsChange'> {} @@ -20,30 +22,32 @@ export function SecureSocksProxySettings({

Secure Socks Proxy

-
-
-
- - - onOptionsChange({ - ...options, - jsonData: { ...options.jsonData, enableSecureSocksProxy: event!.currentTarget.checked }, - }) - } - /> - -
-
-
+ + + + + + + onOptionsChange({ + ...options, + jsonData: { ...options.jsonData, enableSecureSocksProxy: event!.currentTarget.checked }, + }) + } + /> + + + + + ); } diff --git a/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx index b5a1537edd8..fbd20c5c533 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx @@ -1,4 +1,3 @@ -import { css, cx } from '@emotion/css'; import * as React from 'react'; import { KeyValue } from '@grafana/data'; @@ -6,6 +5,8 @@ import { t, Trans } from '@grafana/i18n'; import { FormField } from '../FormField/FormField'; import { Icon } from '../Icon/Icon'; +import { Box } from '../Layout/Box/Box'; +import { Stack } from '../Layout/Stack/Stack'; import { Tooltip } from '../Tooltip/Tooltip'; import { CertificationKey } from './CertificationKey'; @@ -53,29 +54,24 @@ export const TLSAuthSettings = ({ dataSourceConfig, onChange }: HttpSettingsBase const privateKeyBeginsWith = '-----BEGIN RSA PRIVATE KEY-----'; return ( -
-
-
- TLS/SSL Auth Details -
- - - -
+ + + +
+ TLS/SSL Auth Details +
+ + + +
+
{dataSourceConfig.jsonData.tlsAuthWithCACert && ( -
- -
+ + + + + )}
-
+ ); }; diff --git a/packages/grafana-ui/src/components/Forms/InlineFieldRow.mdx b/packages/grafana-ui/src/components/Forms/InlineFieldRow.mdx index 737bd59943f..31013010033 100644 --- a/packages/grafana-ui/src/components/Forms/InlineFieldRow.mdx +++ b/packages/grafana-ui/src/components/Forms/InlineFieldRow.mdx @@ -1,6 +1,6 @@ # InlineFieldRow -Used to align multiple `InlineField` components in one row. The row will wrap if the width of the children exceeds its own. Equivalent to the div with `gf-form-inline` class name. +Used to align multiple `InlineField` components in one row. The row will wrap if the width of the children exceeds its own. Multiple `InlineFieldRow`s vertically stack on each other. ### Usage