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
87
88
89
90
91
92
93
94
|
import { GlToast } from '@gitlab/ui';
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import {
parseBoolean,
historyReplaceState,
buildUrlWithCurrentLocation,
} from '~/lib/utils/common_utils';
import { doesHashExistInUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import Translate from '~/vue_shared/translate';
import Pipelines from '~/ci/pipelines_page/pipelines.vue';
import PipelinesStore from './stores/pipelines_store';
Vue.use(Translate);
Vue.use(GlToast);
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
export const initPipelinesIndex = (selector = '#pipelines-list-vue') => {
const el = document.querySelector(selector);
if (!el) {
return null;
}
const {
endpoint,
artifactsEndpoint,
artifactsEndpointPlaceholder,
pipelineSchedulesPath,
newPipelinePath,
pipelineEditorPath,
suggestedCiTemplates,
canCreatePipeline,
hasGitlabCi,
ciLintPath,
resetCachePath,
projectId,
defaultBranchName,
params,
iosRunnersAvailable,
registrationToken,
fullPath,
visibilityPipelineIdType,
} = el.dataset;
return new Vue({
el,
apolloProvider,
provide: {
artifactsEndpoint,
artifactsEndpointPlaceholder,
fullPath,
iosRunnersAvailable: parseBoolean(iosRunnersAvailable),
manualActionsLimit: 50,
pipelineEditorPath,
pipelineSchedulesPath,
suggestedCiTemplates: JSON.parse(suggestedCiTemplates),
},
data() {
return {
store: new PipelinesStore(),
};
},
created() {
if (doesHashExistInUrl('delete_success')) {
this.$toast.show(__('The pipeline has been deleted'));
historyReplaceState(buildUrlWithCurrentLocation());
}
},
render(createElement) {
return createElement(Pipelines, {
props: {
canCreatePipeline: parseBoolean(canCreatePipeline),
ciLintPath,
defaultBranchName,
defaultVisibilityPipelineIdType: visibilityPipelineIdType,
endpoint,
hasGitlabCi: parseBoolean(hasGitlabCi),
newPipelinePath,
params: JSON.parse(params),
projectId,
registrationToken,
resetCachePath,
store: this.store,
},
});
},
});
};
|