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
0d37b30c
Commit
0d37b30c
authored
Sep 08, 2020
by
Scott Stern
Committed by
Andrew Fontaine
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add update issue by id mutation
parent
5bdbf365
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
0 deletions
+57
-0
app/assets/javascripts/boards/stores/mutation_types.js
app/assets/javascripts/boards/stores/mutation_types.js
+1
-0
app/assets/javascripts/boards/stores/mutations.js
app/assets/javascripts/boards/stores/mutations.js
+9
-0
changelogs/unreleased/ss-add-update-issue.yml
changelogs/unreleased/ss-add-update-issue.yml
+5
-0
spec/frontend/boards/stores/mutations_spec.js
spec/frontend/boards/stores/mutations_spec.js
+42
-0
No files found.
app/assets/javascripts/boards/stores/mutation_types.js
View file @
0d37b30c
...
...
@@ -27,3 +27,4 @@ export const RECEIVE_UPDATE_ISSUE_ERROR = 'RECEIVE_UPDATE_ISSUE_ERROR';
export
const
SET_CURRENT_PAGE
=
'
SET_CURRENT_PAGE
'
;
export
const
TOGGLE_EMPTY_STATE
=
'
TOGGLE_EMPTY_STATE
'
;
export
const
SET_ACTIVE_ID
=
'
SET_ACTIVE_ID
'
;
export
const
UPDATE_ISSUE_BY_ID
=
'
UPDATE_ISSUE_BY_ID
'
;
app/assets/javascripts/boards/stores/mutations.js
View file @
0d37b30c
...
...
@@ -81,6 +81,15 @@ export default {
state
.
isLoadingIssues
=
false
;
},
[
mutationTypes
.
UPDATE_ISSUE_BY_ID
]:
(
state
,
{
issueId
,
prop
,
value
})
=>
{
if
(
!
state
.
issues
[
issueId
])
{
/* eslint-disable-next-line @gitlab/require-i18n-strings */
throw
new
Error
(
'
No issue found.
'
);
}
Vue
.
set
(
state
.
issues
[
issueId
],
prop
,
value
);
},
[
mutationTypes
.
RECEIVE_ISSUES_FOR_ALL_LISTS_FAILURE
]:
state
=>
{
state
.
error
=
__
(
'
An error occurred while fetching the board issues. Please reload the page.
'
);
state
.
isLoadingIssues
=
false
;
...
...
changelogs/unreleased/ss-add-update-issue.yml
0 → 100644
View file @
0d37b30c
---
title
:
Add update issue by id in vuex for boards
merge_request
:
41226
author
:
type
:
added
spec/frontend/boards/stores/mutations_spec.js
View file @
0d37b30c
...
...
@@ -190,6 +190,48 @@ describe('Board Store Mutations', () => {
});
});
describe
(
'
UPDATE_ISSUE_BY_ID
'
,
()
=>
{
const
issueId
=
'
1
'
;
const
prop
=
'
id
'
;
const
value
=
'
2
'
;
const
issue
=
{
[
issueId
]:
{
id
:
1
,
title
:
'
Issue
'
}
};
beforeEach
(()
=>
{
state
=
{
...
state
,
isLoadingIssues
:
true
,
error
:
undefined
,
issues
:
{
...
issue
,
},
};
});
describe
(
'
when the issue is in state
'
,
()
=>
{
it
(
'
updates the property of the correct issue
'
,
()
=>
{
mutations
.
UPDATE_ISSUE_BY_ID
(
state
,
{
issueId
,
prop
,
value
,
});
expect
(
state
.
issues
[
issueId
]).
toEqual
({
...
issue
[
issueId
],
id
:
'
2
'
});
});
});
describe
(
'
when the issue is not in state
'
,
()
=>
{
it
(
'
throws an error
'
,
()
=>
{
expect
(()
=>
{
mutations
.
UPDATE_ISSUE_BY_ID
(
state
,
{
issueId
:
'
3
'
,
prop
,
value
,
});
}).
toThrow
(
new
Error
(
'
No issue found.
'
));
});
});
});
describe
(
'
RECEIVE_ADD_ISSUE_SUCCESS
'
,
()
=>
{
expectNotImplemented
(
mutations
.
RECEIVE_ADD_ISSUE_SUCCESS
);
});
...
...
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