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
6238ad70
Commit
6238ad70
authored
Mar 25, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
0260da25
d64452eb
Changes
6
Hide 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 @
6238ad70
...
...
@@ -38,8 +38,8 @@ export default {
},
},
computed
:
{
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
...
mapGetters
(
'
commit
'
,
[
'
new
BranchName
'
]),
...
mapState
(
'
commit
'
,
[
'
commitAction
'
,
'
newBranchName
'
]),
...
mapGetters
(
'
commit
'
,
[
'
placeholder
BranchName
'
]),
tooltipTitle
()
{
return
this
.
disabled
?
this
.
title
:
''
;
},
...
...
@@ -73,7 +73,8 @@ export default {
</label>
<div
v-if=
"commitAction === value && showInput"
class=
"ide-commit-new-branch"
>
<input
:placeholder=
"newBranchName"
:placeholder=
"placeholderBranchName"
:value=
"newBranchName"
type=
"text"
class=
"form-control monospace"
@
input=
"updateBranchName($event.target.value)"
...
...
app/assets/javascripts/ide/stores/modules/commit/getters.js
View file @
6238ad70
...
...
@@ -14,7 +14,7 @@ const createTranslatedTextForFiles = (files, text) => {
export
const
discardDraftButtonDisabled
=
state
=>
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
(
-
BRANCH_SUFFIX_COUNT
,
)}
`
;
...
...
@@ -25,7 +25,7 @@ export const branchName = (state, getters, rootState) => {
state
.
commitAction
===
consts
.
COMMIT_TO_NEW_BRANCH_MR
)
{
if
(
state
.
newBranchName
===
''
)
{
return
getters
.
new
BranchName
;
return
getters
.
placeholder
BranchName
;
}
return
state
.
newBranchName
;
...
...
changelogs/unreleased/57984-store-branch-name.yml
0 → 100644
View file @
6238ad70
---
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 @
6238ad70
...
...
@@ -76,6 +76,7 @@ describe('IDE commit sidebar radio group', () => {
const
Component
=
Vue
.
extend
(
radioGroup
);
store
.
state
.
commit
.
commitAction
=
'
1
'
;
store
.
state
.
commit
.
newBranchName
=
'
test-123
'
;
vm
=
createComponentWithStore
(
Component
,
store
,
{
value
:
'
1
'
,
...
...
@@ -113,6 +114,12 @@ describe('IDE commit sidebar radio group', () => {
done
();
});
});
it
(
'
renders newBranchName if present
'
,
()
=>
{
const
input
=
vm
.
$el
.
querySelector
(
'
.form-control
'
);
expect
(
input
.
value
).
toBe
(
'
test-123
'
);
});
});
describe
(
'
tooltipTitle
'
,
()
=>
{
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
6238ad70
...
...
@@ -396,7 +396,7 @@ describe('IDE commit module actions', () => {
.
then
(()
=>
{
expect
(
visitUrl
).
toHaveBeenCalledWith
(
`webUrl/merge_requests/new?merge_request[source_branch]=
${
store
.
getters
[
'
commit/
new
BranchName
'
]
store
.
getters
[
'
commit/
placeholder
BranchName
'
]
}
&merge_request[target_branch]=master`
,
);
...
...
spec/javascripts/ide/stores/modules/commit/getters_spec.js
View file @
6238ad70
...
...
@@ -29,11 +29,11 @@ describe('IDE commit module getters', () => {
});
});
describe
(
'
new
BranchName
'
,
()
=>
{
describe
(
'
placeholder
BranchName
'
,
()
=>
{
it
(
'
includes username, currentBranchId, patch & random number
'
,
()
=>
{
gon
.
current_username
=
'
username
'
;
const
branch
=
getters
.
new
BranchName
(
state
,
null
,
{
const
branch
=
getters
.
placeholder
BranchName
(
state
,
null
,
{
currentBranchId
:
'
testing
'
,
});
...
...
@@ -46,7 +46,7 @@ describe('IDE commit module getters', () => {
currentBranchId
:
'
master
'
,
};
const
localGetters
=
{
new
BranchName
:
'
newBranchName
'
,
placeholder
BranchName
:
'
newBranchName
'
,
};
beforeEach
(()
=>
{
...
...
@@ -71,7 +71,7 @@ describe('IDE commit module getters', () => {
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
,
{
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