Commit 4416de25 authored by Tom Quirk's avatar Tom Quirk

Address reviewer feedback

- simplify button disabled state
- rename loading state variables
parent ad6db20c
...@@ -53,8 +53,8 @@ export default { ...@@ -53,8 +53,8 @@ export default {
data() { data() {
return { return {
integrationActive: false, integrationActive: false,
testingLoading: false, isTesting: false,
saveLoading: false, isSaving: false,
}; };
}, },
computed: { computed: {
...@@ -78,14 +78,8 @@ export default { ...@@ -78,14 +78,8 @@ export default {
showTestButton() { showTestButton() {
return this.propsSource.canTest; return this.propsSource.canTest;
}, },
disableSaveButton() { disableButtons() {
return Boolean(this.isResetting || this.testingLoading); return Boolean(this.isSaving || this.isResetting || this.isTesting);
},
disableResetButton() {
return Boolean(this.isSaving || this.testingLoading);
},
disableTestButton() {
return Boolean(this.isResetting || this.saveLoading);
}, },
}, },
mounted() { mounted() {
...@@ -95,10 +89,10 @@ export default { ...@@ -95,10 +89,10 @@ export default {
methods: { methods: {
...mapActions(['setOverride', 'fetchResetIntegration', 'requestJiraIssueTypes']), ...mapActions(['setOverride', 'fetchResetIntegration', 'requestJiraIssueTypes']),
onSaveClick() { onSaveClick() {
this.saveLoading = true; this.isSaving = true;
if (this.integrationActive && !this.form.checkValidity()) { if (this.integrationActive && !this.form.checkValidity()) {
this.saveLoading = false; this.isSaving = false;
eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT); eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
return; return;
} }
...@@ -106,7 +100,7 @@ export default { ...@@ -106,7 +100,7 @@ export default {
this.form.submit(); this.form.submit();
}, },
onTestClick() { onTestClick() {
this.testingLoading = true; this.isTesting = true;
if (!this.form.checkValidity()) { if (!this.form.checkValidity()) {
eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT); eventHub.$emit(VALIDATE_INTEGRATION_FORM_EVENT);
...@@ -128,7 +122,7 @@ export default { ...@@ -128,7 +122,7 @@ export default {
Sentry.captureException(error); Sentry.captureException(error);
}) })
.finally(() => { .finally(() => {
this.testingLoading = false; this.isTesting = false;
}); });
}, },
onResetClick() { onResetClick() {
...@@ -212,8 +206,8 @@ export default { ...@@ -212,8 +206,8 @@ export default {
v-gl-modal.confirmSaveIntegration v-gl-modal.confirmSaveIntegration
category="primary" category="primary"
variant="confirm" variant="confirm"
:loading="saveLoading" :loading="isSaving"
:disabled="disableSaveButton" :disabled="disableButtons"
data-qa-selector="save_changes_button" data-qa-selector="save_changes_button"
> >
{{ __('Save changes') }} {{ __('Save changes') }}
...@@ -225,8 +219,8 @@ export default { ...@@ -225,8 +219,8 @@ export default {
category="primary" category="primary"
variant="confirm" variant="confirm"
type="submit" type="submit"
:loading="saveLoading" :loading="isSaving"
:disabled="disableSaveButton" :disabled="disableButtons"
data-testid="save-button" data-testid="save-button"
data-qa-selector="save_changes_button" data-qa-selector="save_changes_button"
@click.prevent="onSaveClick" @click.prevent="onSaveClick"
...@@ -238,8 +232,8 @@ export default { ...@@ -238,8 +232,8 @@ export default {
v-if="showTestButton" v-if="showTestButton"
category="secondary" category="secondary"
variant="confirm" variant="confirm"
:loading="testingLoading" :loading="isTesting"
:disabled="disableTestButton" :disabled="disableButtons"
data-testid="test-button" data-testid="test-button"
@click.prevent="onTestClick" @click.prevent="onTestClick"
> >
...@@ -252,7 +246,7 @@ export default { ...@@ -252,7 +246,7 @@ export default {
category="secondary" category="secondary"
variant="confirm" variant="confirm"
:loading="isResetting" :loading="isResetting"
:disabled="disableResetButton" :disabled="disableButtons"
data-testid="reset-button" data-testid="reset-button"
> >
{{ __('Reset') }} {{ __('Reset') }}
......
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