mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
Use transmitted branch name
This commit is contained in:
@@ -30,7 +30,8 @@ class BranchForm extends React.Component<Props, State> {
|
|||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
nameValidationError: false
|
nameValidationError: false,
|
||||||
|
name: props.transmittedName
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ class BranchForm extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { t, branches, loading } = this.props;
|
const { t, branches, loading, transmittedName } = this.props;
|
||||||
const { name } = this.state;
|
const { name } = this.state;
|
||||||
orderBranches(branches);
|
orderBranches(branches);
|
||||||
const options = branches.map(branch => ({
|
const options = branches.map(branch => ({
|
||||||
@@ -82,6 +83,7 @@ class BranchForm extends React.Component<Props, State> {
|
|||||||
value={name ? name : ""}
|
value={name ? name : ""}
|
||||||
validationError={this.state.nameValidationError}
|
validationError={this.state.nameValidationError}
|
||||||
errorMessage={t("validation.branch.nameInvalid")}
|
errorMessage={t("validation.branch.nameInvalid")}
|
||||||
|
disabled={!!transmittedName}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class CreateBranch extends React.Component<Props> {
|
|||||||
this.props.createBranch(branch, () => this.branchCreated(branch));
|
this.props.createBranch(branch, () => this.branchCreated(branch));
|
||||||
};
|
};
|
||||||
|
|
||||||
matchesTransmittedName = (url: string) => {
|
transmittedName = (url: string) => {
|
||||||
const params = queryString.parse(url);
|
const params = queryString.parse(url);
|
||||||
return params.name;
|
return params.name;
|
||||||
};
|
};
|
||||||
@@ -68,7 +68,7 @@ class CreateBranch extends React.Component<Props> {
|
|||||||
return <ErrorNotification error={error} />;
|
return <ErrorNotification error={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!branches) {
|
if (loading || !branches) {
|
||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ class CreateBranch extends React.Component<Props> {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
repository={repository}
|
repository={repository}
|
||||||
branches={branches}
|
branches={branches}
|
||||||
transmittedName={this.matchesTransmittedName(location.search)}
|
transmittedName={this.transmittedName(location.search)}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@@ -107,8 +107,7 @@ const mapDispatchToProps = dispatch => {
|
|||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
const { repository } = ownProps;
|
const { repository } = ownProps;
|
||||||
const loading =
|
const loading = isFetchBranchesPending(state, repository); //|| isCreateBranchPending(state);
|
||||||
isFetchBranchesPending(state, repository) || isCreateBranchPending(state);
|
|
||||||
const error =
|
const error =
|
||||||
getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state);
|
getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state);
|
||||||
const branches = getBranches(state, repository);
|
const branches = getBranches(state, repository);
|
||||||
|
|||||||
Reference in New Issue
Block a user