Skip to content
Snippets Groups Projects
Unverified Commit ac393ade authored by Filipa Lacerda's avatar Filipa Lacerda
Browse files

Ensures disabled status while request is being made

parent 12bf940c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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>
Loading
Loading
Loading
Loading
@@ -17,11 +17,6 @@ export default {
type: Object,
required: true,
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
 
computed: {
Loading
Loading
@@ -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>
Loading
Loading
Loading
Loading
@@ -54,12 +54,6 @@ export default {
required: false,
default: false,
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
 
computed: {
Loading
Loading
@@ -136,7 +130,6 @@ export default {
:tooltip-text="status.action.title"
:link="status.action.path"
:action-icon="status.action.icon"
:button-disabled="actionDisabled"
/>
 
</div>
Loading
Loading
Loading
Loading
@@ -29,11 +29,6 @@ export default {
required: false,
default: '',
},
actionDisabled: {
type: String,
required: false,
default: null,
},
},
 
methods: {
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -25,7 +25,6 @@ export default () => {
data() {
return {
mediator,
actionDisabled: null,
};
},
created() {
Loading
Loading
@@ -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);
});
},
},
Loading
Loading
@@ -54,7 +51,6 @@ export default () => {
props: {
isLoading: this.mediator.state.isLoading,
pipeline: this.mediator.store.state.pipeline,
actionDisabled: this.actionDisabled,
},
});
},
Loading
Loading
Loading
Loading
@@ -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;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment