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
5c05f3bb
Commit
5c05f3bb
authored
Apr 29, 2020
by
Marvin Karegyeya
Committed by
Kushal Pandya
Apr 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove getIssue function logic from list model
parent
4edd43ae
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
30 deletions
+54
-30
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/models/list.js
+2
-30
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/boards_store.js
+31
-0
changelogs/unreleased/Remove-getIssues-function-logic-from-list-js.yml
...released/Remove-getIssues-function-logic-from-list-js.yml
+5
-0
spec/frontend/boards/boards_store_spec.js
spec/frontend/boards/boards_store_spec.js
+16
-0
No files found.
app/assets/javascripts/boards/models/list.js
View file @
5c05f3bb
/* eslint-disable no-underscore-dangle, class-methods-use-this, consistent-return
, no-shadow
*/
/* eslint-disable no-underscore-dangle, class-methods-use-this, consistent-return */
import
ListIssue
from
'
ee_else_ce/boards/models/issue
'
;
import
{
__
}
from
'
~/locale
'
;
import
ListLabel
from
'
./label
'
;
import
ListAssignee
from
'
./assignee
'
;
import
{
urlParamsToObject
}
from
'
~/lib/utils/common_utils
'
;
import
flash
from
'
~/flash
'
;
import
boardsStore
from
'
../stores/boards_store
'
;
import
ListMilestone
from
'
./milestone
'
;
...
...
@@ -113,34 +112,7 @@ class List {
}
getIssues
(
emptyIssues
=
true
)
{
const
data
=
{
...
urlParamsToObject
(
boardsStore
.
filter
.
path
),
page
:
this
.
page
,
};
if
(
this
.
label
&&
data
.
label_name
)
{
data
.
label_name
=
data
.
label_name
.
filter
(
label
=>
label
!==
this
.
label
.
title
);
}
if
(
emptyIssues
)
{
this
.
loading
=
true
;
}
return
boardsStore
.
getIssuesForList
(
this
.
id
,
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
this
.
loading
=
false
;
this
.
issuesSize
=
data
.
size
;
if
(
emptyIssues
)
{
this
.
issues
=
[];
}
this
.
createIssues
(
data
.
issues
);
return
data
;
});
return
boardsStore
.
getListIssues
(
this
,
emptyIssues
);
}
newIssue
(
issue
)
{
...
...
app/assets/javascripts/boards/stores/boards_store.js
View file @
5c05f3bb
...
...
@@ -7,6 +7,7 @@ import Vue from 'vue';
import
Cookies
from
'
js-cookie
'
;
import
BoardsStoreEE
from
'
ee_else_ce/boards/stores/boards_store_ee
'
;
import
{
urlParamsToObject
,
getUrlParamsArray
,
parseBoolean
,
convertObjectPropsToCamelCase
,
...
...
@@ -491,6 +492,36 @@ const boardsStore = {
});
},
getListIssues
(
list
,
emptyIssues
=
true
)
{
const
data
=
{
...
urlParamsToObject
(
this
.
filter
.
path
),
page
:
list
.
page
,
};
if
(
list
.
label
&&
data
.
label_name
)
{
data
.
label_name
=
data
.
label_name
.
filter
(
label
=>
label
!==
list
.
label
.
title
);
}
if
(
emptyIssues
)
{
list
.
loading
=
true
;
}
return
this
.
getIssuesForList
(
list
.
id
,
data
)
.
then
(
res
=>
res
.
data
)
.
then
(
data
=>
{
list
.
loading
=
false
;
list
.
issuesSize
=
data
.
size
;
if
(
emptyIssues
)
{
list
.
issues
=
[];
}
list
.
createIssues
(
data
.
issues
);
return
data
;
});
},
getIssuesForList
(
id
,
filter
=
{})
{
const
data
=
{
id
};
Object
.
keys
(
filter
).
forEach
(
key
=>
{
...
...
changelogs/unreleased/Remove-getIssues-function-logic-from-list-js.yml
0 → 100644
View file @
5c05f3bb
---
title
:
removes store logic from issue board models
merge_request
:
21400
author
:
nuwe1
type
:
other
spec/frontend/boards/boards_store_spec.js
View file @
5c05f3bb
...
...
@@ -214,6 +214,22 @@ describe('boardsStore', () => {
});
});
describe
(
'
getListIssues
'
,
()
=>
{
let
list
;
beforeEach
(()
=>
{
list
=
new
List
(
listObj
);
setupDefaultResponses
();
});
it
(
'
makes a request to get issues
'
,
()
=>
{
const
expectedResponse
=
expect
.
objectContaining
({
issues
:
[
createTestIssue
()]
});
expect
(
list
.
issues
).
toEqual
([]);
return
expect
(
boardsStore
.
getListIssues
(
list
,
true
)).
resolves
.
toEqual
(
expectedResponse
);
});
});
describe
(
'
getIssuesForList
'
,
()
=>
{
const
id
=
'
TOO-MUCH
'
;
const
url
=
`
${
endpoints
.
listsEndpoint
}
/
${
id
}
/issues?id=
${
id
}
`
;
...
...
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