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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
b4253735
Commit
b4253735
authored
May 30, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix toggling subgroups and pagination
parent
6f859430
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
7 deletions
+24
-7
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+1
-1
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+9
-1
app/assets/javascripts/groups/services/groups_service.js
app/assets/javascripts/groups/services/groups_service.js
+1
-1
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+13
-4
No files found.
app/assets/javascripts/groups/components/group_item.vue
View file @
b4253735
...
...
@@ -14,7 +14,7 @@ export default {
},
methods
:
{
toggleSubGroups
(
e
)
{
if
(
e
.
target
.
tagName
===
'
A
'
||
!
this
.
hasSubgroups
)
{
if
(
e
.
target
.
tagName
===
'
A
'
||
!
this
.
hasSubgroups
)
{
return
false
;
}
...
...
app/assets/javascripts/groups/index.js
View file @
b4253735
...
...
@@ -34,12 +34,18 @@ $(() => {
fetchGroups
(
parentGroup
)
{
let
parentId
=
null
;
let
getGroups
=
null
;
let
page
=
null
;
let
pageParam
=
null
;
if
(
parentGroup
)
{
parentId
=
parentGroup
.
id
;
}
const
page
=
gl
.
utils
.
getParameterByName
(
'
page
'
);
pageParam
=
gl
.
utils
.
getParameterByName
(
'
page
'
);
if
(
pageParam
)
{
page
=
pageParam
;
}
getGroups
=
service
.
getGroups
(
parentId
,
page
);
getGroups
.
then
((
response
)
=>
{
...
...
@@ -53,8 +59,10 @@ $(() => {
},
toggleSubGroups
(
parentGroup
=
null
)
{
if
(
!
parentGroup
.
isOpen
)
{
store
.
resetGroups
(
parentGroup
);
this
.
fetchGroups
(
parentGroup
);
}
GroupsStore
.
toggleSubGroups
(
parentGroup
);
},
},
...
...
app/assets/javascripts/groups/services/groups_service.js
View file @
b4253735
...
...
@@ -8,7 +8,7 @@ export default class GroupsService {
this
.
groups
=
Vue
.
resource
(
endpoint
);
}
getGroups
(
parentId
,
page
=
1
)
{
getGroups
(
parentId
,
page
)
{
const
data
=
{};
if
(
parentId
)
{
...
...
app/assets/javascripts/groups/stores/groups_store.js
View file @
b4253735
/* eslint-disable class-methods-use-this */
export
default
class
GroupsStore
{
constructor
()
{
this
.
state
=
{};
...
...
@@ -9,7 +10,7 @@ export default class GroupsStore {
setGroups
(
rawGroups
,
parent
=
null
)
{
const
parentGroup
=
parent
;
const
tree
=
this
.
buildTree
(
rawGroups
);
const
tree
=
this
.
buildTree
(
rawGroups
,
parentGroup
);
if
(
parentGroup
)
{
parentGroup
.
subGroups
=
tree
;
...
...
@@ -20,6 +21,11 @@ export default class GroupsStore {
return
tree
;
}
resetGroups
(
parent
)
{
const
parentGroup
=
parent
;
parentGroup
.
subGroups
=
{};
}
storePagination
(
pagination
=
{})
{
let
paginationInfo
;
...
...
@@ -33,7 +39,7 @@ export default class GroupsStore {
this
.
state
.
pageInfo
=
paginationInfo
;
}
buildTree
(
rawGroups
)
{
buildTree
(
rawGroups
,
parentGroup
)
{
const
groups
=
this
.
decorateGroups
(
rawGroups
);
const
tree
=
{};
const
mappedGroups
=
{};
...
...
@@ -49,11 +55,14 @@ export default class GroupsStore {
Object
.
keys
(
mappedGroups
).
map
((
key
)
=>
{
const
currentGroup
=
mappedGroups
[
key
];
// If the group is not at the root level, add it to its parent array of subGroups.
const
parentGroup
=
mappedGroups
[
currentGroup
.
parentId
];
const
findParentGroup
=
mappedGroups
[
currentGroup
.
parentId
];
if
(
currentGroup
.
parentId
)
{
if
(
p
arentGroup
)
{
if
(
findP
arentGroup
)
{
mappedGroups
[
currentGroup
.
parentId
].
subGroups
[
currentGroup
.
id
]
=
currentGroup
;
mappedGroups
[
currentGroup
.
parentId
].
isOpen
=
true
;
// Expand group if it has subgroups
}
else
if
(
parentGroup
&&
parentGroup
.
id
===
currentGroup
.
parentId
)
{
tree
[
currentGroup
.
id
]
=
currentGroup
;
}
else
{
// Means the groups hast no direct parent.
// Save for later processing, we will add them to its corresponding base group
...
...
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