Commit ac393ade authored by Filipa Lacerda's avatar Filipa Lacerda

Ensures disabled status while request is being made

parent 12bf940c
......@@ -31,29 +31,40 @@ export default {
type: String,
required: true,
},
buttonDisabled: {
type: String,
required: false,
default: null,
},
},
data() {
return {
isDisabled: false,
linkRequested: '',
};
},
computed: {
cssClass() {
const actionIconDash = dasherize(this.actionIcon);
return `${actionIconDash} js-icon-${actionIconDash}`;
},
isDisabled() {
return this.buttonDisabled === this.link;
},
},
methods: {
onClickAction() {
$(this.$el).tooltip('hide');
eventHub.$emit('graphAction', this.link);
this.linkRequested = this.link;
this.isDisabled = true;
},
updateDisabled(actionUrl) {
if (actionUrl === this.linkRequested) {
this.isDisabled = false;
}
}
},
created() {
eventHub.$on('graphActionFinished', this.updateDisabled);
},
beforeDestroy() {
eventHub.$off('graphActionFinished', this.updateDisabled);
},
};
</script>
<template>
......
......@@ -17,11 +17,6 @@ export default {
type: Object,
required: true,
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
computed: {
......@@ -75,7 +70,6 @@ export default {
:key="stage.name"
:stage-connector-class="stageConnectorClass(index, stage)"
:is-first-column="isFirstColumn(index)"
:action-disabled="actionDisabled"
/>
</ul>
</div>
......
......@@ -54,12 +54,6 @@ export default {
required: false,
default: false,
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
computed: {
......@@ -136,7 +130,6 @@ export default {
:tooltip-text="status.action.title"
:link="status.action.path"
:action-icon="status.action.icon"
:button-disabled="actionDisabled"
/>
</div>
......
......@@ -29,11 +29,6 @@ export default {
required: false,
default: '',
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
methods: {
......@@ -74,7 +69,6 @@ export default {
v-if="job.size === 1"
:job="job"
css-class-job-name="build-content"
:action-disabled="actionDisabled"
/>
<dropdown-job-component
......
......@@ -25,7 +25,6 @@ export default () => {
data() {
return {
mediator,
actionDisabled: null,
};
},
created() {
......@@ -36,16 +35,14 @@ export default () => {
},
methods: {
postAction(action) {
this.actionDisabled = action;
this.mediator.service.postAction(action)
.then(() => {
this.mediator.refreshPipeline();
this.actionDisabled = null;
eventHub.$emit('graphActionFinished', action);
})
.catch(() => {
this.actionDisabled = null;
Flash(__('An error occurred while making the request.'));
eventHub.$emit('graphActionFinished', action);
});
},
},
......@@ -54,7 +51,6 @@ export default () => {
props: {
isLoading: this.mediator.state.isLoading,
pipeline: this.mediator.store.state.pipeline,
actionDisabled: this.actionDisabled,
},
});
},
......
......@@ -468,6 +468,14 @@
margin-bottom: 10px;
white-space: normal;
.ci-job-dropdown-container {
// override dropdown.scss
.dropdown-menu li button {
padding: 0;
text-align: center;
}
}
// ensure .build-content has hover style when action-icon is hovered
.ci-job-dropdown-container:hover .build-content {
@extend .build-content:hover;
......
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