The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/admin/ldap/LdapUserGroups.tsx

55 lines
1.5 KiB

import { useMemo } from 'react';
import { Tooltip, Icon, InteractiveTable, type CellProps, Column } from '@grafana/ui';
import { Trans } from 'app/core/internationalization';
import { LdapRole } from 'app/types';
interface Props {
groups: LdapRole[];
}
export const LdapUserGroups = ({ groups }: Props) => {
const items = useMemo(() => groups, [groups]);
const columns = useMemo<Array<Column<LdapRole>>>(
() => [
{
id: 'groupDN',
header: 'LDAP Group',
},
{
id: 'orgName',
header: 'Organization',
cell: (props: CellProps<LdapRole, string | undefined>) =>
props.value && props.row.original.orgRole ? props.value : '',
},
{
id: 'orgRole',
header: 'Role',
cell: (props: CellProps<LdapRole, string | undefined>) =>
props.value || (
<>
<Trans i18nKey="admin.ldap-user-groups.no-org-found">
No match{' '}
<Tooltip content="No matching organizations found">
<Icon name="info-circle" />
</Tooltip>
</Trans>
</>
),
},
],
[]
);
return (
<InteractiveTable
headerTooltips={{
orgName: { content: 'Only the first match for an Organization will be used', iconName: 'info-circle' },
}}
columns={columns}
data={items}
getRowId={(row) => row.orgId + row.orgRole + row.groupDN}
/>
);
};