2018-09-13 12:20:28 +02:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
2018-09-20 08:32:02 +02:00
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
import { withRouter } from "react-router-dom";
|
2018-09-20 15:43:12 +02:00
|
|
|
import type { Changeset } from "@scm-manager/ui-types";
|
|
|
|
|
import { fetchChangesetIfNeeded } from "../modules/changesets";
|
2018-09-13 12:20:28 +02:00
|
|
|
|
2018-09-20 08:32:02 +02:00
|
|
|
type Props = {
|
2018-09-20 15:43:12 +02:00
|
|
|
id: string,
|
|
|
|
|
changeset: Changeset,
|
|
|
|
|
repository: Repository,
|
|
|
|
|
repositories: Repository[],
|
|
|
|
|
fetchChangesetIfNeeded: (
|
|
|
|
|
namespace: string,
|
|
|
|
|
repoName: string,
|
|
|
|
|
id: string
|
|
|
|
|
) => void
|
2018-09-20 08:32:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ChangesetView extends React.Component<State, Props> {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
2018-09-20 15:43:12 +02:00
|
|
|
const { fetchChangesetIfNeeded, repository } = this.props;
|
2018-09-20 08:32:02 +02:00
|
|
|
const id = this.props.match.params.id;
|
2018-09-20 15:43:12 +02:00
|
|
|
//state macht keinen Sinn?! repositories holen!
|
2018-09-25 14:11:18 +02:00
|
|
|
fetchChangesetIfNeeded(repository.namespace, repository.name, id);
|
2018-09-20 08:32:02 +02:00
|
|
|
}
|
2018-09-13 12:20:28 +02:00
|
|
|
|
|
|
|
|
render() {
|
2018-09-20 08:32:02 +02:00
|
|
|
const id = this.props.match.params.id;
|
|
|
|
|
|
|
|
|
|
return <div>Hallo! Changesets here! {id}</div>;
|
2018-09-13 12:20:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 08:32:02 +02:00
|
|
|
const mapStateToProps = (state, ownProps: Props) => {
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
2018-09-20 15:43:12 +02:00
|
|
|
return {
|
|
|
|
|
fetchChangesetIfNeeded: (
|
|
|
|
|
namespace: string,
|
|
|
|
|
repoName: string,
|
|
|
|
|
id: string
|
|
|
|
|
) => {
|
2018-09-25 14:11:18 +02:00
|
|
|
dispatch(fetchChangesetIfNeeded(namespace, repoName, id));
|
2018-09-20 15:43:12 +02:00
|
|
|
}
|
|
|
|
|
};
|
2018-09-20 08:32:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default withRouter(
|
|
|
|
|
connect(
|
|
|
|
|
mapStateToProps,
|
|
|
|
|
mapDispatchToProps
|
|
|
|
|
)(ChangesetView)
|
|
|
|
|
);
|