mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
Debugging attempts
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import type { Repository, Branch } from "@scm-manager/ui-types";
|
||||
import { Route, Switch, withRouter } from "react-router-dom";
|
||||
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import { Route, withRouter } from "react-router-dom";
|
||||
import Changesets from "./Changesets";
|
||||
import BranchSelector from "./BranchSelector";
|
||||
import { connect } from "react-redux";
|
||||
import { ErrorPage, Loading } from "@scm-manager/ui-components";
|
||||
import { Loading } from "@scm-manager/ui-components";
|
||||
import {
|
||||
fetchBranches,
|
||||
getBranches,
|
||||
@@ -35,13 +35,14 @@ type State = {
|
||||
selectedBranch?: Branch
|
||||
};
|
||||
|
||||
class BranchRoot extends React.PureComponent<Props, State> {
|
||||
class BranchRoot extends React.Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
console.log("BR did mount");
|
||||
this.props.fetchBranches(this.props.repository);
|
||||
}
|
||||
|
||||
@@ -75,23 +76,22 @@ class BranchRoot extends React.PureComponent<Props, State> {
|
||||
branchSelected = (branch: Branch) => {
|
||||
const url = this.matchedUrl();
|
||||
this.props.history.push(
|
||||
`${url}/${encodeURIComponent(branch.name)}/changesets/`
|
||||
`${url}/${encodeURIComponent(branch.name)}/changesets`
|
||||
);
|
||||
};
|
||||
|
||||
render() {
|
||||
console.log("BR render");
|
||||
const { repository, match, branches, loading } = this.props;
|
||||
const url = this.stripEndingSlash(match.url);
|
||||
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
}
|
||||
|
||||
if (!repository || !branches) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<BranchSelector
|
||||
@@ -109,13 +109,11 @@ class BranchRoot extends React.PureComponent<Props, State> {
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
fetchBranches: (repo: Repository) => {
|
||||
@@ -138,9 +136,9 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
};
|
||||
|
||||
export default compose(
|
||||
withRouter,
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
),
|
||||
withRouter
|
||||
)
|
||||
)(BranchRoot);
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
// @flow
|
||||
|
||||
import React from "react";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import type {
|
||||
Branch,
|
||||
Changeset,
|
||||
PagedCollection,
|
||||
Repository
|
||||
} from "@scm-manager/ui-types";
|
||||
import {withRouter} from "react-router-dom";
|
||||
import type {Branch, Changeset, PagedCollection, Repository} from "@scm-manager/ui-types";
|
||||
import {
|
||||
fetchChangesetsByBranch,
|
||||
fetchChangesetsByBranchAndPage,
|
||||
@@ -16,21 +11,27 @@ import {
|
||||
isFetchChangesetsPending,
|
||||
selectListAsCollection
|
||||
} from "../modules/changesets";
|
||||
import { connect } from "react-redux";
|
||||
import {connect} from "react-redux";
|
||||
import ChangesetList from "../components/changesets/ChangesetList";
|
||||
import { ErrorPage, LinkPaginator, Loading } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import {ErrorPage, LinkPaginator, Loading} from "@scm-manager/ui-components";
|
||||
import {translate} from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
fetchChangesetsByBranch: (Repository, Branch) => void,
|
||||
fetchChangesetsByBranchAndPage: (Repository, Branch, number) => void,
|
||||
repository: Repository, //TODO: Do we really need/want this here?
|
||||
branch: Branch,
|
||||
|
||||
// State props
|
||||
changesets: Changeset[],
|
||||
loading: boolean,
|
||||
match: any,
|
||||
list: PagedCollection,
|
||||
error: Error,
|
||||
|
||||
// Dispatch props
|
||||
fetchChangesetsByBranch: (Repository, Branch) => void,
|
||||
fetchChangesetsByBranchAndPage: (Repository, Branch, number) => void,
|
||||
|
||||
// Context Props
|
||||
match: any,
|
||||
t: string => string
|
||||
};
|
||||
|
||||
@@ -38,6 +39,7 @@ type State = {};
|
||||
|
||||
class Changesets extends React.Component<Props, State> {
|
||||
componentDidMount() {
|
||||
console.log("CDM");
|
||||
const {
|
||||
fetchChangesetsByBranch,
|
||||
fetchChangesetsByBranchAndPage,
|
||||
@@ -57,26 +59,26 @@ class Changesets extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
const {
|
||||
match,
|
||||
repository,
|
||||
branch,
|
||||
fetchChangesetsByBranch,
|
||||
fetchChangesetsByBranchAndPage
|
||||
} = this.props;
|
||||
const { page } = match.params;
|
||||
|
||||
if (branch === prevProps.branch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!page) {
|
||||
fetchChangesetsByBranch(repository, branch);
|
||||
} else {
|
||||
fetchChangesetsByBranchAndPage(repository, branch, page);
|
||||
}
|
||||
}
|
||||
// componentDidUpdate(prevProps: Props) {
|
||||
// const {
|
||||
// match,
|
||||
// repository,
|
||||
// branch,
|
||||
// fetchChangesetsByBranch,
|
||||
// fetchChangesetsByBranchAndPage
|
||||
// } = this.props;
|
||||
// const { page } = match.params;
|
||||
//
|
||||
// if (branch === prevProps.branch) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!page) {
|
||||
// fetchChangesetsByBranch(repository, branch);
|
||||
// } else {
|
||||
// fetchChangesetsByBranchAndPage(repository, branch, page);
|
||||
// }
|
||||
// }
|
||||
|
||||
render() {
|
||||
const { changesets, loading, error, t } = this.props;
|
||||
|
||||
@@ -1,32 +1,17 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import {
|
||||
deleteRepo,
|
||||
fetchRepo,
|
||||
getFetchRepoFailure,
|
||||
getRepository,
|
||||
isFetchRepoPending
|
||||
} from "../modules/repos";
|
||||
import { connect } from "react-redux";
|
||||
import { Route, Switch } from "react-router-dom";
|
||||
import type { Repository } from "@scm-manager/ui-types";
|
||||
import {
|
||||
ErrorPage,
|
||||
Loading,
|
||||
Navigation,
|
||||
NavLink,
|
||||
Page,
|
||||
Section
|
||||
} from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import {deleteRepo, fetchRepo, getFetchRepoFailure, getRepository, isFetchRepoPending} from "../modules/repos";
|
||||
import {connect} from "react-redux";
|
||||
import {Route, Switch} from "react-router-dom";
|
||||
import type {Repository} from "@scm-manager/ui-types";
|
||||
import {ErrorPage, Loading, Navigation, NavLink, Page, Section} from "@scm-manager/ui-components";
|
||||
import {translate} from "react-i18next";
|
||||
import RepositoryDetails from "../components/RepositoryDetails";
|
||||
import DeleteNavAction from "../components/DeleteNavAction";
|
||||
import Edit from "../containers/Edit";
|
||||
|
||||
import type { History } from "history";
|
||||
import type {History} from "history";
|
||||
import EditNavLink from "../components/EditNavLink";
|
||||
import BranchChooser from "./BranchChooser";
|
||||
import Changesets from "./Changesets";
|
||||
import BranchRoot from "./BranchRoot";
|
||||
|
||||
type Props = {
|
||||
|
||||
Reference in New Issue
Block a user