grafana/public/app/features/admin/ldap/LdapUserGroups.tsx
Ivana Huckova 1c58202b26
@grafana/ui: Replace various icons using Icon component (#23442)
* Replace icons in dashboard and settings

* Replace icons in alerting

* Update batch of icons

* Implement icons accross various files

* Style updates

* Search: Fix recent and starred icons

* Update styling and details

* Replace new icon created by unicons

* Fix e2e test, styling

* Minor styling updates

Co-authored-by: Clarity-89 <homes89@ukr.net>
2020-04-12 22:20:02 +02:00

70 lines
2.2 KiB
TypeScript

import React, { FC } from 'react';
import { Tooltip, Icon } from '@grafana/ui';
import { LdapRole } from 'app/types';
interface Props {
groups: LdapRole[];
showAttributeMapping?: boolean;
}
export const LdapUserGroups: FC<Props> = ({ groups, showAttributeMapping }) => {
const items = showAttributeMapping ? groups : groups.filter(item => item.orgRole);
return (
<div className="gf-form-group">
<div className="gf-form">
<table className="filter-table form-inline">
<thead>
<tr>
{showAttributeMapping && <th>LDAP Group</th>}
<th>
Organization
<Tooltip placement="top" content="Only the first match for an Organization will be used" theme={'info'}>
<span className="gf-form-help-icon">
<Icon name="info-circle" />
</span>
</Tooltip>
</th>
<th>Role</th>
</tr>
</thead>
<tbody>
{items.map((group, index) => {
return (
<tr key={`${group.orgId}-${index}`}>
{showAttributeMapping && (
<>
<td>{group.groupDN}</td>
{!group.orgRole && (
<>
<td />
<td>
<span className="text-warning">
No match
<Tooltip placement="top" content="No matching groups found" theme={'info'}>
<span className="gf-form-help-icon">
<Icon name="info-circle" />
</span>
</Tooltip>
</span>
</td>
</>
)}
</>
)}
{group.orgName && (
<>
<td>{group.orgName}</td>
<td>{group.orgRole}</td>
</>
)}
</tr>
);
})}
</tbody>
</table>
</div>
</div>
);
};