Title: [90411] trunk/Tools
Revision
90411
Author
[email protected]
Date
2011-07-05 15:54:50 -0700 (Tue, 05 Jul 2011)

Log Message

2011-07-05  Adam Barth  <[email protected]>

        Add basic ajax support to garden-o-matic
        https://bugs.webkit.org/show_bug.cgi?id=63874

        Reviewed by Eric Seidel.

        This patch adds some basic infrastructure to garden-o-matic.
        Currently, the infrastructure is just used to make the "quit" command
        use Ajax, but in the future, this infrastructure will be used to do
        more sophistocated remote proceedure calls.

        * Scripts/webkitpy/tool/servers/data/gardeningserver/index.html:
        * Scripts/webkitpy/tool/servers/data/gardeningserver/main.js: Added.
        * Scripts/webkitpy/tool/servers/gardeningserver.py:
        * Scripts/webkitpy/tool/servers/reflectionhandler.py:

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (90410 => 90411)


--- trunk/Tools/ChangeLog	2011-07-05 22:52:01 UTC (rev 90410)
+++ trunk/Tools/ChangeLog	2011-07-05 22:54:50 UTC (rev 90411)
@@ -1,5 +1,22 @@
 2011-07-05  Adam Barth  <[email protected]>
 
+        Add basic ajax support to garden-o-matic
+        https://bugs.webkit.org/show_bug.cgi?id=63874
+
+        Reviewed by Eric Seidel.
+
+        This patch adds some basic infrastructure to garden-o-matic.
+        Currently, the infrastructure is just used to make the "quit" command
+        use Ajax, but in the future, this infrastructure will be used to do
+        more sophistocated remote proceedure calls.
+
+        * Scripts/webkitpy/tool/servers/data/gardeningserver/index.html:
+        * Scripts/webkitpy/tool/servers/data/gardeningserver/main.js: Added.
+        * Scripts/webkitpy/tool/servers/gardeningserver.py:
+        * Scripts/webkitpy/tool/servers/reflectionhandler.py:
+
+2011-07-05  Adam Barth  <[email protected]>
+
         Add trivial garden-o-matic command (with server)
         https://bugs.webkit.org/show_bug.cgi?id=63872
 

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/index.html (90410 => 90411)


--- trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/index.html	2011-07-05 22:52:01 UTC (rev 90410)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/index.html	2011-07-05 22:54:50 UTC (rev 90411)
@@ -1,2 +1,39 @@
-<h1>Hello, world!</h1>
-<a href=""
+<!DOCTYPE html>
+<html>
+<head>
+<title>Garden-O-Matic</title>
+<style>
+body {
+  margin: 0;
+  padding: 0px;
+}
+h1 {
+  margin: 0px;
+  padding: 3px;
+  background-color: #EFF5FB;
+}
+.butterbar {
+  width: 500px;
+  margin-left: -250px;
+  position: fixed;
+  border-radius: 5px;
+  top: 1px;
+  left: 50%;
+  padding: 3px;
+  background-color: #F5F6CE;
+}
+.butterbar .hide {
+  float: right;
+}
+</style>
+</head>
+<body>
+<div class="butterbar"><span class="status">Loading...</span> <a class="hide" href=""
+<h1>Garden-O-Matic</h1>
+<ul>
+  <li><button class="quit">Quit</button></li>
+</ul>
+<script src="" 
+<script src=""
+</body>
+</html>

Added: trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/main.js (0 => 90411)


--- trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/main.js	                        (rev 0)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/data/gardeningserver/main.js	2011-07-05 22:54:50 UTC (rev 90411)
@@ -0,0 +1,19 @@
+(function() {
+  function quit() {
+    $.post('/quitquitquit', function(data){
+      $('.butterbar .status').html(data)
+      $('.butterbar').fadeIn();
+    });
+  }
+
+  function hide() {
+    $(this).parent().fadeOut();
+  }
+
+  $('.hide').live('click', hide);
+  $('.quit').live('click', quit);
+
+  $(document).ready(function() {
+    $('.butterbar').fadeOut();
+  })
+})();

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (90410 => 90411)


--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2011-07-05 22:52:01 UTC (rev 90410)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py	2011-07-05 22:54:50 UTC (rev 90411)
@@ -37,6 +37,7 @@
 class GardeningHTTPRequestHandler(ReflectionHandler):
     STATIC_FILE_NAMES = frozenset([
         "index.html",
+        "main.js",
     ])
 
     STATIC_FILE_DIRECTORY = os.path.join(os.path.dirname(__file__), "data", "gardeningserver")

Modified: trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py (90410 => 90411)


--- trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py	2011-07-05 22:52:01 UTC (rev 90410)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py	2011-07-05 22:54:50 UTC (rev 90411)
@@ -79,15 +79,17 @@
         self._serve_file(os.path.join(self.STATIC_FILE_DIRECTORY, static_path))
 
     def quitquitquit(self):
+        self._serve_text("Server quit.\n")
+        # Shutdown has to happen on another thread from the server's thread,
+        # otherwise there's a deadlock
+        threading.Thread(target=lambda: self.server.shutdown()).start()
+
+    def _serve_text(self, html):
         self.send_response(200)
         self.send_header("Content-type", "text/plain")
         self.end_headers()
-        self.wfile.write("Quit.\n")
+        self.wfile.write(html)
 
-        # Shutdown has to happen on another thread from the server's thread,
-        # otherwise there's a deadlock
-        threading.Thread(target=lambda: self.server.shutdown()).start()
-
     def _serve_json(self, json):
         self.send_response(200)
         self.send_header('Content-type', 'application/json')
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to