/* global Vue, Flash, gl */ /* eslint-disable no-param-reassign, no-bitwise */ ((gl) => { gl.VueStage = Vue.extend({ data() { return { builds: '', spinner: '', }; }, props: ['stage', 'svgs', 'match'], methods: { fetchBuilds(e) { const areaExpanded = e.currentTarget.attributes['aria-expanded']; if (areaExpanded && (areaExpanded.textContent === 'true')) return null; return this.$http.get(this.stage.dropdown_path) .then((response) => { this.builds = JSON.parse(response.body).html; }, () => { const flash = new Flash('Something went wrong on our end.'); return flash; }); }, }, computed: { buildsOrSpinner() { return this.builds ? this.builds : this.spinner; }, dropdownClass() { if (this.builds) return 'js-builds-dropdown-container'; return 'js-builds-dropdown-loading builds-dropdown-loading'; }, buildStatus() { return `Build: ${this.stage.status.label}`; }, tooltip() { return `has-tooltip ci-status-icon ci-status-icon-${this.stage.status.group}`; }, svg() { const { icon } = this.stage.status; const stageIcon = icon.replace(/icon/i, 'stage_icon'); return this.svgs[this.match(stageIcon)]; }, triggerButtonClass() { return `mini-pipeline-graph-dropdown-toggle has-tooltip js-builds-dropdown-button ci-status-icon-${this.stage.status.group}`; }, }, template: `
`, }); })(window.gl || (window.gl = {}));