2020-09-12 00:08:44 +00:00
|
|
|
import Vue from 'vue';
|
2020-09-17 18:10:12 +00:00
|
|
|
import Vuex from 'vuex';
|
2020-10-15 21:09:12 +00:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
2020-10-12 09:08:38 +00:00
|
|
|
import { parseDataAttributes } from 'ee_else_ce/groups/members/utils';
|
2020-09-12 00:08:44 +00:00
|
|
|
import App from './components/app.vue';
|
2020-11-19 12:09:26 +00:00
|
|
|
import membersStore from '~/members/store';
|
2020-09-12 00:08:44 +00:00
|
|
|
|
2020-11-29 09:09:27 +00:00
|
|
|
export const initGroupMembersApp = (
|
|
|
|
el,
|
|
|
|
{
|
|
|
|
tableFields = [],
|
|
|
|
tableAttrs = {},
|
|
|
|
tableSortableFields = [],
|
|
|
|
requestFormatter = () => {},
|
|
|
|
filteredSearchBar = { show: false },
|
|
|
|
},
|
|
|
|
) => {
|
2020-09-12 00:08:44 +00:00
|
|
|
if (!el) {
|
|
|
|
return () => {};
|
|
|
|
}
|
|
|
|
|
2020-09-17 18:10:12 +00:00
|
|
|
Vue.use(Vuex);
|
2020-10-15 21:09:12 +00:00
|
|
|
Vue.use(GlToast);
|
2020-09-17 18:10:12 +00:00
|
|
|
|
2020-11-19 12:09:26 +00:00
|
|
|
const store = new Vuex.Store(
|
|
|
|
membersStore({
|
2020-10-12 09:08:38 +00:00
|
|
|
...parseDataAttributes(el),
|
2020-09-17 18:10:12 +00:00
|
|
|
currentUserId: gon.current_user_id || null,
|
2020-09-22 15:09:37 +00:00
|
|
|
tableFields,
|
2020-11-10 21:08:51 +00:00
|
|
|
tableAttrs,
|
2020-11-29 09:09:27 +00:00
|
|
|
tableSortableFields,
|
2020-10-14 18:08:47 +00:00
|
|
|
requestFormatter,
|
2020-11-29 09:09:27 +00:00
|
|
|
filteredSearchBar,
|
2020-09-17 18:10:12 +00:00
|
|
|
}),
|
2020-11-19 12:09:26 +00:00
|
|
|
);
|
2020-09-17 18:10:12 +00:00
|
|
|
|
2020-09-12 00:08:44 +00:00
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
components: { App },
|
2020-09-17 18:10:12 +00:00
|
|
|
store,
|
2020-12-24 00:10:25 +00:00
|
|
|
render: (createElement) => createElement('app'),
|
2020-09-12 00:08:44 +00:00
|
|
|
});
|
|
|
|
};
|