import { TopicConfig } from 'generated-sources'; import React from 'react'; import { ClusterName, TopicName } from 'redux/interfaces'; interface Props { clusterName: ClusterName; topicName: TopicName; config?: TopicConfig[]; isFetched: boolean; fetchTopicConfig: (clusterName: ClusterName, topicName: TopicName) => void; } interface ListItemProps { config: TopicConfig; } const ConfigListItem: React.FC = ({ config: { name, value, defaultValue }, }) => { const hasCustomValue = value !== defaultValue; return ( {name} {value} {hasCustomValue && defaultValue} ); }; const Settings: React.FC = ({ clusterName, topicName, isFetched, fetchTopicConfig, config, }) => { React.useEffect(() => { fetchTopicConfig(clusterName, topicName); }, [fetchTopicConfig, clusterName, topicName]); if (!isFetched || !config) { return null; } return (
{config.map((item) => ( ))}
Key Value Default Value
); }; export default Settings;