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
129dd185
Commit
129dd185
authored
May 03, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added merge request to IDE sidebar
#44846
parent
9b8332d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
68 deletions
+51
-68
app/assets/javascripts/ide/components/editor_mode_dropdown.vue
...ssets/javascripts/ide/components/editor_mode_dropdown.vue
+11
-64
app/assets/javascripts/ide/components/ide_review.vue
app/assets/javascripts/ide/components/ide_review.vue
+38
-3
app/assets/javascripts/ide/ide_router.js
app/assets/javascripts/ide/ide_router.js
+2
-1
No files found.
app/assets/javascripts/ide/components/editor_mode_dropdown.vue
View file @
129dd185
<
script
>
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
export
default
{
components
:
{
Icon
,
},
props
:
{
hasChanges
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
mergeRequestId
:
{
type
:
String
,
required
:
false
,
default
:
''
,
},
viewer
:
{
type
:
String
,
required
:
true
,
},
showShadow
:
{
type
:
Boolean
,
mergeRequestId
:
{
type
:
Number
,
required
:
true
,
},
},
...
...
@@ -44,69 +30,30 @@ export default {
<
template
>
<div
class=
"dropdown"
:class=
"
{
shadow: showShadow,
}"
style=
"margin-left:auto;"
>
<button
type=
"button"
class=
"btn btn-primary btn-sm"
:class=
"
{
'btn-inverted': hasChanges,
}"
class=
"btn btn-link"
data-toggle=
"dropdown"
>
<template
v-if=
"viewer === 'mrdiff' && mergeRequestId"
>
{{
mergeReviewLine
}}
</
template
>
<
template
v-else-if=
"viewer === 'editor'"
>
{{
__
(
'
Editing
'
)
}}
</
template
>
<
template
v-else
>
{{
__
(
'
Reviewing
'
)
}}
</
template
>
<icon
name=
"angle-down"
:size=
"12"
css-classes=
"caret-down"
/>
Edit
</button>
<div
class=
"dropdown-menu dropdown-menu-selectable dropdown-open-left"
>
<ul>
<
template
v-if=
"mergeRequestId"
>
<li>
<a
href=
"#"
@
click.prevent=
"changeMode('mrdiff')"
:class=
"
{
'is-active': viewer === 'mrdiff',
}"
>
<strong
class=
"dropdown-menu-inner-title"
>
{{
mergeReviewLine
}}
</strong>
<span
class=
"dropdown-menu-inner-content"
>
{{
__
(
'
Compare changes with the merge request target branch
'
)
}}
</span>
</a>
</li>
<li
role=
"separator"
class=
"divider"
>
</li>
</
template
>
<li>
<a
href=
"#"
@
click.prevent=
"changeMode('
editor
')"
@
click.prevent=
"changeMode('
mrdiff
')"
:class=
"
{
'is-active': viewer === '
editor
',
'is-active': viewer === '
mrdiff
',
}"
>
<strong
class=
"dropdown-menu-inner-title"
>
{{ __('Editing') }}
</strong>
<strong
class=
"dropdown-menu-inner-title"
>
{{
mergeReviewLine
}}
</strong>
<span
class=
"dropdown-menu-inner-content"
>
{{ __('
View and edit lines
') }}
{{
__
(
'
Compare changes with the merge request target branch
'
)
}}
</span>
</a>
</li>
...
...
app/assets/javascripts/ide/components/ide_review.vue
View file @
129dd185
<
script
>
import
{
mapGetters
,
mapState
,
mapActions
}
from
'
vuex
'
;
import
IdeTreeList
from
'
./ide_tree_list.vue
'
;
import
EditorModeDropdown
from
'
./editor_mode_dropdown.vue
'
;
export
default
{
components
:
{
IdeTreeList
,
EditorModeDropdown
,
},
computed
:
{
...
mapGetters
([
'
currentMergeRequest
'
]),
...
mapState
([
'
viewer
'
]),
},
mounted
()
{
this
.
updateViewer
(
this
.
currentMergeRequest
?
'
mrdiff
'
:
'
diff
'
);
},
methods
:
{
...
mapActions
([
'
updateViewer
'
]),
},
};
</
script
>
<
template
>
<ide-tree-list
viewer-type=
"diff
"
:viewer-type=
"viewer
"
header-class=
"ide-review-header"
:disable-action-dropdown=
"true"
>
<template
slot=
"header"
>
{{
__
(
'
Review
'
)
}}
<div
class=
"ide-review-button-holder"
>
{{
__
(
'
Review
'
)
}}
<editor-mode-dropdown
v-if=
"currentMergeRequest"
:viewer=
"viewer"
:merge-request-id=
"currentMergeRequest.iid"
@
click=
"updateViewer"
/>
</div>
<div
class=
"prepend-top-5 ide-review-sub-header"
>
{{
__
(
'
Lastest changes
'
)
}}
<template
v-if=
"!currentMergeRequest || viewer === 'diff'"
>
{{
__
(
'
Lastest changes
'
)
}}
</
template
>
<
template
v-else-if=
"currentMergeRequest && viewer === 'mrdiff'"
>
Merge request
(
<a
:href=
"currentMergeRequest.web_url"
>
!
{{
currentMergeRequest
.
iid
}}
</a>
)
</
template
>
</div>
</template>
</ide-tree-list>
</template>
<
style
>
.ide-review-button-holder
{
display
:
flex
;
width
:
100%
;
align-items
:
center
;
}
</
style
>
app/assets/javascripts/ide/ide_router.js
View file @
129dd185
...
...
@@ -2,6 +2,7 @@ import Vue from 'vue';
import
VueRouter
from
'
vue-router
'
;
import
flash
from
'
~/flash
'
;
import
store
from
'
./stores
'
;
import
{
activityBarViews
}
from
'
./constants
'
;
Vue
.
use
(
VueRouter
);
...
...
@@ -101,7 +102,7 @@ router.beforeEach((to, from, next) => {
throw
e
;
});
}
else
if
(
to
.
params
.
mrid
)
{
store
.
dispatch
(
'
update
Viewer
'
,
'
mrdiff
'
);
store
.
dispatch
(
'
update
ActivityBarView
'
,
activityBarViews
.
review
);
store
.
dispatch
(
'
getMergeRequestData
'
,
{
...
...
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