| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  | import React from "react"; | 
					
						
							|  |  |  | import { connect } from "react-redux"; | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  | import { Redirect, Route, Switch, RouteComponentProps } from "react-router-dom"; | 
					
						
							| 
									
										
										
										
											2019-10-23 15:47:08 +02:00
										 |  |  | import { WithTranslation, withTranslation } from "react-i18next"; | 
					
						
							|  |  |  | import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  | import { Repository } from "@scm-manager/ui-types"; | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  | import { | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |   ErrorPage, | 
					
						
							|  |  |  |   Loading, | 
					
						
							|  |  |  |   Navigation, | 
					
						
							|  |  |  |   NavLink, | 
					
						
							|  |  |  |   Page, | 
					
						
							|  |  |  |   Section, | 
					
						
							|  |  |  |   SubNavigation, | 
					
						
							|  |  |  |   MenuContext, | 
					
						
							|  |  |  |   storeMenuCollapsed, | 
					
						
							|  |  |  |   isMenuCollapsed | 
					
						
							|  |  |  | } from "@scm-manager/ui-components"; | 
					
						
							|  |  |  | import { fetchRepoByName, getFetchRepoFailure, getRepository, isFetchRepoPending } from "../modules/repos"; | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  | import RepositoryDetails from "../components/RepositoryDetails"; | 
					
						
							|  |  |  | import EditRepo from "./EditRepo"; | 
					
						
							|  |  |  | import BranchesOverview from "../branches/containers/BranchesOverview"; | 
					
						
							|  |  |  | import CreateBranch from "../branches/containers/CreateBranch"; | 
					
						
							|  |  |  | import Permissions from "../permissions/containers/Permissions"; | 
					
						
							|  |  |  | import EditRepoNavLink from "../components/EditRepoNavLink"; | 
					
						
							|  |  |  | import BranchRoot from "../branches/containers/BranchRoot"; | 
					
						
							|  |  |  | import PermissionsNavLink from "../components/PermissionsNavLink"; | 
					
						
							|  |  |  | import RepositoryNavLink from "../components/RepositoryNavLink"; | 
					
						
							|  |  |  | import { getLinks, getRepositoriesLink } from "../../modules/indexResource"; | 
					
						
							| 
									
										
										
										
											2020-01-08 10:31:43 +01:00
										 |  |  | import CodeOverview from "../codeSection/containers/CodeOverview"; | 
					
						
							|  |  |  | import ChangesetView from "./ChangesetView"; | 
					
						
							|  |  |  | import SourceExtensions from "../sources/containers/SourceExtensions"; | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  | type Props = RouteComponentProps & | 
					
						
							|  |  |  |   WithTranslation & { | 
					
						
							|  |  |  |     namespace: string; | 
					
						
							|  |  |  |     name: string; | 
					
						
							|  |  |  |     repository: Repository; | 
					
						
							|  |  |  |     loading: boolean; | 
					
						
							|  |  |  |     error: Error; | 
					
						
							|  |  |  |     repoLink: string; | 
					
						
							|  |  |  |     indexLinks: object; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // dispatch functions
 | 
					
						
							|  |  |  |     fetchRepoByName: (link: string, namespace: string, name: string) => void; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type State = { | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |   menuCollapsed: boolean; | 
					
						
							|  |  |  |   setMenuCollapsed: (collapsed: boolean) => void; | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  | class RepositoryRoot extends React.Component<Props, State> { | 
					
						
							|  |  |  |   constructor(props: Props) { | 
					
						
							|  |  |  |     super(props); | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |     this.state = { | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |       menuCollapsed: isMenuCollapsed(), | 
					
						
							|  |  |  |       setMenuCollapsed: (collapsed: boolean) => this.setState({ menuCollapsed: collapsed }) | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   componentDidMount() { | 
					
						
							| 
									
										
										
										
											2018-11-05 13:52:46 +01:00
										 |  |  |     const { fetchRepoByName, namespace, name, repoLink } = this.props; | 
					
						
							|  |  |  |     fetchRepoByName(repoLink, namespace, name); | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |   componentDidUpdate() { | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |     if (this.state.menuCollapsed && this.isCollapseForbidden()) { | 
					
						
							|  |  |  |       this.setState({ menuCollapsed: false }); | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |   isCollapseForbidden = () => { | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |     return this.props.location.pathname.includes("/settings/"); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   stripEndingSlash = (url: string) => { | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  |     if (url.endsWith("/")) { | 
					
						
							| 
									
										
										
										
											2019-03-07 17:49:20 +01:00
										 |  |  |       return url.substring(0, url.length - 1); | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     return url; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   matchedUrl = () => { | 
					
						
							|  |  |  |     return this.stripEndingSlash(this.props.match.url); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-29 10:22:54 +01:00
										 |  |  |   matchesBranches = (route: any) => { | 
					
						
							|  |  |  |     const url = this.matchedUrl(); | 
					
						
							| 
									
										
										
										
											2019-03-29 13:52:19 +01:00
										 |  |  |     const regex = new RegExp(`${url}/branch/.+/info`); | 
					
						
							| 
									
										
										
										
											2019-03-29 10:22:54 +01:00
										 |  |  |     return route.location.pathname.match(regex); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-07 10:30:46 +01:00
										 |  |  |   matchesCode = (route: any) => { | 
					
						
							| 
									
										
										
										
											2018-10-09 11:53:06 +02:00
										 |  |  |     const url = this.matchedUrl(); | 
					
						
							| 
									
										
										
										
											2020-01-07 10:30:46 +01:00
										 |  |  |     const regex = new RegExp(`${url}(/code)/.*`); | 
					
						
							| 
									
										
										
										
											2018-10-09 11:53:06 +02:00
										 |  |  |     return route.location.pathname.match(regex); | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-07 10:30:46 +01:00
										 |  |  |   getCodeLinkname = () => { | 
					
						
							|  |  |  |     const { repository } = this.props; | 
					
						
							|  |  |  |     if (repository?._links?.sources) { | 
					
						
							|  |  |  |       return "sources"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (repository?._links?.changesets) { | 
					
						
							|  |  |  |       return "changesets"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return ""; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   evaluateDestinationForCodeLink = () => { | 
					
						
							|  |  |  |     const { repository } = this.props; | 
					
						
							|  |  |  |     let url = `${this.matchedUrl()}/code`; | 
					
						
							|  |  |  |     if (repository?._links?.sources) { | 
					
						
							|  |  |  |       return `${url}/sources/`; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     return `${url}/changesets`; | 
					
						
							| 
									
										
										
										
											2019-11-01 09:29:57 +01:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |   onCollapseRepositoryMenu = (collapsed: boolean) => { | 
					
						
							|  |  |  |     this.setState({ menuCollapsed: collapsed }, () => storeMenuCollapsed(collapsed)); | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   render() { | 
					
						
							| 
									
										
										
										
											2019-02-01 10:04:37 +01:00
										 |  |  |     const { loading, error, indexLinks, repository, t } = this.props; | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |     const { menuCollapsed } = this.state; | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (error) { | 
					
						
							| 
									
										
										
										
											2019-03-28 14:47:57 +01:00
										 |  |  |       return ( | 
					
						
							| 
									
										
										
										
											2019-10-21 10:57:56 +02:00
										 |  |  |         <ErrorPage title={t("repositoryRoot.errorTitle")} subtitle={t("repositoryRoot.errorSubtitle")} error={error} /> | 
					
						
							| 
									
										
										
										
											2019-03-28 14:47:57 +01:00
										 |  |  |       ); | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!repository || loading) { | 
					
						
							| 
									
										
										
										
											2018-08-03 09:34:39 +02:00
										 |  |  |       return <Loading />; | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const url = this.matchedUrl(); | 
					
						
							| 
									
										
										
										
											2018-11-09 14:04:47 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-28 13:15:27 +01:00
										 |  |  |     const extensionProps: any = { | 
					
						
							| 
									
										
										
										
											2018-11-09 14:04:47 +01:00
										 |  |  |       repository, | 
					
						
							| 
									
										
										
										
											2019-02-01 10:04:37 +01:00
										 |  |  |       url, | 
					
						
							| 
									
										
										
										
											2020-02-28 13:15:27 +01:00
										 |  |  |       indexLinks | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const navExtensionProps = { | 
					
						
							|  |  |  |       ...extensionProps, | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |       collapsedRepositoryMenu: menuCollapsed | 
					
						
							| 
									
										
										
										
											2018-11-09 14:04:47 +01:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-21 10:57:56 +02:00
										 |  |  |     const redirectUrlFactory = binder.getExtension("repository.redirect", this.props); | 
					
						
							| 
									
										
										
										
											2019-03-07 17:49:20 +01:00
										 |  |  |     let redirectedUrl; | 
					
						
							| 
									
										
										
										
											2019-03-28 14:47:57 +01:00
										 |  |  |     if (redirectUrlFactory) { | 
					
						
							| 
									
										
										
										
											2019-03-06 17:24:50 +01:00
										 |  |  |       redirectedUrl = url + redirectUrlFactory(this.props); | 
					
						
							| 
									
										
										
										
											2019-03-28 14:47:57 +01:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  |       redirectedUrl = url + "/info"; | 
					
						
							| 
									
										
										
										
											2019-03-06 17:24:50 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-03 09:34:39 +02:00
										 |  |  |     return ( | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |       <Page title={repository.namespace + "/" + repository.name}> | 
					
						
							|  |  |  |         <div className="columns"> | 
					
						
							|  |  |  |           <div className="column"> | 
					
						
							|  |  |  |             <MenuContext.Provider value={this.state}> | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |               <Switch> | 
					
						
							|  |  |  |                 <Redirect exact from={this.props.match.url} to={redirectedUrl} /> | 
					
						
							| 
									
										
										
										
											2020-01-15 10:49:01 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |                 {/* redirect pre 2.0.0-rc2 links */} | 
					
						
							|  |  |  |                 <Redirect from={`${url}/changeset/:id`} to={`${url}/code/changeset/:id`} /> | 
					
						
							|  |  |  |                 <Redirect exact from={`${url}/sources`} to={`${url}/code/sources`} /> | 
					
						
							|  |  |  |                 <Redirect from={`${url}/sources/:revision/:path*`} to={`${url}/code/sources/:revision/:path*`} /> | 
					
						
							|  |  |  |                 <Redirect exact from={`${url}/changesets`} to={`${url}/code/changesets`} /> | 
					
						
							|  |  |  |                 <Redirect from={`${url}/branch/:branch/changesets`} to={`${url}/code/branch/:branch/changesets/`} /> | 
					
						
							| 
									
										
										
										
											2020-01-15 10:49:01 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |                 <Route path={`${url}/info`} exact component={() => <RepositoryDetails repository={repository} />} /> | 
					
						
							|  |  |  |                 <Route path={`${url}/settings/general`} component={() => <EditRepo repository={repository} />} /> | 
					
						
							|  |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/settings/permissions`} | 
					
						
							|  |  |  |                   render={() => ( | 
					
						
							|  |  |  |                     <Permissions namespace={this.props.repository.namespace} repoName={this.props.repository.name} /> | 
					
						
							|  |  |  |                   )} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <Route | 
					
						
							|  |  |  |                   exact | 
					
						
							|  |  |  |                   path={`${url}/code/changeset/:id`} | 
					
						
							|  |  |  |                   render={() => <ChangesetView repository={repository} />} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/code/sourceext/:extension`} | 
					
						
							|  |  |  |                   exact={true} | 
					
						
							|  |  |  |                   render={() => <SourceExtensions repository={repository} />} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/code/sourceext/:extension/:revision/:path*`} | 
					
						
							|  |  |  |                   render={() => <SourceExtensions repository={repository} baseUrl={`${url}/code/sources`} />} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/code`} | 
					
						
							|  |  |  |                   render={() => <CodeOverview baseUrl={`${url}/code`} repository={repository} />} | 
					
						
							| 
									
										
										
										
											2019-01-23 15:42:15 +01:00
										 |  |  |                 /> | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/branch/:branch`} | 
					
						
							|  |  |  |                   render={() => <BranchRoot repository={repository} baseUrl={`${url}/branch`} />} | 
					
						
							| 
									
										
										
										
											2019-03-28 11:51:00 +01:00
										 |  |  |                 /> | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |                 <Route | 
					
						
							|  |  |  |                   path={`${url}/branches`} | 
					
						
							|  |  |  |                   exact={true} | 
					
						
							|  |  |  |                   render={() => <BranchesOverview repository={repository} baseUrl={`${url}/branch`} />} | 
					
						
							| 
									
										
										
										
											2018-09-20 16:28:41 +02:00
										 |  |  |                 /> | 
					
						
							| 
									
										
										
										
											2020-02-26 10:41:39 +01:00
										 |  |  |                 <Route path={`${url}/branches/create`} render={() => <CreateBranch repository={repository} />} /> | 
					
						
							|  |  |  |                 <ExtensionPoint name="repository.route" props={extensionProps} renderAll={true} /> | 
					
						
							|  |  |  |               </Switch> | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |             </MenuContext.Provider> | 
					
						
							|  |  |  |           </div> | 
					
						
							|  |  |  |           <div className={menuCollapsed ? "column is-1" : "column is-3"}> | 
					
						
							|  |  |  |             <Navigation> | 
					
						
							|  |  |  |               <Section | 
					
						
							|  |  |  |                 label={t("repositoryRoot.menu.navigationLabel")} | 
					
						
							|  |  |  |                 onCollapse={ | 
					
						
							|  |  |  |                   this.isCollapseForbidden() ? undefined : () => this.onCollapseRepositoryMenu(!menuCollapsed) | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 collapsed={menuCollapsed} | 
					
						
							|  |  |  |               > | 
					
						
							| 
									
										
										
										
											2020-02-28 13:15:27 +01:00
										 |  |  |                 <ExtensionPoint name="repository.navigation.topLevel" props={navExtensionProps} renderAll={true} /> | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |                 <NavLink | 
					
						
							|  |  |  |                   to={`${url}/info`} | 
					
						
							|  |  |  |                   icon="fas fa-info-circle" | 
					
						
							|  |  |  |                   label={t("repositoryRoot.menu.informationNavLink")} | 
					
						
							|  |  |  |                   title={t("repositoryRoot.menu.informationNavLink")} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <RepositoryNavLink | 
					
						
							|  |  |  |                   repository={repository} | 
					
						
							|  |  |  |                   linkName="branches" | 
					
						
							|  |  |  |                   to={`${url}/branches/`} | 
					
						
							|  |  |  |                   icon="fas fa-code-branch" | 
					
						
							|  |  |  |                   label={t("repositoryRoot.menu.branchesNavLink")} | 
					
						
							|  |  |  |                   activeWhenMatch={this.matchesBranches} | 
					
						
							|  |  |  |                   activeOnlyWhenExact={false} | 
					
						
							|  |  |  |                   title={t("repositoryRoot.menu.branchesNavLink")} | 
					
						
							|  |  |  |                 /> | 
					
						
							|  |  |  |                 <RepositoryNavLink | 
					
						
							|  |  |  |                   repository={repository} | 
					
						
							|  |  |  |                   linkName={this.getCodeLinkname()} | 
					
						
							|  |  |  |                   to={this.evaluateDestinationForCodeLink()} | 
					
						
							|  |  |  |                   icon="fas fa-code" | 
					
						
							|  |  |  |                   label={t("repositoryRoot.menu.sourcesNavLink")} | 
					
						
							|  |  |  |                   activeWhenMatch={this.matchesCode} | 
					
						
							|  |  |  |                   activeOnlyWhenExact={false} | 
					
						
							|  |  |  |                   title={t("repositoryRoot.menu.sourcesNavLink")} | 
					
						
							|  |  |  |                 /> | 
					
						
							| 
									
										
										
										
											2020-02-28 13:15:27 +01:00
										 |  |  |                 <ExtensionPoint name="repository.navigation" props={navExtensionProps} renderAll={true} /> | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |                 <SubNavigation | 
					
						
							|  |  |  |                   to={`${url}/settings/general`} | 
					
						
							|  |  |  |                   label={t("repositoryRoot.menu.settingsNavLink")} | 
					
						
							|  |  |  |                   title={t("repositoryRoot.menu.settingsNavLink")} | 
					
						
							| 
									
										
										
										
											2020-02-25 09:49:23 +01:00
										 |  |  |                 > | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |                   <EditRepoNavLink repository={repository} editUrl={`${url}/settings/general`} /> | 
					
						
							|  |  |  |                   <PermissionsNavLink permissionUrl={`${url}/settings/permissions`} repository={repository} /> | 
					
						
							| 
									
										
										
										
											2020-02-28 13:15:27 +01:00
										 |  |  |                   <ExtensionPoint name="repository.setting" props={navExtensionProps} renderAll={true} /> | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |                 </SubNavigation> | 
					
						
							|  |  |  |               </Section> | 
					
						
							|  |  |  |             </Navigation> | 
					
						
							| 
									
										
										
										
											2018-08-03 09:34:39 +02:00
										 |  |  |           </div> | 
					
						
							| 
									
										
										
										
											2020-02-26 15:45:24 +01:00
										 |  |  |         </div> | 
					
						
							|  |  |  |       </Page> | 
					
						
							| 
									
										
										
										
											2018-08-03 09:34:39 +02:00
										 |  |  |     ); | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-08 10:31:43 +01:00
										 |  |  | const mapStateToProps = (state: any, ownProps: Props) => { | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   const { namespace, name } = ownProps.match.params; | 
					
						
							|  |  |  |   const repository = getRepository(state, namespace, name); | 
					
						
							|  |  |  |   const loading = isFetchRepoPending(state, namespace, name); | 
					
						
							|  |  |  |   const error = getFetchRepoFailure(state, namespace, name); | 
					
						
							| 
									
										
										
										
											2018-10-11 08:19:50 +02:00
										 |  |  |   const repoLink = getRepositoriesLink(state); | 
					
						
							| 
									
										
										
										
											2019-02-01 10:04:37 +01:00
										 |  |  |   const indexLinks = getLinks(state); | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   return { | 
					
						
							|  |  |  |     namespace, | 
					
						
							|  |  |  |     name, | 
					
						
							|  |  |  |     repository, | 
					
						
							|  |  |  |     loading, | 
					
						
							| 
									
										
										
										
											2018-10-11 08:19:50 +02:00
										 |  |  |     error, | 
					
						
							| 
									
										
										
										
											2019-02-01 10:04:37 +01:00
										 |  |  |     repoLink, | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  |     indexLinks | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-08 10:31:43 +01:00
										 |  |  | const mapDispatchToProps = (dispatch: any) => { | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   return { | 
					
						
							| 
									
										
										
										
											2018-11-05 13:52:46 +01:00
										 |  |  |     fetchRepoByName: (link: string, namespace: string, name: string) => { | 
					
						
							|  |  |  |       dispatch(fetchRepoByName(link, namespace, name)); | 
					
						
							| 
									
										
										
										
											2019-10-20 18:02:52 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2018-08-01 18:23:16 +02:00
										 |  |  |   }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-07 10:30:46 +01:00
										 |  |  | export default connect(mapStateToProps, mapDispatchToProps)(withTranslation("repos")(RepositoryRoot)); |