added extension point for default branch + renamed bindrepositorysetting

This commit is contained in:
Florian Scholdei
2019-02-06 09:51:31 +01:00
parent 7baea043c1
commit 1c0f417f9a
4 changed files with 31 additions and 9 deletions

View File

@@ -127,6 +127,7 @@ class RepositoryConfig extends React.Component<Props, State> {
disabled={!this.state.selectedBranchName}
/>
</form>
<hr />
</>
);
} else {

View File

@@ -27,14 +27,9 @@ binder.bind(
);
binder.bind("repos.repository-avatar", GitAvatar, gitPredicate);
cfgBinder.bindRepositorySub(
"/configuration",
"scm-git-plugin.repo-config.link",
"configuration",
RepositoryConfig
);
// global config
binder.bind("repo-config.route", RepositoryConfig, gitPredicate);
// global config
cfgBinder.bindGlobal(
"/git",
"scm-git-plugin.config.link",

View File

@@ -72,7 +72,7 @@ class ConfigurationBinder {
binder.bind("repository.route", RepoRoute, repoPredicate);
}
bindRepositorySub(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any) {
bindRepositorySetting(to: string, labelI18nKey: string, linkName: string, RepositoryComponent: any) {
// create predicate based on the link name of the current repository route
// if the linkname is not available, the navigation link and the route are not bound to the extension points

View File

@@ -14,6 +14,7 @@ import {
} from "../modules/repos";
import type { History } from "history";
import { ErrorNotification } from "@scm-manager/ui-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = {
loading: boolean,
@@ -25,7 +26,8 @@ type Props = {
// context props
repository: Repository,
history: History
history: History,
match: any
};
class EditRepo extends React.Component<Props> {
@@ -47,8 +49,27 @@ class EditRepo extends React.Component<Props> {
this.props.deleteRepo(repository, this.deleted);
};
stripEndingSlash = (url: string) => {
if (url.endsWith("/")) {
return url.substring(0, url.length - 2);
}
return url;
};
matchedUrl = () => {
return this.stripEndingSlash(this.props.match.url);
};
render() {
const { loading, error, repository } = this.props;
const url = this.matchedUrl();
const extensionProps = {
repository,
url
};
return (
<div>
<ErrorNotification error={error} />
@@ -60,6 +81,11 @@ class EditRepo extends React.Component<Props> {
}}
/>
<hr />
<ExtensionPoint
name="repo-config.route"
props={extensionProps}
renderAll={true}
/>
<DeleteRepo repository={repository} delete={this.delete} />
</div>
);