2009-12-02 Adam Barth <abarth@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Dec 2009 09:11:54 +0000 (09:11 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Dec 2009 09:11:54 +0000 (09:11 +0000)
        Reviewed by Eric Seidel.

        [bzt] Implement status bubble view
        https://bugs.webkit.org/show_bug.cgi?id=32057

        The status bubble is a compact representation of the queue status for a
        given patch.  This will eventually help us reduce the comment spam from
        the queues.

        * QueueStatusServer/index.html: Added HTML5 doctype for sanity.
        * QueueStatusServer/queue_status.py:
        * QueueStatusServer/status_bubble.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51591 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/QueueStatusServer/index.html
WebKitTools/QueueStatusServer/queue_status.py
WebKitTools/QueueStatusServer/status_bubble.html [new file with mode: 0644]

index dd55514313094e4bb82dc84f9716894bb7b1ed9a..e8950bbc34af20d8ccf51836fd5239707031a15f 100644 (file)
@@ -1,3 +1,18 @@
+2009-12-02  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        [bzt] Implement status bubble view
+        https://bugs.webkit.org/show_bug.cgi?id=32057
+
+        The status bubble is a compact representation of the queue status for a
+        given patch.  This will eventually help us reduce the comment spam from
+        the queues.
+
+        * QueueStatusServer/index.html: Added HTML5 doctype for sanity.
+        * QueueStatusServer/queue_status.py:
+        * QueueStatusServer/status_bubble.html: Added.
+
 2009-12-02  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Adam Barth.
index 2b5aced2c4bf98202d5ba9d9f934ca550497176e..fbd51fb0fdcdf4c7ff2cc1adb9ab861942323903 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
 <html>
 <head>
     <title>WebKit Commit Queue Status</title>
index e4bea746623e8bd515b8f093d4f18ca8f35d7377..29722e64eb722b61ab2024d30981ec8bb19256b8 100644 (file)
@@ -73,6 +73,52 @@ class PatchStatus(webapp.RequestHandler):
         self.response.out.write(statuses[0].message)
 
 
+class StatusSummary(object):
+    def _status_to_code(self, status):
+        code_names = {
+            "Pass": "pass",
+            "Pending": "pending",
+            "Fail": "fail",
+            "Error": "error",
+        }
+        return code_names.get(status, "none")
+
+    def _queue_name_to_code(self, queue_name):
+        code_names = {
+            "style-queue": "style",
+        }
+        return code_names[queue_name]
+
+    queues = [
+        "style-queue",
+    ]
+
+    def __init__(self):
+        self._summary = {}
+
+    def summarize(self, attachment_id):
+        if self._summary.get(attachment_id):
+            return self._summary.get(attachment_id)
+
+        for queue in self.queues:
+            statuses = QueueStatus.all().filter('queue_name =', queue).filter('active_patch_id =', attachment_id).order('-date').fetch(1)
+            status_code = self._status_to_code(statuses[0].message if statuses else None)
+            queue_code = self._queue_name_to_code(queue)
+            attachment_summary[queue_code] = status_code
+
+        self._summary[attachment_id] = attachment_summary
+        return attachment_summary
+
+
+class StatusBubble(webapp.RequestHandler):
+    def get(self, attachment_id):
+        status_summary = StatusSummary()
+        template_values = {
+            "queue_status" : status_summary.summarize(int(attachment_id)),
+        }
+        self.response.out.write(template.render('status_bubble.html', template_values))
+
+
 class UpdateStatus(webapp.RequestHandler):
     def get(self):
         self.response.out.write(template.render('update_status.html', None))
@@ -105,6 +151,7 @@ routes = [
     ('/', MainPage),
     ('/update-status', UpdateStatus),
     (r'/patch-status/(.*)/(.*)', PatchStatus),
+    (r'/status-bubble/(.*)', StatusBubble),
 ]
 
 application = webapp.WSGIApplication(routes, debug=True)
diff --git a/WebKitTools/QueueStatusServer/status_bubble.html b/WebKitTools/QueueStatusServer/status_bubble.html
new file mode 100644 (file)
index 0000000..f8959d9
--- /dev/null
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    font-family: Verdana, sans-serif;
+    margin: 0px;
+    padding: 0px;
+}
+.status {
+    display: block;
+    float: left;
+    margin: 1px;
+    padding: 1px 2px;
+    border-radius: 5px;
+    border: 1px solid #AAA;
+    font-size: 11px;
+}
+.pass {
+    background-color: #8FDF5F;
+    border: 1px solid #4F8530;
+}
+.fail {
+    background-color: #E98080;
+    border: 1px solid #A77272;
+}
+.pending {
+    background-color: #FFFC6C;
+    border: 1px solid #C5C56D;
+}
+</style>
+</head>
+<body>{% for key, value in queue_status.items %}
+<div class="status {{value}}" title="{{key}}: {{value}}">{{key}}</div>{% endfor %}
+</body>
+</html>