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,
|
2022-05-07 20:08:51 +05:30
|
|
|
defaultBranchName,
|
2021-02-22 17:27:13 +05:30
|
|
|
params,
|
2021-09-04 01:27:46 +05:30
|
|
|
ciRunnerSettingsPath,
|
2022-05-07 20:08:51 +05:30
|
|
|
anyRunnersAvailable,
|
2022-07-16 23:28:13 +05:30
|
|
|
iosRunnersAvailable,
|
|
|
|
registrationToken,
|
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),
|
2022-07-16 23:28:13 +05:30
|
|
|
ciRunnerSettingsPath,
|
|
|
|
anyRunnersAvailable: parseBoolean(anyRunnersAvailable),
|
|
|
|
iosRunnersAvailable: parseBoolean(iosRunnersAvailable),
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
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,
|
2022-05-07 20:08:51 +05:30
|
|
|
defaultBranchName,
|
2021-02-22 17:27:13 +05:30
|
|
|
params: JSON.parse(params),
|
2022-07-16 23:28:13 +05:30
|
|
|
registrationToken,
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|