mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* LDAP: Show all LDAP groups * Use the returned LDAP groups as the reference when debugging LDAP We need to use the LDAP groups returned as the main reference for assuming what we were able to match and what wasn't. Before, we were using the configured groups in LDAP TOML configuration file. * s/User name/Username * Add a title to for the LDAP mapping results * LDAP: UI Updates to debug view * LDAP: Make it explicit when we weren't able to match teams
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import React, { FC } from 'react';
|
|
import { Tooltip } from '@grafana/ui';
|
|
import { LdapTeam } from 'app/types';
|
|
|
|
interface Props {
|
|
teams: LdapTeam[];
|
|
showAttributeMapping?: boolean;
|
|
}
|
|
|
|
export const LdapUserTeams: FC<Props> = ({ teams, showAttributeMapping }) => {
|
|
const items = showAttributeMapping ? teams : teams.filter(item => item.teamName);
|
|
|
|
return (
|
|
<div className="gf-form-group">
|
|
<div className="gf-form">
|
|
<table className="filter-table form-inline">
|
|
<thead>
|
|
<tr>
|
|
{showAttributeMapping && <th>LDAP Group</th>}
|
|
<th>Organisation</th>
|
|
<th>Team</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{items.map((team, index) => {
|
|
return (
|
|
<tr key={`${team.teamName}-${index}`}>
|
|
{showAttributeMapping && (
|
|
<>
|
|
<td>{team.groupDN}</td>
|
|
{!team.orgName && (
|
|
<>
|
|
<td />
|
|
<td>
|
|
<div className="text-warning">
|
|
No match
|
|
<Tooltip placement="top" content="No matching teams found" theme={'info'}>
|
|
<span className="gf-form-help-icon">
|
|
<i className="fa fa-info-circle" />
|
|
</span>
|
|
</Tooltip>
|
|
</div>
|
|
</td>
|
|
</>
|
|
)}
|
|
</>
|
|
)}
|
|
{team.orgName && (
|
|
<>
|
|
<td>{team.orgName}</td>
|
|
<td>{team.teamName}</td>
|
|
</>
|
|
)}
|
|
</tr>
|
|
);
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|