1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
import Vue from 'vue';
import VueRouter from 'vue-router';
import { GlToast } from '@gitlab/ui';
import { parseBoolean } from '~/lib/utils/common_utils';
import GroupItem from 'jh_else_ce/groups/components/group_item.vue';
import GroupFolder from './components/group_folder.vue';
import {
ACTIVE_TAB_SUBGROUPS_AND_PROJECTS,
ACTIVE_TAB_SHARED,
ACTIVE_TAB_ARCHIVED,
} from './constants';
import OverviewTabs from './components/overview_tabs.vue';
export const createRouter = () => {
const routes = [
{ name: ACTIVE_TAB_SHARED, path: '/groups/:group*/-/shared' },
{ name: ACTIVE_TAB_ARCHIVED, path: '/groups/:group*/-/archived' },
{ name: ACTIVE_TAB_SUBGROUPS_AND_PROJECTS, path: '/:group*' },
];
const router = new VueRouter({
routes,
mode: 'history',
base: gon.relative_url_root || '/',
});
return router;
};
export const initGroupOverviewTabs = () => {
const el = document.getElementById('js-group-overview-tabs');
if (!el) return false;
Vue.component('GroupFolder', GroupFolder);
Vue.component('GroupItem', GroupItem);
Vue.use(GlToast);
Vue.use(VueRouter);
const router = createRouter();
const {
groupId,
newSubgroupPath,
newProjectPath,
newSubgroupIllustration,
newProjectIllustration,
emptyProjectsIllustration,
emptySubgroupIllustration,
emptySearchIllustration,
canCreateSubgroups,
canCreateProjects,
currentGroupVisibility,
subgroupsAndProjectsEndpoint,
sharedProjectsEndpoint,
archivedProjectsEndpoint,
initialSort,
} = el.dataset;
return new Vue({
el,
router,
provide: {
groupId,
newSubgroupPath,
newProjectPath,
newSubgroupIllustration,
newProjectIllustration,
emptyProjectsIllustration,
emptySubgroupIllustration,
emptySearchIllustration,
canCreateSubgroups: parseBoolean(canCreateSubgroups),
canCreateProjects: parseBoolean(canCreateProjects),
currentGroupVisibility,
endpoints: {
[ACTIVE_TAB_SUBGROUPS_AND_PROJECTS]: subgroupsAndProjectsEndpoint,
[ACTIVE_TAB_SHARED]: sharedProjectsEndpoint,
[ACTIVE_TAB_ARCHIVED]: archivedProjectsEndpoint,
},
initialSort,
},
render(createElement) {
return createElement(OverviewTabs);
},
});
};
|