You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2014/04/30 16:46:46 UTC
couchdb commit: updated refs/heads/master to a8ddf6c
Repository: couchdb
Updated Branches:
refs/heads/master 97d4a34c1 -> a8ddf6ce4
remove duplicated code
use the central viewhelper which even renders bytes
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a8ddf6ce
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a8ddf6ce
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a8ddf6ce
Branch: refs/heads/master
Commit: a8ddf6ce4fd4158992aa8bbb528c498cd98225a5
Parents: 97d4a34
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Wed Apr 30 13:38:40 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Wed Apr 30 13:42:51 2014 +0200
----------------------------------------------------------------------
src/fauxton/app/addons/databases/resources.js | 18 ------------------
.../app/addons/databases/templates/item.html | 2 +-
2 files changed, 1 insertion(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a8ddf6ce/src/fauxton/app/addons/databases/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/databases/resources.js b/src/fauxton/app/addons/databases/resources.js
index f8aab96..e9e68a4 100644
--- a/src/fauxton/app/addons/databases/resources.js
+++ b/src/fauxton/app/addons/databases/resources.js
@@ -142,24 +142,6 @@ function(app, FauxtonAPI, Documents) {
}
},
- humanSize: function() {
- // cribbed from http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable
- var i = -1;
- var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
- var fileSizeInBytes = this.dataSize();
-
- if (!fileSizeInBytes) {
- return 0;
- }
-
- do {
- fileSizeInBytes = fileSizeInBytes / 1024;
- i++;
- } while (fileSizeInBytes > 1024);
-
- return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
- },
-
dataSize: function () {
if (this.get("other")){
return this.get("other").data_size;
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a8ddf6ce/src/fauxton/app/addons/databases/templates/item.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/databases/templates/item.html b/src/fauxton/app/addons/databases/templates/item.html
index 304ab78..62cfb77 100644
--- a/src/fauxton/app/addons/databases/templates/item.html
+++ b/src/fauxton/app/addons/databases/templates/item.html
@@ -15,7 +15,7 @@ the License.
<td>
<a href="#/database/<%=encoded%>/_all_docs"><%= database.get("name") %></a>
</td>
-<td><%= database.status.humanSize() %></td>
+<td><%= formatSize(database.status.dataSize()) %></td>
<td>
<%= database.status.numDocs() %>
<% if (database.status.isGraveYard()) { %>