changeset 5:14d152040c1d

improved web ui
author Atul Varma <avarma@mozilla.com>
date Wed, 02 Jun 2010 22:38:57 -0700
parents 4b66cf5f42bf
children 61a41c30ccae
files static-files/app.js static-files/index.html
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/static-files/app.js	Wed Jun 02 21:43:14 2010 -0700
+++ b/static-files/app.js	Wed Jun 02 22:38:57 2010 -0700
@@ -7,6 +7,11 @@
     dataType: "text/plain",
     success: function(response) {
       cb(JSON.parse(response));
+    },
+    error: function(xhr, textStatus, errorThrown) {
+      var log = ("HTTP error: " + xhr.status + " " +
+                 xhr.responseText + "\n");
+      cb({success: false, log: log});
     }
   };
   jQuery.ajax(options);
@@ -17,11 +22,14 @@
     $("form").submit(
       function(event) {
         event.preventDefault();
+        $("#success").hide();
+        $("#failure").hide();
         jsonRequest(
           "try",
           {url: $("#pull-url").val()},
           function(data) {
             if (data.success) {
+              $("#success .patch").val(data.patch);
               $("#success").slideDown();
             } else {
               $("#failure .log").text(data.log);
--- a/static-files/index.html	Wed Jun 02 21:43:14 2010 -0700
+++ b/static-files/index.html	Wed Jun 02 22:38:57 2010 -0700
@@ -20,10 +20,18 @@
     display: none;
   }
 
+  .code {
+    font-family: Monaco, monospace;
+    white-space: pre-wrap;
+  }
+
+  #success .patch {
+    width: 60em;
+    height: 20em;
+  }
+
   #failure .log {
     color: red;
-    font-family: Monaco, monospace;
-    white-space: pre-wrap;
   }
   </style>
 </head>
@@ -37,10 +45,11 @@
 </form>
 <div id="success">
   <p>Yay, we got a patch!</p>
+  <textarea class="patch code"></textarea>
 </div>
 <div id="failure">
-  <p>Alas, failure:</p>
-  <div class="log"></div>
+  <p>Alas, failure.</p>
+  <div class="log code"></div>
 </div>
 <script src="jquery.js"></script>
 <script src="app.js"></script>