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

44 lines
892 B
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import { GlToast } from '@gitlab/ui';
2020-11-24 15:15:51 +05:30
import Vue from 'vue';
import Vuex from 'vuex';
2021-03-11 19:13:27 +05:30
import { parseDataAttributes } from 'ee_else_ce/members/utils';
2020-11-24 15:15:51 +05:30
import App from './components/app.vue';
2021-03-11 19:13:27 +05:30
import membersStore from './store';
2020-11-24 15:15:51 +05:30
2021-03-11 19:13:27 +05:30
export const initMembersApp = (
2021-02-22 17:27:13 +05:30
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,
2021-03-08 18:12:59 +05:30
render: (createElement) => createElement('app'),
2020-11-24 15:15:51 +05:30
});
};