Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/groups/components/groups.vue')
-rw-r--r--app/assets/javascripts/groups/components/groups.vue45
1 files changed, 45 insertions, 0 deletions
diff --git a/app/assets/javascripts/groups/components/groups.vue b/app/assets/javascripts/groups/components/groups.vue
new file mode 100644
index 00000000000..341855b9915
--- /dev/null
+++ b/app/assets/javascripts/groups/components/groups.vue
@@ -0,0 +1,45 @@
+<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>