kafka-ui/kafka-ui-react-app/src/components/Topics/Details/Settings/SettingsContainer.ts
2020-03-01 16:07:33 +02:00

34 lines
967 B
TypeScript

import { connect } from 'react-redux';
import { RootState, ClusterName, TopicName } from 'redux/interfaces';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import {
fetchTopicConfig,
} from 'redux/actions';
import Settings from './Settings';
import {
getTopicConfig,
getTopicConfigFetched,
} from 'redux/reducers/topics/selectors';
interface RouteProps {
clusterName: ClusterName;
topicName: TopicName;
}
interface OwnProps extends RouteComponentProps<RouteProps> { }
const mapStateToProps = (state: RootState, { match: { params: { topicName, clusterName } } }: OwnProps) => ({
clusterName,
topicName,
config: getTopicConfig(state, topicName),
isFetched: getTopicConfigFetched(state),
});
const mapDispatchToProps = {
fetchTopicConfig: (clusterName: ClusterName, topicName: TopicName) => fetchTopicConfig(clusterName, topicName),
};
export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(Settings)
);