Commit 61b6643e authored by Fatih Acet's avatar Fatih Acet

Merge branch 'ui_pipelines_mini_graph' into 'master'

better UI fix - simple solution - pipelines#index mini_graph in Vue

See merge request !8614
parents 6b0ea00d e6753362
...@@ -5,18 +5,19 @@ ...@@ -5,18 +5,19 @@
gl.VueStage = Vue.extend({ gl.VueStage = Vue.extend({
data() { data() {
return { return {
count: 0,
builds: '', builds: '',
spinner: '<span class="fa fa-spinner fa-spin"></span>', spinner: '<span class="fa fa-spinner fa-spin"></span>',
}; };
}, },
props: ['stage', 'svgs', 'match'], props: ['stage', 'svgs', 'match'],
methods: { methods: {
fetchBuilds() { fetchBuilds(e) {
if (this.count > 0) return null; const areaExpanded = e.currentTarget.attributes['aria-expanded'];
if (areaExpanded && (areaExpanded.textContent === 'true')) return null;
return this.$http.get(this.stage.dropdown_path) return this.$http.get(this.stage.dropdown_path)
.then((response) => { .then((response) => {
this.count += 1;
this.builds = JSON.parse(response.body).html; this.builds = JSON.parse(response.body).html;
}, () => { }, () => {
const flash = new Flash('Something went wrong on our end.'); const flash = new Flash('Something went wrong on our end.');
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
return `has-tooltip ci-status-icon ci-status-icon-${this.stage.status.group}`; return `has-tooltip ci-status-icon ci-status-icon-${this.stage.status.group}`;
}, },
svg() { svg() {
const icon = this.stage.status.icon; const { icon } = this.stage.status;
const stageIcon = icon.replace(/icon/i, 'stage_icon'); const stageIcon = icon.replace(/icon/i, 'stage_icon');
return this.svgs[this.match(stageIcon)]; return this.svgs[this.match(stageIcon)];
}, },
...@@ -50,18 +51,25 @@ ...@@ -50,18 +51,25 @@
template: ` template: `
<div> <div>
<button <button
@click='fetchBuilds' @click='fetchBuilds($event)'
:class="triggerButtonClass" :class="triggerButtonClass"
:title='stage.title' :title='stage.title'
data-placement="top" data-placement="top"
data-toggle="dropdown" data-toggle="dropdown"
type="button"> type="button"
>
<span v-html="svg"></span> <span v-html="svg"></span>
<i class="fa fa-caret-down "></i> <i class="fa fa-caret-down "></i>
</button> </button>
<ul class="dropdown-menu mini-pipeline-graph-dropdown-menu js-builds-dropdown-container"> <ul class="dropdown-menu mini-pipeline-graph-dropdown-menu js-builds-dropdown-container">
<div class="arrow-up"></div> <div class="arrow-up"></div>
<div :class="dropdownClass" class="js-builds-dropdown-list scrollable-menu" v-html="buildsOrSpinner"></div> <div
@click=''
:class="dropdownClass"
class="js-builds-dropdown-list scrollable-menu"
v-html="buildsOrSpinner"
>
</div>
</ul> </ul>
</div> </div>
`, `,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment