2021-02-22 17:27:13 +05:30
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import Vue from 'vue';
|
2021-02-22 17:27:13 +05:30
|
|
|
import {
|
|
|
|
parseBoolean,
|
|
|
|
historyReplaceState,
|
|
|
|
buildUrlWithCurrentLocation,
|
|
|
|
} from '~/lib/utils/common_utils';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { doesHashExistInUrl } from '~/lib/utils/url_utility';
|
|
|
|
import { __ } from '~/locale';
|
2021-02-22 17:27:13 +05:30
|
|
|
import Translate from '~/vue_shared/translate';
|
|
|
|
import Pipelines from './components/pipelines_list/pipelines.vue';
|
|
|
|
import PipelinesStore from './stores/pipelines_store';
|
|
|
|
|
|
|
|
Vue.use(Translate);
|
|
|
|
Vue.use(GlToast);
|
|
|
|
|
|
|
|
export const initPipelinesIndex = (selector = '#pipelines-list-vue') => {
|
|
|
|
const el = document.querySelector(selector);
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
|
|
|
endpoint,
|
2021-06-08 01:23:25 +05:30
|
|
|
artifactsEndpoint,
|
|
|
|
artifactsEndpointPlaceholder,
|
2021-02-22 17:27:13 +05:30
|
|
|
pipelineScheduleUrl,
|
|
|
|
emptyStateSvgPath,
|
|
|
|
errorStateSvgPath,
|
|
|
|
noPipelinesSvgPath,
|
|
|
|
newPipelinePath,
|
2021-09-30 23:02:18 +05:30
|
|
|
pipelineEditorPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
suggestedCiTemplates,
|
2021-02-22 17:27:13 +05:30
|
|
|
canCreatePipeline,
|
|
|
|
hasGitlabCi,
|
|
|
|
ciLintPath,
|
|
|
|
resetCachePath,
|
|
|
|
projectId,
|
|
|
|
params,
|
2021-06-08 01:23:25 +05:30
|
|
|
codeQualityPagePath,
|
2021-09-04 01:27:46 +05:30
|
|
|
ciRunnerSettingsPath,
|
2021-02-22 17:27:13 +05:30
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-04-29 21:17:54 +05:30
|
|
|
provide: {
|
2021-09-30 23:02:18 +05:30
|
|
|
pipelineEditorPath,
|
2021-06-08 01:23:25 +05:30
|
|
|
artifactsEndpoint,
|
|
|
|
artifactsEndpointPlaceholder,
|
2021-04-29 21:17:54 +05:30
|
|
|
suggestedCiTemplates: JSON.parse(suggestedCiTemplates),
|
|
|
|
},
|
2021-02-22 17:27:13 +05:30
|
|
|
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: {
|
|
|
|
store: this.store,
|
|
|
|
endpoint,
|
|
|
|
pipelineScheduleUrl,
|
|
|
|
emptyStateSvgPath,
|
|
|
|
errorStateSvgPath,
|
|
|
|
noPipelinesSvgPath,
|
|
|
|
newPipelinePath,
|
|
|
|
canCreatePipeline: parseBoolean(canCreatePipeline),
|
|
|
|
hasGitlabCi: parseBoolean(hasGitlabCi),
|
|
|
|
ciLintPath,
|
|
|
|
resetCachePath,
|
|
|
|
projectId,
|
|
|
|
params: JSON.parse(params),
|
2021-06-08 01:23:25 +05:30
|
|
|
codeQualityPagePath,
|
2021-09-04 01:27:46 +05:30
|
|
|
ciRunnerSettingsPath,
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|