Add comments for method and minor refinements

This commit is contained in:
kushalpandya 2017-05-30 16:58:09 +05:30 committed by Jarka Kadlecova
parent 4341801a41
commit f57a4a945a

View file

@ -44,6 +44,9 @@ export default class IntegrationSettingsForm {
this.toggleServiceState($(e.currentTarget).is(':checked')); this.toggleServiceState($(e.currentTarget).is(':checked'));
} }
/**
* Change Form's validation enforcement based on service status (active/inactive)
*/
toggleServiceState(serviceActive) { toggleServiceState(serviceActive) {
this.toggleSubmitBtnLabel(serviceActive, this.canTestService); this.toggleSubmitBtnLabel(serviceActive, this.canTestService);
if (serviceActive) { if (serviceActive) {
@ -54,7 +57,7 @@ export default class IntegrationSettingsForm {
} }
/** /**
* Toggle Submit button label based on Integration status * Toggle Submit button label based on Integration status and ability to test service
*/ */
toggleSubmitBtnLabel(serviceActive, canTestService) { toggleSubmitBtnLabel(serviceActive, canTestService) {
this.$submitBtnLabel.text( this.$submitBtnLabel.text(
@ -76,7 +79,9 @@ export default class IntegrationSettingsForm {
this.$submitBtnLoader.removeClass('hidden'); this.$submitBtnLoader.removeClass('hidden');
} else { } else {
this.$submitBtn.enable(); this.$submitBtn.enable();
this.$submitBtnLoader.addClass('hidden'); if (!this.$submitBtnLoader.hasClass('hidden')) {
this.$submitBtnLoader.addClass('hidden');
}
} }
} }