Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a72241f4
Commit
a72241f4
authored
Mar 25, 2019
by
Natalia Tepluhina
Committed by
Phil Hughes
Mar 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed commit logic to pick a branch
- fixed getter spec with correct getter name
parent
9e98ccf1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
10 deletions
+23
-10
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
...javascripts/ide/components/commit_sidebar/radio_group.vue
+4
-3
app/assets/javascripts/ide/stores/modules/commit/getters.js
app/assets/javascripts/ide/stores/modules/commit/getters.js
+2
-2
changelogs/unreleased/57984-store-branch-name.yml
changelogs/unreleased/57984-store-branch-name.yml
+5
-0
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
...scripts/ide/components/commit_sidebar/radio_group_spec.js
+7
-0
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+1
-1
spec/javascripts/ide/stores/modules/commit/getters_spec.js
spec/javascripts/ide/stores/modules/commit/getters_spec.js
+4
-4
No files found.
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
View file @
a72241f4
...
@@ -38,8 +38,8 @@ export default {
...
@@ -38,8 +38,8 @@ export default {
},
},
},
},
computed
:
{
computed
:
{
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
...
mapState
(
'
commit
'
,
[
'
commitAction
'
,
'
newBranchName
'
]),
...
mapGetters
(
'
commit
'
,
[
'
new
BranchName
'
]),
...
mapGetters
(
'
commit
'
,
[
'
placeholder
BranchName
'
]),
tooltipTitle
()
{
tooltipTitle
()
{
return
this
.
disabled
?
this
.
title
:
''
;
return
this
.
disabled
?
this
.
title
:
''
;
},
},
...
@@ -73,7 +73,8 @@ export default {
...
@@ -73,7 +73,8 @@ export default {
</label>
</label>
<div
v-if=
"commitAction === value && showInput"
class=
"ide-commit-new-branch"
>
<div
v-if=
"commitAction === value && showInput"
class=
"ide-commit-new-branch"
>
<input
<input
:placeholder=
"newBranchName"
:placeholder=
"placeholderBranchName"
:value=
"newBranchName"
type=
"text"
type=
"text"
class=
"form-control monospace"
class=
"form-control monospace"
@
input=
"updateBranchName($event.target.value)"
@
input=
"updateBranchName($event.target.value)"
...
...
app/assets/javascripts/ide/stores/modules/commit/getters.js
View file @
a72241f4
...
@@ -14,7 +14,7 @@ const createTranslatedTextForFiles = (files, text) => {
...
@@ -14,7 +14,7 @@ const createTranslatedTextForFiles = (files, text) => {
export
const
discardDraftButtonDisabled
=
state
=>
export
const
discardDraftButtonDisabled
=
state
=>
state
.
commitMessage
===
''
||
state
.
submitCommitLoading
;
state
.
commitMessage
===
''
||
state
.
submitCommitLoading
;
export
const
new
BranchName
=
(
state
,
_
,
rootState
)
=>
export
const
placeholder
BranchName
=
(
state
,
_
,
rootState
)
=>
`
${
gon
.
current_username
}
-
${
rootState
.
currentBranchId
}
-patch-
${
`
${
new
Date
().
getTime
()}
`
.
substr
(
`
${
gon
.
current_username
}
-
${
rootState
.
currentBranchId
}
-patch-
${
`
${
new
Date
().
getTime
()}
`
.
substr
(
-
BRANCH_SUFFIX_COUNT
,
-
BRANCH_SUFFIX_COUNT
,
)}
`
;
)}
`
;
...
@@ -25,7 +25,7 @@ export const branchName = (state, getters, rootState) => {
...
@@ -25,7 +25,7 @@ export const branchName = (state, getters, rootState) => {
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH_MR
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH_MR
)
{
)
{
if
(
state
.
newBranchName
===
''
)
{
if
(
state
.
newBranchName
===
''
)
{
return
getters
.
new
BranchName
;
return
getters
.
placeholder
BranchName
;
}
}
return
state
.
newBranchName
;
return
state
.
newBranchName
;
...
...
changelogs/unreleased/57984-store-branch-name.yml
0 → 100644
View file @
a72241f4
---
title
:
Resolves Branch name is lost if I change commit mode in Web IDE
merge_request
:
26180
author
:
type
:
fixed
spec/javascripts/ide/components/commit_sidebar/radio_group_spec.js
View file @
a72241f4
...
@@ -76,6 +76,7 @@ describe('IDE commit sidebar radio group', () => {
...
@@ -76,6 +76,7 @@ describe('IDE commit sidebar radio group', () => {
const
Component
=
Vue
.
extend
(
radioGroup
);
const
Component
=
Vue
.
extend
(
radioGroup
);
store
.
state
.
commit
.
commitAction
=
'
1
'
;
store
.
state
.
commit
.
commitAction
=
'
1
'
;
store
.
state
.
commit
.
newBranchName
=
'
test-123
'
;
vm
=
createComponentWithStore
(
Component
,
store
,
{
vm
=
createComponentWithStore
(
Component
,
store
,
{
value
:
'
1
'
,
value
:
'
1
'
,
...
@@ -113,6 +114,12 @@ describe('IDE commit sidebar radio group', () => {
...
@@ -113,6 +114,12 @@ describe('IDE commit sidebar radio group', () => {
done
();
done
();
});
});
});
});
it
(
'
renders newBranchName if present
'
,
()
=>
{
const
input
=
vm
.
$el
.
querySelector
(
'
.form-control
'
);
expect
(
input
.
value
).
toBe
(
'
test-123
'
);
});
});
});
describe
(
'
tooltipTitle
'
,
()
=>
{
describe
(
'
tooltipTitle
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
a72241f4
...
@@ -396,7 +396,7 @@ describe('IDE commit module actions', () => {
...
@@ -396,7 +396,7 @@ describe('IDE commit module actions', () => {
.
then
(()
=>
{
.
then
(()
=>
{
expect
(
visitUrl
).
toHaveBeenCalledWith
(
expect
(
visitUrl
).
toHaveBeenCalledWith
(
`webUrl/merge_requests/new?merge_request[source_branch]=
${
`webUrl/merge_requests/new?merge_request[source_branch]=
${
store
.
getters
[
'
commit/
new
BranchName
'
]
store
.
getters
[
'
commit/
placeholder
BranchName
'
]
}
&merge_request[target_branch]=master`
,
}
&merge_request[target_branch]=master`
,
);
);
...
...
spec/javascripts/ide/stores/modules/commit/getters_spec.js
View file @
a72241f4
...
@@ -29,11 +29,11 @@ describe('IDE commit module getters', () => {
...
@@ -29,11 +29,11 @@ describe('IDE commit module getters', () => {
});
});
});
});
describe
(
'
new
BranchName
'
,
()
=>
{
describe
(
'
placeholder
BranchName
'
,
()
=>
{
it
(
'
includes username, currentBranchId, patch & random number
'
,
()
=>
{
it
(
'
includes username, currentBranchId, patch & random number
'
,
()
=>
{
gon
.
current_username
=
'
username
'
;
gon
.
current_username
=
'
username
'
;
const
branch
=
getters
.
new
BranchName
(
state
,
null
,
{
const
branch
=
getters
.
placeholder
BranchName
(
state
,
null
,
{
currentBranchId
:
'
testing
'
,
currentBranchId
:
'
testing
'
,
});
});
...
@@ -46,7 +46,7 @@ describe('IDE commit module getters', () => {
...
@@ -46,7 +46,7 @@ describe('IDE commit module getters', () => {
currentBranchId
:
'
master
'
,
currentBranchId
:
'
master
'
,
};
};
const
localGetters
=
{
const
localGetters
=
{
new
BranchName
:
'
newBranchName
'
,
placeholder
BranchName
:
'
newBranchName
'
,
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
...
@@ -71,7 +71,7 @@ describe('IDE commit module getters', () => {
...
@@ -71,7 +71,7 @@ describe('IDE commit module getters', () => {
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
state-newBranchName
'
);
expect
(
getters
.
branchName
(
state
,
localGetters
,
rootState
)).
toBe
(
'
state-newBranchName
'
);
});
});
it
(
'
uses
getters new
BranchName when state newBranchName is empty
'
,
()
=>
{
it
(
'
uses
placeholder
BranchName when state newBranchName is empty
'
,
()
=>
{
Object
.
assign
(
state
,
{
Object
.
assign
(
state
,
{
newBranchName
:
''
,
newBranchName
:
''
,
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment