List.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import React from 'react';
  2. import { Connect, Connector } from 'generated-sources';
  3. import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
  4. import ClusterContext from 'components/contexts/ClusterContext';
  5. import { useParams } from 'react-router-dom';
  6. import { ClusterName } from 'redux/interfaces';
  7. import Indicator from 'components/common/Dashboard/Indicator';
  8. import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper';
  9. import PageLoader from 'components/common/PageLoader/PageLoader';
  10. export interface ListProps {
  11. areConnectsFetching: boolean;
  12. areConnectorsFetching: boolean;
  13. connectors: Connector[];
  14. connects: Connect[];
  15. fetchConnects(clusterName: ClusterName): void;
  16. }
  17. const List: React.FC<ListProps> = ({
  18. connectors,
  19. connects,
  20. areConnectsFetching,
  21. areConnectorsFetching,
  22. fetchConnects,
  23. }) => {
  24. const { isReadOnly } = React.useContext(ClusterContext);
  25. const { clusterName } = useParams<{ clusterName: string }>();
  26. React.useEffect(() => {
  27. fetchConnects(clusterName);
  28. }, [fetchConnects, clusterName]);
  29. return (
  30. <div className="section">
  31. <Breadcrumb>All Connectors</Breadcrumb>
  32. <div className="box has-background-danger has-text-centered has-text-light">
  33. Kafka Connect section is under construction.
  34. </div>
  35. <MetricsWrapper>
  36. <Indicator
  37. label="Connects"
  38. title="Connects"
  39. fetching={areConnectsFetching}
  40. >
  41. {connects.length}
  42. </Indicator>
  43. {!isReadOnly && (
  44. <div className="level-item level-right">
  45. <button type="button" className="button is-primary" disabled>
  46. Create Connector
  47. </button>
  48. </div>
  49. )}
  50. </MetricsWrapper>
  51. {areConnectorsFetching ? (
  52. <PageLoader />
  53. ) : (
  54. <div className="box">
  55. <div className="table-container">
  56. <table className="table is-fullwidth">
  57. <thead>
  58. <tr>
  59. <th>Name</th>
  60. <th>Connect</th>
  61. <th>Type</th>
  62. <th>Plugin</th>
  63. <th>Topics</th>
  64. <th>Status</th>
  65. <th>Tasks</th>
  66. <th> </th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. {connectors.length === 0 && (
  71. <tr>
  72. <td colSpan={10}>No connectors found</td>
  73. </tr>
  74. )}
  75. </tbody>
  76. </table>
  77. </div>
  78. </div>
  79. )}
  80. </div>
  81. );
  82. };
  83. export default List;