Details.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { SchemaSubject } from 'generated-sources';
  2. import React from 'react';
  3. import { ClusterName } from 'redux/interfaces';
  4. import Breadcrumb from '../../common/Breadcrumb/Breadcrumb';
  5. import DetailsItem from './DetailsItem';
  6. import { clusterSchemasPath } from '../../../lib/paths';
  7. interface DetailsProps {
  8. schema: SchemaSubject;
  9. clusterName: ClusterName;
  10. schemaName: SchemaSubject['subject'];
  11. versions: string;
  12. fetchSchemaVersions: (
  13. clusterName: ClusterName,
  14. schemaName: SchemaSubject['subject']
  15. ) => void;
  16. }
  17. const Details: React.FC<DetailsProps> = ({
  18. schema,
  19. clusterName,
  20. versions,
  21. fetchSchemaVersions,
  22. schemaName,
  23. }) => {
  24. React.useEffect(() => {
  25. fetchSchemaVersions(clusterName, schemaName);
  26. }, [fetchSchemaVersions, clusterName, schemaName]);
  27. return (
  28. <div className="section">
  29. <div className="level">
  30. <div className="level-item level-left">
  31. <Breadcrumb
  32. links={[
  33. {
  34. href: clusterSchemasPath(clusterName),
  35. label: 'Schema Registry',
  36. },
  37. ]}
  38. >
  39. {schema.subject}
  40. </Breadcrumb>
  41. </div>
  42. </div>
  43. <div className="box">
  44. <table className="table is-striped is-fullwidth">
  45. <thead>
  46. <tr>
  47. <th>Latest Version</th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <DetailsItem schema={schema} />
  52. </tbody>
  53. </table>
  54. </div>
  55. <div className="box">
  56. <table className="table is-striped is-fullwidth">
  57. <thead>
  58. <tr>
  59. <th>Versions</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <tr>
  64. <td>{versions}</td>
  65. </tr>
  66. </tbody>
  67. </table>
  68. </div>
  69. </div>
  70. );
  71. };
  72. export default Details;