2020-12-01 21:09:29 +00:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-02-14 18:09:20 +00:00
|
|
|
import Vue from 'vue';
|
2020-12-01 21:09:29 +00:00
|
|
|
import {
|
|
|
|
parseBoolean,
|
|
|
|
historyReplaceState,
|
|
|
|
buildUrlWithCurrentLocation,
|
|
|
|
} from '~/lib/utils/common_utils';
|
2021-02-14 18:09:20 +00:00
|
|
|
import { doesHashExistInUrl } from '~/lib/utils/url_utility';
|
|
|
|
import { __ } from '~/locale';
|
2020-12-01 21:09:29 +00:00
|
|
|
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-04-27 21:10:09 +00:00
|
|
|
artifactsEndpoint,
|
|
|
|
artifactsEndpointPlaceholder,
|
2020-12-01 21:09:29 +00:00
|
|
|
pipelineScheduleUrl,
|
|
|
|
emptyStateSvgPath,
|
|
|
|
errorStateSvgPath,
|
|
|
|
noPipelinesSvgPath,
|
|
|
|
newPipelinePath,
|
2021-06-29 12:08:48 +00:00
|
|
|
pipelineEditorPath,
|
2021-04-13 06:11:22 +00:00
|
|
|
suggestedCiTemplates,
|
2020-12-01 21:09:29 +00:00
|
|
|
canCreatePipeline,
|
|
|
|
hasGitlabCi,
|
|
|
|
ciLintPath,
|
|
|
|
resetCachePath,
|
|
|
|
projectId,
|
|
|
|
params,
|
2021-05-12 12:10:24 +00:00
|
|
|
codeQualityPagePath,
|
2021-06-15 00:10:11 +00:00
|
|
|
ciRunnerSettingsPath,
|
2020-12-01 21:09:29 +00:00
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-04-07 12:08:53 +00:00
|
|
|
provide: {
|
2021-06-29 12:08:48 +00:00
|
|
|
pipelineEditorPath,
|
2021-04-27 21:10:09 +00:00
|
|
|
artifactsEndpoint,
|
|
|
|
artifactsEndpointPlaceholder,
|
2021-04-13 06:11:22 +00:00
|
|
|
suggestedCiTemplates: JSON.parse(suggestedCiTemplates),
|
2021-04-07 12:08:53 +00:00
|
|
|
},
|
2020-12-01 21:09:29 +00:00
|
|
|
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-05-12 12:10:24 +00:00
|
|
|
codeQualityPagePath,
|
2021-06-15 00:10:11 +00:00
|
|
|
ciRunnerSettingsPath,
|
2020-12-01 21:09:29 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|