kafka-ui/frontend/src/components/Topics/Details/Settings/SettingsContainer.ts
2020-01-12 21:39:43 +03:00

34 lines
948 B
TypeScript

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