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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
5c8f31eb
Commit
5c8f31eb
authored
May 09, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide merge request option in IDE when merge requests are disabled
Closes #45698
parent
1802954b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
...ets/javascripts/ide/components/commit_sidebar/actions.vue
+3
-1
changelogs/unreleased/ide-hide-merge-request-if-disabled.yml
changelogs/unreleased/ide-hide-merge-request-if-disabled.yml
+5
-0
spec/javascripts/ide/components/commit_sidebar/actions_spec.js
...javascripts/ide/components/commit_sidebar/actions_spec.js
+20
-0
spec/javascripts/ide/mock_data.js
spec/javascripts/ide/mock_data.js
+1
-0
No files found.
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
View file @
5c8f31eb
<
script
>
<
script
>
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
*
as
consts
from
'
../../stores/modules/commit/constants
'
;
import
*
as
consts
from
'
../../stores/modules/commit/constants
'
;
import
RadioGroup
from
'
./radio_group.vue
'
;
import
RadioGroup
from
'
./radio_group.vue
'
;
...
@@ -10,6 +10,7 @@ export default {
...
@@ -10,6 +10,7 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
'
currentBranchId
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapState
([
'
currentBranchId
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapGetters
([
'
currentProject
'
]),
commitToCurrentBranchText
()
{
commitToCurrentBranchText
()
{
return
sprintf
(
return
sprintf
(
__
(
'
Commit to %{branchName} branch
'
),
__
(
'
Commit to %{branchName} branch
'
),
...
@@ -52,6 +53,7 @@ export default {
...
@@ -52,6 +53,7 @@ export default {
:show-input=
"true"
:show-input=
"true"
/>
/>
<radio-group
<radio-group
v-if=
"currentProject.merge_requests_enabled"
:value=
"$options.commitToNewBranchMR"
:value=
"$options.commitToNewBranchMR"
:label=
"__('Create a new branch and merge request')"
:label=
"__('Create a new branch and merge request')"
:show-input=
"true"
:show-input=
"true"
...
...
changelogs/unreleased/ide-hide-merge-request-if-disabled.yml
0 → 100644
View file @
5c8f31eb
---
title
:
Hide merge request option in IDE when disabled
merge_request
:
author
:
type
:
changed
spec/javascripts/ide/components/commit_sidebar/actions_spec.js
View file @
5c8f31eb
...
@@ -3,6 +3,7 @@ import store from '~/ide/stores';
...
@@ -3,6 +3,7 @@ import store from '~/ide/stores';
import
commitActions
from
'
~/ide/components/commit_sidebar/actions.vue
'
;
import
commitActions
from
'
~/ide/components/commit_sidebar/actions.vue
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
resetStore
}
from
'
spec/ide/helpers
'
;
import
{
resetStore
}
from
'
spec/ide/helpers
'
;
import
{
projectData
}
from
'
spec/ide/mock_data
'
;
describe
(
'
IDE commit sidebar actions
'
,
()
=>
{
describe
(
'
IDE commit sidebar actions
'
,
()
=>
{
let
vm
;
let
vm
;
...
@@ -13,6 +14,10 @@ describe('IDE commit sidebar actions', () => {
...
@@ -13,6 +14,10 @@ describe('IDE commit sidebar actions', () => {
vm
=
createComponentWithStore
(
Component
,
store
);
vm
=
createComponentWithStore
(
Component
,
store
);
vm
.
$store
.
state
.
currentBranchId
=
'
master
'
;
vm
.
$store
.
state
.
currentBranchId
=
'
master
'
;
vm
.
$store
.
state
.
currentProjectId
=
'
abcproject
'
;
vm
.
$store
.
state
.
projects
.
abcproject
=
{
...
projectData
,
};
vm
.
$mount
();
vm
.
$mount
();
...
@@ -32,4 +37,19 @@ describe('IDE commit sidebar actions', () => {
...
@@ -32,4 +37,19 @@ describe('IDE commit sidebar actions', () => {
it
(
'
renders current branch text
'
,
()
=>
{
it
(
'
renders current branch text
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Commit to master branch
'
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Commit to master branch
'
);
});
});
it
(
'
hides merge request option when project merge requests are disabled
'
,
done
=>
{
vm
.
$destroy
();
vm
.
$store
.
state
.
projects
.
abcproject
.
merge_requests_enabled
=
false
;
vm
.
$mount
();
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
input[type="radio"]
'
).
length
).
toBe
(
2
);
expect
(
vm
.
$el
.
textContent
).
not
.
toContain
(
'
Create a new branch and merge request
'
);
done
();
});
});
});
});
spec/javascripts/ide/mock_data.js
View file @
5c8f31eb
...
@@ -12,4 +12,5 @@ export const projectData = {
...
@@ -12,4 +12,5 @@ export const projectData = {
},
},
},
},
mergeRequests
:
{},
mergeRequests
:
{},
merge_requests_enabled
:
true
,
};
};
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