diff --git a/_attachments/pages/index.html b/_attachments/pages/index.html
index f4651fa3..c6befdbc 100644
--- a/_attachments/pages/index.html
+++ b/_attachments/pages/index.html
@@ -14,7 +14,7 @@
var baseURL = "_rewrite/",
vhost = false;
- if (document.location.pathname.indexOf("_design") == -1) {
+ if ( document.location.pathname.indexOf( "_design" ) == -1 ) {
// in a vhost
vhost = true;
baseURL = "";
@@ -25,34 +25,39 @@
* target == ID of the DOM node you wish to render the template into
* data == data object to pass into the mustache template when rendering
*/
- function render(template, target, data) {
- if (!data) var data = {};
- $( "#" + target ).html( $.mustache( $.trim( $( "#" + template + "Template" ).text() ), data ) );
+ function render( template, target, data ) {
+ if ( !data ) var data = {};
+ $( "#" + target ).html( $.mustache( $( "#" + template + "Template" ).text(), data ) );
}
- function gotDb(dbInfo) {
+ function formatDiskSize(bytes) {
+ return (parseFloat(bytes)/1024/1024).toString().substr(0,4) + "MB"
+ }
+
+ function gotDb( dbInfo ) {
+
+ $.extend(dbInfo, {
+ "host": window.location.host,
+ "disk_size": formatDiskSize(dbInfo.disk_size)
+ });
- render('db', 'stats', dbInfo);
+ if( vhost ) dbInfo.db_name = 'db';
- var data = {
- "db_name": dbInfo.db_name,
- "host": window.location.host
- }
+ render( 'db', 'stats', dbInfo );
- if(vhost) data.db_name = 'db';
+ render( 'bulk', 'bulk', dbInfo );
- render('url', 'url', data);
}
- $.getJSON(baseURL + 'db', gotDb);
+ $.getJSON( baseURL + 'db', gotDb );
- $('.csv').click(function(e) {
+ $( '.csv' ).click( function( e ) {
- function gotHeaders(headers) {
+ function gotHeaders( headers ) {
window.location.href = baseURL + 'csv?headers=' + headers;
}
- $.get(baseURL + 'headers', gotHeaders);
+ $.get( baseURL + 'headers', gotHeaders );
e.preventDefault();
@@ -69,10 +74,9 @@
-
- DB Stats
-
-
+
+
+
Actions
@@ -84,7 +88,7 @@
Uploading
- You can bulk upload an array of JSON objects representing your documents to a remote server via HTTP POST. Make sure that they are formatted one document per line:
+ You can bulk upload an array of JSON documents to a Couch via HTTP POST. Make sure that they are formatted one document per line:
{
"docs": [
@@ -95,7 +99,7 @@
}
POST to the this URL:
-
+
@@ -105,12 +109,34 @@
-
+