2011-04-28 Eric Seidel <eric@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 22:59:11 +0000 (22:59 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 22:59:11 +0000 (22:59 +0000)
        Reviewed by Adam Barth.

        EWS bubbles should show "submit to ews" button if they've not been processed
        https://bugs.webkit.org/show_bug.cgi?id=59751

        * QueueStatusServer/handlers/statusbubble.py:
        * QueueStatusServer/handlers/submittoews.py:
        * QueueStatusServer/templates/statusbubble.html:
        * QueueStatusServer/templates/submittoews.html:

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

Tools/ChangeLog
Tools/QueueStatusServer/handlers/statusbubble.py
Tools/QueueStatusServer/handlers/submittoews.py
Tools/QueueStatusServer/templates/statusbubble.html
Tools/QueueStatusServer/templates/submittoews.html

index b03f756..405162e 100644 (file)
@@ -2,6 +2,18 @@
 
         Reviewed by Adam Barth.
 
+        EWS bubbles should show "submit to ews" button if they've not been processed
+        https://bugs.webkit.org/show_bug.cgi?id=59751
+
+        * QueueStatusServer/handlers/statusbubble.py:
+        * QueueStatusServer/handlers/submittoews.py:
+        * QueueStatusServer/templates/statusbubble.html:
+        * QueueStatusServer/templates/submittoews.html:
+
+2011-04-28  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Adam Barth.
+
         EWS Bubbles should show commit-queue position when patch is in the commit-queue
         https://bugs.webkit.org/show_bug.cgi?id=59744
 
index 886aff4..aa73ce7 100644 (file)
@@ -48,11 +48,19 @@ class StatusBubble(webapp.RequestHandler):
         }
         return bubble
 
-    def get(self, attachment_id):
-        attachment = Attachment(int(attachment_id))
+    def _have_ews_status_for(self, attachment, queue):
+        return bool(queue.is_ews() and (attachment.position_in_queue(queue) or attachment.status_for_queue(queue)))
+
+    def get(self, attachment_id_string):
+        attachment_id = int(attachment_id_string)
+        attachment = Attachment(attachment_id)
         # Show all queue positions, even the commit-queue.
         bubbles = [self._build_bubble(queue, attachment) for queue in Queue.all() if queue.is_ews() or attachment.position_in_queue(queue)]
+        # If all EWS queues have no position and no status we show a "submit to ews" button.
+        have_ews_status_or_position = reduce(operator.or_, map(lambda queue: self._have_ews_status_for(attachment, queue), Queue.all()))
         template_values = {
             "bubbles": bubbles,
+            "attachment_id": attachment_id,
+            "show_submit_to_ews": not have_ews_status_or_position,
         }
         self.response.out.write(template.render("templates/statusbubble.html", template_values))
index 3ba4373..248bce4 100644 (file)
@@ -62,3 +62,5 @@ class SubmitToEWS(UpdateBase):
         attachment_id = self._int_from_request("attachment_id")
         attachment = Attachment(attachment_id)
         self._add_attachment_to_ews_queues(attachment)
+        if self.request.get("next_action") == "return_to_bubbles":
+            self.redirect("/status-bubble/%s" % attachment_id)
index 21e3d87..8248a89 100644 (file)
@@ -67,6 +67,13 @@ window.addEventListener("message", function(e) {
 </head>
 <body>
 <div id="bubbleContainer">
+{% if show_submit_to_ews %}
+  <form name="submit_to_ews" enctype="multipart/form-data" method="post" action="/submit-to-ews">
+    <input type="hidden" name="attachment_id" value="{{ attachment_id }}">
+    <input type="hidden" name="next_action" value="return_to_bubbles">
+    <input class="status" type="submit" value="Submit for EWS analysis">
+  </form>
+{% else %}
   {% for bubble in bubbles %}
   <a class="status {{ bubble.state }}"
   {% if bubble.status %}
@@ -80,6 +87,7 @@ window.addEventListener("message", function(e) {
     {% endif %}
   </a>
   {% endfor %}
+{% endif %}
 </div>
 </body>
 </html>
index 935d7bb..76db69e 100644 (file)
@@ -1,3 +1,3 @@
 <form name="submit_to_ews" enctype="multipart/form-data" method="post">
-Attachment id of patch to submit: <input name="attachment_id"><input type="submit" value="Submit for EWS Processing"></div>
+Attachment id of patch to submit: <input name="attachment_id"><input type="submit" value="Submit for EWS Processing">
 </form>