add repository to source actionbar extensionPoint

This commit is contained in:
Eduard Heimbuch
2019-09-05 10:46:27 +02:00
parent 90d1236df2
commit b608ed4de2
2 changed files with 12 additions and 3 deletions

View File

@@ -1,13 +1,14 @@
//@flow //@flow
import React from "react"; import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import type { Branch } from "@scm-manager/ui-types"; import type { Branch, Repository } from "@scm-manager/ui-types";
import injectSheet from "react-jss"; import injectSheet from "react-jss";
import { ExtensionPoint, binder } from "@scm-manager/ui-extensions"; import { ExtensionPoint, binder } from "@scm-manager/ui-extensions";
import {ButtonGroup} from "./buttons"; import {ButtonGroup} from "./buttons";
import classNames from "classnames"; import classNames from "classnames";
type Props = { type Props = {
repository: Repository,
branch: Branch, branch: Branch,
defaultBranch: Branch, defaultBranch: Branch,
branches: Branch[], branches: Branch[],
@@ -63,7 +64,7 @@ class Breadcrumb extends React.Component<Props> {
} }
render() { render() {
const { classes, baseUrl, branch, defaultBranch, branches, revision, path } = this.props; const { classes, baseUrl, branch, defaultBranch, branches, revision, path, repository } = this.props;
return ( return (
<> <>
@@ -77,7 +78,14 @@ class Breadcrumb extends React.Component<Props> {
<ButtonGroup> <ButtonGroup>
<ExtensionPoint <ExtensionPoint
name="repos.sources.actionbar" name="repos.sources.actionbar"
props={{ baseUrl, branch: branch ? branch : defaultBranch, path, isBranchUrl: branches && branches.filter(b => b.name === revision).length > 0 }} props={{
baseUrl,
branch: branch ? branch : defaultBranch,
path,
isBranchUrl: branches &&
branches.filter(b => b.name.replace("/", "%2F") === revision).length > 0,
repository
}}
renderAll={true} renderAll={true}
/> />
</ButtonGroup> </ButtonGroup>

View File

@@ -157,6 +157,7 @@ class Sources extends React.Component<Props, State> {
branches && branches.filter(b => b.defaultBranch === true)[0] branches && branches.filter(b => b.defaultBranch === true)[0]
} }
branches={branches && branches} branches={branches && branches}
repository={repository}
/> />
<FileTree <FileTree
repository={repository} repository={repository}