mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Use InteractiveTable * Remove unused return * Fix icon alignment * InteractiveTable in LdapUserMappingInfo * Update no teams text * InteractiveTable in LdapUserGroups * Remove unused code * Cleanup * LdapSyncInfo to InteractiveTable * Update more tables * Memoize * Fix connection status * Update lockfile * Refactor LdapSyncInfo * Fix lockfile * Remove showAttributeMapping as it is always true
60 lines
1.2 KiB
TypeScript
60 lines
1.2 KiB
TypeScript
import React, { useMemo } from 'react';
|
|
|
|
import { Column, Icon, InteractiveTable } from '@grafana/ui';
|
|
import { LdapPermissions } from 'app/types';
|
|
|
|
interface Props {
|
|
permissions: LdapPermissions;
|
|
}
|
|
|
|
interface TableRow {
|
|
permission: string;
|
|
value: React.ReactNode;
|
|
}
|
|
|
|
export const LdapUserPermissions = ({ permissions }: Props) => {
|
|
const columns = useMemo<Array<Column<TableRow>>>(
|
|
() => [
|
|
{
|
|
id: 'permission',
|
|
header: 'Permissions',
|
|
disableGrow: true,
|
|
},
|
|
{
|
|
id: 'value',
|
|
},
|
|
],
|
|
[]
|
|
);
|
|
|
|
const data = useMemo<TableRow[]>(
|
|
() => [
|
|
{
|
|
permission: 'Grafana admin',
|
|
value: permissions.isGrafanaAdmin ? (
|
|
<>
|
|
<Icon name="shield" /> Yes
|
|
</>
|
|
) : (
|
|
'No'
|
|
),
|
|
},
|
|
{
|
|
permission: 'Status',
|
|
value: permissions.isDisabled ? (
|
|
<>
|
|
<Icon name="times" /> Inactive
|
|
</>
|
|
) : (
|
|
<>
|
|
<Icon name="check" /> Active
|
|
</>
|
|
),
|
|
},
|
|
],
|
|
[permissions]
|
|
);
|
|
|
|
return <InteractiveTable data={data} columns={columns} getRowId={(row) => row.permission} />;
|
|
};
|