/* global Vue, Turbolinks, gl */ /* eslint-disable no-param-reassign */ ((gl) => { gl.VuePipelines = Vue.extend({ components: { runningPipeline: gl.VueRunningPipeline, pipelineActions: gl.VuePipelineActions, stages: gl.VueStages, commit: gl.CommitComponent, pipelineUrl: gl.VuePipelineUrl, pipelineHead: gl.VuePipelineHead, glPagination: gl.VueGlPagination, statusScope: gl.VueStatusScope, timeAgo: gl.VueTimeAgo, }, data() { return { pipelines: [], timeLoopInterval: '', intervalId: '', apiScope: 'all', pageInfo: {}, pagenum: 1, count: { all: 0, running_or_pending: 0 }, pageRequest: false, }; }, props: ['scope', 'store', 'svgs'], created() { const pagenum = gl.utils.getParameterByName('p'); const scope = gl.utils.getParameterByName('scope'); if (pagenum) this.pagenum = pagenum; if (scope) this.apiScope = scope; this.store.fetchDataLoop.call(this, Vue, this.pagenum, this.scope, this.apiScope); }, methods: { change(pagenum, apiScope) { Turbolinks.visit(`?scope=${apiScope}&p=${pagenum}`); }, author(pipeline) { if (!pipeline.commit) return { avatar_url: '', web_url: '', username: '' }; if (pipeline.commit.author) return pipeline.commit.author; return { avatar_url: pipeline.commit.author_gravatar_url, web_url: `mailto:${pipeline.commit.author_email}`, username: pipeline.commit.author_name, }; }, ref(pipeline) { const { ref } = pipeline; return { name: ref.name, tag: ref.tag, ref_url: ref.path }; }, commitTitle(pipeline) { return pipeline.commit ? pipeline.commit.title : ''; }, commitSha(pipeline) { return pipeline.commit ? pipeline.commit.short_id : ''; }, commitUrl(pipeline) { return pipeline.commit ? pipeline.commit.commit_path : ''; }, match(string) { return string.replace(/_([a-z])/g, (m, w) => w.toUpperCase()); }, }, template: `
Status Pipeline Commit Stages
`, }); })(window.gl || (window.gl = {}));