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