mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 02:55:56 +01:00
Restructured Changeset Component
WIP
This commit is contained in:
@@ -7,9 +7,9 @@ import {
|
||||
getRepository,
|
||||
isFetchRepoPending
|
||||
} from "../modules/repos";
|
||||
import { connect } from "react-redux";
|
||||
import { Route } from "react-router-dom";
|
||||
import type { Repository } from "@scm-manager/ui-types";
|
||||
import {connect} from "react-redux";
|
||||
import {Route} from "react-router-dom";
|
||||
import type {Repository} from "@scm-manager/ui-types";
|
||||
import {
|
||||
Page,
|
||||
Loading,
|
||||
@@ -18,13 +18,14 @@ import {
|
||||
NavLink,
|
||||
Section
|
||||
} from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
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 Changesets from "../../changesets/containers/Changesets";
|
||||
|
||||
type Props = {
|
||||
namespace: string,
|
||||
@@ -45,7 +46,7 @@ type Props = {
|
||||
|
||||
class RepositoryRoot extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
const { fetchRepo, namespace, name } = this.props;
|
||||
const {fetchRepo, namespace, name} = this.props;
|
||||
|
||||
fetchRepo(namespace, name);
|
||||
}
|
||||
@@ -70,7 +71,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, error, repository, t } = this.props;
|
||||
const {loading, error, repository, t} = this.props;
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
@@ -83,7 +84,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
}
|
||||
|
||||
if (!repository || loading) {
|
||||
return <Loading />;
|
||||
return <Loading/>;
|
||||
}
|
||||
|
||||
const url = this.matchedUrl();
|
||||
@@ -95,22 +96,26 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
<Route
|
||||
path={url}
|
||||
exact
|
||||
component={() => <RepositoryDetails repository={repository} />}
|
||||
component={() => <RepositoryDetails repository={repository}/>}
|
||||
/>
|
||||
<Route
|
||||
path={`${url}/edit`}
|
||||
component={() => <Edit repository={repository} />}
|
||||
component={() => <Edit repository={repository}/>}
|
||||
/>
|
||||
<Route
|
||||
path={`${url}/history`}
|
||||
component={() => <Changesets repository={repository} branchName={"master"} history={this.props.history}/>}
|
||||
/>
|
||||
</div>
|
||||
<div className="column">
|
||||
<Navigation>
|
||||
<Section label={t("repository-root.navigation-label")}>
|
||||
<NavLink to={url} label={t("repository-root.information")} />
|
||||
<EditNavLink repository={repository} editUrl={`${url}/edit`} />
|
||||
<NavLink to={url} label={t("repository-root.information")}/>
|
||||
<EditNavLink repository={repository} editUrl={`${url}/edit`}/>
|
||||
</Section>
|
||||
<Section label={t("repository-root.actions-label")}>
|
||||
<DeleteNavAction repository={repository} delete={this.delete} />
|
||||
<NavLink to="/repos" label={t("repository-root.back-label")} />
|
||||
<DeleteNavAction repository={repository} delete={this.delete}/>
|
||||
<NavLink to="/repos" label={t("repository-root.back-label")}/>
|
||||
</Section>
|
||||
</Navigation>
|
||||
</div>
|
||||
@@ -121,7 +126,7 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const { namespace, name } = ownProps.match.params;
|
||||
const {namespace, name} = ownProps.match.params;
|
||||
const repository = getRepository(state, namespace, name);
|
||||
const loading = isFetchRepoPending(state, namespace, name);
|
||||
const error = getFetchRepoFailure(state, namespace, name);
|
||||
|
||||
Reference in New Issue
Block a user