changeset 7:d27bd0db6bf1

added loading screen, removed duplicate bug listings.
author Atul Varma <varmaa@toolness.com>
date Sun, 07 Mar 2010 23:09:11 -0800
parents 8c29933b8435
children 85027feb6b6e
files dashboard.css dashboard.js index.html
diffstat 3 files changed, 47 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dashboard.css	Sun Mar 07 19:25:20 2010 -0800
+++ b/dashboard.css	Sun Mar 07 23:09:11 2010 -0800
@@ -17,6 +17,10 @@
     text-decoration: line-through;
 }
 
+#reports {
+    display: none;
+}
+
 #templates {
     display: none;
 }
@@ -57,3 +61,7 @@
 .P1.critical, .P1.blocker {
     color: red;
 }
+
+.countdown {
+    color: #f0f0f0;
+}
--- a/dashboard.js	Sun Mar 07 19:25:20 2010 -0800
+++ b/dashboard.js	Sun Mar 07 23:09:11 2010 -0800
@@ -1,5 +1,7 @@
 $(window).ready(
   function() {
+    var reportsLeft = 0;
+
     function sortByLastChanged(bugs) {
       bugs.forEach(
         function(bug) {
@@ -27,6 +29,7 @@
       bugs.forEach(
         function(bug) {
           var row = rowTemplate.clone();
+          row.attr("id", "bug-id-" + bug.id);
           row.find(".summary").text(bug.summary);
           if (bug.priority != "--")
             row.find(".importance").text(bug.priority + NBSP +
@@ -43,15 +46,33 @@
       query.append(table);
     }
 
+    function finalizeReports() {
+      var visited = {};
+      $("#reports .bug-row").each(
+        function() {
+          var id = $(this).attr("id");
+          if (id in visited)
+            $(this).remove();
+          else
+            visited[id] = true;
+        });
+      $("#loading-screen").hide();
+      $("#reports").fadeIn();
+    }
+
     function report(selector, searchTerms) {
       var newTerms = {__proto__: defaults};
       for (name in searchTerms)
         newTerms[name.replace(/_DOT_/g, ".")] = searchTerms[name];
       Bugzilla.search(newTerms,
                       function(response) {
-                        showBugs($(selector),
-                                 response.bugs);
+                        showBugs($(selector), response.bugs);
+                        reportsLeft--;
+                        $("#loading-screen .countdown").text(reportsLeft);
+                        if (!reportsLeft)
+                          finalizeReports();
                       });
+      reportsLeft++;
     }
 
     // Taken from MDC @ Core_JavaScript_1.5_Reference/Objects/Date.
@@ -118,4 +139,6 @@
             email2_type: "not_equals",
             email2_assigned_to: 1,
             email2_reporter: 1});
+
+    $("#loading-screen .countdown").text(reportsLeft);
   });
--- a/index.html	Sun Mar 07 19:25:20 2010 -0800
+++ b/index.html	Sun Mar 07 23:09:11 2010 -0800
@@ -6,17 +6,20 @@
   <title>Atul's Bugzilla Dashboard</title>
 </head>
 <body>
-<h1>Atul's Bugzilla Dashboard</h1>
-<h2>My Assigned Bugs</h2>
-<div id="assigned-bugs"></div>
-<h2>My Fixed Bugs</h2>
-<div id="fixed-bugs"></div>
-<h2>My Requested Code Reviews</h2>
-<div id="code-reviews"></div>
-<h2>My Reported Bugs</h2>
-<div id="reported-bugs"></div>
-<h2>My CC'd Bugs</h2>
-<div id="cc-bugs"></div>
+<div id="loading-screen"><h1 class="countdown"></h1></div>
+<div id="reports">
+  <h1>Atul's Bugzilla Dashboard</h1>
+  <h2>My Assigned Bugs</h2>
+  <div id="assigned-bugs"></div>
+  <h2>My Fixed Bugs</h2>
+  <div id="fixed-bugs"></div>
+  <h2>My Requested Code Reviews</h2>
+  <div id="code-reviews"></div>
+  <h2>My Reported Bugs</h2>
+  <div id="reported-bugs"></div>
+  <h2>My CC'd Bugs</h2>
+  <div id="cc-bugs"></div>
+</div>
 <div id="templates">
   <table class="bugs">
     <tr class="header">