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
3bffbb15
Commit
3bffbb15
authored
May 30, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ability to search merge requests
reset merge requests before fetch
parent
8f646faf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
10 deletions
+39
-10
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
.../javascripts/ide/stores/modules/merge_requests/actions.js
+4
-5
app/assets/javascripts/ide/stores/modules/merge_requests/constants.js
...avascripts/ide/stores/modules/merge_requests/constants.js
+6
-1
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
...ts/javascripts/ide/stores/modules/merge_requests/state.js
+2
-1
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
...scripts/ide/stores/modules/merge_requests/actions_spec.js
+27
-3
No files found.
app/assets/javascripts/ide/stores/modules/merge_requests/actions.js
View file @
3bffbb15
...
...
@@ -11,13 +11,12 @@ export const receiveMergeRequestsError = ({ commit }) => {
export
const
receiveMergeRequestsSuccess
=
({
commit
},
data
)
=>
commit
(
types
.
RECEIVE_MERGE_REQUESTS_SUCCESS
,
data
);
export
const
fetchMergeRequests
=
({
dispatch
,
state
}
)
=>
{
export
const
fetchMergeRequests
=
({
dispatch
,
state
:
{
scope
,
state
}
},
search
=
''
)
=>
{
dispatch
(
'
requestMergeRequests
'
);
dispatch
(
'
resetMergeRequests
'
);
Api
.
mergeRequests
({
scope
:
state
.
scope
,
state
:
'
opened
'
})
.
then
(({
data
})
=>
{
dispatch
(
'
receiveMergeRequestsSuccess
'
,
data
);
})
Api
.
mergeRequests
({
scope
,
state
,
search
})
.
then
(({
data
})
=>
dispatch
(
'
receiveMergeRequestsSuccess
'
,
data
))
.
catch
(()
=>
dispatch
(
'
receiveMergeRequestsError
'
));
};
...
...
app/assets/javascripts/ide/stores/modules/merge_requests/constants.js
View file @
3bffbb15
// eslint-disable-next-line import/prefer-default-export
export
const
scopes
=
{
assignedToMe
:
'
assigned-to-me
'
,
createdByMe
:
'
created-by-me
'
,
};
export
const
states
=
{
opened
:
'
opened
'
,
closed
:
'
closed
'
,
merged
:
'
merged
'
,
};
app/assets/javascripts/ide/stores/modules/merge_requests/state.js
View file @
3bffbb15
import
{
scopes
}
from
'
./constants
'
;
import
{
scopes
,
states
}
from
'
./constants
'
;
export
default
()
=>
({
isLoading
:
false
,
mergeRequests
:
[],
scope
:
scopes
.
assignedToMe
,
state
:
states
.
opened
,
});
spec/javascripts/ide/stores/modules/merge_requests/actions_spec.js
View file @
3bffbb15
...
...
@@ -12,7 +12,7 @@ import actions, {
import
{
mergeRequests
}
from
'
../../../mock_data
'
;
import
testAction
from
'
../../../../helpers/vuex_action_helper
'
;
describe
(
'
ID
e
merge requests actions
'
,
()
=>
{
describe
(
'
ID
E
merge requests actions
'
,
()
=>
{
let
mockedState
;
let
mock
;
...
...
@@ -95,6 +95,21 @@ describe('IDe merge requests actions', () => {
params
:
{
scope
:
'
assigned-to-me
'
,
state
:
'
opened
'
,
search
:
''
,
},
});
});
it
(
'
calls API with search
'
,
()
=>
{
const
apiSpy
=
spyOn
(
axios
,
'
get
'
).
and
.
callThrough
();
fetchMergeRequests
({
dispatch
()
{},
state
:
mockedState
},
'
testing search
'
);
expect
(
apiSpy
).
toHaveBeenCalledWith
(
jasmine
.
anything
(),
{
params
:
{
scope
:
'
assigned-to-me
'
,
state
:
'
opened
'
,
search
:
'
testing search
'
,
},
});
});
...
...
@@ -105,7 +120,11 @@ describe('IDe merge requests actions', () => {
null
,
mockedState
,
[],
[{
type
:
'
requestMergeRequests
'
},
{
type
:
'
receiveMergeRequestsSuccess
'
}],
[
{
type
:
'
requestMergeRequests
'
},
{
type
:
'
resetMergeRequests
'
},
{
type
:
'
receiveMergeRequestsSuccess
'
},
],
done
,
);
});
...
...
@@ -118,6 +137,7 @@ describe('IDe merge requests actions', () => {
[],
[
{
type
:
'
requestMergeRequests
'
},
{
type
:
'
resetMergeRequests
'
},
{
type
:
'
receiveMergeRequestsSuccess
'
,
payload
:
mergeRequests
},
],
done
,
...
...
@@ -136,7 +156,11 @@ describe('IDe merge requests actions', () => {
null
,
mockedState
,
[],
[{
type
:
'
requestMergeRequests
'
},
{
type
:
'
receiveMergeRequestsError
'
}],
[
{
type
:
'
requestMergeRequests
'
},
{
type
:
'
resetMergeRequests
'
},
{
type
:
'
receiveMergeRequestsError
'
},
],
done
,
);
});
...
...
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