CHUKWA-812.  Added throttle to dashboard save. (Eric Yang)
diff --git a/CHANGES.txt b/CHANGES.txt
index 44a5350..c7372d2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,8 @@
 
   BUGS
 
+    CHUKWA-812.  Added throttle to dashboard save. (Eric Yang)
+
 Release 0.8 - 05/22/2016
 
   IMPROVEMENTS
diff --git a/src/main/web/hicc/home/index.html b/src/main/web/hicc/home/index.html
index aefe260..412a3ba 100755
--- a/src/main/web/hicc/home/index.html
+++ b/src/main/web/hicc/home/index.html
@@ -32,6 +32,7 @@
     <link rel="stylesheet" type="text/css" href="css/component.css" />
     <script src="js/modernizr.custom.js"></script>
     <script src="js/jquery.js" type="text/javascript"></script>
+    <script src="js/throttle.js" type="text/javascript"></script>
     <script src="js/jquery-ui.js"></script>
     <script src="js/lodash.min.js" type="text/javascript"></script>
     <script src="js/gridstack.min.js" type="text/javascript"></script>
@@ -207,11 +208,6 @@
         gridstack.addWidget(buildWidget(this.src), this.col, this.row, this.size_x, this.size_y);
 
       });
-      // Bind save operation only after load operation has been
-      // completed to avoid race conditions.
-      $('.grid-stack').on('change', function(event, ui) {
-        save();
-      });
     }
   );
 
@@ -343,6 +339,10 @@
     }
   );
 
+  $('.grid-stack').on('change', throttle(function(event, ui) {
+    save();
+  }, 250));
+
 });
 
 function setTime() {
diff --git a/src/main/web/hicc/home/js/throttle.js b/src/main/web/hicc/home/js/throttle.js
new file mode 100644
index 0000000..f8f7ff0
--- /dev/null
+++ b/src/main/web/hicc/home/js/throttle.js
@@ -0,0 +1,22 @@
+function throttle(fn, threshhold, scope) {
+  threshhold || (threshhold = 250);
+  var last,
+      deferTimer;
+  return function () {
+    var context = scope || this;
+
+    var now = +new Date,
+        args = arguments;
+    if (last && now < last + threshhold) {
+      // hold on to it
+      clearTimeout(deferTimer);
+      deferTimer = setTimeout(function () {
+        last = now;
+        fn.apply(context, args);
+      }, threshhold);
+    } else {
+      last = now;
+      fn.apply(context, args);
+    }
+  };
+}