]> err.no Git - dak/commitdiff
queue_report.py: toggle binary-NEW packages only
authorLuca Falavigna <dktrkranz@debian.org>
Thu, 19 Aug 2010 14:30:08 +0000 (14:30 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Tue, 24 Aug 2010 20:10:24 +0000 (20:10 +0000)
Add a Javascript function to display binary-NEW packages
only in HTML view , so it is easier to track them.

Signed-off-by: Luca Falavigna <dktrkranz@debian.org>
dak/queue_report.py

index be4787219e9fde8a5963fa3fb665637c90a0fd86..fc68cb0bf96e7a2fd4ece11cc4f609a9a7cfaca0 100755 (executable)
@@ -40,7 +40,7 @@ import apt_pkg
 
 from daklib import utils
 from daklib.queue import Upload
-from daklib.dbconn import DBConn, has_new_comment, DBChange, get_uid_from_fingerprint
+from daklib.dbconn import DBConn, has_new_comment, DBChange, DBSource, get_uid_from_fingerprint
 from daklib.textutils import fix_maintainer
 from daklib.dak_exceptions import *
 
@@ -172,6 +172,23 @@ def header():
     <title>
       Debian NEW and BYHAND Packages
     </title>
+    <script type="text/javascript">
+    function togglePkg() {
+        var children = document.getElementsByTagName("*");
+        for (var i = 0; i < children.length; i++) {
+            if(!children[i].hasAttribute("class"))
+                continue;
+            c = children[i].getAttribute("class").split(" ");
+            for(var j = 0; j < c.length; j++) {
+                if(c[j] == "binNEW") {
+                    if (children[i].style.display == '')
+                        children[i].style.display = 'none';
+                    else children[i].style.display = '';
+                }
+            }
+        }
+    }
+    </script>
   </head>
   <body id="NEW">
     <div id="logo">
@@ -222,6 +239,7 @@ def table_header(type, source_count, total_count):
     print "<h1>Summary for: %s</h1>" % (type)
     print """
     <table class="NEW">
+      <p class="togglepkg" onclick="togglePkg()">Click to toggle all/binary-NEW packages</p>
       <caption>
     """
     print "Package count in <strong>%s</strong>: <em>%s</em>&nbsp;|&nbsp; Total Package count: <em>%s</em>" % (type, source_count, total_count)
@@ -250,10 +268,15 @@ def table_row(source, version, arch, last_mod, maint, distribution, closes, fing
     global row_number
 
     trclass = "sid"
+    session = DBConn().session()
     for dist in distribution:
         if dist == "experimental":
             trclass = "exp"
 
+    if not len(session.query(DBSource).filter_by(source = source).all()):
+        trclass += " binNEW"
+    session.commit()
+
     if row_number % 2 != 0:
         print "<tr class=\"%s even\">" % (trclass)
     else: