couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [11/19] git commit: The idea of the inspector UI
Date Mon, 11 Feb 2013 13:51:16 GMT
The idea of the inspector UI


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/fb598b4a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/fb598b4a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/fb598b4a

Branch: refs/heads/nodejs_couchdb
Commit: fb598b4a23805400201f92843af33da3823509d5
Parents: 595c1eb
Author: Jason Smith (work) <jhs@iriscouch.com>
Authored: Thu Feb 7 10:51:59 2013 +0000
Committer: Jason Smith (work) <jhs@iriscouch.com>
Committed: Thu Feb 7 10:51:59 2013 +0000

----------------------------------------------------------------------
 share/www/debug.html |   61 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 53 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fb598b4a/share/www/debug.html
----------------------------------------------------------------------
diff --git a/share/www/debug.html b/share/www/debug.html
index 6c90417..5738cb4 100644
--- a/share/www/debug.html
+++ b/share/www/debug.html
@@ -28,6 +28,12 @@ specific language governing permissions and limitations under the License.
       .is_not_admin, .is_admin {
         display: none;
       }
+
+      #node_inspector_frame {
+        width: 100%;
+        height: 50em;
+        border: none;
+      }
     </style>
   </head>
   <body>
@@ -40,18 +46,25 @@ specific language governing permissions and limitations under the License.
         <p class="is_not_admin">
           Sorry, only the site admin may use the debugger.
         </p>
-        <p class="is_admin">
+        <div class="is_admin">
+          <p>
           These JavaScript processes are debuggable:
-        </p>
-        <ul id="query_servers">
-          <!--
-          <li><button class="run" id="run">Verify Your Installation.</button><span
id="result"></span></li>
-          -->
-        </ul>
+          </p>
+
+          <ul id="query_servers">
+            <li>...</li>
+          </ul>
+
+          <div id="node_inspector">
+            <hr>
+            <h2 class="title"></h2>
+            <iframe id="node_inspector_frame" src=""></iframe>
+          </div>
+        </div> <!-- is_admin -->
       </div>
     </div>
     <script>
-    jQuery(function($) {
+jQuery(function($) {
 
 request.couch('/_session', function(er, res) {
   if(er)
@@ -63,9 +76,41 @@ request.couch('/_session', function(er, res) {
 
   console.log('Confirmed admin')
   $('.is_admin').show()
+  get_debuggers()
 })
 
+function get_debuggers() {
+  request.couch('/_debug', function(er, res) {
+    if(er)
+      throw er
+    if(!res.body.ok)
+      throw new Error('Unknown response: ' + JSON.stringify(res.body))
+
+    var servers = $('#query_servers')
+    servers.html('')
+    if(res.body.pids.length == 0)
+      return
+
+    res.body.pids.forEach(function(pid) {
+      var link = $('<li><a href="#">' + pid + '</a></li>')
+      servers.append(link)
+
+      link.find('a').click(function() {
+        inspect_pid(pid)
+        return false
+      })
     })
+  })
+}
+
+function inspect_pid(pid) {
+  var src = '/_debug/' + pid + '/'
+  $('#node_inspector .title').html('Debugging: <' + pid + '>')
+  $('#node_inspector_frame').attr('src', src)
+  $('#node_inspector_frame').css('border', '1px solid black')
+}
+
+}) // jQuery
     </script>
   </body>
 </html>


Mime
View raw message