kafka-ui/kafka-ui-react-app/src/components/Schemas/Details/DetailsContainer.ts
Azat Mutigullin 083e3f7de0
Improve eslint configuration (#385)
Co-authored-by: Oleg Shuralev <workshur@gmail.com>
2021-04-22 14:50:06 +03:00

42 lines
961 B
TypeScript

import { connect } from 'react-redux';
import { ClusterName, RootState } from 'redux/interfaces';
import { RouteComponentProps, withRouter } from 'react-router-dom';
import {
getIsSchemaVersionFetched,
getSchema,
getSortedSchemaVersions,
} from 'redux/reducers/schemas/selectors';
import { fetchSchemaVersions, deleteSchema } from 'redux/actions';
import Details from './Details';
interface RouteProps {
clusterName: ClusterName;
subject: string;
}
type OwnProps = RouteComponentProps<RouteProps>;
const mapStateToProps = (
state: RootState,
{
match: {
params: { clusterName, subject },
},
}: OwnProps
) => ({
subject,
schema: getSchema(state, subject),
versions: getSortedSchemaVersions(state),
isFetched: getIsSchemaVersionFetched(state),
clusterName,
});
const mapDispatchToProps = {
fetchSchemaVersions,
deleteSchema,
};
export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(Details)
);