From acd4a1f4aa2177eb2b71ba9951307fe9c6adc7ce Mon Sep 17 00:00:00 2001 From: smizrahi Date: Fri, 22 Dec 2023 13:08:38 +0000 Subject: [PATCH] fix(calendar): Prevent clicking on delete event button when network is slow --- .../UIxAppointmentViewTemplate.wox | 8 ++++++ .../js/Scheduler/ComponentController.js | 26 +++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox index ef0d8c381..cb97fe18d 100644 --- a/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox +++ b/UI/Templates/SchedulerUI/UIxAppointmentViewTemplate.wox @@ -276,6 +276,7 @@ @@ -292,6 +293,7 @@ arrow_drop_down @@ -299,6 +301,7 @@ repeat_one @@ -306,6 +309,7 @@ repeat @@ -339,6 +343,7 @@ @@ -355,6 +360,7 @@ arrow_drop_down @@ -362,6 +368,7 @@ repeat_one @@ -369,6 +376,7 @@ repeat diff --git a/UI/WebServerResources/js/Scheduler/ComponentController.js b/UI/WebServerResources/js/Scheduler/ComponentController.js index 89b7f7354..3f5e9c861 100644 --- a/UI/WebServerResources/js/Scheduler/ComponentController.js +++ b/UI/WebServerResources/js/Scheduler/ComponentController.js @@ -14,6 +14,7 @@ this.calendarService = Calendar; this.service = Component; this.component = stateComponent; + this.isDeleting = false; // Put organizer in an array to display it as an mdChip this.organizer = [stateComponent.organizer]; @@ -144,17 +145,26 @@ }; this.deleteOccurrence = function () { - this.component.remove(true).then(function() { - $rootScope.$emit('calendars:list'); - $mdDialog.hide(); - }); + if (!this.isDeleting) { + this.isDeleting = true; + this.component.remove(true).then(function() { + $rootScope.$emit('calendars:list'); + $mdDialog.hide(); + vm.isDeleting = false; + }); + } }; this.deleteAllOccurrences = function () { - this.component.remove().then(function() { - $rootScope.$emit('calendars:list'); - $mdDialog.hide(); - }); + if (!this.isDeleting) { + this.isDeleting = true; + this.component.remove().then(function () { + $rootScope.$emit('calendars:list'); + $mdDialog.hide(); + vm.isDeleting = false; + }); + } + }; this.toggleRawSource = function ($event) {