Merged in bugfix/branch_error_messages (pull request #363)

show error messages on failed branch creation
This commit is contained in:
Rene Pfeuffer
2019-11-25 12:12:47 +00:00
3 changed files with 6 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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);
});
});
});

View File

@@ -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 {