added gitbranchinformation binding

This commit is contained in:
Florian Scholdei
2019-04-01 09:52:39 +02:00
parent 442e4c4889
commit bb5e3c9c58
7 changed files with 74 additions and 33 deletions

View File

@@ -8,11 +8,10 @@ type Props = {
repository: Repository,
// context props
t: (string) => string
t: string => string
};
class CloneInformation extends React.Component<Props> {
render() {
const { url, repository, t } = this.props;
@@ -51,7 +50,6 @@ class CloneInformation extends React.Component<Props> {
</div>
);
}
}
export default translate("plugins")(CloneInformation);

View File

@@ -0,0 +1,33 @@
//@flow
import React from "react";
import type { Repository } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
type Props = {
repository: Repository,
t: string => string
};
class GitBranchInformation extends React.Component<Props> {
render() {
const { repository, t } = this.props;
return (
<div>
<h4>{t("scm-git-plugin.information.fetch")}</h4>
<pre>
<code>git fetch</code>
</pre>
<h4>{t("scm-git-plugin.information.checkout")}</h4>
<pre>
<code>
git checkout -placeholder-
<br />
</code>
</pre>
</div>
); // TODO: Placeholder
}
}
export default translate("plugins")(GitBranchInformation);

View File

@@ -10,7 +10,7 @@ type Configuration = {
gcExpression?: string,
nonFastForwardDisallowed: boolean,
_links: Links
}
};
type Props = {
initialConfiguration: Configuration,
@@ -19,25 +19,24 @@ type Props = {
onConfigurationChange: (Configuration, boolean) => void,
// context props
t: (string) => string
}
t: string => string
};
type State = Configuration & {
}
type State = Configuration & {};
class GitConfigurationForm extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = { ...props.initialConfiguration };
}
handleChange = (value: any, name: string) => {
this.setState({
[name]: value
}, () => this.props.onConfigurationChange(this.state, true));
this.setState(
{
[name]: value
},
() => this.props.onConfigurationChange(this.state, true)
);
};
render() {
@@ -46,24 +45,25 @@ class GitConfigurationForm extends React.Component<Props, State> {
return (
<>
<InputField name="gcExpression"
label={t("scm-git-plugin.config.gcExpression")}
helpText={t("scm-git-plugin.config.gcExpressionHelpText")}
value={gcExpression}
onChange={this.handleChange}
disabled={readOnly}
<InputField
name="gcExpression"
label={t("scm-git-plugin.config.gcExpression")}
helpText={t("scm-git-plugin.config.gcExpressionHelpText")}
value={gcExpression}
onChange={this.handleChange}
disabled={readOnly}
/>
<Checkbox name="nonFastForwardDisallowed"
label={t("scm-git-plugin.config.nonFastForwardDisallowed")}
helpText={t("scm-git-plugin.config.nonFastForwardDisallowedHelpText")}
checked={nonFastForwardDisallowed}
onChange={this.handleChange}
disabled={readOnly}
<Checkbox
name="nonFastForwardDisallowed"
label={t("scm-git-plugin.config.nonFastForwardDisallowed")}
helpText={t("scm-git-plugin.config.nonFastForwardDisallowedHelpText")}
checked={nonFastForwardDisallowed}
onChange={this.handleChange}
disabled={readOnly}
/>
</>
);
}
}
export default translate("plugins")(GitConfigurationForm);

View File

@@ -6,6 +6,7 @@ import GitAvatar from "./GitAvatar";
import {ConfigurationBinder as cfgBinder} from "@scm-manager/ui-components";
import GitGlobalConfiguration from "./GitGlobalConfiguration";
import GitBranchInformation from "./GitBranchInformation";
import GitMergeInformation from "./GitMergeInformation";
import RepositoryConfig from "./RepositoryConfig";
@@ -20,6 +21,11 @@ binder.bind(
ProtocolInformation,
gitPredicate
);
binder.bind(
"repos.branch-details.information",
GitBranchInformation,
gitPredicate
);
binder.bind(
"repos.repository-merge.information",
GitMergeInformation,

View File

@@ -1,9 +1,11 @@
{
"scm-git-plugin": {
"information": {
"clone" : "Repository klonen",
"create" : "Neues Repository erstellen",
"replace" : "Ein bestehendes Repository aktualisieren",
"clone": "Repository klonen",
"create": "Neues Repository erstellen",
"replace": "Ein bestehendes Repository aktualisieren",
"fetch": "Remote-Änderungen herunterladen",
"checkout": "Branch wechseln",
"merge": {
"heading": "Merge des Source Branch in den Target Branch",
"checkout": "1. Sicherstellen, dass der Workspace aufgeräumt ist und der Target Branch ausgecheckt wurde.",
@@ -37,7 +39,7 @@
"success": "Der standard Branch wurde geändert!"
}
},
"permissions" : {
"permissions": {
"configuration": {
"read,write": {
"git": {

View File

@@ -4,6 +4,8 @@
"clone": "Clone the repository",
"create": "Create a new repository",
"replace": "Push an existing repository",
"fetch": "Get remote changes",
"checkout": "Switch branch",
"merge": {
"heading": "How to merge source branch into target branch",
"checkout": "1. Make sure your workspace is clean and checkout target branch",