import React, { FC } from 'react'; import { Alert, Icon } from '@grafana/ui'; import { AppNotificationSeverity, LdapConnectionInfo, LdapServerInfo } from 'app/types'; interface Props { ldapConnectionInfo: LdapConnectionInfo; } export const LdapConnectionStatus: FC = ({ ldapConnectionInfo }) => { return ( <>

LDAP Connection

{ldapConnectionInfo && ldapConnectionInfo.map((serverInfo, index) => ( ))}
Host Port
{serverInfo.host} {serverInfo.port} {serverInfo.available ? ( ) : ( )}
); }; interface LdapConnectionErrorProps { ldapConnectionInfo: LdapConnectionInfo; } export const LdapErrorBox: FC = ({ ldapConnectionInfo }) => { const hasError = ldapConnectionInfo.some((info) => info.error); if (!hasError) { return null; } const connectionErrors: LdapServerInfo[] = []; ldapConnectionInfo.forEach((info) => { if (info.error) { connectionErrors.push(info); } }); const errorElements = connectionErrors.map((info, index) => (
{info.host}:{info.port}
{info.error} {index !== connectionErrors.length - 1 && ( <>

)}
)); return ( {errorElements} ); };