kafka-ui/kafka-ui-react-app/src/components/Schemas/Details/DetailsContainer.ts
2021-03-09 13:42:03 +03:00

41 lines
1 KiB
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 { getClustersReadonlyStatus } from 'redux/reducers/clusters/selectors';
import { fetchSchemaVersions } 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
) => ({
schema: getSchema(state, subject),
versions: getSortedSchemaVersions(state),
isFetched: getIsSchemaVersionFetched(state),
clusterName,
isReadOnly: getClustersReadonlyStatus(clusterName)(state),
});
const mapDispatchToProps = {
fetchSchemaVersions,
};
export default withRouter(
connect(mapStateToProps, mapDispatchToProps)(Details)
);