summaryrefslogtreecommitdiff
path: root/share/www/script/couch.js
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2009-02-25 16:39:55 +0000
committerJan Lehnardt <jan@apache.org>2009-02-25 16:39:55 +0000
commit8a5b0c697a6fdb3169afe82391368c26bec86978 (patch)
tree00b4b6a482fb8e6af481c8f5a52fb24655554ef7 /share/www/script/couch.js
parent0fb2f9696d8005eb46d5efeac1ae217fe0fb6a04 (diff)
add js test suite for stats, enable access for a previously internal metric
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@747852 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r--share/www/script/couch.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js
index 7bec5e32..8a0d3d23 100644
--- a/share/www/script/couch.js
+++ b/share/www/script/couch.js
@@ -312,20 +312,13 @@ CouchDB.request = function(method, uri, options) {
return req;
}
-CouchDB.requestStats = function(module, key, aggregate, options) {
- var options, optionsOrLast = Array.prototype.pop.apply(arguments);
- if (typeof optionsOrLast == "string") {
- options = null;
- Array.prototype.push.apply(arguments, [optionsOrLast]);
- } else {
- options = optionsOrLast;
+CouchDB.requestStats = function(module, key, test) {
+ var query_arg = "";
+ if(test !== null) {
+ query_arg = "?flush=true";
}
- var request_options = {};
- request_options.headers = {"Content-Type": "application/json"};
-
- var stat = CouchDB.request("GET", "/_stats/" + Array.prototype.join.apply(arguments,["/"]) + (options ?
- ("?" + CouchDB.params(options)) : ""), request_options).responseText;
+ var stat = CouchDB.request("GET", "/_stats/" + module + "/" + key + query_arg).responseText;
return JSON.parse(stat)[module][key];
}