DataSourcePermissionsList.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import React, { PureComponent } from 'react';
  2. import { DataSourcePermission } from '../../types';
  3. import { dataSourceAclLevels, DataSourcePermissionLevel } from '../../types/acl';
  4. import DescriptionPicker from '../../core/components/Picker/DescriptionPicker';
  5. interface Props {
  6. items: DataSourcePermission[];
  7. onRemoveItem: (item) => void;
  8. }
  9. export class DataSourcePermissionsList extends PureComponent<Props> {
  10. render() {
  11. const { items } = this.props;
  12. const permissionLevels = dataSourceAclLevels;
  13. permissionLevels.push({ value: DataSourcePermissionLevel.Admin, label: 'Admin', description: '' });
  14. return (
  15. <table className="filter-table gf-form-group">
  16. <tbody>
  17. <tr className="gf-form-disabled">
  18. <td style={{ width: '1%' }}>
  19. <i style={{ width: '25px', height: '25px' }} className="gicon gicon-shield" />
  20. </td>
  21. <td style={{ width: '90%' }}>
  22. Admin
  23. <span className="filter-table__weak-italic"> (Role)</span>
  24. </td>
  25. <td />
  26. <td className="query-keyword">Can</td>
  27. <td>
  28. <div className="gf-form">
  29. <DescriptionPicker
  30. optionsWithDesc={permissionLevels}
  31. onSelected={() => {}}
  32. value={2}
  33. disabled={true}
  34. className={'gf-form-input--form-dropdown-right'}
  35. />
  36. </div>
  37. </td>
  38. <td>
  39. <button className="btn btn-inverse btn-small">
  40. <i className="fa fa-lock" />
  41. </button>
  42. </td>
  43. </tr>
  44. {items.map((item, index) => {
  45. return (
  46. <tr>
  47. <td style={{ width: '1%' }}>
  48. <i style={{ width: '25px', height: '25px' }} className="gicon gicon-shield" />
  49. </td>
  50. <td style={{ width: '90%' }}>
  51. {}
  52. <span className="filter-table__weak-italic"> (Role)</span>
  53. </td>
  54. <td />
  55. <td className="query-keyword">Can</td>
  56. <td>
  57. <div className="gf-form">
  58. <DescriptionPicker
  59. optionsWithDesc={permissionLevels}
  60. onSelected={() => {}}
  61. value={2}
  62. disabled={true}
  63. className={'gf-form-input--form-dropdown-right'}
  64. />
  65. </div>
  66. </td>
  67. <td>
  68. <button className="btn btn-inverse btn-small">
  69. <i className="fa fa-lock" />
  70. </button>
  71. </td>
  72. </tr>
  73. );
  74. })}
  75. </tbody>
  76. </table>
  77. );
  78. }
  79. }
  80. export default DataSourcePermissionsList;