mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
add extension points to
- redirect the repo route - add a repo top level navigation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
|
||||
type Props = {
|
||||
content: string
|
||||
};
|
||||
|
||||
class MarkdownView extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const {content } = this.props;
|
||||
return (
|
||||
<div>
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MarkdownView;
|
||||
@@ -11,4 +11,5 @@ export { default as Textarea } from "./Textarea.js";
|
||||
export { default as PasswordConfirmation } from "./PasswordConfirmation.js";
|
||||
export { default as LabelWithHelpIcon } from "./LabelWithHelpIcon.js";
|
||||
export { default as DropDown } from "./DropDown.js";
|
||||
export { default as MarkdownView } from "./MarkdownView.js";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from "../modules/repos";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { Route, Switch } from "react-router-dom";
|
||||
import {Redirect, Route, Switch} from "react-router-dom";
|
||||
import type { Repository } from "@scm-manager/ui-types";
|
||||
|
||||
import {
|
||||
@@ -34,7 +34,7 @@ import PermissionsNavLink from "../components/PermissionsNavLink";
|
||||
import Sources from "../sources/containers/Sources";
|
||||
import RepositoryNavLink from "../components/RepositoryNavLink";
|
||||
import {getLinks, getRepositoriesLink} from "../../modules/indexResource";
|
||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
import {binder, ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
namespace: string,
|
||||
@@ -101,13 +101,20 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
indexLinks
|
||||
};
|
||||
|
||||
const redirectUrlFactory = binder.getExtension("repository.redirect", this.props);
|
||||
let redirectedUrl =url+"/info";
|
||||
if (redirectUrlFactory){
|
||||
redirectedUrl = url + redirectUrlFactory(this.props);
|
||||
}
|
||||
|
||||
return (
|
||||
<Page title={repository.namespace + "/" + repository.name}>
|
||||
<div className="columns">
|
||||
<div className="column is-three-quarters is-clipped">
|
||||
<Switch>
|
||||
<Redirect exact path={url} to={redirectedUrl}/>
|
||||
<Route
|
||||
path={url}
|
||||
path={`${url}/info`}
|
||||
exact
|
||||
component={() => <RepositoryDetails repository={repository} />}
|
||||
/>
|
||||
@@ -172,8 +179,13 @@ class RepositoryRoot extends React.Component<Props> {
|
||||
<div className="column">
|
||||
<Navigation>
|
||||
<Section label={t("repositoryRoot.menu.navigationLabel")}>
|
||||
<ExtensionPoint
|
||||
name="repository.navigation.topLevel"
|
||||
props={extensionProps}
|
||||
renderAll={true}
|
||||
/>
|
||||
<NavLink
|
||||
to={url}
|
||||
to={`${url}/info`}
|
||||
icon="fas fa-info-circle"
|
||||
label={t("repositoryRoot.menu.informationNavLink")}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user