mirror of
				https://github.com/scm-manager/scm-manager.git
				synced 2025-10-31 10:35:56 +01:00 
			
		
		
		
	merge with 2.0.0-m3
This commit is contained in:
		| @@ -7,15 +7,17 @@ import { | ||||
|   getRepository, | ||||
|   isFetchRepoPending | ||||
| } from "../modules/repos"; | ||||
|  | ||||
| import { connect } from "react-redux"; | ||||
| import { Route } from "react-router-dom"; | ||||
| import { Route, Switch } from "react-router-dom"; | ||||
| import type { Repository } from "@scm-manager/ui-types"; | ||||
|  | ||||
| import { | ||||
|   Page, | ||||
|   Loading, | ||||
|   ErrorPage, | ||||
|   Loading, | ||||
|   Navigation, | ||||
|   NavLink, | ||||
|   Page, | ||||
|   Section | ||||
| } from "@scm-manager/ui-components"; | ||||
| import { translate } from "react-i18next"; | ||||
| @@ -26,7 +28,8 @@ import Permissions from "../permissions/containers/Permissions"; | ||||
|  | ||||
| import type { History } from "history"; | ||||
| import EditNavLink from "../components/EditNavLink"; | ||||
| import Changesets from "./Changesets"; | ||||
|  | ||||
| import BranchRoot from "./BranchRoot"; | ||||
| import ChangesetView from "./ChangesetView"; | ||||
| import PermissionsNavLink from "../components/PermissionsNavLink"; | ||||
|  | ||||
| @@ -78,6 +81,12 @@ class RepositoryRoot extends React.Component<Props> { | ||||
|     return route.location.pathname.match(`${url}/changeset/`); | ||||
|   }; | ||||
|  | ||||
|   matches = (route: any) => { | ||||
|     const url = this.matchedUrl(); | ||||
|     const regex = new RegExp(`${url}(/branches)?/?[^/]*/changesets?.*`); | ||||
|     return route.location.pathname.match(regex); | ||||
|   }; | ||||
|  | ||||
|   render() { | ||||
|     const { loading, error, repository, t } = this.props; | ||||
|  | ||||
| @@ -96,44 +105,55 @@ class RepositoryRoot extends React.Component<Props> { | ||||
|     } | ||||
|  | ||||
|     const url = this.matchedUrl(); | ||||
|  | ||||
|     return ( | ||||
|       <Page title={repository.namespace + "/" + repository.name}> | ||||
|         <div className="columns"> | ||||
|           <div className="column is-three-quarters"> | ||||
|             <Route | ||||
|               path={url} | ||||
|               exact | ||||
|               component={() => <RepositoryDetails repository={repository} />} | ||||
|             /> | ||||
|             <Route | ||||
|               path={`${url}/edit`} | ||||
|               component={() => <Edit repository={repository} />} | ||||
|             /> | ||||
|             <Route | ||||
|               exact | ||||
|               path={`${url}/history`} | ||||
|               render={() => <Changesets repository={repository} />} | ||||
|             /> | ||||
|             <Route | ||||
|               exact | ||||
|               path={`${url}/history/:branch`} | ||||
|               render={() => <Changesets repository={repository} />} | ||||
|             /> | ||||
|             <Route | ||||
|               exact | ||||
|               path={`${url}/changeset/:id`} | ||||
|               render={() => <ChangesetView repository={repository} />} | ||||
|             /> | ||||
|             <Route | ||||
|               path={`${url}/permissions`} | ||||
|               render={props => ( | ||||
|                 <Permissions | ||||
|                   namespace={this.props.repository.namespace} | ||||
|                   repoName={this.props.repository.name} | ||||
|                 /> | ||||
|               )} | ||||
|             /> | ||||
|             <Switch> | ||||
|               <Route | ||||
|                 path={url} | ||||
|                 exact | ||||
|                 component={() => <RepositoryDetails repository={repository} />} | ||||
|               /> | ||||
|               <Route | ||||
|                 path={`${url}/edit`} | ||||
|                 component={() => <Edit repository={repository} />} | ||||
|               /> | ||||
|               <Route | ||||
|                 path={`${url}/permissions`} | ||||
|                 render={props => ( | ||||
|                   <Permissions | ||||
|                     namespace={this.props.repository.namespace} | ||||
|                     repoName={this.props.repository.name} | ||||
|                   /> | ||||
|                 )} | ||||
|               /> | ||||
|               <Route | ||||
|                 exact | ||||
|                 path={`${url}/changeset/:id`} | ||||
|                 render={() => <ChangesetView repository={repository} />} | ||||
|               /> | ||||
|               <Route | ||||
|                 path={`${url}/changesets`} | ||||
|                 render={() => ( | ||||
|                   <BranchRoot | ||||
|                     repository={repository} | ||||
|                     baseUrlWithBranch={`${url}/branches`} | ||||
|                     baseUrlWithoutBranch={`${url}/changesets`} | ||||
|                   /> | ||||
|                 )} | ||||
|               /> | ||||
|               <Route | ||||
|                 path={`${url}/branches/:branch/changesets`} | ||||
|                 render={() => ( | ||||
|                   <BranchRoot | ||||
|                     repository={repository} | ||||
|                     baseUrlWithBranch={`${url}/branches`} | ||||
|                     baseUrlWithoutBranch={`${url}/changesets`} | ||||
|                   /> | ||||
|                 )} | ||||
|               /> | ||||
|             </Switch> | ||||
|           </div> | ||||
|           <div className="column"> | ||||
|             <Navigation> | ||||
| @@ -141,15 +161,15 @@ class RepositoryRoot extends React.Component<Props> { | ||||
|                 <NavLink to={url} label={t("repository-root.information")} /> | ||||
|                 <NavLink | ||||
|                   activeOnlyWhenExact={false} | ||||
|                   to={`${url}/history`} | ||||
|                   to={`${url}/changesets/`} | ||||
|                   label={t("repository-root.history")} | ||||
|                   otherLocation={this.matchChangeset} | ||||
|                   activeWhenMatch={this.matches} | ||||
|                 /> | ||||
|                 <EditNavLink repository={repository} editUrl={`${url}/edit`} /> | ||||
|                 <PermissionsNavLink | ||||
|                   permissionUrl={`${url}/permissions`} | ||||
|                   repository={repository} | ||||
|                 /> | ||||
|                 <EditNavLink repository={repository} editUrl={`${url}/edit`} /> | ||||
|               </Section> | ||||
|               <Section label={t("repository-root.actions-label")}> | ||||
|                 <DeleteNavAction repository={repository} delete={this.delete} /> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user