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
03820e9b
Commit
03820e9b
authored
Jun 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fetch both created & assigned
show badges for both [ci skip]
parent
0b278a93
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
128 additions
and
93 deletions
+128
-93
app/assets/javascripts/ide/components/ide_side_bar.vue
app/assets/javascripts/ide/components/ide_side_bar.vue
+30
-4
app/assets/javascripts/ide/components/merge_requests/dropdown.vue
...ts/javascripts/ide/components/merge_requests/dropdown.vue
+25
-36
app/assets/javascripts/ide/components/merge_requests/list.vue
...assets/javascripts/ide/components/merge_requests/list.vue
+29
-15
app/assets/javascripts/ide/stores/actions/merge_request.js
app/assets/javascripts/ide/stores/actions/merge_request.js
+1
-3
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
.../javascripts/ide/stores/modules/merge_requests/actions.js
+14
-13
app/assets/javascripts/ide/stores/modules/merge_requests/constants.js
...avascripts/ide/stores/modules/merge_requests/constants.js
+2
-2
app/assets/javascripts/ide/stores/modules/merge_requests/getters.js
.../javascripts/ide/stores/modules/merge_requests/getters.js
+4
-0
app/assets/javascripts/ide/stores/modules/merge_requests/index.js
...ts/javascripts/ide/stores/modules/merge_requests/index.js
+2
-0
app/assets/javascripts/ide/stores/modules/merge_requests/mutation_types.js
...ripts/ide/stores/modules/merge_requests/mutation_types.js
+0
-2
app/assets/javascripts/ide/stores/modules/merge_requests/mutations.js
...avascripts/ide/stores/modules/merge_requests/mutations.js
+9
-12
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
...ts/javascripts/ide/stores/modules/merge_requests/state.js
+9
-4
app/assets/javascripts/vue_shared/components/tabs/tab.vue
app/assets/javascripts/vue_shared/components/tabs/tab.vue
+3
-0
app/assets/javascripts/vue_shared/components/tabs/tabs.js
app/assets/javascripts/vue_shared/components/tabs/tabs.js
+0
-2
No files found.
app/assets/javascripts/ide/components/ide_side_bar.vue
View file @
03820e9b
...
...
@@ -38,6 +38,7 @@ export default {
data
()
{
return
{
showTooltip
:
false
,
showMergeRequestsDropdown
:
false
,
};
},
computed
:
{
...
...
@@ -67,6 +68,23 @@ export default {
this
.
showTooltip
=
this
.
$refs
.
branchId
.
scrollWidth
>
this
.
$refs
.
branchId
.
offsetWidth
;
});
},
showMergeRequestsDropdown
()
{
if
(
this
.
showMergeRequestsDropdown
)
{
document
.
addEventListener
(
'
click
'
,
this
.
hideMergeRequestDropdown
);
}
else
{
document
.
removeEventListener
(
'
click
'
,
this
.
hideMergeRequestDropdown
);
}
},
},
methods
:
{
hideMergeRequestDropdown
(
e
)
{
if
(
this
.
$refs
.
mergeRequestDropdown
.
contains
(
e
.
target
))
return
;
this
.
showMergeRequestsDropdown
=
false
;
},
toggleMergeRequestDropdown
()
{
this
.
showMergeRequestsDropdown
=
!
this
.
showMergeRequestsDropdown
;
},
},
};
</
script
>
...
...
@@ -91,12 +109,17 @@ export default {
</div>
</
template
>
<
template
v-else
>
<div
class=
"context-header ide-context-header dropdown"
>
<div
class=
"context-header ide-context-header dropdown"
:class=
"
{
show: showMergeRequestsDropdown
}"
ref="mergeRequestDropdown"
>
<a
href=
"#"
role=
"button"
@
click
.
prevent
data-toggle=
"dropdown"
@
click.prevent=
"toggleMergeRequestDropdown"
>
<div
v-if=
"currentProject.avatar_url"
...
...
@@ -148,7 +171,10 @@ export default {
name=
"chevron-down"
/>
</a>
<merge-request-dropdown
/>
<merge-request-dropdown
v-if=
"showMergeRequestsDropdown"
@
hide=
"toggleMergeRequestDropdown"
/>
</div>
<div
class=
"multi-file-commit-panel-inner-scroll"
>
<component
...
...
app/assets/javascripts/ide/components/merge_requests/dropdown.vue
View file @
03820e9b
<
script
>
import
{
map
Action
s
,
mapState
}
from
'
vuex
'
;
import
{
map
Getter
s
,
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
:
{
...
...
@@ -11,28 +10,16 @@ export default {
Tab
,
List
,
},
data
()
{
return
{
activeTabIndex
:
0
,
};
},
computed
:
{
...
map
State
(
'
mergeRequests
'
,
[
'
isLoading
'
,
'
mergeRequests
'
]),
...
map
Getters
(
'
mergeRequests
'
,
[
'
assignedData
'
,
'
createdData
'
]),
...
mapState
([
'
currentMergeRequestId
'
]),
tabScope
()
{
return
this
.
activeTabIndex
===
0
?
scopes
.
createdByMe
:
scopes
.
assignedToMe
;
},
createdMergeRequestLength
()
{
return
this
.
createdData
.
mergeRequests
.
length
;
},
mounted
()
{
this
.
fetchMergeRequests
();
},
methods
:
{
...
mapActions
(
'
mergeRequests
'
,
[
'
fetchMergeRequests
'
,
'
setScope
'
]),
updateActiveTab
(
index
)
{
this
.
activeTabIndex
=
index
;
this
.
setScope
(
this
.
tabScope
);
this
.
fetchMergeRequests
();
hideDropdown
()
{
this
.
$emit
(
'
hide
'
);
},
},
};
...
...
@@ -40,31 +27,33 @@ export default {
<
template
>
<div
class=
"dropdown-menu ide-merge-requests-dropdown"
>
<tabs
stop-propagation
@
changed=
"updateActiveTab"
>
<tab
:title=
"__('Created by me')"
active
>
<tabs
stop-propagation
>
<tab
active
>
<template
slot=
"title"
>
{{
__
(
'
Created by me
'
)
}}
<span
class=
"badge badge-pill"
>
{{
createdMergeRequestLength
}}
</span>
</
template
>
<list
v-if=
"activeTabIndex === 0"
:is-loading=
"isLoading"
:items=
"mergeRequests"
type=
"created"
:current-id=
"currentMergeRequestId"
:empty-text=
"__('You have not created any merge requests')"
@
search=
"fetchMergeRequests
"
@
hide=
"hideDropdown
"
/>
</tab>
<tab
:title=
"__('Assigned to me')"
>
<tab>
<
template
slot=
"title"
>
{{
__
(
'
Assigned to me
'
)
}}
<span
class=
"badge badge-pill"
>
{{
assignedData
.
mergeRequests
.
length
}}
</span>
</
template
>
<list
v-if=
"activeTabIndex === 1"
:is-loading=
"isLoading"
:items=
"mergeRequests"
type=
"assigned"
:current-id=
"currentMergeRequestId"
:empty-text=
"__('You do not have any assigned merge requests')"
@
search=
"fetchMergeRequests
"
@
hide=
"hideDropdown
"
/>
</tab>
</tabs>
...
...
app/assets/javascripts/ide/components/merge_requests/list.vue
View file @
03820e9b
<
script
>
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
LoadingIcon
from
'
../../../vue_shared/components/loading_icon.vue
'
;
import
Item
from
'
./item.vue
'
;
...
...
@@ -9,12 +10,8 @@ export default {
Item
,
},
props
:
{
isLoading
:
{
type
:
Boolean
,
required
:
true
,
},
items
:
{
type
:
Array
,
type
:
{
type
:
String
,
required
:
true
,
},
currentId
:
{
...
...
@@ -32,24 +29,41 @@ export default {
};
},
computed
:
{
...
mapGetters
(
'
mergeRequests
'
,
[
'
getData
'
]),
data
()
{
return
this
.
getData
(
this
.
type
);
},
isLoading
()
{
return
this
.
data
.
isLoading
;
},
mergeRequests
()
{
return
this
.
data
.
mergeRequests
;
},
hasMergeRequests
()
{
return
this
.
item
s
.
length
!==
0
;
return
this
.
mergeRequest
s
.
length
!==
0
;
},
hasNoSearchResults
()
{
return
this
.
search
!==
''
&&
!
this
.
hasMergeRequests
;
},
},
watch
:
{
isLoading
()
{
this
.
focusSearch
();
},
mounted
()
{
this
.
loadMergeRequests
();
},
methods
:
{
...
mapActions
(
'
mergeRequests
'
,
[
'
fetchMergeRequests
'
]),
...
mapActions
([
'
closeAllFiles
'
]),
loadMergeRequests
()
{
this
.
fetchMergeRequests
({
type
:
this
.
type
,
search
:
this
.
search
});
},
viewMergeRequest
(
item
)
{
return
this
.
closeAllFiles
()
.
then
(()
=>
{
this
.
$emit
(
'
hide
'
);
this
.
$router
.
push
(
`/project/
${
item
.
projectPathWithNamespace
}
/merge_requests/
${
item
.
iid
}
`
);
});
},
searchMergeRequests
:
_
.
debounce
(
function
debounceSearch
()
{
this
.
$emit
(
'
search
'
,
this
.
search
);
this
.
loadMergeRequests
(
);
},
250
),
focusSearch
()
{
if
(
!
this
.
isLoading
)
{
...
...
@@ -88,7 +102,7 @@ export default {
<ul
class=
"mb-3"
>
<template
v-if=
"hasMergeRequests"
>
<li
v-for=
"item in
item
s"
v-for=
"item in
mergeRequest
s"
:key=
"item.id"
>
<item
...
...
@@ -103,7 +117,7 @@ export default {
class=
"ide-merge-requests-empty d-flex align-items-center justify-content-center"
>
<
template
v-if=
"hasNoSearchResults"
>
No merge requests found
{{
__
(
'
No merge requests found
'
)
}}
</
template
>
<
template
v-else
>
{{
emptyText
}}
...
...
app/assets/javascripts/ide/stores/actions/merge_request.js
View file @
03820e9b
...
...
@@ -17,9 +17,7 @@ export const getMergeRequestData = (
mergeRequestId
,
mergeRequest
:
data
,
});
if
(
!
state
.
currentMergeRequestId
)
{
commit
(
types
.
SET_CURRENT_MERGE_REQUEST
,
mergeRequestId
);
}
resolve
(
data
);
})
.
catch
(()
=>
{
...
...
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
View file @
03820e9b
import
{
__
}
from
'
../../../../locale
'
;
import
Api
from
'
../../../../api
'
;
import
flash
from
'
../../../../flash
'
;
import
{
scopes
}
from
'
./constants
'
;
import
*
as
types
from
'
./mutation_types
'
;
export
const
requestMergeRequests
=
({
commit
})
=>
commit
(
types
.
REQUEST_MERGE_REQUESTS
);
export
const
receiveMergeRequestsError
=
({
commit
})
=>
{
export
const
requestMergeRequests
=
({
commit
},
type
)
=>
commit
(
types
.
REQUEST_MERGE_REQUESTS
,
type
);
export
const
receiveMergeRequestsError
=
({
commit
},
type
)
=>
{
flash
(
__
(
'
Error loading merge requests.
'
));
commit
(
types
.
RECEIVE_MERGE_REQUESTS_ERROR
);
commit
(
types
.
RECEIVE_MERGE_REQUESTS_ERROR
,
type
);
};
export
const
receiveMergeRequestsSuccess
=
({
commit
},
data
)
=>
commit
(
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
,
data
);
export
const
receiveMergeRequestsSuccess
=
({
commit
},
{
type
,
data
}
)
=>
commit
(
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
,
{
type
,
data
}
);
export
const
fetchMergeRequests
=
({
dispatch
,
state
:
{
scope
,
state
}
},
search
=
''
)
=>
{
dispatch
(
'
requestMergeRequests
'
);
dispatch
(
'
resetMergeRequests
'
);
export
const
fetchMergeRequests
=
({
dispatch
,
state
:
{
state
}
},
{
type
,
search
=
''
})
=>
{
const
scope
=
scopes
[
type
];
dispatch
(
'
requestMergeRequests
'
,
type
);
dispatch
(
'
resetMergeRequests
'
,
type
);
Api
.
mergeRequests
({
scope
,
state
,
search
})
.
then
(({
data
})
=>
dispatch
(
'
receiveMergeRequestsSuccess
'
,
data
))
.
catch
(()
=>
dispatch
(
'
receiveMergeRequestsError
'
));
.
then
(({
data
})
=>
dispatch
(
'
receiveMergeRequestsSuccess
'
,
{
type
,
data
}
))
.
catch
(()
=>
dispatch
(
'
receiveMergeRequestsError
'
,
type
));
};
export
const
resetMergeRequests
=
({
commit
})
=>
commit
(
types
.
RESET_MERGE_REQUESTS
);
export
const
setScope
=
({
commit
},
scope
)
=>
commit
(
types
.
SET_SCOPE
,
scope
);
export
const
resetMergeRequests
=
({
commit
},
type
)
=>
commit
(
types
.
RESET_MERGE_REQUESTS
,
type
);
export
default
()
=>
{};
app/assets/javascripts/ide/stores/modules/merge_requests/constants.js
View file @
03820e9b
export
const
scopes
=
{
assigned
ToMe
:
'
assigned-to-me
'
,
created
ByMe
:
'
created-by-me
'
,
assigned
:
'
assigned-to-me
'
,
created
:
'
created-by-me
'
,
};
export
const
states
=
{
...
...
app/assets/javascripts/ide/stores/modules/merge_requests/getters.js
0 → 100644
View file @
03820e9b
export
const
getData
=
state
=>
type
=>
state
[
type
];
export
const
assignedData
=
state
=>
state
.
assigned
;
export
const
createdData
=
state
=>
state
.
created
;
app/assets/javascripts/ide/stores/modules/merge_requests/index.js
View file @
03820e9b
import
state
from
'
./state
'
;
import
*
as
actions
from
'
./actions
'
;
import
*
as
getters
from
'
./getters
'
;
import
mutations
from
'
./mutations
'
;
export
default
{
...
...
@@ -7,4 +8,5 @@ export default {
state
:
state
(),
actions
,
mutations
,
getters
,
};
app/assets/javascripts/ide/stores/modules/merge_requests/mutation_types.js
View file @
03820e9b
...
...
@@ -3,5 +3,3 @@ export const RECEIVE_MERGE_REQUESTS_ERROR = 'RECEIVE_MERGE_REQUESTS_ERROR';
export
const
RECEIVE_MERGE_REQUESTS_SUCCESS
=
'
RECEIVE_MERGE_REQUESTS_SUCCESS
'
;
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 @
03820e9b
...
...
@@ -2,15 +2,15 @@
import
*
as
types
from
'
./mutation_types
'
;
export
default
{
[
types
.
REQUEST_MERGE_REQUESTS
](
state
)
{
state
.
isLoading
=
true
;
[
types
.
REQUEST_MERGE_REQUESTS
](
state
,
type
)
{
state
[
type
]
.
isLoading
=
true
;
},
[
types
.
RECEIVE_MERGE_REQUESTS_ERROR
](
state
)
{
state
.
isLoading
=
false
;
[
types
.
RECEIVE_MERGE_REQUESTS_ERROR
](
state
,
type
)
{
state
[
type
]
.
isLoading
=
false
;
},
[
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
](
state
,
data
)
{
state
.
isLoading
=
false
;
state
.
mergeRequests
=
data
.
map
(
mergeRequest
=>
({
[
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
](
state
,
{
type
,
data
}
)
{
state
[
type
]
.
isLoading
=
false
;
state
[
type
]
.
mergeRequests
=
data
.
map
(
mergeRequest
=>
({
id
:
mergeRequest
.
id
,
iid
:
mergeRequest
.
iid
,
title
:
mergeRequest
.
title
,
...
...
@@ -20,10 +20,7 @@ export default {
.
replace
(
`/merge_requests/
${
mergeRequest
.
iid
}
`
,
''
),
}));
},
[
types
.
RESET_MERGE_REQUESTS
](
state
)
{
state
.
mergeRequests
=
[];
},
[
types
.
SET_SCOPE
](
state
,
scope
)
{
state
.
scope
=
scope
;
[
types
.
RESET_MERGE_REQUESTS
](
state
,
type
)
{
state
[
type
].
mergeRequests
=
[];
},
};
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
View file @
03820e9b
import
{
s
copes
,
s
tates
}
from
'
./constants
'
;
import
{
states
}
from
'
./constants
'
;
export
default
()
=>
({
created
:
{
isLoading
:
false
,
mergeRequests
:
[],
scope
:
scopes
.
createdByMe
,
},
assigned
:
{
isLoading
:
false
,
mergeRequests
:
[],
},
state
:
states
.
opened
,
});
app/assets/javascripts/vue_shared/components/tabs/tab.vue
View file @
03820e9b
...
...
@@ -26,6 +26,9 @@ export default {
created
()
{
this
.
isTab
=
true
;
},
updated
()
{
this
.
$parent
.
$forceUpdate
();
},
};
</
script
>
...
...
app/assets/javascripts/vue_shared/components/tabs/tabs.js
View file @
03820e9b
...
...
@@ -29,8 +29,6 @@ export default {
this
.
tabs
[
index
].
localActive
=
true
;
this
.
currentIndex
=
index
;
this
.
$emit
(
'
changed
'
,
this
.
currentIndex
);
},
},
render
(
h
)
{
...
...
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