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
524ebff5
Commit
524ebff5
authored
Jun 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show merge requests in IDE
Closes #45184
parent
af9cc234
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
285 additions
and
15 deletions
+285
-15
app/assets/javascripts/ide/components/ide_side_bar.vue
app/assets/javascripts/ide/components/ide_side_bar.vue
+34
-12
app/assets/javascripts/ide/components/merge_requests/dropdown.vue
...ts/javascripts/ide/components/merge_requests/dropdown.vue
+78
-0
app/assets/javascripts/ide/components/merge_requests/item.vue
...assets/javascripts/ide/components/merge_requests/item.vue
+59
-0
app/assets/javascripts/ide/components/merge_requests/list.vue
...assets/javascripts/ide/components/merge_requests/list.vue
+91
-0
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
.../javascripts/ide/stores/modules/merge_requests/actions.js
+2
-0
app/assets/javascripts/ide/stores/modules/merge_requests/mutation_types.js
...ripts/ide/stores/modules/merge_requests/mutation_types.js
+2
-0
app/assets/javascripts/ide/stores/modules/merge_requests/mutations.js
...avascripts/ide/stores/modules/merge_requests/mutations.js
+3
-0
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
...ts/javascripts/ide/stores/modules/merge_requests/state.js
+1
-1
app/assets/javascripts/vue_shared/components/tabs/tabs.js
app/assets/javascripts/vue_shared/components/tabs/tabs.js
+15
-2
No files found.
app/assets/javascripts/ide/components/ide_side_bar.vue
View file @
524ebff5
...
@@ -13,6 +13,7 @@ import CommitSection from './repo_commit_section.vue';
...
@@ -13,6 +13,7 @@ import CommitSection from './repo_commit_section.vue';
import
CommitForm
from
'
./commit_sidebar/form.vue
'
;
import
CommitForm
from
'
./commit_sidebar/form.vue
'
;
import
IdeReview
from
'
./ide_review.vue
'
;
import
IdeReview
from
'
./ide_review.vue
'
;
import
SuccessMessage
from
'
./commit_sidebar/success_message.vue
'
;
import
SuccessMessage
from
'
./commit_sidebar/success_message.vue
'
;
import
MergeRequestDropdown
from
'
./merge_requests/dropdown.vue
'
;
import
{
activityBarViews
}
from
'
../constants
'
;
import
{
activityBarViews
}
from
'
../constants
'
;
export
default
{
export
default
{
...
@@ -32,6 +33,7 @@ export default {
...
@@ -32,6 +33,7 @@ export default {
CommitForm
,
CommitForm
,
IdeReview
,
IdeReview
,
SuccessMessage
,
SuccessMessage
,
MergeRequestDropdown
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -46,6 +48,7 @@ export default {
...
@@ -46,6 +48,7 @@ export default {
'
changedFiles
'
,
'
changedFiles
'
,
'
stagedFiles
'
,
'
stagedFiles
'
,
'
lastCommitMsg
'
,
'
lastCommitMsg
'
,
'
currentMergeRequestId
'
,
]),
]),
...
mapGetters
([
'
currentProject
'
,
'
someUncommitedChanges
'
]),
...
mapGetters
([
'
currentProject
'
,
'
someUncommitedChanges
'
]),
showSuccessMessage
()
{
showSuccessMessage
()
{
...
@@ -88,9 +91,12 @@ export default {
...
@@ -88,9 +91,12 @@ export default {
</div>
</div>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<div
class=
"context-header ide-context-header"
>
<div
class=
"context-header ide-context-header
dropdown
"
>
<a
<a
:href=
"currentProject.web_url"
href=
"#"
role=
"button"
@
click
.
prevent
data-toggle=
"dropdown"
>
>
<div
<div
v-if=
"currentProject.avatar_url"
v-if=
"currentProject.avatar_url"
...
@@ -114,6 +120,7 @@ export default {
...
@@ -114,6 +120,7 @@ export default {
<div
class=
"sidebar-context-title"
>
<div
class=
"sidebar-context-title"
>
{{
currentProject
.
name
}}
{{
currentProject
.
name
}}
</div>
</div>
<div
class=
"d-flex"
>
<div
<div
class=
"sidebar-context-title ide-sidebar-branch-title"
class=
"sidebar-context-title ide-sidebar-branch-title"
ref=
"branchId"
ref=
"branchId"
...
@@ -125,8 +132,23 @@ export default {
...
@@ -125,8 +132,23 @@ export default {
css-classes=
"append-right-5"
css-classes=
"append-right-5"
/>
{{
currentBranchId
}}
/>
{{
currentBranchId
}}
</div>
</div>
<div
v-if=
"currentMergeRequestId"
class=
"sidebar-context-title ide-sidebar-branch-title prepend-left-8"
>
<icon
name=
"git-merge"
css-classes=
"append-right-5"
/>
!
{{
currentMergeRequestId
}}
</div>
</div>
</div>
</div>
<icon
class=
"ml-auto"
name=
"chevron-down"
/>
</a>
</a>
<merge-request-dropdown
/>
</div>
</div>
<div
class=
"multi-file-commit-panel-inner-scroll"
>
<div
class=
"multi-file-commit-panel-inner-scroll"
>
<component
<component
...
...
app/assets/javascripts/ide/components/merge_requests/dropdown.vue
0 → 100644
View file @
524ebff5
<
script
>
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
Tabs
from
'
../../../vue_shared/components/tabs/tabs
'
;
import
Tab
from
'
../../../vue_shared/components/tabs/tab.vue
'
;
import
List
from
'
./list.vue
'
;
import
{
scopes
}
from
'
../../stores/modules/merge_requests/constants
'
;
export
default
{
components
:
{
Tabs
,
Tab
,
List
,
},
data
()
{
return
{
activeTabIndex
:
0
,
};
},
computed
:
{
...
mapState
(
'
mergeRequests
'
,
[
'
isLoading
'
,
'
mergeRequests
'
]),
...
mapState
([
'
currentMergeRequestId
'
]),
tabScope
()
{
return
this
.
activeTabIndex
===
0
?
scopes
.
createdByMe
:
scopes
.
assignedToMe
;
},
},
mounted
()
{
this
.
fetchMergeRequests
();
},
methods
:
{
...
mapActions
(
'
mergeRequests
'
,
[
'
fetchMergeRequests
'
,
'
setScope
'
]),
updateActiveTab
(
index
)
{
this
.
activeTabIndex
=
index
;
this
.
setScope
(
this
.
tabScope
);
this
.
fetchMergeRequests
();
},
},
};
</
script
>
<
template
>
<div
class=
"dropdown-menu"
>
<tabs
stop-propagation
@
changed=
"updateActiveTab"
>
<tab
:title=
"__('Created by me')"
active
>
<list
v-if=
"activeTabIndex === 0"
:is-loading=
"isLoading"
:items=
"mergeRequests"
:current-id=
"currentMergeRequestId"
@
search=
"fetchMergeRequests"
/>
</tab>
<tab
:title=
"__('Assigned to me')"
>
<list
v-if=
"activeTabIndex === 1"
:is-loading=
"isLoading"
:items=
"mergeRequests"
:current-id=
"currentMergeRequestId"
@
search=
"fetchMergeRequests"
/>
</tab>
</tabs>
</div>
</
template
>
<
style
scoped
>
.dropdown-menu
{
width
:
400px
;
padding
:
0
;
max-height
:
initial
!important
;
}
</
style
>
app/assets/javascripts/ide/components/merge_requests/item.vue
0 → 100644
View file @
524ebff5
<
script
>
import
Icon
from
'
../../../vue_shared/components/icon.vue
'
;
export
default
{
components
:
{
Icon
,
},
props
:
{
item
:
{
type
:
Object
,
required
:
true
,
},
currentId
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
isActive
()
{
return
this
.
item
.
iid
===
parseInt
(
this
.
currentId
,
10
);
},
pathWithID
()
{
return
`
${
this
.
item
.
projectPathWithNamespace
}
!
${
this
.
item
.
iid
}
`
;
},
},
methods
:
{
clickItem
()
{
this
.
$emit
(
'
click
'
,
this
.
item
);
},
},
};
</
script
>
<
template
>
<button
type=
"button"
class=
"d-flex align-items-center"
@
click=
"clickItem"
>
<span
class=
"d-flex append-right-default"
style=
"min-width: 18px"
>
<icon
v-if=
"isActive"
name=
"mobile-issue-close"
:size=
"18"
/>
</span>
<span>
<strong>
{{
item
.
title
}}
</strong>
<span
class=
"d-block mt-1"
>
{{
pathWithID
}}
</span>
</span>
</button>
</
template
>
app/assets/javascripts/ide/components/merge_requests/list.vue
0 → 100644
View file @
524ebff5
<
script
>
import
_
from
'
underscore
'
;
import
LoadingIcon
from
'
../../../vue_shared/components/loading_icon.vue
'
;
import
Item
from
'
./item.vue
'
;
export
default
{
components
:
{
LoadingIcon
,
Item
,
},
props
:
{
isLoading
:
{
type
:
Boolean
,
required
:
true
,
},
items
:
{
type
:
Array
,
required
:
true
,
},
currentId
:
{
type
:
String
,
required
:
true
,
},
},
data
()
{
return
{
search
:
''
,
};
},
watch
:
{
isLoading
()
{
this
.
focusSearch
();
},
},
methods
:
{
viewMergeRequest
(
item
)
{
this
.
$router
.
push
(
`/project/
${
item
.
projectPathWithNamespace
}
/merge_requests/
${
item
.
iid
}
`
);
},
searchMergeRequests
:
_
.
debounce
(
function
debounceSearch
()
{
this
.
$emit
(
'
search
'
,
this
.
search
);
},
250
),
focusSearch
()
{
if
(
!
this
.
isLoading
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
searchInput
.
focus
();
});
}
},
},
};
</
script
>
<
template
>
<div>
<loading-icon
class=
"mt-3 mb-3"
v-if=
"isLoading"
size=
"2"
/>
<template
v-else
>
<div
class=
"dropdown-input mt-3 pb-3 mb-3 border-bottom"
>
<input
type=
"search"
class=
"dropdown-input-field"
placeholder=
"Search merge requests"
v-model=
"search"
@
input=
"searchMergeRequests"
ref=
"searchInput"
/>
<i
aria-hidden=
"true"
class=
"fa fa-search dropdown-input-search"
></i>
</div>
<div
class=
"dropdown-content"
>
<ul
class=
"mb-3"
>
<li
v-for=
"item in items"
:key=
"item.id"
>
<item
:item=
"item"
:current-id=
"currentId"
@
click=
"viewMergeRequest"
/>
</li>
</ul>
</div>
</
template
>
</div>
</template>
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
View file @
524ebff5
...
@@ -22,4 +22,6 @@ export const fetchMergeRequests = ({ dispatch, state: { scope, state } }, search
...
@@ -22,4 +22,6 @@ export const fetchMergeRequests = ({ dispatch, state: { scope, state } }, search
export
const
resetMergeRequests
=
({
commit
})
=>
commit
(
types
.
RESET_MERGE_REQUESTS
);
export
const
resetMergeRequests
=
({
commit
})
=>
commit
(
types
.
RESET_MERGE_REQUESTS
);
export
const
setScope
=
({
commit
},
scope
)
=>
commit
(
types
.
SET_SCOPE
,
scope
);
export
default
()
=>
{};
export
default
()
=>
{};
app/assets/javascripts/ide/stores/modules/merge_requests/mutation_types.js
View file @
524ebff5
...
@@ -3,3 +3,5 @@ export const RECEIVE_MERGE_REQUESTS_ERROR = 'RECEIVE_MERGE_REQUESTS_ERROR';
...
@@ -3,3 +3,5 @@ export const RECEIVE_MERGE_REQUESTS_ERROR = 'RECEIVE_MERGE_REQUESTS_ERROR';
export
const
RECEIVE_MERGE_REQUESTS_SUCCESS
=
'
RECEIVE_MERGE_REQUESTS_SUCCESS
'
;
export
const
RECEIVE_MERGE_REQUESTS_SUCCESS
=
'
RECEIVE_MERGE_REQUESTS_SUCCESS
'
;
export
const
RESET_MERGE_REQUESTS
=
'
RESET_MERGE_REQUESTS
'
;
export
const
RESET_MERGE_REQUESTS
=
'
RESET_MERGE_REQUESTS
'
;
export
const
SET_SCOPE
=
'
SET_SCOPE
'
;
app/assets/javascripts/ide/stores/modules/merge_requests/mutations.js
View file @
524ebff5
...
@@ -23,4 +23,7 @@ export default {
...
@@ -23,4 +23,7 @@ export default {
[
types
.
RESET_MERGE_REQUESTS
](
state
)
{
[
types
.
RESET_MERGE_REQUESTS
](
state
)
{
state
.
mergeRequests
=
[];
state
.
mergeRequests
=
[];
},
},
[
types
.
SET_SCOPE
](
state
,
scope
)
{
state
.
scope
=
scope
;
},
};
};
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
View file @
524ebff5
...
@@ -3,6 +3,6 @@ import { scopes, states } from './constants';
...
@@ -3,6 +3,6 @@ import { scopes, states } from './constants';
export
default
()
=>
({
export
default
()
=>
({
isLoading
:
false
,
isLoading
:
false
,
mergeRequests
:
[],
mergeRequests
:
[],
scope
:
scopes
.
assignedTo
Me
,
scope
:
scopes
.
createdBy
Me
,
state
:
states
.
opened
,
state
:
states
.
opened
,
});
});
app/assets/javascripts/vue_shared/components/tabs/tabs.js
View file @
524ebff5
export
default
{
export
default
{
props
:
{
stopPropagation
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
data
()
{
data
()
{
return
{
return
{
currentIndex
:
0
,
currentIndex
:
0
,
...
@@ -13,11 +20,17 @@ export default {
...
@@ -13,11 +20,17 @@ export default {
this
.
tabs
=
this
.
$children
.
filter
(
child
=>
child
.
isTab
);
this
.
tabs
=
this
.
$children
.
filter
(
child
=>
child
.
isTab
);
this
.
currentIndex
=
this
.
tabs
.
findIndex
(
tab
=>
tab
.
localActive
);
this
.
currentIndex
=
this
.
tabs
.
findIndex
(
tab
=>
tab
.
localActive
);
},
},
setTab
(
index
)
{
setTab
(
e
,
index
)
{
if
(
this
.
stopPropagation
)
{
e
.
stopPropagation
();
}
this
.
tabs
[
this
.
currentIndex
].
localActive
=
false
;
this
.
tabs
[
this
.
currentIndex
].
localActive
=
false
;
this
.
tabs
[
index
].
localActive
=
true
;
this
.
tabs
[
index
].
localActive
=
true
;
this
.
currentIndex
=
index
;
this
.
currentIndex
=
index
;
this
.
$emit
(
'
changed
'
,
this
.
currentIndex
);
},
},
},
},
render
(
h
)
{
render
(
h
)
{
...
@@ -36,7 +49,7 @@ export default {
...
@@ -36,7 +49,7 @@ export default {
href
:
'
#
'
,
href
:
'
#
'
,
},
},
on
:
{
on
:
{
click
:
()
=>
this
.
setTab
(
i
),
click
:
e
=>
this
.
setTab
(
e
,
i
),
},
},
},
},
tab
.
$slots
.
title
||
tab
.
title
,
tab
.
$slots
.
title
||
tab
.
title
,
...
...
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