diff --git a/.betterer.results b/.betterer.results index 8f8c6ee10c8..115753f74ad 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1762,9 +1762,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "1"], [0, 0, 0, "Styles should be written using objects.", "2"] ], - "public/app/features/admin/ldap/LdapPage.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/alerting/AlertTab.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], diff --git a/public/app/features/admin/ldap/LdapPage.tsx b/public/app/features/admin/ldap/LdapPage.tsx index 5a0e68fc1b7..e82df553ddc 100644 --- a/public/app/features/admin/ldap/LdapPage.tsx +++ b/public/app/features/admin/ldap/LdapPage.tsx @@ -3,8 +3,7 @@ import { connect, ConnectedProps } from 'react-redux'; import { NavModelItem } from '@grafana/data'; import { featureEnabled } from '@grafana/runtime'; -import { Alert, Button, LegacyForms } from '@grafana/ui'; -const { FormField } = LegacyForms; +import { Alert, Button, Field, Form, HorizontalGroup, Input } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; import { contextSrv } from 'app/core/core'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; @@ -42,6 +41,10 @@ interface State { isLoading: boolean; } +interface FormModel { + username: string; +} + const pageNav: NavModelItem = { text: 'LDAP', subTitle: `Verify your LDAP and user mapping configuration.`, @@ -76,9 +79,7 @@ export class LdapPage extends PureComponent { return await loadUserMapping(username); } - search = (event: any) => { - event.preventDefault(); - const username = event.target.elements['username'].value; + search = (username: string) => { if (username) { this.fetchUserMapping(username); } @@ -98,11 +99,9 @@ export class LdapPage extends PureComponent { <> {ldapError && ldapError.title && ( -
- - {ldapError.body} - -
+ + {ldapError.body} + )} @@ -111,31 +110,32 @@ export class LdapPage extends PureComponent { {canReadLDAPUser && ( <> -

Test user mapping

-
-
- - - -
+

Test user mapping

+
this.search(data.username)}> + {({ register }) => ( + + + + + + + )} +
{userError && userError.title && ( -
- - {userError.body} - -
+ + {userError.body} + )} {ldapUser && }