summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2008-09-16 20:24:48 +0000
committerChristopher Lenz <cmlenz@apache.org>2008-09-16 20:24:48 +0000
commit70155ce87a85a5b70a225f350863e7ed50097345 (patch)
treec70671528ecbf4574e3718be0291ed52e5759d08 /share
parent7748f4bdc38d34b6c078693446ce638e2d0767ae (diff)
Add HTTP API for getting the complete config, and add a page to Futon that displays the configuration.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@696041 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/config.html84
-rw-r--r--share/www/index.html1
-rw-r--r--share/www/script/jquery.couch.js17
-rw-r--r--share/www/style/layout.css12
4 files changed, 114 insertions, 0 deletions
diff --git a/share/www/config.html b/share/www/config.html
new file mode 100644
index 00000000..d811fe1f
--- /dev/null
+++ b/share/www/config.html
@@ -0,0 +1,84 @@
+<!DOCTYPE html>
+<!--
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+
+-->
+<html lang="en">
+ <head>
+ <title>Configuration</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <link rel="stylesheet" href="style/layout.css?0.8.0" type="text/css">
+ <script src="script/json2.js"></script>
+ <script src="script/jquery.js?1.2.6"></script>
+ <script src="script/jquery.couch.js?0.8.0"></script>
+ <script src="script/pprint.js?0.8.0"></script>
+ <script>
+ $(document).ready(function() {
+ if (window !== parent) parent.updateNavigation();
+
+ $(document.body).addClass("loading");
+ $.couch.config({
+ success: function(resp) {
+ var sections = [];
+ for (var sectionName in resp) {
+ sections.push(sectionName);
+ }
+ sections.sort();
+ $.each(sections, function(idx, sectionName) {
+ var row = $("<tr><th></th></tr>")
+ .find("th").text(sectionName).end()
+ .appendTo("#config tbody.content");
+ var section = resp[sectionName]
+ var options = [];
+ for (var option in section) {
+ options.push(option);
+ }
+ options = options.sort();
+ var prev = null;
+ $.each(options, function(idx, optionName) {
+ var cur = idx == 0 ? row : $("<tr></tr>");
+ $("<td class='name'></td>").text(optionName).appendTo(cur);
+ $("<td class='value'></td>").text(section[optionName]).appendTo(cur);
+ if (cur !== row) cur.insertAfter(prev);
+ prev = cur;
+ });
+ row.find("th").attr("rowspan", options.length);
+ });
+ $("#config tbody tr").removeClass("odd").filter(":odd").addClass("odd");
+ $(document.body).removeClass("loading");
+ }
+ });
+ });
+ </script>
+ </head>
+ <body>
+ <h1>
+ <a href="browse/index.html">Overview</a>
+ <strong>Configuration</strong>
+ </h1>
+ <div id="wrap">
+
+ <table id="config" class="listing">
+ <caption>Configuration</caption>
+ <thead><tr>
+ <th>Section</th>
+ <th>Option</th>
+ <th>Value</th>
+ </tr></thead>
+ <tbody class="content"></tbody>
+ </table>
+
+ </div>
+ <div id="dump"></div>
+ </body>
+</html>
diff --git a/share/www/index.html b/share/www/index.html
index d0cc4786..54cc9e15 100644
--- a/share/www/index.html
+++ b/share/www/index.html
@@ -88,6 +88,7 @@ specific language governing permissions and limitations under the License.
<li><span>Tools</span><ul>
<li><a href="browse/index.html" target="content">Overview</a></li>
<li><a href="replicator.html" target="content">Replicator</a></li>
+ <li><a href="config.html" target="content">Configuration</a></li>
<li><a href="couch_tests.html" target="content">Test Suite</a></li>
</ul></li>
<li><span>Databases</span>
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js
index 2121cf0c..bd77bf80 100644
--- a/share/www/script/jquery.couch.js
+++ b/share/www/script/jquery.couch.js
@@ -32,6 +32,23 @@
});
},
+ config: function(options, section, option, value) {
+ $.ajax({
+ type: "GET", url: "/_config/",
+ complete: function(req) {
+ var resp = $.httpData(req, "json");
+ if (req.status == 200) {
+ if (options.success) options.success(resp);
+ } else if (options.error) {
+ options.error(req.status, resp.error, resp.reason);
+ } else {
+ alert("An error occurred retrieving the server configuration: " +
+ resp.reason);
+ }
+ }
+ });
+ },
+
db: function(name) {
return {
name: name,
diff --git a/share/www/style/layout.css b/share/www/style/layout.css
index ec13b27d..7b0aeb04 100644
--- a/share/www/style/layout.css
+++ b/share/www/style/layout.css
@@ -459,6 +459,18 @@ ul.suggest-dropdown li.selected { cursor: pointer; background: Highlight;
background-image: url(../image/test_failure.gif); color: #c00;
}
+/* Configuration */
+
+table#config tbody th { background: #e6e6e6; border-right: none;
+ border-top: 1px solid #d9d9d9;
+}
+table#config tbody td.name { border-left: 1px solid #d9d9d9; color: #333;
+ font-weight: bold;
+}
+table#config tbody td.value {
+ font-family: "DejaVu Sans Mono",Monaco,monospace;
+}
+
/* Replication */
form#replicator { background: #f4f4f4; border: 1px solid;