BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3bffbb15
Unverified
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
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
10 deletions
+39
-10
actions.js
.../javascripts/ide/stores/modules/merge_requests/actions.js
+4
-5
constants.js
...avascripts/ide/stores/modules/merge_requests/constants.js
+6
-1
state.js
...ts/javascripts/ide/stores/modules/merge_requests/state.js
+2
-1
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