about summary refs log tree commit diff
path: root/uploader
diff options
context:
space:
mode:
Diffstat (limited to 'uploader')
-rw-r--r--uploader/templates/phenotypes/view-dataset.html32
1 files changed, 26 insertions, 6 deletions
diff --git a/uploader/templates/phenotypes/view-dataset.html b/uploader/templates/phenotypes/view-dataset.html
index fa1044b..ed59d76 100644
--- a/uploader/templates/phenotypes/view-dataset.html
+++ b/uploader/templates/phenotypes/view-dataset.html
@@ -147,6 +147,8 @@
                           },
                           {
                               text: "Bulk Edit (Download Data)",
+                              className: "btn btn-info btn-bulk-edit",
+                              titleAttr: "Click to download data for editing.",
                               action: (event, dt, node, config) => {
                                   var phenoids = [];
                                   var selected = dt.rows({selected: true, page: "all"}).data();
@@ -160,6 +162,19 @@
                                       alert("No record selected. Nothing to do!");
                                       return false;
                                   }
+
+                                  $(".btn-bulk-edit").prop("disabled", true);
+                                  $(".btn-bulk-edit").addClass("d-none");
+                                  var spinner = $(
+                                      "<div id='bulk-edit-spinner' class='spinner-grow text-info'>");
+                                  spinner_content = $(
+                                      "<span class='visually-hidden'>");
+                                  spinner_content.html(
+                                      "Downloading data &hellip;");
+                                  spinner.append(spinner_content)
+                                  $(".btn-bulk-edit").parent().append(
+                                      spinner);
+
                                   $.ajax(
                                       (`/species/${species_id}/populations/` +
                                        `${population_id}/phenotypes/datasets/` +
@@ -185,19 +200,24 @@
                                               console.log("Experienced an error: ", textStatus);
                                               console.log("The ERROR: ", errorThrown);
                                           },
+                                          complete: (jqXHR, textStatus) => {
+                                              $("#bulk-edit-spinner").remove();
+                                              $(".btn-bulk-edit").removeClass(
+                                                  "d-none");
+                                              $(".btn-bulk-edit").prop(
+                                                  "disabled", false);
+                                          },
                                           contentType: "application/json"
                                       });
-                              },
-                              className: "btn btn-info",
-                              titleAttr: "Click to download data for editing."
+                              }
                           },
                           {
                               text: "Bulk Edit (Upload Data)",
+                              className: "btn btn-info btn-bulk-edit",
+                              titleAttr: "Click to upload edited data you got by clicking the `Bulk Edit (Download Data)` button.",
                               action: (event, dt, node, config) => {
                                   alert("Not implemented yet!")
-                              },
-                              className: "btn btn-info",
-                              titleAttr: "Click to upload edited data you got by clicking the `Bulk Edit (Download Data)` button."
+                              }
                           }
                       ]
                   },