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
2ffdcc02
Commit
2ffdcc02
authored
Mar 18, 2019
by
mfluharty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename receiving actions to begin with receive
parent
cf1e2084
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
ee/app/assets/javascripts/operations/store/actions.js
ee/app/assets/javascripts/operations/store/actions.js
+10
-10
ee/spec/javascripts/operations/store/actions_spec.js
ee/spec/javascripts/operations/store/actions_spec.js
+13
-13
No files found.
ee/app/assets/javascripts/operations/store/actions.js
View file @
2ffdcc02
...
...
@@ -4,8 +4,8 @@ import axios from '~/lib/utils/axios_utils';
import
Poll
from
'
~/lib/utils/poll
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
,
s__
,
n__
,
sprintf
}
from
'
~/locale
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
_
from
'
underscore
'
;
import
*
as
types
from
'
./mutation_types
'
;
const
API_MINIMUM_QUERY_LENGTH
=
3
;
...
...
@@ -29,8 +29,8 @@ export const addProjectsToDashboard = ({ state, dispatch }) => {
.
post
(
state
.
projectEndpoints
.
add
,
{
project_ids
:
state
.
selectedProjects
.
map
(
p
=>
p
.
id
),
})
.
then
(
response
=>
dispatch
(
'
re
quest
AddProjectsToDashboardSuccess
'
,
response
.
data
))
.
catch
(()
=>
dispatch
(
'
re
quest
AddProjectsToDashboardError
'
));
.
then
(
response
=>
dispatch
(
'
re
ceive
AddProjectsToDashboardSuccess
'
,
response
.
data
))
.
catch
(()
=>
dispatch
(
'
re
ceive
AddProjectsToDashboardError
'
));
};
export
const
toggleSelectedProject
=
({
commit
,
state
},
project
)
=>
{
...
...
@@ -45,7 +45,7 @@ export const clearSearchResults = ({ commit }) => {
commit
(
types
.
CLEAR_SEARCH_RESULTS
);
};
export
const
re
quest
AddProjectsToDashboardSuccess
=
({
dispatch
,
state
},
data
)
=>
{
export
const
re
ceive
AddProjectsToDashboardSuccess
=
({
dispatch
,
state
},
data
)
=>
{
const
{
added
,
invalid
}
=
data
;
if
(
invalid
.
length
)
{
...
...
@@ -80,7 +80,7 @@ export const requestAddProjectsToDashboardSuccess = ({ dispatch, state }, data)
}
};
export
const
re
quest
AddProjectsToDashboardError
=
({
state
})
=>
{
export
const
re
ceive
AddProjectsToDashboardError
=
({
state
})
=>
{
createFlash
(
sprintf
(
__
(
'
Something went wrong, unable to add %{project} to dashboard
'
),
{
project
:
n__
(
'
project
'
,
'
projects
'
,
state
.
selectedProjects
.
length
),
...
...
@@ -131,15 +131,15 @@ export const receiveProjectsError = ({ commit }) => {
export
const
removeProject
=
({
dispatch
},
removePath
)
=>
{
axios
.
delete
(
removePath
)
.
then
(()
=>
dispatch
(
'
re
quest
RemoveProjectSuccess
'
))
.
catch
(()
=>
dispatch
(
'
re
quest
RemoveProjectError
'
));
.
then
(()
=>
dispatch
(
'
re
ceive
RemoveProjectSuccess
'
))
.
catch
(()
=>
dispatch
(
'
re
ceive
RemoveProjectError
'
));
};
export
const
re
quest
RemoveProjectSuccess
=
({
dispatch
})
=>
{
dispatch
(
'
f
orceProjectsRequest
'
);
export
const
re
ceive
RemoveProjectSuccess
=
({
dispatch
})
=>
{
dispatch
(
'
f
etchProjects
'
);
};
export
const
re
quest
RemoveProjectError
=
()
=>
{
export
const
re
ceive
RemoveProjectError
=
()
=>
{
createFlash
(
__
(
'
Something went wrong, unable to remove project
'
));
};
...
...
ee/spec/javascripts/operations/store/actions_spec.js
View file @
2ffdcc02
...
...
@@ -38,7 +38,7 @@ describe('actions', () => {
[],
[
{
type
:
'
re
quest
AddProjectsToDashboardSuccess
'
,
type
:
'
re
ceive
AddProjectsToDashboardSuccess
'
,
payload
:
mockResponse
,
},
],
...
...
@@ -54,7 +54,7 @@ describe('actions', () => {
null
,
store
.
state
,
[],
[{
type
:
'
re
quest
AddProjectsToDashboardError
'
}],
[{
type
:
'
re
ceive
AddProjectsToDashboardError
'
}],
done
,
);
});
...
...
@@ -96,10 +96,10 @@ describe('actions', () => {
});
});
describe
(
'
re
quest
AddProjectsToDashboardSuccess
'
,
()
=>
{
describe
(
'
re
ceive
AddProjectsToDashboardSuccess
'
,
()
=>
{
it
(
'
fetches projects when new projects are added to the dashboard
'
,
done
=>
{
testAction
(
actions
.
re
quest
AddProjectsToDashboardSuccess
,
actions
.
re
ceive
AddProjectsToDashboardSuccess
,
{
added
:
[
1
],
invalid
:
[],
...
...
@@ -127,7 +127,7 @@ describe('actions', () => {
}
};
const
addInvalidProjects
=
invalid
=>
store
.
dispatch
(
'
re
quest
AddProjectsToDashboardSuccess
'
,
{
store
.
dispatch
(
'
re
ceive
AddProjectsToDashboardSuccess
'
,
{
added
:
[],
invalid
,
duplicate
:
[],
...
...
@@ -160,10 +160,10 @@ describe('actions', () => {
});
});
describe
(
'
re
quest
AddProjectsToDashboardError
'
,
()
=>
{
describe
(
'
re
ceive
AddProjectsToDashboardError
'
,
()
=>
{
it
(
'
shows error message
'
,
()
=>
{
const
spy
=
spyOnDependency
(
defaultActions
,
'
createFlash
'
);
store
.
dispatch
(
'
re
quest
AddProjectsToDashboardError
'
);
store
.
dispatch
(
'
re
ceive
AddProjectsToDashboardError
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
mockText
.
ADD_PROJECTS_ERROR
);
});
...
...
@@ -287,7 +287,7 @@ describe('actions', () => {
mockRemovePath
,
null
,
[],
[{
type
:
'
re
quest
RemoveProjectSuccess
'
}],
[{
type
:
'
re
ceive
RemoveProjectSuccess
'
}],
done
,
);
});
...
...
@@ -300,16 +300,16 @@ describe('actions', () => {
mockRemovePath
,
null
,
[],
[{
type
:
'
re
quest
RemoveProjectError
'
}],
[{
type
:
'
re
ceive
RemoveProjectError
'
}],
done
,
);
});
});
describe
(
'
re
quest
RemoveProjectSuccess
'
,
()
=>
{
describe
(
'
re
ceive
RemoveProjectSuccess
'
,
()
=>
{
it
(
'
fetches operations dashboard projects
'
,
done
=>
{
testAction
(
actions
.
re
quest
RemoveProjectSuccess
,
actions
.
re
ceive
RemoveProjectSuccess
,
null
,
null
,
[],
...
...
@@ -319,11 +319,11 @@ describe('actions', () => {
});
});
describe
(
'
re
quest
RemoveProjectError
'
,
()
=>
{
describe
(
'
re
ceive
RemoveProjectError
'
,
()
=>
{
it
(
'
displays project removal error
'
,
done
=>
{
const
spy
=
spyOnDependency
(
defaultActions
,
'
createFlash
'
);
testAction
(
actions
.
re
quest
RemoveProjectError
,
null
,
null
,
[],
[],
done
);
testAction
(
actions
.
re
ceive
RemoveProjectError
,
null
,
null
,
[],
[],
done
);
expect
(
spy
).
toHaveBeenCalledWith
(
mockText
.
REMOVE_PROJECT_ERROR
);
});
...
...
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