From f2d92c49d1518a29dce20eea6acea9fa916ec298 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 25 Nov 2019 11:37:23 +0100 Subject: [PATCH 1/3] show error messages on failed branch creation --- .../ui-webapp/src/repos/branches/containers/CreateBranch.tsx | 2 +- scm-ui/ui-webapp/src/repos/branches/modules/branches.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scm-ui/ui-webapp/src/repos/branches/containers/CreateBranch.tsx b/scm-ui/ui-webapp/src/repos/branches/containers/CreateBranch.tsx index 8ae8640c62..36fe6746e3 100644 --- a/scm-ui/ui-webapp/src/repos/branches/containers/CreateBranch.tsx +++ b/scm-ui/ui-webapp/src/repos/branches/containers/CreateBranch.tsx @@ -114,7 +114,7 @@ const mapDispatchToProps = dispatch => { const mapStateToProps = (state, ownProps) => { const { repository } = ownProps; const loading = isFetchBranchesPending(state, repository) || isCreateBranchPending(state, repository); - const error = getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state); + const error = getFetchBranchesFailure(state, repository) || getCreateBranchFailure(state, repository); const branches = getBranches(state, repository); const createBranchesLink = getBranchCreateLink(state, repository); return { diff --git a/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts b/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts index 35c55aec42..a58f43c4c7 100644 --- a/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts +++ b/scm-ui/ui-webapp/src/repos/branches/modules/branches.ts @@ -186,8 +186,8 @@ export function isCreateBranchPending(state: object, repository: Repository) { return isPending(state, CREATE_BRANCH, createKey(repository)); } -export function getCreateBranchFailure(state: object) { - return getFailure(state, CREATE_BRANCH); +export function getCreateBranchFailure(state: object, repository: Repository) { + return getFailure(state, CREATE_BRANCH, createKey(repository)); } export function createBranchPending(repository: Repository): Action { From 47fc883cab43f74f81361865014ba5b3c2cdd3e7 Mon Sep 17 00:00:00 2001 From: Eduard Heimbuch Date: Mon, 25 Nov 2019 12:24:54 +0100 Subject: [PATCH 2/3] fix unit tests --- .../ui-webapp/src/repos/branches/modules/branches.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scm-ui/ui-webapp/src/repos/branches/modules/branches.test.ts b/scm-ui/ui-webapp/src/repos/branches/modules/branches.test.ts index 2003477101..b23ccc640b 100644 --- a/scm-ui/ui-webapp/src/repos/branches/modules/branches.test.ts +++ b/scm-ui/ui-webapp/src/repos/branches/modules/branches.test.ts @@ -482,14 +482,14 @@ describe("branches", () => { it("should return error when create branch did fail", () => { const state = { failure: { - [CREATE_BRANCH]: error + [CREATE_BRANCH + `/${repository.namespace}/${repository.name}`]: error } }; - expect(getCreateBranchFailure(state)).toEqual(error); + expect(getCreateBranchFailure(state, repository)).toEqual(error); }); it("should return undefined when create branch did not fail", () => { - expect(getCreateBranchFailure({})).toBe(undefined); + expect(getCreateBranchFailure({}, repository)).toBe(undefined); }); }); }); From 34ab9104f21cc9c6f11e20fc01203a13dfa18d46 Mon Sep 17 00:00:00 2001 From: Rene Pfeuffer Date: Mon, 25 Nov 2019 12:12:47 +0000 Subject: [PATCH 3/3] Close branch bugfix/branch_error_messages