debian-mirror-gitlab/app/assets/javascripts/groups/members/index.js

44 lines
910 B
JavaScript
Raw Normal View History

2020-11-24 15:15:51 +05:30
import Vue from 'vue';
import Vuex from 'vuex';
2021-01-03 14:25:43 +05:30
import { GlToast } from '@gitlab/ui';
import { parseDataAttributes } from 'ee_else_ce/groups/members/utils';
2020-11-24 15:15:51 +05:30
import App from './components/app.vue';
2021-02-22 17:27:13 +05:30
import membersStore from '~/members/store';
2020-11-24 15:15:51 +05:30
2021-02-22 17:27:13 +05:30
export const initGroupMembersApp = (
el,
{
tableFields = [],
tableAttrs = {},
tableSortableFields = [],
requestFormatter = () => {},
filteredSearchBar = { show: false },
},
) => {
2020-11-24 15:15:51 +05:30
if (!el) {
return () => {};
}
Vue.use(Vuex);
2021-01-03 14:25:43 +05:30
Vue.use(GlToast);
2020-11-24 15:15:51 +05:30
2021-02-22 17:27:13 +05:30
const store = new Vuex.Store(
membersStore({
2021-01-03 14:25:43 +05:30
...parseDataAttributes(el),
2020-11-24 15:15:51 +05:30
currentUserId: gon.current_user_id || null,
2021-01-03 14:25:43 +05:30
tableFields,
2021-01-29 00:20:46 +05:30
tableAttrs,
2021-02-22 17:27:13 +05:30
tableSortableFields,
2021-01-03 14:25:43 +05:30
requestFormatter,
2021-02-22 17:27:13 +05:30
filteredSearchBar,
2020-11-24 15:15:51 +05:30
}),
2021-02-22 17:27:13 +05:30
);
2020-11-24 15:15:51 +05:30
return new Vue({
el,
components: { App },
store,
render: createElement => createElement('app'),
});
};