import React, { PureComponent } from 'react'; import { dateTimeFormat } from '@grafana/data'; import { SyncInfo, UserDTO } from 'app/types'; import { Button, LinkButton } from '@grafana/ui'; interface Props { ldapSyncInfo: SyncInfo; user: UserDTO; onUserSync: () => void; } interface State {} const format = 'dddd YYYY-MM-DD HH:mm zz'; const debugLDAPMappingBaseURL = '/admin/ldap'; export class UserLdapSyncInfo extends PureComponent { onUserSync = () => { this.props.onUserSync(); }; render() { const { ldapSyncInfo, user } = this.props; const nextSyncSuccessful = ldapSyncInfo && ldapSyncInfo.nextSync; const nextSyncTime = nextSyncSuccessful ? dateTimeFormat(ldapSyncInfo.nextSync, { format }) : ''; const debugLDAPMappingURL = `${debugLDAPMappingBaseURL}?user=${user && user.login}`; return ( <>

LDAP Synchronisation

{ldapSyncInfo.enabled ? ( <> ) : ( <> )}
External sync User synced via LDAP – some changes must be done in LDAP or mappings. LDAP
Next scheduled synchronisation {nextSyncTime}Next scheduled synchronisation Not enabled
Debug LDAP Mapping
); } }