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} disabled={!this.state.selectedBranchName}
/> />
</form> </form>
<hr />
</> </>
); );
} else { } else {

View File

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

View File

@@ -72,7 +72,7 @@ class ConfigurationBinder {
binder.bind("repository.route", RepoRoute, repoPredicate); 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 // 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 // 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"; } from "../modules/repos";
import type { History } from "history"; import type { History } from "history";
import { ErrorNotification } from "@scm-manager/ui-components"; import { ErrorNotification } from "@scm-manager/ui-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = { type Props = {
loading: boolean, loading: boolean,
@@ -25,7 +26,8 @@ type Props = {
// context props // context props
repository: Repository, repository: Repository,
history: History history: History,
match: any
}; };
class EditRepo extends React.Component<Props> { class EditRepo extends React.Component<Props> {
@@ -47,8 +49,27 @@ class EditRepo extends React.Component<Props> {
this.props.deleteRepo(repository, this.deleted); 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() { render() {
const { loading, error, repository } = this.props; const { loading, error, repository } = this.props;
const url = this.matchedUrl();
const extensionProps = {
repository,
url
};
return ( return (
<div> <div>
<ErrorNotification error={error} /> <ErrorNotification error={error} />
@@ -60,6 +81,11 @@ class EditRepo extends React.Component<Props> {
}} }}
/> />
<hr /> <hr />
<ExtensionPoint
name="repo-config.route"
props={extensionProps}
renderAll={true}
/>
<DeleteRepo repository={repository} delete={this.delete} /> <DeleteRepo repository={repository} delete={this.delete} />
</div> </div>
); );