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
Léo-Paul Géneau
gitlab-ce
Commits
0531631c
Commit
0531631c
authored
Jun 25, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable current branch option in commit form is user does not have permissions to push
parent
9b760c4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
...ets/javascripts/ide/components/commit_sidebar/actions.vue
+11
-3
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
...javascripts/ide/components/commit_sidebar/radio_group.vue
+6
-4
app/assets/javascripts/ide/stores/getters.js
app/assets/javascripts/ide/stores/getters.js
+4
-1
No files found.
app/assets/javascripts/ide/components/commit_sidebar/actions.vue
View file @
0531631c
...
@@ -10,7 +10,7 @@ export default {
...
@@ -10,7 +10,7 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
'
currentBranchId
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapState
([
'
currentBranchId
'
,
'
changedFiles
'
,
'
stagedFiles
'
]),
...
mapGetters
([
'
currentProject
'
]),
...
mapGetters
([
'
currentProject
'
,
'
currentBranch
'
]),
commitToCurrentBranchText
()
{
commitToCurrentBranchText
()
{
return
sprintf
(
return
sprintf
(
__
(
'
Commit to %{branchName} branch
'
),
__
(
'
Commit to %{branchName} branch
'
),
...
@@ -23,7 +23,9 @@ export default {
...
@@ -23,7 +23,9 @@ export default {
},
},
},
},
mounted
()
{
mounted
()
{
if
(
this
.
disableMergeRequestRadio
)
{
if
(
!
this
.
currentBranch
.
can_push
)
{
this
.
updateCommitAction
(
consts
.
COMMIT_TO_NEW_BRANCH
);
}
else
if
(
this
.
disableMergeRequestRadio
)
{
this
.
updateCommitAction
(
consts
.
COMMIT_TO_CURRENT_BRANCH
);
this
.
updateCommitAction
(
consts
.
COMMIT_TO_CURRENT_BRANCH
);
}
}
},
},
...
@@ -33,6 +35,9 @@ export default {
...
@@ -33,6 +35,9 @@ export default {
commitToCurrentBranch
:
consts
.
COMMIT_TO_CURRENT_BRANCH
,
commitToCurrentBranch
:
consts
.
COMMIT_TO_CURRENT_BRANCH
,
commitToNewBranch
:
consts
.
COMMIT_TO_NEW_BRANCH
,
commitToNewBranch
:
consts
.
COMMIT_TO_NEW_BRANCH
,
commitToNewBranchMR
:
consts
.
COMMIT_TO_NEW_BRANCH_MR
,
commitToNewBranchMR
:
consts
.
COMMIT_TO_NEW_BRANCH_MR
,
currentBranchPermissionsTooltip
:
__
(
"
This option is disabled as you don't have write permissions for the current branch
"
,
),
};
};
</
script
>
</
script
>
...
@@ -40,10 +45,12 @@ export default {
...
@@ -40,10 +45,12 @@ export default {
<div
class=
"append-bottom-15 ide-commit-radios"
>
<div
class=
"append-bottom-15 ide-commit-radios"
>
<radio-group
<radio-group
:value=
"$options.commitToCurrentBranch"
:value=
"$options.commitToCurrentBranch"
:checked=
"true"
:disabled=
"!currentBranch.can_push"
:title=
"$options.currentBranchPermissionsTooltip"
>
>
<span
<span
v-html=
"commitToCurrentBranchText"
v-html=
"commitToCurrentBranchText"
class=
"ide-radio-label"
>
>
</span>
</span>
</radio-group>
</radio-group>
...
@@ -56,6 +63,7 @@ export default {
...
@@ -56,6 +63,7 @@ export default {
v-if=
"currentProject.merge_requests_enabled"
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')"
:title=
"__('This option is disabled while you still have unstaged changes')"
:show-input=
"true"
:show-input=
"true"
:disabled=
"disableMergeRequestRadio"
:disabled=
"disableMergeRequestRadio"
/>
/>
...
...
app/assets/javascripts/ide/components/commit_sidebar/radio_group.vue
View file @
0531631c
<
script
>
<
script
>
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
,
mapGetters
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
import
tooltip
from
'
~/vue_shared/directives/tooltip
'
;
export
default
{
export
default
{
...
@@ -32,14 +31,17 @@ export default {
...
@@ -32,14 +31,17 @@ export default {
required
:
false
,
required
:
false
,
default
:
false
,
default
:
false
,
},
},
title
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
},
},
computed
:
{
computed
:
{
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
...
mapState
(
'
commit
'
,
[
'
commitAction
'
]),
...
mapGetters
(
'
commit
'
,
[
'
newBranchName
'
]),
...
mapGetters
(
'
commit
'
,
[
'
newBranchName
'
]),
tooltipTitle
()
{
tooltipTitle
()
{
return
this
.
disabled
return
this
.
disabled
?
this
.
title
:
''
;
?
__
(
'
This option is disabled while you still have unstaged changes
'
)
:
''
;
},
},
},
},
methods
:
{
methods
:
{
...
...
app/assets/javascripts/ide/stores/getters.js
View file @
0531631c
...
@@ -82,10 +82,13 @@ export const getStagedFilesCountForPath = state => path =>
...
@@ -82,10 +82,13 @@ export const getStagedFilesCountForPath = state => path =>
getChangesCountForFiles
(
state
.
stagedFiles
,
path
);
getChangesCountForFiles
(
state
.
stagedFiles
,
path
);
export
const
lastCommit
=
(
state
,
getters
)
=>
{
export
const
lastCommit
=
(
state
,
getters
)
=>
{
const
branch
=
getters
.
currentProject
&&
getters
.
current
Project
.
branches
[
state
.
currentBranchId
]
;
const
branch
=
getters
.
currentProject
&&
getters
.
current
Branch
;
return
branch
?
branch
.
commit
:
null
;
return
branch
?
branch
.
commit
:
null
;
};
};
export
const
currentBranch
=
(
state
,
getters
)
=>
getters
.
currentProject
.
branches
[
state
.
currentBranchId
];
// prevent babel-plugin-rewire from generating an invalid default during karma tests
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
export
default
()
=>
{};
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