From b37981e83f1e39499729da468a2e00a129fc60de Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 16 Apr 2024 20:09:39 -0500 Subject: [PATCH] Prevent multi-click for grid filters "Save Defaults" button --- tailbone/templates/grids/complete.mako | 6 ++++++ tailbone/templates/grids/filters.mako | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tailbone/templates/grids/complete.mako b/tailbone/templates/grids/complete.mako index f9e665dc..205012be 100644 --- a/tailbone/templates/grids/complete.mako +++ b/tailbone/templates/grids/complete.mako @@ -357,6 +357,8 @@ loading: false, ajaxDataUrl: ${json.dumps(grid.ajax_data_url)|n}, + savingDefaults: false, + data: ${grid.component_studly}CurrentData, rowStatusMap: ${json.dumps(grid_data['row_status_map'])|n}, @@ -589,6 +591,7 @@ this.firstItem = data.first_item this.lastItem = data.last_item this.loading = false + this.savingDefaults = false this.checkedRows = this.locateCheckedRows(data.checked_rows) if (success) { success() @@ -600,6 +603,7 @@ duration: 2000, // 4 seconds }) this.loading = false + this.savingDefaults = false if (failure) { failure() } @@ -609,6 +613,7 @@ this.data = [] this.total = 0 this.loading = false + this.savingDefaults = false if (failure) { failure() } @@ -805,6 +810,7 @@ }, saveDefaults() { + this.savingDefaults = true // apply current filters as normal, but add special directive this.applyFilters({'save-current-filters-as-defaults': true}) diff --git a/tailbone/templates/grids/filters.mako b/tailbone/templates/grids/filters.mako index 5e1fef9b..4c584883 100644 --- a/tailbone/templates/grids/filters.mako +++ b/tailbone/templates/grids/filters.mako @@ -60,8 +60,9 @@ - Save Defaults + class="control" + :disabled="savingDefaults"> + {{ savingDefaults ? "Working, please wait..." : "Save Defaults" }} % endif