Commit 87ae36b1 authored by pburdette's avatar pburdette

Disable trigger button

When making a request disable
the trigger button until redirected.
parent 95bc54ae
...@@ -43,6 +43,7 @@ export default { ...@@ -43,6 +43,7 @@ export default {
variables: [], variables: [],
key: '', key: '',
secretValue: '', secretValue: '',
triggerBtnDisabled: false,
}; };
}, },
computed: { computed: {
...@@ -98,6 +99,11 @@ export default { ...@@ -98,6 +99,11 @@ export default {
1, 1,
); );
}, },
trigger() {
this.triggerBtnDisabled = true;
this.triggerManualJob(this.variables);
},
}, },
}; };
</script> </script>
...@@ -182,7 +188,9 @@ export default { ...@@ -182,7 +188,9 @@ export default {
variant="info" variant="info"
category="primary" category="primary"
:aria-label="__('Trigger manual job')" :aria-label="__('Trigger manual job')"
@click="triggerManualJob(variables)" :disabled="triggerBtnDisabled"
data-testid="trigger-manual-job-btn"
@click="trigger"
> >
{{ action.button_title }} {{ action.button_title }}
</gl-button> </gl-button>
......
...@@ -23,6 +23,8 @@ describe('Manual Variables Form', () => { ...@@ -23,6 +23,8 @@ describe('Manual Variables Form', () => {
}); });
}; };
const findTriggerBtn = () => wrapper.find('[data-testid="trigger-manual-job-btn"]');
beforeEach(() => { beforeEach(() => {
factory(requiredProps); factory(requiredProps);
}); });
...@@ -53,6 +55,10 @@ describe('Manual Variables Form', () => { ...@@ -53,6 +55,10 @@ describe('Manual Variables Form', () => {
expect(wrapper.find('a').attributes('href')).toBe(requiredProps.variablesSettingsUrl); expect(wrapper.find('a').attributes('href')).toBe(requiredProps.variablesSettingsUrl);
}); });
it('trigger button is not disabled on mount', () => {
expect(findTriggerBtn().props('disabled')).toBe(false);
});
describe('when adding a new variable', () => { describe('when adding a new variable', () => {
it('creates a new variable when user types a new key and resets the form', (done) => { it('creates a new variable when user types a new key and resets the form', (done) => {
wrapper.vm wrapper.vm
......
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