LdapUserTeams.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import React, { FC } from 'react';
  2. import { Tooltip, Icon } from '@grafana/ui';
  3. import { LdapTeam } from 'app/types';
  4. interface Props {
  5. teams: LdapTeam[];
  6. showAttributeMapping?: boolean;
  7. }
  8. export const LdapUserTeams: FC<Props> = ({ teams, showAttributeMapping }) => {
  9. const items = showAttributeMapping ? teams : teams.filter((item) => item.teamName);
  10. return (
  11. <div className="gf-form-group">
  12. <div className="gf-form">
  13. <table className="filter-table form-inline">
  14. <thead>
  15. <tr>
  16. {showAttributeMapping && <th>LDAP Group</th>}
  17. <th>Organisation</th>
  18. <th>Team</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {items.map((team, index) => {
  23. return (
  24. <tr key={`${team.teamName}-${index}`}>
  25. {showAttributeMapping && (
  26. <>
  27. <td>{team.groupDN}</td>
  28. {!team.orgName && (
  29. <>
  30. <td />
  31. <td>
  32. <div className="text-warning">
  33. No match
  34. <Tooltip placement="top" content="No matching teams found" theme={'info'}>
  35. <span className="gf-form-help-icon">
  36. <Icon name="info-circle" />
  37. </span>
  38. </Tooltip>
  39. </div>
  40. </td>
  41. </>
  42. )}
  43. </>
  44. )}
  45. {team.orgName && (
  46. <>
  47. <td>{team.orgName}</td>
  48. <td>{team.teamName}</td>
  49. </>
  50. )}
  51. </tr>
  52. );
  53. })}
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. );
  59. };