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
4b488d72
Commit
4b488d72
authored
May 08, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare groups components for subgroups
parent
5e0e3971
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
15 deletions
+68
-15
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+30
-9
app/assets/javascripts/groups/components/groups.vue
app/assets/javascripts/groups/components/groups.vue
+15
-3
app/assets/javascripts/groups/event_hub.js
app/assets/javascripts/groups/event_hub.js
+3
-0
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+2
-2
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+18
-1
No files found.
app/assets/javascripts/groups/components/group_item.vue
View file @
4b488d72
<
script
>
import
eventHub
from
'
../event_hub
'
;
export
default
{
props
:
{
group
:
{
type
:
Object
,
required
:
true
,
}
}
},
},
methods
:
{
toggleSubGroups
()
{
eventHub
.
$emit
(
'
toggleSubGroups
'
,
this
.
group
);
},
},
};
</
script
>
<
template
>
<tr>
<tr
@
click=
"toggleSubGroups"
>
<template
>
<td>
<span>
<i
v-show=
"group.isOpen"
class=
"fa fa-caret-down"
aria-hidden=
"true"
/>
<i
v-show=
"!group.isOpen"
class=
"fa fa-caret-right"
aria-hidden=
"true"
/>
</span>
</td>
<td>
<div>
<a
:href=
"group.web_url"
>
{{
group
.
full_name
}}
</a>
</div>
<div>
{{
group
.
description
}}
</div>
</td>
</
template
>
</tr>
</template>
app/assets/javascripts/groups/components/groups.vue
View file @
4b488d72
...
...
@@ -2,6 +2,7 @@
import
GroupsStore
from
'
../stores/groups_store
'
;
import
GroupsService
from
'
../services/groups_service
'
;
import
GroupItem
from
'
../components/group_item.vue
'
;
import
eventHub
from
'
../event_hub
'
;
export
default
{
components
:
{
...
...
@@ -14,7 +15,7 @@ export default {
return
{
store
,
state
:
store
.
state
,
}
}
;
},
created
()
{
...
...
@@ -22,6 +23,8 @@ export default {
this
.
service
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
this
.
fetchGroups
();
eventHub
.
$on
(
'
toggleSubGroups
'
,
this
.
toggleSubGroups
);
},
methods
:
{
...
...
@@ -34,12 +37,21 @@ export default {
// TODO: Handler error
});
},
}
toggleSubGroups
(
group
)
{
GroupsStore
.
toggleSubGroups
(
group
);
},
},
};
</
script
>
<
template
>
<table
class=
"table table-bordered"
>
<group-item
:group=
"group"
v-for=
"group in state.groups"
/>
<template
v-for=
"group in state.groups"
>
<tr
is=
"group-item"
:group=
"group"
/>
<tr
v-if=
"group.isOpen"
>
<td>
sub groups for
{{
group
.
name
}}
</td>
<td></td>
</tr>
</
template
>
</table>
</template>
app/assets/javascripts/groups/event_hub.js
0 → 100644
View file @
4b488d72
import
Vue
from
'
vue
'
;
export
default
new
Vue
();
app/assets/javascripts/groups/index.js
View file @
4b488d72
/* eslint-disable no-unused-vars */
import
Vue
from
'
vue
'
;
import
GroupsComponent
from
'
./components/groups.vue
'
import
GroupsComponent
from
'
./components/groups.vue
'
;
$
(()
=>
{
const
appEl
=
document
.
querySelector
(
'
#dashboard-group-app
'
);
...
...
@@ -9,7 +9,7 @@ $(() => {
const
GroupsApp
=
new
Vue
({
el
:
appEl
,
components
:
{
'
groups-component
'
:
GroupsComponent
'
groups-component
'
:
GroupsComponent
,
},
render
:
createElement
=>
createElement
(
'
groups-component
'
),
});
...
...
app/assets/javascripts/groups/stores/groups_store.js
View file @
4b488d72
...
...
@@ -7,8 +7,25 @@ export default class GroupsStore {
}
setGroups
(
groups
)
{
this
.
state
.
groups
=
groups
;
this
.
state
.
groups
=
this
.
decorateGroups
(
groups
)
;
return
groups
;
}
decorateGroups
(
rawGroups
)
{
this
.
groups
=
rawGroups
.
map
(
GroupsStore
.
decorateGroup
);
return
this
.
groups
;
}
static
decorateGroup
(
rawGroup
)
{
const
group
=
rawGroup
;
group
.
isOpen
=
false
;
return
group
;
}
static
toggleSubGroups
(
toggleGroup
)
{
const
group
=
toggleGroup
;
group
.
isOpen
=
!
group
.
isOpen
;
return
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