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
5e0e3971
Commit
5e0e3971
authored
May 05, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List groups with basic details
- Adds Groups component - Adds GroupItem component
parent
26573605
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
23 deletions
+82
-23
app/assets/javascripts/groups/components/group_item.vue
app/assets/javascripts/groups/components/group_item.vue
+21
-0
app/assets/javascripts/groups/components/groups.vue
app/assets/javascripts/groups/components/groups.vue
+45
-0
app/assets/javascripts/groups/index.js
app/assets/javascripts/groups/index.js
+5
-15
app/assets/javascripts/groups/stores/groups_store.js
app/assets/javascripts/groups/stores/groups_store.js
+10
-1
app/views/dashboard/groups/_groups.html.haml
app/views/dashboard/groups/_groups.html.haml
+1
-7
No files found.
app/assets/javascripts/groups/components/group_item.vue
0 → 100644
View file @
5e0e3971
<
script
>
export
default
{
props
:
{
group
:
{
type
:
Object
,
required
:
true
,
}
}
};
</
script
>
<
template
>
<tr>
<td>
<div>
<a
:href=
"group.web_url"
>
{{
group
.
full_name
}}
</a>
</div>
<div>
{{
group
.
description
}}
</div>
</td>
</tr>
</
template
>
app/assets/javascripts/groups/components/groups.vue
0 → 100644
View file @
5e0e3971
<
script
>
import
GroupsStore
from
'
../stores/groups_store
'
;
import
GroupsService
from
'
../services/groups_service
'
;
import
GroupItem
from
'
../components/group_item.vue
'
;
export
default
{
components
:
{
'
group-item
'
:
GroupItem
,
},
data
()
{
const
store
=
new
GroupsStore
();
return
{
store
,
state
:
store
.
state
,
}
},
created
()
{
const
appEl
=
document
.
querySelector
(
'
#dashboard-group-app
'
);
this
.
service
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
this
.
fetchGroups
();
},
methods
:
{
fetchGroups
()
{
this
.
service
.
getGroups
()
.
then
((
response
)
=>
{
this
.
store
.
setGroups
(
response
.
json
());
})
.
catch
(()
=>
{
// TODO: Handler error
});
},
}
};
</
script
>
<
template
>
<table
class=
"table table-bordered"
>
<group-item
:group=
"group"
v-for=
"group in state.groups"
/>
</table>
</
template
>
app/assets/javascripts/groups/index.js
View file @
5e0e3971
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-vars */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
GroupsStore
from
'
./stores/groups_store
'
;
import
GroupsComponent
from
'
./components/groups.vue
'
import
GroupsService
from
'
./services/groups_service
'
;
$
(()
=>
{
$
(()
=>
{
const
appEl
=
document
.
querySelector
(
'
.js-groups-list-holder
'
);
const
appEl
=
document
.
querySelector
(
'
#dashboard-group-app
'
);
const
groupsStore
=
new
GroupsStore
();
const
groupsService
=
new
GroupsService
(
appEl
.
dataset
.
endpoint
);
const
GroupsApp
=
new
Vue
({
const
GroupsApp
=
new
Vue
({
el
:
appEl
,
el
:
appEl
,
data
:
groupsStore
,
components
:
{
mounted
()
{
'
groups-component
'
:
GroupsComponent
groupsService
.
getGroups
()
.
then
((
response
)
=>
{
this
.
groups
=
response
.
json
();
})
.
catch
(()
=>
{
// TODO: Handle error
});
},
},
render
:
createElement
=>
createElement
(
'
groups-component
'
),
});
});
});
});
app/assets/javascripts/groups/stores/groups_store.js
View file @
5e0e3971
export
default
class
GroupsStore
{
export
default
class
GroupsStore
{
constructor
()
{
constructor
()
{
this
.
groups
=
[];
this
.
state
=
{};
this
.
state
.
groups
=
[];
return
this
;
}
setGroups
(
groups
)
{
this
.
state
.
groups
=
groups
;
return
groups
;
}
}
}
}
app/views/dashboard/groups/_groups.html.haml
View file @
5e0e3971
.js-groups-list-holder
{
data:
{
endpoint:
dashboard_groups_path
(
format: :json
)
}
}
.js-groups-list-holder
#dashboard-group-app
{
data:
{
endpoint:
dashboard_groups_path
(
format: :json
)
}
}
%ul
.content-list
-
@groups
.
each
do
|
group
|
-
group_member
=
group
.
group_members
.
find_by
(
user_id:
current_user
)
=
render
'shared/groups/group'
,
group:
group_member
.
group
,
group_member:
group_member
=
paginate
@groups
,
theme:
'gitlab'
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