mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
added extension point for default branch + renamed bindrepositorysetting
This commit is contained in:
@@ -127,6 +127,7 @@ class RepositoryConfig extends React.Component<Props, State> {
|
||||
disabled={!this.state.selectedBranchName}
|
||||
/>
|
||||
</form>
|
||||
<hr />
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user