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
import React from "react";
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 { ExtensionPoint, binder } from "@scm-manager/ui-extensions";
import {ButtonGroup} from "./buttons";
import classNames from "classnames";
type Props = {
repository: Repository,
branch: Branch,
defaultBranch: Branch,
branches: Branch[],
@@ -63,7 +64,7 @@ class Breadcrumb extends React.Component<Props> {
}
render() {
const { classes, baseUrl, branch, defaultBranch, branches, revision, path } = this.props;
const { classes, baseUrl, branch, defaultBranch, branches, revision, path, repository } = this.props;
return (
<>
@@ -77,7 +78,14 @@ class Breadcrumb extends React.Component<Props> {
<ButtonGroup>
<ExtensionPoint
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}
/>
</ButtonGroup>

View File

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