mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
Merged in feature/additionalPropsToExtensionBranchWp (pull request #174)
ConfigurationBinder can now pass additional props to extensions
This commit is contained in:
@@ -36,9 +36,9 @@ class ConfigurationBinder {
|
|||||||
binder.bind("config.navigation", ConfigNavLink, configPredicate);
|
binder.bind("config.navigation", ConfigNavLink, configPredicate);
|
||||||
|
|
||||||
// route for global configuration, passes the link from the index resource to component
|
// route for global configuration, passes the link from the index resource to component
|
||||||
const ConfigRoute = ({ url, links }) => {
|
const ConfigRoute = ({ url, links, ...additionalProps }) => {
|
||||||
const link = links[linkName].href;
|
const link = links[linkName].href;
|
||||||
return this.route(url + to, <ConfigurationComponent link={link}/>);
|
return this.route(url + to, <ConfigurationComponent link={link} {...additionalProps} />);
|
||||||
};
|
};
|
||||||
|
|
||||||
// bind config route to extension point
|
// bind config route to extension point
|
||||||
@@ -63,9 +63,9 @@ class ConfigurationBinder {
|
|||||||
|
|
||||||
|
|
||||||
// route for global configuration, passes the current repository to component
|
// route for global configuration, passes the current repository to component
|
||||||
const RepoRoute = ({url, repository}) => {
|
const RepoRoute = ({url, repository, ...additionalProps}) => {
|
||||||
const link = repository._links[linkName].href
|
const link = repository._links[linkName].href;
|
||||||
return this.route(url + to, <RepositoryComponent repository={repository} link={link}/>);
|
return this.route(url + to, <RepositoryComponent repository={repository} link={link} {...additionalProps}/>);
|
||||||
};
|
};
|
||||||
|
|
||||||
// bind config route to extension point
|
// bind config route to extension point
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import ChangesetView from "./ChangesetView";
|
|||||||
import PermissionsNavLink from "../components/PermissionsNavLink";
|
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 {getRepositoriesLink} from "../../modules/indexResource";
|
import {getLinks, getRepositoriesLink} from "../../modules/indexResource";
|
||||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -31,6 +31,7 @@ type Props = {
|
|||||||
loading: boolean,
|
loading: boolean,
|
||||||
error: Error,
|
error: Error,
|
||||||
repoLink: string,
|
repoLink: string,
|
||||||
|
indexLinks: Object,
|
||||||
|
|
||||||
// dispatch functions
|
// dispatch functions
|
||||||
fetchRepoByName: (link: string, namespace: string, name: string) => void,
|
fetchRepoByName: (link: string, namespace: string, name: string) => void,
|
||||||
@@ -75,7 +76,7 @@ class RepositoryRoot extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading, error, repository, t } = this.props;
|
const { loading, error, indexLinks, repository, t } = this.props;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
@@ -95,7 +96,8 @@ class RepositoryRoot extends React.Component<Props> {
|
|||||||
|
|
||||||
const extensionProps = {
|
const extensionProps = {
|
||||||
repository,
|
repository,
|
||||||
url
|
url,
|
||||||
|
indexLinks
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -216,13 +218,15 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
const loading = isFetchRepoPending(state, namespace, name);
|
const loading = isFetchRepoPending(state, namespace, name);
|
||||||
const error = getFetchRepoFailure(state, namespace, name);
|
const error = getFetchRepoFailure(state, namespace, name);
|
||||||
const repoLink = getRepositoriesLink(state);
|
const repoLink = getRepositoriesLink(state);
|
||||||
|
const indexLinks = getLinks(state);
|
||||||
return {
|
return {
|
||||||
namespace,
|
namespace,
|
||||||
name,
|
name,
|
||||||
repository,
|
repository,
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
repoLink
|
repoLink,
|
||||||
|
indexLinks
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user