summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/members
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/groups/members')
-rw-r--r--app/assets/javascripts/groups/members/components/app.vue40
-rw-r--r--app/assets/javascripts/groups/members/constants.js4
-rw-r--r--app/assets/javascripts/groups/members/index.js43
-rw-r--r--app/assets/javascripts/groups/members/utils.js47
4 files changed, 5 insertions, 129 deletions
diff --git a/app/assets/javascripts/groups/members/components/app.vue b/app/assets/javascripts/groups/members/components/app.vue
deleted file mode 100644
index 34a2c67fa9f..00000000000
--- a/app/assets/javascripts/groups/members/components/app.vue
+++ /dev/null
@@ -1,40 +0,0 @@
-<script>
-import { mapState, mapMutations } from 'vuex';
-import { GlAlert } from '@gitlab/ui';
-import MembersTable from '~/members/components/table/members_table.vue';
-import FilterSortContainer from '~/members/components/filter_sort/filter_sort_container.vue';
-import { scrollToElement } from '~/lib/utils/common_utils';
-import { HIDE_ERROR } from '~/members/store/mutation_types';
-
-export default {
- name: 'GroupMembersApp',
- components: { MembersTable, FilterSortContainer, GlAlert },
- computed: {
- ...mapState(['showError', 'errorMessage']),
- },
- watch: {
- showError(value) {
- if (value) {
- this.$nextTick(() => {
- scrollToElement(this.$refs.errorAlert.$el);
- });
- }
- },
- },
- methods: {
- ...mapMutations({
- hideError: HIDE_ERROR,
- }),
- },
-};
-</script>
-
-<template>
- <div>
- <gl-alert v-if="showError" ref="errorAlert" variant="danger" @dismiss="hideError">{{
- errorMessage
- }}</gl-alert>
- <filter-sort-container />
- <members-table />
- </div>
-</template>
diff --git a/app/assets/javascripts/groups/members/constants.js b/app/assets/javascripts/groups/members/constants.js
index 6d71b666d7a..3315712891d 100644
--- a/app/assets/javascripts/groups/members/constants.js
+++ b/app/assets/javascripts/groups/members/constants.js
@@ -1,5 +1 @@
export const GROUP_MEMBER_BASE_PROPERTY_NAME = 'group_member';
-export const GROUP_MEMBER_ACCESS_LEVEL_PROPERTY_NAME = 'access_level';
-
-export const GROUP_LINK_BASE_PROPERTY_NAME = 'group_link';
-export const GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME = 'group_access';
diff --git a/app/assets/javascripts/groups/members/index.js b/app/assets/javascripts/groups/members/index.js
deleted file mode 100644
index 3ec874b8d36..00000000000
--- a/app/assets/javascripts/groups/members/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import { GlToast } from '@gitlab/ui';
-import { parseDataAttributes } from 'ee_else_ce/groups/members/utils';
-import App from './components/app.vue';
-import membersStore from '~/members/store';
-
-export const initGroupMembersApp = (
- el,
- {
- tableFields = [],
- tableAttrs = {},
- tableSortableFields = [],
- requestFormatter = () => {},
- filteredSearchBar = { show: false },
- },
-) => {
- if (!el) {
- return () => {};
- }
-
- Vue.use(Vuex);
- Vue.use(GlToast);
-
- const store = new Vuex.Store(
- membersStore({
- ...parseDataAttributes(el),
- currentUserId: gon.current_user_id || null,
- tableFields,
- tableAttrs,
- tableSortableFields,
- requestFormatter,
- filteredSearchBar,
- }),
- );
-
- return new Vue({
- el,
- components: { App },
- store,
- render: (createElement) => createElement('app'),
- });
-};
diff --git a/app/assets/javascripts/groups/members/utils.js b/app/assets/javascripts/groups/members/utils.js
index 4fcf348b69f..dc4eb7f4422 100644
--- a/app/assets/javascripts/groups/members/utils.js
+++ b/app/assets/javascripts/groups/members/utils.js
@@ -1,45 +1,8 @@
-import { isUndefined } from 'lodash';
-import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_utils';
-import {
- GROUP_MEMBER_BASE_PROPERTY_NAME,
- GROUP_MEMBER_ACCESS_LEVEL_PROPERTY_NAME,
- GROUP_LINK_BASE_PROPERTY_NAME,
- GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME,
-} from './constants';
-
-export const parseDataAttributes = (el) => {
- const { members, groupId, memberPath, canManageMembers } = el.dataset;
-
- return {
- members: convertObjectPropsToCamelCase(JSON.parse(members), { deep: true }),
- sourceId: parseInt(groupId, 10),
- memberPath,
- canManageMembers: parseBoolean(canManageMembers),
- };
-};
-
-const baseRequestFormatter = (basePropertyName, accessLevelPropertyName) => ({
- accessLevel,
- ...otherProperties
-}) => {
- const accessLevelProperty = !isUndefined(accessLevel)
- ? { [accessLevelPropertyName]: accessLevel }
- : {};
+import { MEMBER_ACCESS_LEVEL_PROPERTY_NAME } from '~/members/constants';
+import { baseRequestFormatter } from '~/members/utils';
+import { GROUP_MEMBER_BASE_PROPERTY_NAME } from './constants';
- return {
- [basePropertyName]: {
- ...accessLevelProperty,
- ...otherProperties,
- },
- };
-};
-
-export const memberRequestFormatter = baseRequestFormatter(
+export const groupMemberRequestFormatter = baseRequestFormatter(
GROUP_MEMBER_BASE_PROPERTY_NAME,
- GROUP_MEMBER_ACCESS_LEVEL_PROPERTY_NAME,
-);
-
-export const groupLinkRequestFormatter = baseRequestFormatter(
- GROUP_LINK_BASE_PROPERTY_NAME,
- GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME,
+ MEMBER_ACCESS_LEVEL_PROPERTY_NAME,
);