nutcracker-web 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 723ec8b5104701fa2f47687fabd61114734ab753
4
- data.tar.gz: a85a1c952d17522f2e49340be25c1ebf73ac971d
3
+ metadata.gz: 3bd76d2f00550f78cd1d77d520003f058aca8878
4
+ data.tar.gz: 2539295a1915a2ea1e02df71a05407addcf5d6bd
5
5
  SHA512:
6
- metadata.gz: 30e738099ce6fe771cd36b7ee862b569c30102c95e532768892377a2611c219fcd5ab242b4c1a13ba1f551be9a01fe6acf59c9248ff8b99eb5fab8a3cbbf0bce
7
- data.tar.gz: 3d304c975786b6f1a055d6d770327c2d29155222aa45b9df6a8b2150d6fe08f7783a90bbef2cdc165a16a390e5d58bd3e4289dcc8a091eae01f2a6ed38857892
6
+ metadata.gz: 57ed2e29fcd868a769a7f0ac82e8ebf2ce8e1d630a067941f5adb1f3f25ff145c09508480735a43034ab3a36a1cb6095059307d27e9a34c90dcc3fe918f28e99
7
+ data.tar.gz: 76346e8c39735e579443738b5cb099c42abdb3d0b97e88f0ecfc2029b6e2d61cb9a583842fb996e7b08cbcb2f7b758cb307190ab775fbfdc9ee78169fd9b263c
data/Rakefile CHANGED
@@ -29,13 +29,16 @@ task :compile do
29
29
  end
30
30
  end
31
31
 
32
- Gem::PackageTask.new(eval File.read('nutcracker-web.gemspec')) do |pkg|
33
- pkg.need_zip = false
34
- pkg.need_tar = false
32
+ task :build => [:compile] do
33
+ Gem::PackageTask.new(eval File.read 'nutcracker-web.gemspec') do |pkg|
34
+ pkg.need_zip = false
35
+ pkg.need_tar = false
36
+ end
37
+ Rake::Task["gem"].invoke
35
38
  end
36
39
 
37
- task :build => [:compile] do
38
- `rake gem`
40
+ task :gem do
41
+ abort "Please use rake build instead"
39
42
  end
40
43
 
41
44
  task :install => [:build] do
@@ -1,5 +1,5 @@
1
1
  module Nutcracker
2
2
  module Web
3
- VERSION="0.0.6"
3
+ VERSION="0.0.7"
4
4
  end
5
5
  end
@@ -259,5 +259,5 @@ function(t,e){function n(t,e,n,r){var i,o,s,a,u,l,c,h,f,p;if((e?e.ownerDocument|
259
259
  * See the License for the specific language governing permissions and
260
260
  * limitations under the License.
261
261
  * ========================================================== */
262
- !function(t){"use strict";var e=function(e,n){this.options=t.extend({},t.fn.affix.defaults,n),this.$window=t(window).on("scroll.affix.data-api",t.proxy(this.checkPosition,this)).on("click.affix.data-api",t.proxy(function(){setTimeout(t.proxy(this.checkPosition,this),1)},this)),this.$element=t(e),this.checkPosition()};e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e,n=t(document).height(),r=this.$window.scrollTop(),i=this.$element.offset(),o=this.options.offset,s=o.bottom,a=o.top,u="affix affix-top affix-bottom";"object"!=typeof o&&(s=a=o),"function"==typeof a&&(a=o.top()),"function"==typeof s&&(s=o.bottom()),e=null!=this.unpin&&r+this.unpin<=i.top?!1:null!=s&&i.top+this.$element.height()>=n-s?"bottom":null!=a&&a>=r?"top":!1,this.affixed!==e&&(this.affixed=e,this.unpin="bottom"==e?i.top-r:null,this.$element.removeClass(u).addClass("affix"+(e?"-"+e:"")))}};var n=t.fn.affix;t.fn.affix=function(n){return this.each(function(){var r=t(this),i=r.data("affix"),o="object"==typeof n&&n;i||r.data("affix",i=new e(this,o)),"string"==typeof n&&i[n]()})},t.fn.affix.Constructor=e,t.fn.affix.defaults={offset:0},t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),n=e.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),e.affix(n)})})}(window.jQuery),function(){var t=this,e=t.humanize,n={};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=n),exports.humanize=n):("function"==typeof define&&define.amd&&define("humanize",function(){return n}),t.humanize=n),n.noConflict=function(){return t.humanize=e,this},n.pad=function(t,e,n,r){if(t+="",n?n.length>1&&(n=n.charAt(0)):n=" ",r=void 0===r?"left":"right","right"===r)for(;t.length<e;)t+=n;else for(;t.length<e;)t=n+t;return t},n.time=function(){return(new Date).getTime()/1e3};var r=[0,0,31,59,90,120,151,181,212,243,273,304,334],i=[0,0,31,60,91,121,152,182,213,244,274,305,335];n.date=function(t,e){var o=void 0===e?new Date:e instanceof Date?new Date(e):new Date(1e3*e),s=/\\?([a-z])/gi,a=function(t,e){return c[t]?c[t]():e},u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"],c={d:function(){return n.pad(c.j(),2,"0")},D:function(){return c.l().slice(0,3)},j:function(){return o.getDate()},l:function(){return u[c.w()]},N:function(){return c.w()||7},S:function(){var t=c.j();return t>4&&21>t?"th":{1:"st",2:"nd",3:"rd"}[t%10]||"th"},w:function(){return o.getDay()},z:function(){return(c.L()?i[c.n()]:r[c.n()])+c.j()-1},W:function(){var t=c.z()-c.N()+1.5;return n.pad(1+Math.floor(Math.abs(t)/7)+(t%7>3.5?1:0),2,"0")},F:function(){return l[o.getMonth()]},m:function(){return n.pad(c.n(),2,"0")},M:function(){return c.F().slice(0,3)},n:function(){return o.getMonth()+1},t:function(){return new Date(c.Y(),c.n(),0).getDate()},L:function(){return 1===new Date(c.Y(),1,29).getMonth()?1:0},o:function(){var t=c.n(),e=c.W();return c.Y()+(12===t&&9>e?-1:1===t&&e>9)},Y:function(){return o.getFullYear()},y:function(){return String(c.Y()).slice(-2)},a:function(){return o.getHours()>11?"pm":"am"},A:function(){return c.a().toUpperCase()},B:function(){var t=o.getTime()/1e3,e=t%86400+3600;0>e&&(e+=86400);var n=e/86.4%1e3;return 0>t?Math.ceil(n):Math.floor(n)},g:function(){return c.G()%12||12},G:function(){return o.getHours()},h:function(){return n.pad(c.g(),2,"0")},H:function(){return n.pad(c.G(),2,"0")},i:function(){return n.pad(o.getMinutes(),2,"0")},s:function(){return n.pad(o.getSeconds(),2,"0")},u:function(){return n.pad(1e3*o.getMilliseconds(),6,"0")},O:function(){var t=o.getTimezoneOffset(),e=Math.abs(t);return(t>0?"-":"+")+n.pad(100*Math.floor(e/60)+e%60,4,"0")},P:function(){var t=c.O();return t.substr(0,3)+":"+t.substr(3,2)},Z:function(){return 60*-o.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(s,a)},r:function(){return"D, d M Y H:i:s O".replace(s,a)},U:function(){return o.getTime()/1e3||0}};return t.replace(s,a)},n.numberFormat=function(t,e,n,r){e=isNaN(e)?2:Math.abs(e),n=void 0===n?".":n,r=void 0===r?",":r;var i=0>t?"-":"";t=Math.abs(+t||0);var o=parseInt(t.toFixed(e),10)+"",s=o.length>3?o.length%3:0;return i+(s?o.substr(0,s)+r:"")+o.substr(s).replace(/(\d{3})(?=\d)/g,"$1"+r)+(e?n+Math.abs(t-o).toFixed(e).slice(2):"")},n.naturalDay=function(t,e){t=void 0===t?n.time():t,e=void 0===e?"Y-m-d":e;var r=86400,i=new Date,o=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()/1e3;return o>t&&t>=o-r?"yesterday":t>=o&&o+r>t?"today":t>=o+r&&o+2*r>t?"tomorrow":n.date(e,t)},n.relativeTime=function(t){t=void 0===t?n.time():t;var e=n.time(),r=e-t;if(2>r&&r>-2)return(r>=0?"just ":"")+"now";if(60>r&&r>-60)return r>=0?Math.floor(r)+" seconds ago":"in "+Math.floor(-r)+" seconds";if(120>r&&r>-120)return r>=0?"about a minute ago":"in about a minute";if(3600>r&&r>-3600)return r>=0?Math.floor(r/60)+" minutes ago":"in "+Math.floor(-r/60)+" minutes";if(7200>r&&r>-7200)return r>=0?"about an hour ago":"in about an hour";if(86400>r&&r>-86400)return r>=0?Math.floor(r/3600)+" hours ago":"in "+Math.floor(-r/3600)+" hours";var i=172800;if(i>r&&r>-i)return r>=0?"1 day ago":"in 1 day";var o=2505600;if(o>r&&r>-o)return r>=0?Math.floor(r/86400)+" days ago":"in "+Math.floor(-r/86400)+" days";var s=5184e3;if(s>r&&r>-s)return r>=0?"about a month ago":"in about a month";var a=parseInt(n.date("Y",e),10),u=parseInt(n.date("Y",t),10),l=12*a+parseInt(n.date("n",e),10),c=12*u+parseInt(n.date("n",t),10),h=l-c;if(12>h&&h>-12)return h>=0?h+" months ago":"in "+-h+" months";var f=a-u;return 2>f&&f>-2?f>=0?"a year ago":"in a year":f>=0?f+" years ago":"in "+-f+" years"},n.ordinal=function(t){t=parseInt(t,10),t=isNaN(t)?0:t;var e=0>t?"-":"";t=Math.abs(t);var n=t%100;return e+t+(n>4&&21>n?"th":{1:"st",2:"nd",3:"rd"}[t%10]||"th")},n.filesize=function(t,e,r,i,o){if(e=void 0===e?1024:e,r=isNaN(r)?2:Math.abs(r),i=void 0===i?".":i,o=void 0===o?",":o,0>=t)return"0 bytes";var s=[1],a=["bytes","Kb","Mb","Gb","Tb","Pb"];if(e>t)return n.numberFormat(t,0)+" "+a[0];for(var u=1;u<a.length;u++)if(s[u]=s[u-1]*e,t<s[u])return n.numberFormat(t/s[u-1],r,i,o)+" "+a[u-1];return n.numberFormat(t/s[a.length-1],r,i,o)+" "+a[a.length-1]},n.linebreaks=function(t){return t=t.replace(/^([\n|\r]*)/,""),t=t.replace(/([\n|\r]*)$/,""),t=t.replace(/(\r\n|\n|\r)/g,"\n"),t=t.replace(/(\n{2,})/g,"</p><p>"),t=t.replace(/\n/g,"<br />"),"<p>"+t+"</p>"},n.nl2br=function(t){return t.replace(/(\r\n|\n|\r)/g,"<br />")},n.truncatechars=function(t,e){return t.length<=e?t:t.substr(0,e)+"…"},n.truncatewords=function(t,e){var n=t.split(" ");return n.length<e?t:n.slice(0,e).join(" ")+"…"}}.call(this),function(){this.JST||(this.JST={}),this.JST.cluster=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a;for(n.push("<h3 align=center> "),n.push(r(this.model.get("name"))),n.push(' </h3>\n\n<ul class="pager fixed">\n '),this.prevCluster?(n.push('\n <li class="previous nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(o=this.prevCluster)?o.get("routeURL"):void 0)),n.push('">&larr; Prev</a></li>\n ')):n.push('\n <li class="previous disabled nosel"><a>&larr; Prev</a></li>\n '),n.push("\n \n "),this.nextCluster?(n.push('\n <li class="next nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(s=this.nextCluster)?s.get("routeURL"):void 0)),n.push('">Next &rarr;</a></li>\n ')):n.push('\n <li class="next disabled nosel"><a>Next &rarr;</a></li>\n '),n.push('\n </li>\n</ul>\n\n\n</br>\n<table class="table table-striped table-bordered">\n <tr>\n <th>Client Connections</th>\n <th>Client EOF</th>\n <th>Client Errors</th>\n <th>Forward Errors</th>\n <th>Fragments</th>\n <th>Server Ejects</th>\n </tr>\n <tr>\n <td>'),n.push(r(this.model.get("client_connections"))),n.push("</td>\n <td>"),n.push(r(this.model.get("client_eof"))),n.push("</td>\n <td>"),n.push(r(this.model.get("client_err"))),n.push("</td>\n <td>"),n.push(r(this.model.get("forward_error"))),n.push("</td>\n <td>"),n.push(r(this.model.get("fragments"))),n.push("</td>\n <td>"),n.push(r(this.model.get("server_ejects"))),n.push('</td>\n </tr>\n\n</table>\n\n</br>\n<div class="chartsBox">\n <div class="row">\n <div class="span5">\n <div id="chart1" style="padding-left: 23%"></div>\n </div>\n <div class="span5">\n <div id="chart2" style="padding-left: 40%"></div>\n </div>\n </div>\n</div>\n\n\n</br>\n<table class="table table-striped table-bordered">\n <thead>\n <tr>\n <th>Host</th>\n <th>Used Memory</th>\n <th>Free Memory</th>\n <th>Used Memory RSS</th>\n <th>Max Memory</th>\n <th>Fragmentation</th>\n </tr>\n </thead>\n <tbody>\n '),a=this.model.get("nodes").models,e=0,i=a.length;i>e;e++)t=a[e],n.push('\n <tr>\n <td><a href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("hostname"))),n.push("</a></td>\n <td>"),n.push(r(humanize.filesize(t.get("usedMemory")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("freeMemory")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("usedMemoryRss")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("maxMemory")))),n.push("</td>\n <td>"),n.push(r(t.get("fragmentation"))),n.push("</td>\n </tr>\n ");n.push("\n <tr>\n <td>&nbsp;</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("usedMemory")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("freeMemory")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("usedMemoryRss")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("maxMemory")).sum()))),n.push("</td>\n <td>~"),n.push(r(humanize.numberFormat(_(this.model.get("nodes").pluck("fragmentation")).average(),2))),n.push("</td>\n </tr>\n </tbody>\n</table>\n\n\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.config=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push("\n<h3> Clusters </h3>\n<br/>\n"),u=_(this.model.get("config")).map(function(t,e){return[e,t]}),i=0,s=u.length;s>i;i++){for(e=u[i],n.push('\n <table class="table table-striped table-bordered">\n <tr><th>Name</th><td>'),n.push("<a href="+Nutcracker.Models.Cluster.routeURL(e[0])+">"+e[0]+"</a>"),n.push("</td></tr>\n <tr><th>Servers</th><td>"),n.push(e[1].servers.map(function(t){return"<a href="+Nutcracker.Models.Node.routeURL(t)+">"+t+"</a>"}).join("<br/>")),n.push("</td></tr>\n "),l=_(e[1]).map(function(t,e){return[e,t]}),o=0,a=l.length;a>o;o++)t=l[o],n.push("\n "),/servers/.test(t[0])||(n.push("\n <tr><th>"),n.push(r(t[0])),n.push("</th><td>"),n.push(r(t[1])),n.push("</td></tr>\n ")),n.push("\n ");n.push("\n </table>\n </br>\n")}n.push("\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.footer=function(t){t||(t={});var e,n=[],r=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){n.push('<div id="lastUpdate"></div>\n')}.call(this)}.call(t),t.safe=r,t.escape=i,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.navbar=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push('<div class="navbar">\n <div class="navbar-inner">\n <div class="container" style="font-size: 17px">\n <a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse">\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n </a>\n <a class="brand" href="#" style="color: #ffffff;font-size: 25px">Nutcracker</a>\n <div class="nav-collapse collapse navbar-responsive-collapse">\n <ul class="nav">\n <li class="divider-vertical"></li>\n <li id="overview" ><a href="#/">Overview</a></li>\n <li class="divider-vertical"></li>\n <li id="config" ><a href="#/config">Config </a></li>\n <li class="divider-vertical"></li>\n <li id="clusters" class="dropdown">\n <a class="dropdown-toggle" id="drop4" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Clusters <b class="caret"></b></a>\n <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">\n <li class=\'divider\'></li>\n '),u=this.model.get("clusters").models,i=0,s=u.length;s>i;i++)t=u[i],n.push('\n <li role="presentation" style="font-size: 15px">\n <a role="menuitem" tabindex="-1" href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a>\n </li>\n <li class='divider'></li>\n ");for(n.push('\n </ul>\n </li>\n\n <li class="divider-vertical"></li>\n <li id="nodes" class="dropdown">\n <a class="dropdown-toggle" id="drop5" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Nodes <b class="caret"></b></a>\n <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop5">\n <li class=\'divider\'></li>\n '),l=this.model.nodes().models,o=0,a=l.length;a>o;o++)e=l[o],n.push('\n <li role="presentation" style="font-size: 15px">\n <a role="menuitem" tabindex="-1" href="'),n.push(r(e.get("routeURL"))),n.push('">'),n.push(r(e.get("hostname"))),n.push("</a>\n </li>\n <li class='divider'></li>\n ");n.push('\n </ul>\n </li>\n\n <li class="divider-vertical"></li>\n </ul>\n\n <ul class="nav pull-right">\n <li class="divider-vertical"></li>\n <li id="auto-refresh-drop-down" class="dropdown">\n <a class="dropdown-toggle" id="auto-refresh-drop" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Auto Refresh </a>\n <ul id="auto-refresh-menu" class="dropdown-menu" role="menu" aria-labelledby="auto-refresh-drop">\n <li id="auto-refresh-value-30" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="30" role="menuitem" tabindex="-1" href="">30 Seconds</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-60" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="60" role="menuitem" tabindex="-1" href="">60 Seconds</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-300" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="300" role="menuitem" tabindex="-1" href="">5 Minutes</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-3600" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="3600" role="menuitem" tabindex="-1" href="">1 Hour</a>\n </li>\n </ul>\n </li>\n <li class="divider-vertical"></li>\n </ul>\n\n \n </div><!-- /.nav-collapse -->\n </div>\n </div><!-- /navbar-inner -->\n</div><!-- /navbar -->\n')}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.node=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a;for(n.push("<h3 align=center>"),n.push(r(this.model.get("hostname"))),n.push('</h3>\n\n<ul class="pager">\n '),this.prevNode?(n.push('\n <li class="previous nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(o=this.prevNode)?o.get("routeURL"):void 0)),n.push('">&larr; Prev</a></li>\n ')):n.push('\n <li class="previous disabled nosel"><a>&larr; Prev</a></li>\n '),n.push("\n \n "),s=this.model.get("clusters"),e=0,i=s.length;i>e;e++)t=s[e],n.push('\n <li class="nosel"><a class="nextPrevButton" href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a></li>\n ");n.push("\n\n "),this.nextNode?(n.push('\n <li class="next nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(a=this.nextNode)?a.get("routeURL"):void 0)),n.push('">Next &rarr;</a></li>\n ')):n.push('\n <li class="next disabled nosel"><a>Next &rarr;</a></li>\n '),n.push('\n </li>\n</ul>\n</br>\n<div class="chartsBox">\n <div class="row">\n <div class="span5">\n <div id="chart1" style="padding-left: 26%"></div>\n </div>\n <div class="span5">\n <div id="chart2" style="padding-left: 40%"></div>\n </div>\n </div>\n</div>\n\n<br/>\n<div class="row-fluid">\n <div class="span6">\n <h4> Cluster <-> Node Stats </h4>\n <table class="table table-striped table-bordered">\n <tr><th>In-Queue</th><td> '),n.push(r(this.model.get("in_queue"))),n.push("</td></tr>\n <tr><th>In-Queue Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("in_queue_bytes")))),n.push("</td></tr>\n <tr><th>Out-Queue</th><td> "),n.push(r(this.model.get("out_queue"))),n.push("</td></tr>\n <tr><th>Out-Queue Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("out_queue_bytes")))),n.push("</td></tr>\n <tr><th>Requests</th><td> "),n.push(r(this.model.get("requests"))),n.push("</td></tr>\n <tr><th>Requests Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("request_bytes")))),n.push("</td></tr>\n <tr><th>Responses</th><td> "),n.push(r(this.model.get("responses"))),n.push("</td></tr>\n <tr><th>Responses Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("response_bytes")))),n.push("</td></tr>\n <tr><th>Server Connections</th><td> "),n.push(r(this.model.get("server_connections"))),n.push("</td></tr>\n <tr><th>Server EOF</th><td> "),n.push(r(this.model.get("server_eof"))),n.push("</td></tr>\n <tr><th>Server Error</th><td> "),n.push(r(this.model.get("server_err"))),n.push("</td></tr>\n <tr><th>Server Timedout</th><td> "),n.push(r(this.model.get("server_timedout"))),n.push('</td></tr>\n </table>\n </div>\n\n <div class="span6">\n <h4>Node Stats</h3>\n <table class="table table-striped table-bordered">\n <tr><th>Hits</th><td> '),n.push(r(humanize.numberFormat(this.model.get("info").hits,0))),n.push("</td></tr>\n <tr><th>Misses</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").misses,0))),n.push("</td></tr>\n <tr><th>Hit Ratio</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").hit_ratio,2))),n.push("</td></tr>\n <tr><th>Max Memory</th><td> "),n.push(r(humanize.filesize(this.model.get("info").max_memory))),n.push("</td></tr>\n <tr><th>Used Memory</th><td> "),n.push(r(humanize.filesize(this.model.get("info").used_memory))),n.push("</td></tr>\n <tr><th>Used Memory RSS</th><td> "),n.push(r(humanize.filesize(this.model.get("info").used_memory_rss))),n.push("</td></tr>\n <tr><th>Connections</th><td> "),n.push(r(this.model.get("info").connections)),n.push("</td></tr>\n <tr><th>Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").keys,0))),n.push("</td></tr>\n <tr><th>Evicted Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").evicted_keys,0))),n.push("</td></tr>\n <tr><th>Expired Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").expired_keys,0))),n.push("</td></tr>\n <tr><th>Fragmentation</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").fragmentation,2))),n.push("</td></tr>\n <tr><th>&nbsp;</th><td> &nbsp;</td></tr>\n </table>\n </div>\n\n</div>\n\n\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.overview=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push('<h3> Overview </h3>\n<br/>\n<table class="table table-striped table-bordered">\n <tbody>\n <tr><th>Hostname</th><td>'),n.push(r(this.model.get("source"))),n.push("</td></tr>\n <tr><th>Service</th><td>Nutcracker Ver. "),n.push(r(this.model.get("version"))),n.push("</td></tr>\n <tr><th>Uptime</th><td>"),n.push(r(humanize.relativeTime((new Date-1e3*this.model.get("uptime"))/1e3))),n.push("</td></tr>\n <tr><th>Server Connections</th><td>"),n.push(r(this.model.get("serverConnections"))),n.push("</td></tr>\n <tr><th>Client Connections</th><td>"),n.push(r(this.model.get("clientConnections"))),n.push("</td></tr>\n\n <tr>\n <th>Total Clusters</th>\n <td>\n "),u=this.model.get("clusters").models,i=0,s=u.length;s>i;i++)t=u[i],n.push('\n <a href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a><br/>\n ");for(n.push("\n </td>\n </tr>\n\n <tr>\n <th>Total Nodes</th>\n <td>\n "),l=this.model.nodes().models,o=0,a=l.length;a>o;o++)e=l[o],n.push('\n <a href="'),n.push(r(e.get("routeURL"))),n.push('">'),n.push(r(e.get("hostname"))),n.push("</a><br/>\n ");n.push("\n </td>\n </tr>\n \n\n </tbody>\n</table>\n\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){window.Nutcracker={Models:{},Collections:{},Views:{},Routers:{},Utils:{},reload:function(){return""===window.location.hash?Nutcracker.router.navigate("/",{trigger:!0}):Nutcracker.router.navigate(window.location.hash,{trigger:!0})},initialize:function(){var t;return t=new Nutcracker.Models.Overview($("#container").data("clusters")),Nutcracker.overview=t,Nutcracker.screen=new Nutcracker.Utils.RegionManager,Nutcracker.screen.navbar(new Nutcracker.Views.Navbar({model:t})),Nutcracker.screen.footer(new Nutcracker.Views.Footer({model:t})),Nutcracker.router=new Nutcracker.Routers.Overview,Backbone.history.start()}},$(document).ready(function(){return Nutcracker.initialize()})}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Collections.Clusters=function(n){function i(){return this.initialize=e(this.initialize,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(){return this.model=Nutcracker.Models.Cluster},i}(Backbone.Collection)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Collections.Nodes=function(n){function i(){return this.usedMemory=e(this.usedMemory,this),this.maxMemory=e(this.maxMemory,this),this.freeMemory=e(this.freeMemory,this),this.serverConnections=e(this.serverConnections,this),this.add=e(this.add,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(){return this.model=Nutcracker.Models.Node},i.prototype.add=function(t){return this.any(function(e){return e.get("server_url")===t[0].server_url})||i.__super__.add.apply(this,arguments)},i.prototype.serverConnections=function(){return _(this.pluck("server_connections")).sum()},i.prototype.freeMemory=function(){return _(this.pluck("freeMemory")).sum()},i.prototype.maxMemory=function(){return _(this.pluck("maxMemory")).sum()},i.prototype.usedMemory=function(){return _(this.pluck("usedMemory")).sum()},i}(Backbone.Collection)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Models.Cluster=function(n){function i(){return this.set=e(this.set,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.routeURL=function(t){return"#/clusters/"+t},i.prototype.initialize=function(){return this.set("routeURL",this.constructor.routeURL(this.get("name")))},i.prototype.set=function(t,e){var n,r=this;return null==t.nodes||t.nodes instanceof Nutcracker.Collections.Nodes||(t.nodes=new Nutcracker.Collections.Nodes(t.nodes)),null!=(n=t.nodes)&&n.map(function(t){return t.get("clusters").push(r),t.set("clusters",_(t.get("clusters")).uniq())}),Backbone.Model.prototype.set.call(this,t,e)},i}(Backbone.Model)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Models.Node=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.routeURL=function(t){return"#/nodes/"+t.split(":").slice(0,2).join(":")},r.prototype.initialize=function(){var t;return this.set("clusters",[]),this.set("hostname",null!=(t=this.get("server_url"))?t.replace(/redis:\/\//,""):void 0),this.set("maxMemory",this.get("info").max_memory),this.set("usedMemory",this.get("info").used_memory),this.set("freeMemory",this.get("info").max_memory-this.get("info").used_memory),this.set("usedMemoryRss",this.get("info").used_memory_rss),this.set("fragmentation",this.get("info").fragmentation),this.get("freeMemory")<0&&this.set("freeMemory",0),this.set("hits",this.get("info").hits),this.set("misses",this.get("info").misses),0===this.get("maxMemory")&&this.set("maxMemory",this.get("usedMemory")),0===this.get("hits")&&this.set("hits",1),this.set("routeURL",this.constructor.routeURL(this.get("hostname")))},r}(Backbone.Model)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Models.Overview=function(n){function i(){return this.postInit=e(this.postInit,this),this.clusters=e(this.clusters,this),this.fetch=e(this.fetch,this),this.nodes=e(this.nodes,this),this.initialize=e(this.initialize,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.url="/overview.json",i.prototype.initialize=function(){return this.postInit()},i.prototype.nodes=function(){return new Backbone.Collection(_(this.get("clusters").pluck("nodes")).chain().pluck("models").flatten().uniq(!1,function(t){return t.get("hostname")}).value())},i.prototype.fetch=function(){return i.__super__.fetch.apply(this,arguments)&&this.postInit(),Nutcracker.reload()},i.prototype.clusters=function(){return this.get("clusters")},i.prototype.postInit=function(){var t,e,n,r,i,o;for(t=_(this.get("clusters").pluck("client_connections")).sum(),n=0,o=this.get("clusters").pluck("nodes"),r=0,i=o.length;i>r;r++)e=o[r],n+=e.serverConnections();return this.set("serverConnections",n),this.set("clientConnections",t),this.set("initializeTime",new Date)},i.prototype.set=function(t,e){return null==t.clusters||t.clusters instanceof Nutcracker.Collections.Clusters||(t.clusters=new Nutcracker.Collections.Clusters(t.clusters)),Backbone.Model.prototype.set.call(this,t,e)},i}(Backbone.Model)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Routers.Overview=function(n){function i(){return this._show=e(this._show,this),this.showConfig=e(this.showConfig,this),this.showNode=e(this.showNode,this),this.showCluster=e(this.showCluster,this),this.showOverview=e(this.showOverview,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.routes={"":"showOverview",config:"showConfig","clusters/:cluster":"showCluster","nodes/:node":"showNode"},i.prototype.initialize=function(){return this.showOverview()},i.prototype.showOverview=function(){return this._show(Nutcracker.Views.Overview)},i.prototype.showCluster=function(t){var e,n;return e=Nutcracker.overview.clusters(),n=e.findWhere({name:t}),this._show(Nutcracker.Views.Cluster,{model:n,collection:e})},i.prototype.showNode=function(t){var e,n;return e=Nutcracker.overview.nodes(),n=e.findWhere({hostname:t}),this._show(Nutcracker.Views.Node,{model:n,collection:e})},i.prototype.showConfig=function(){return this._show(Nutcracker.Views.Config)},i.prototype._show=function(t,e){return null==e&&(e={model:Nutcracker.overview}),Nutcracker.screen.body(new t(e))},i}(Backbone.Router)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};Nutcracker.Utils.RegionManager=function(){function e(e,n,r,i){this.navbarID=null!=e?e:"#navbar",this.bodyID=null!=n?n:"#container",this.footerID=null!=r?r:"#footer",this.current=null!=i?i:{},this._render=t(this._render,this),this.footer=t(this.footer,this),this.body=t(this.body,this),this.navbar=t(this.navbar,this)}return e.prototype.navbar=function(t){return this._render(this.navbarID,t)},e.prototype.body=function(t){return this._render(this.bodyID,t)},e.prototype.footer=function(t){return this._render(this.footerID,t)},e.prototype._render=function(t,e){var n;return $(t).html(e.render().el),null!=(n=this.current[t])&&n.remove,this.current[t]=e},e}()}.call(this),function(){_.prototype.sum=function(){return _.reduce(this._wrapped,function(t,e){return t+e},0)},_.prototype.average=function(){return this.sum()/parseFloat(this._wrapped.length)}}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Backbone.GoogleChart=function(n){function i(){return this.listen=e(this.listen,this),this.render=e(this.render,this),this.id=e(this.id,this),this.onGoogleLoad=e(this.onGoogleLoad,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(t){var e,n=this;return e=_.extend({},t),["el","id","attributes","className","tagName"].map(function(t){return delete e[t]}),google.load("visualization","1",{packages:["corechart"],callback:function(){return n.onGoogleLoad("loaded")
262
+ !function(t){"use strict";var e=function(e,n){this.options=t.extend({},t.fn.affix.defaults,n),this.$window=t(window).on("scroll.affix.data-api",t.proxy(this.checkPosition,this)).on("click.affix.data-api",t.proxy(function(){setTimeout(t.proxy(this.checkPosition,this),1)},this)),this.$element=t(e),this.checkPosition()};e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e,n=t(document).height(),r=this.$window.scrollTop(),i=this.$element.offset(),o=this.options.offset,s=o.bottom,a=o.top,u="affix affix-top affix-bottom";"object"!=typeof o&&(s=a=o),"function"==typeof a&&(a=o.top()),"function"==typeof s&&(s=o.bottom()),e=null!=this.unpin&&r+this.unpin<=i.top?!1:null!=s&&i.top+this.$element.height()>=n-s?"bottom":null!=a&&a>=r?"top":!1,this.affixed!==e&&(this.affixed=e,this.unpin="bottom"==e?i.top-r:null,this.$element.removeClass(u).addClass("affix"+(e?"-"+e:"")))}};var n=t.fn.affix;t.fn.affix=function(n){return this.each(function(){var r=t(this),i=r.data("affix"),o="object"==typeof n&&n;i||r.data("affix",i=new e(this,o)),"string"==typeof n&&i[n]()})},t.fn.affix.Constructor=e,t.fn.affix.defaults={offset:0},t.fn.affix.noConflict=function(){return t.fn.affix=n,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),n=e.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),e.affix(n)})})}(window.jQuery),function(){var t=this,e=t.humanize,n={};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=n),exports.humanize=n):("function"==typeof define&&define.amd&&define("humanize",function(){return n}),t.humanize=n),n.noConflict=function(){return t.humanize=e,this},n.pad=function(t,e,n,r){if(t+="",n?n.length>1&&(n=n.charAt(0)):n=" ",r=void 0===r?"left":"right","right"===r)for(;t.length<e;)t+=n;else for(;t.length<e;)t=n+t;return t},n.time=function(){return(new Date).getTime()/1e3};var r=[0,0,31,59,90,120,151,181,212,243,273,304,334],i=[0,0,31,60,91,121,152,182,213,244,274,305,335];n.date=function(t,e){var o=void 0===e?new Date:e instanceof Date?new Date(e):new Date(1e3*e),s=/\\?([a-z])/gi,a=function(t,e){return c[t]?c[t]():e},u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"],c={d:function(){return n.pad(c.j(),2,"0")},D:function(){return c.l().slice(0,3)},j:function(){return o.getDate()},l:function(){return u[c.w()]},N:function(){return c.w()||7},S:function(){var t=c.j();return t>4&&21>t?"th":{1:"st",2:"nd",3:"rd"}[t%10]||"th"},w:function(){return o.getDay()},z:function(){return(c.L()?i[c.n()]:r[c.n()])+c.j()-1},W:function(){var t=c.z()-c.N()+1.5;return n.pad(1+Math.floor(Math.abs(t)/7)+(t%7>3.5?1:0),2,"0")},F:function(){return l[o.getMonth()]},m:function(){return n.pad(c.n(),2,"0")},M:function(){return c.F().slice(0,3)},n:function(){return o.getMonth()+1},t:function(){return new Date(c.Y(),c.n(),0).getDate()},L:function(){return 1===new Date(c.Y(),1,29).getMonth()?1:0},o:function(){var t=c.n(),e=c.W();return c.Y()+(12===t&&9>e?-1:1===t&&e>9)},Y:function(){return o.getFullYear()},y:function(){return String(c.Y()).slice(-2)},a:function(){return o.getHours()>11?"pm":"am"},A:function(){return c.a().toUpperCase()},B:function(){var t=o.getTime()/1e3,e=t%86400+3600;0>e&&(e+=86400);var n=e/86.4%1e3;return 0>t?Math.ceil(n):Math.floor(n)},g:function(){return c.G()%12||12},G:function(){return o.getHours()},h:function(){return n.pad(c.g(),2,"0")},H:function(){return n.pad(c.G(),2,"0")},i:function(){return n.pad(o.getMinutes(),2,"0")},s:function(){return n.pad(o.getSeconds(),2,"0")},u:function(){return n.pad(1e3*o.getMilliseconds(),6,"0")},O:function(){var t=o.getTimezoneOffset(),e=Math.abs(t);return(t>0?"-":"+")+n.pad(100*Math.floor(e/60)+e%60,4,"0")},P:function(){var t=c.O();return t.substr(0,3)+":"+t.substr(3,2)},Z:function(){return 60*-o.getTimezoneOffset()},c:function(){return"Y-m-d\\TH:i:sP".replace(s,a)},r:function(){return"D, d M Y H:i:s O".replace(s,a)},U:function(){return o.getTime()/1e3||0}};return t.replace(s,a)},n.numberFormat=function(t,e,n,r){e=isNaN(e)?2:Math.abs(e),n=void 0===n?".":n,r=void 0===r?",":r;var i=0>t?"-":"";t=Math.abs(+t||0);var o=parseInt(t.toFixed(e),10)+"",s=o.length>3?o.length%3:0;return i+(s?o.substr(0,s)+r:"")+o.substr(s).replace(/(\d{3})(?=\d)/g,"$1"+r)+(e?n+Math.abs(t-o).toFixed(e).slice(2):"")},n.naturalDay=function(t,e){t=void 0===t?n.time():t,e=void 0===e?"Y-m-d":e;var r=86400,i=new Date,o=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()/1e3;return o>t&&t>=o-r?"yesterday":t>=o&&o+r>t?"today":t>=o+r&&o+2*r>t?"tomorrow":n.date(e,t)},n.relativeTime=function(t){t=void 0===t?n.time():t;var e=n.time(),r=e-t;if(2>r&&r>-2)return(r>=0?"just ":"")+"now";if(60>r&&r>-60)return r>=0?Math.floor(r)+" seconds ago":"in "+Math.floor(-r)+" seconds";if(120>r&&r>-120)return r>=0?"about a minute ago":"in about a minute";if(3600>r&&r>-3600)return r>=0?Math.floor(r/60)+" minutes ago":"in "+Math.floor(-r/60)+" minutes";if(7200>r&&r>-7200)return r>=0?"about an hour ago":"in about an hour";if(86400>r&&r>-86400)return r>=0?Math.floor(r/3600)+" hours ago":"in "+Math.floor(-r/3600)+" hours";var i=172800;if(i>r&&r>-i)return r>=0?"1 day ago":"in 1 day";var o=2505600;if(o>r&&r>-o)return r>=0?Math.floor(r/86400)+" days ago":"in "+Math.floor(-r/86400)+" days";var s=5184e3;if(s>r&&r>-s)return r>=0?"about a month ago":"in about a month";var a=parseInt(n.date("Y",e),10),u=parseInt(n.date("Y",t),10),l=12*a+parseInt(n.date("n",e),10),c=12*u+parseInt(n.date("n",t),10),h=l-c;if(12>h&&h>-12)return h>=0?h+" months ago":"in "+-h+" months";var f=a-u;return 2>f&&f>-2?f>=0?"a year ago":"in a year":f>=0?f+" years ago":"in "+-f+" years"},n.ordinal=function(t){t=parseInt(t,10),t=isNaN(t)?0:t;var e=0>t?"-":"";t=Math.abs(t);var n=t%100;return e+t+(n>4&&21>n?"th":{1:"st",2:"nd",3:"rd"}[t%10]||"th")},n.filesize=function(t,e,r,i,o){if(e=void 0===e?1024:e,r=isNaN(r)?2:Math.abs(r),i=void 0===i?".":i,o=void 0===o?",":o,0>=t)return"0 bytes";var s=[1],a=["bytes","Kb","Mb","Gb","Tb","Pb"];if(e>t)return n.numberFormat(t,0)+" "+a[0];for(var u=1;u<a.length;u++)if(s[u]=s[u-1]*e,t<s[u])return n.numberFormat(t/s[u-1],r,i,o)+" "+a[u-1];return n.numberFormat(t/s[a.length-1],r,i,o)+" "+a[a.length-1]},n.linebreaks=function(t){return t=t.replace(/^([\n|\r]*)/,""),t=t.replace(/([\n|\r]*)$/,""),t=t.replace(/(\r\n|\n|\r)/g,"\n"),t=t.replace(/(\n{2,})/g,"</p><p>"),t=t.replace(/\n/g,"<br />"),"<p>"+t+"</p>"},n.nl2br=function(t){return t.replace(/(\r\n|\n|\r)/g,"<br />")},n.truncatechars=function(t,e){return t.length<=e?t:t.substr(0,e)+"…"},n.truncatewords=function(t,e){var n=t.split(" ");return n.length<e?t:n.slice(0,e).join(" ")+"…"}}.call(this),function(){this.JST||(this.JST={}),this.JST.cluster=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a;for(n.push("<h3 align=center> "),n.push(r(this.model.get("name"))),n.push(' </h3>\n\n<ul class="pager fixed">\n '),this.prevCluster?(n.push('\n <li class="previous nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(o=this.prevCluster)?o.get("routeURL"):void 0)),n.push('">&larr; Prev</a></li>\n ')):n.push('\n <li class="previous disabled nosel"><a>&larr; Prev</a></li>\n '),n.push("\n\n "),this.nextCluster?(n.push('\n <li class="next nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(s=this.nextCluster)?s.get("routeURL"):void 0)),n.push('">Next &rarr;</a></li>\n ')):n.push('\n <li class="next disabled nosel"><a>Next &rarr;</a></li>\n '),n.push('\n </li>\n</ul>\n\n\n</br>\n<table class="table table-striped table-bordered">\n <tr>\n <th>Client Connections</th>\n <th>Client EOF</th>\n <th>Client Errors</th>\n <th>Forward Errors</th>\n <th>Fragments</th>\n <th>Server Ejects</th>\n </tr>\n <tr>\n <td>'),n.push(r(this.model.get("client_connections"))),n.push("</td>\n <td>"),n.push(r(this.model.get("client_eof"))),n.push("</td>\n <td>"),n.push(r(this.model.get("client_err"))),n.push("</td>\n <td>"),n.push(r(this.model.get("forward_error"))),n.push("</td>\n <td>"),n.push(r(this.model.get("fragments"))),n.push("</td>\n <td>"),n.push(r(this.model.get("server_ejects"))),n.push('</td>\n </tr>\n\n</table>\n\n</br>\n<div class="chartsBox">\n <div class="row">\n <div class="span5">\n <div id="chart1" style="padding-left: 23%"></div>\n </div>\n <div class="span5">\n <div id="chart2" style="padding-left: 40%"></div>\n </div>\n </div>\n</div>\n\n\n</br>\n<table class="table table-striped table-bordered">\n <thead>\n <tr>\n <th>Host</th>\n <th>Free Memory</th>\n <th>Used Memory</th>\n <th>Used Memory RSS</th>\n <th>Max Memory</th>\n <th>Fragmentation</th>\n </tr>\n </thead>\n <tbody>\n '),a=this.model.get("nodes").models,e=0,i=a.length;i>e;e++)t=a[e],n.push('\n <tr>\n <td><a href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("hostname"))),n.push("</a></td>\n <td>"),n.push(r(humanize.filesize(t.get("freeMemory")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("usedMemory")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("usedMemoryRss")))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(t.get("maxMemory")))),n.push("</td>\n <td>"),n.push(r(t.get("fragmentation"))),n.push("</td>\n </tr>\n ");n.push("\n <tr>\n <td>&nbsp;</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("freeMemory")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("usedMemory")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("usedMemoryRss")).sum()))),n.push("</td>\n <td>"),n.push(r(humanize.filesize(_(this.model.get("nodes").pluck("maxMemory")).sum()))),n.push("</td>\n <td>~"),n.push(r(humanize.numberFormat(_(this.model.get("nodes").pluck("fragmentation")).average(),2))),n.push("</td>\n </tr>\n </tbody>\n</table>\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.config=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push("\n<h3> Clusters </h3>\n<br/>\n"),u=_(this.model.get("config")).map(function(t,e){return[e,t]}),i=0,s=u.length;s>i;i++){for(e=u[i],n.push('\n <table class="table table-striped table-bordered">\n <tr><th>Name</th><td>'),n.push("<a href="+Nutcracker.Models.Cluster.routeURL(e[0])+">"+e[0]+"</a>"),n.push("</td></tr>\n <tr><th>Servers</th><td>"),n.push(e[1].servers.map(function(t){return"<a href="+Nutcracker.Models.Node.routeURL(t)+">"+t+"</a>"}).join("<br/>")),n.push("</td></tr>\n "),l=_(e[1]).map(function(t,e){return[e,t]}),o=0,a=l.length;a>o;o++)t=l[o],n.push("\n "),/servers/.test(t[0])||(n.push("\n <tr><th>"),n.push(r(t[0])),n.push("</th><td>"),n.push(r(t[1])),n.push("</td></tr>\n ")),n.push("\n ");n.push("\n </table>\n </br>\n")}n.push("\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.footer=function(t){t||(t={});var e,n=[],r=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){n.push('<div id="lastUpdate"></div>\n')}.call(this)}.call(t),t.safe=r,t.escape=i,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.navbar=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push('<div class="navbar">\n <div class="navbar-inner">\n <div class="container" style="font-size: 17px">\n <a class="btn btn-navbar" data-toggle="collapse" data-target=".navbar-responsive-collapse">\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n </a>\n <a class="brand" href="#" style="color: #ffffff;font-size: 25px">Nutcracker</a>\n <div class="nav-collapse collapse navbar-responsive-collapse">\n <ul class="nav">\n <li class="divider-vertical"></li>\n <li id="overview" ><a href="#/">Overview</a></li>\n <li class="divider-vertical"></li>\n <li id="config" ><a href="#/config">Config </a></li>\n <li class="divider-vertical"></li>\n <li id="clusters" class="dropdown">\n <a class="dropdown-toggle" id="drop4" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Clusters <b class="caret"></b></a>\n <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">\n <li class=\'divider\'></li>\n '),u=this.model.get("clusters").models,i=0,s=u.length;s>i;i++)t=u[i],n.push('\n <li role="presentation" style="font-size: 15px">\n <a role="menuitem" tabindex="-1" href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a>\n </li>\n <li class='divider'></li>\n ");for(n.push('\n </ul>\n </li>\n\n <li class="divider-vertical"></li>\n <li id="nodes" class="dropdown">\n <a class="dropdown-toggle" id="drop5" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Nodes <b class="caret"></b></a>\n <ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop5">\n <li class=\'divider\'></li>\n '),l=this.model.nodes().models,o=0,a=l.length;a>o;o++)e=l[o],n.push('\n <li role="presentation" style="font-size: 15px">\n <a role="menuitem" tabindex="-1" href="'),n.push(r(e.get("routeURL"))),n.push('">'),n.push(r(e.get("hostname"))),n.push("</a>\n </li>\n <li class='divider'></li>\n ");n.push('\n </ul>\n </li>\n\n <li class="divider-vertical"></li>\n </ul>\n\n <ul class="nav pull-right">\n <li class="divider-vertical"></li>\n <li id="auto-refresh-drop-down" class="dropdown">\n <a class="dropdown-toggle" id="auto-refresh-drop" style="padding-top: 10px;" role="button" data-toggle="dropdown" href="#">Auto Refresh </a>\n <ul id="auto-refresh-menu" class="dropdown-menu" role="menu" aria-labelledby="auto-refresh-drop">\n <li id="auto-refresh-value-30" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="30" role="menuitem" tabindex="-1" href="">30 Seconds</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-60" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="60" role="menuitem" tabindex="-1" href="">60 Seconds</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-300" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="300" role="menuitem" tabindex="-1" href="">5 Minutes</a>\n </li>\n <li class=\'divider\'></li>\n <li id="auto-refresh-value-3600" role="presentation" style="font-size: 15px">\n <a class="auto-refresh-button" value="3600" role="menuitem" tabindex="-1" href="">1 Hour</a>\n </li>\n </ul>\n </li>\n <li class="divider-vertical"></li>\n </ul>\n\n \n </div><!-- /.nav-collapse -->\n </div>\n </div><!-- /navbar-inner -->\n</div><!-- /navbar -->\n')}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.node=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a;for(n.push("<h3 align=center>"),n.push(r(this.model.get("hostname"))),n.push('</h3>\n\n<ul class="pager">\n '),this.prevNode?(n.push('\n <li class="previous nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(o=this.prevNode)?o.get("routeURL"):void 0)),n.push('">&larr; Prev</a></li>\n ')):n.push('\n <li class="previous disabled nosel"><a>&larr; Prev</a></li>\n '),n.push("\n \n "),s=this.model.get("clusters"),e=0,i=s.length;i>e;e++)t=s[e],n.push('\n <li class="nosel"><a class="nextPrevButton" href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a></li>\n ");n.push("\n\n "),this.nextNode?(n.push('\n <li class="next nosel"><a class="nextPrevButton" href="'),n.push(r(null!=(a=this.nextNode)?a.get("routeURL"):void 0)),n.push('">Next &rarr;</a></li>\n ')):n.push('\n <li class="next disabled nosel"><a>Next &rarr;</a></li>\n '),n.push('\n </li>\n</ul>\n</br>\n<div class="chartsBox">\n <div class="row">\n <div class="span5">\n <div id="chart1" style="padding-left: 26%"></div>\n </div>\n <div class="span5">\n <div id="chart2" style="padding-left: 40%"></div>\n </div>\n </div>\n</div>\n\n<br/>\n<div class="row-fluid">\n <div class="span6">\n <h4> Cluster <-> Node Stats </h4>\n <table class="table table-striped table-bordered">\n <tr><th>In-Queue</th><td> '),n.push(r(this.model.get("in_queue"))),n.push("</td></tr>\n <tr><th>In-Queue Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("in_queue_bytes")))),n.push("</td></tr>\n <tr><th>Out-Queue</th><td> "),n.push(r(this.model.get("out_queue"))),n.push("</td></tr>\n <tr><th>Out-Queue Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("out_queue_bytes")))),n.push("</td></tr>\n <tr><th>Requests</th><td> "),n.push(r(this.model.get("requests"))),n.push("</td></tr>\n <tr><th>Requests Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("request_bytes")))),n.push("</td></tr>\n <tr><th>Responses</th><td> "),n.push(r(this.model.get("responses"))),n.push("</td></tr>\n <tr><th>Responses Memory Size</th><td> "),n.push(r(humanize.filesize(this.model.get("response_bytes")))),n.push("</td></tr>\n <tr><th>Server Connections</th><td> "),n.push(r(this.model.get("server_connections"))),n.push("</td></tr>\n <tr><th>Server EOF</th><td> "),n.push(r(this.model.get("server_eof"))),n.push("</td></tr>\n <tr><th>Server Error</th><td> "),n.push(r(this.model.get("server_err"))),n.push("</td></tr>\n <tr><th>Server Timedout</th><td> "),n.push(r(this.model.get("server_timedout"))),n.push('</td></tr>\n </table>\n </div>\n\n <div class="span6">\n <h4>Node Stats</h3>\n <table class="table table-striped table-bordered">\n <tr><th>Hits</th><td> '),n.push(r(humanize.numberFormat(this.model.get("info").hits,0))),n.push("</td></tr>\n <tr><th>Misses</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").misses,0))),n.push("</td></tr>\n <tr><th>Hit Ratio</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").hit_ratio,2))),n.push("</td></tr>\n <tr><th>Max Memory</th><td> "),n.push(r(humanize.filesize(this.model.get("info").max_memory))),n.push("</td></tr>\n <tr><th>Used Memory</th><td> "),n.push(r(humanize.filesize(this.model.get("info").used_memory))),n.push("</td></tr>\n <tr><th>Used Memory RSS</th><td> "),n.push(r(humanize.filesize(this.model.get("info").used_memory_rss))),n.push("</td></tr>\n <tr><th>Connections</th><td> "),n.push(r(this.model.get("info").connections)),n.push("</td></tr>\n <tr><th>Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").keys,0))),n.push("</td></tr>\n <tr><th>Evicted Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").evicted_keys,0))),n.push("</td></tr>\n <tr><th>Expired Keys</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").expired_keys,0))),n.push("</td></tr>\n <tr><th>Fragmentation</th><td> "),n.push(r(humanize.numberFormat(this.model.get("info").fragmentation,2))),n.push("</td></tr>\n <tr><th>&nbsp;</th><td> &nbsp;</td></tr>\n </table>\n </div>\n\n</div>\n\n\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST.overview=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?o(t):""},i=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}),function(){!function(){var t,e,i,o,s,a,u,l;for(n.push('<h3> Overview </h3>\n<br/>\n<table class="table table-striped table-bordered">\n <tbody>\n <tr><th>Hostname</th><td>'),n.push(r(this.model.get("source"))),n.push("</td></tr>\n <tr><th>Service</th><td>Nutcracker Ver. "),n.push(r(this.model.get("version"))),n.push("</td></tr>\n <tr><th>Uptime</th><td>"),n.push(r(humanize.relativeTime((new Date-1e3*this.model.get("uptime"))/1e3))),n.push("</td></tr>\n <tr><th>Server Connections</th><td>"),n.push(r(this.model.get("serverConnections"))),n.push("</td></tr>\n <tr><th>Client Connections</th><td>"),n.push(r(this.model.get("clientConnections"))),n.push("</td></tr>\n\n <tr>\n <th>Total Clusters</th>\n <td>\n "),u=this.model.get("clusters").models,i=0,s=u.length;s>i;i++)t=u[i],n.push('\n <a href="'),n.push(r(t.get("routeURL"))),n.push('">'),n.push(r(t.get("name"))),n.push("</a><br/>\n ");for(n.push("\n </td>\n </tr>\n\n <tr>\n <th>Total Nodes</th>\n <td>\n "),l=this.model.nodes().models,o=0,a=l.length;a>o;o++)e=l[o],n.push('\n <a href="'),n.push(r(e.get("routeURL"))),n.push('">'),n.push(r(e.get("hostname"))),n.push("</a><br/>\n ");n.push("\n </td>\n </tr>\n \n\n </tbody>\n</table>\n\n")}.call(this)}.call(t),t.safe=i,t.escape=o,n.join("")}}.call(this),function(){window.Nutcracker={Models:{},Collections:{},Views:{},Routers:{},Utils:{},reload:function(){return""===window.location.hash?Nutcracker.router.navigate("/",{trigger:!0}):Nutcracker.router.navigate(window.location.hash,{trigger:!0})},initialize:function(){var t;return t=new Nutcracker.Models.Overview($("#container").data("clusters")),Nutcracker.overview=t,Nutcracker.screen=new Nutcracker.Utils.RegionManager,Nutcracker.screen.navbar(new Nutcracker.Views.Navbar({model:t})),Nutcracker.screen.footer(new Nutcracker.Views.Footer({model:t})),Nutcracker.router=new Nutcracker.Routers.Overview,Backbone.history.start()}},$(document).ready(function(){return Nutcracker.initialize()})}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Collections.Clusters=function(n){function i(){return this.initialize=e(this.initialize,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(){return this.model=Nutcracker.Models.Cluster},i}(Backbone.Collection)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Collections.Nodes=function(n){function i(){return this.usedMemory=e(this.usedMemory,this),this.maxMemory=e(this.maxMemory,this),this.freeMemory=e(this.freeMemory,this),this.serverConnections=e(this.serverConnections,this),this.add=e(this.add,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(){return this.model=Nutcracker.Models.Node},i.prototype.add=function(t){return this.any(function(e){return e.get("server_url")===t[0].server_url})||i.__super__.add.apply(this,arguments)},i.prototype.serverConnections=function(){return _(this.pluck("server_connections")).sum()},i.prototype.freeMemory=function(){return _(this.pluck("freeMemory")).sum()},i.prototype.maxMemory=function(){return _(this.pluck("maxMemory")).sum()},i.prototype.usedMemory=function(){return _(this.pluck("usedMemory")).sum()},i}(Backbone.Collection)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Models.Cluster=function(n){function i(){return this.set=e(this.set,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.routeURL=function(t){return"#/clusters/"+t},i.prototype.initialize=function(){return this.set("routeURL",this.constructor.routeURL(this.get("name")))},i.prototype.set=function(t,e){var n,r=this;return null==t.nodes||t.nodes instanceof Nutcracker.Collections.Nodes||(t.nodes=new Nutcracker.Collections.Nodes(t.nodes)),null!=(n=t.nodes)&&n.map(function(t){return t.get("clusters").push(r),t.set("clusters",_(t.get("clusters")).uniq())}),Backbone.Model.prototype.set.call(this,t,e)},i}(Backbone.Model)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Models.Node=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.routeURL=function(t){return"#/nodes/"+t.split(":").slice(0,2).join(":")},r.prototype.initialize=function(){var t;return this.set("clusters",[]),this.set("hostname",null!=(t=this.get("server_url"))?t.replace(/redis:\/\//,""):void 0),this.set("maxMemory",this.get("info").max_memory),this.set("usedMemory",this.get("info").used_memory),this.set("freeMemory",this.get("info").max_memory-this.get("info").used_memory),this.set("usedMemoryRss",this.get("info").used_memory_rss),this.set("fragmentation",this.get("info").fragmentation),this.get("freeMemory")<0&&this.set("freeMemory",0),this.set("hits",this.get("info").hits),this.set("misses",this.get("info").misses),0===this.get("maxMemory")&&this.set("maxMemory",this.get("usedMemory")),0===this.get("hits")&&this.set("hits",1),this.set("routeURL",this.constructor.routeURL(this.get("hostname")))},r}(Backbone.Model)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Models.Overview=function(n){function i(){return this.postInit=e(this.postInit,this),this.clusters=e(this.clusters,this),this.fetch=e(this.fetch,this),this.nodes=e(this.nodes,this),this.initialize=e(this.initialize,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.url="/overview.json",i.prototype.initialize=function(){return this.postInit()},i.prototype.nodes=function(){return new Backbone.Collection(_(this.get("clusters").pluck("nodes")).chain().pluck("models").flatten().uniq(!1,function(t){return t.get("hostname")}).value())},i.prototype.fetch=function(){return i.__super__.fetch.apply(this,arguments)&&this.postInit(),Nutcracker.reload()},i.prototype.clusters=function(){return this.get("clusters")},i.prototype.postInit=function(){var t,e,n,r,i,o;for(t=_(this.get("clusters").pluck("client_connections")).sum(),n=0,o=this.get("clusters").pluck("nodes"),r=0,i=o.length;i>r;r++)e=o[r],n+=e.serverConnections();return this.set("serverConnections",n),this.set("clientConnections",t),this.set("initializeTime",new Date)},i.prototype.set=function(t,e){return null==t.clusters||t.clusters instanceof Nutcracker.Collections.Clusters||(t.clusters=new Nutcracker.Collections.Clusters(t.clusters)),Backbone.Model.prototype.set.call(this,t,e)},i}(Backbone.Model)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Routers.Overview=function(n){function i(){return this._show=e(this._show,this),this.showConfig=e(this.showConfig,this),this.showNode=e(this.showNode,this),this.showCluster=e(this.showCluster,this),this.showOverview=e(this.showOverview,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.routes={"":"showOverview",config:"showConfig","clusters/:cluster":"showCluster","nodes/:node":"showNode"},i.prototype.initialize=function(){return this.showOverview()},i.prototype.showOverview=function(){return this._show(Nutcracker.Views.Overview)},i.prototype.showCluster=function(t){var e,n;return e=Nutcracker.overview.clusters(),n=e.findWhere({name:t}),this._show(Nutcracker.Views.Cluster,{model:n,collection:e})},i.prototype.showNode=function(t){var e,n;return e=Nutcracker.overview.nodes(),n=e.findWhere({hostname:t}),this._show(Nutcracker.Views.Node,{model:n,collection:e})},i.prototype.showConfig=function(){return this._show(Nutcracker.Views.Config)},i.prototype._show=function(t,e){return null==e&&(e={model:Nutcracker.overview}),Nutcracker.screen.body(new t(e))},i}(Backbone.Router)}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};Nutcracker.Utils.RegionManager=function(){function e(e,n,r,i){this.navbarID=null!=e?e:"#navbar",this.bodyID=null!=n?n:"#container",this.footerID=null!=r?r:"#footer",this.current=null!=i?i:{},this._render=t(this._render,this),this.footer=t(this.footer,this),this.body=t(this.body,this),this.navbar=t(this.navbar,this)}return e.prototype.navbar=function(t){return this._render(this.navbarID,t)},e.prototype.body=function(t){return this._render(this.bodyID,t)},e.prototype.footer=function(t){return this._render(this.footerID,t)},e.prototype._render=function(t,e){var n;return $(t).html(e.render().el),null!=(n=this.current[t])&&n.remove,this.current[t]=e},e}()}.call(this),function(){_.prototype.sum=function(){return _.reduce(this._wrapped,function(t,e){return t+e},0)},_.prototype.average=function(){return this.sum()/parseFloat(this._wrapped.length)}}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Backbone.GoogleChart=function(n){function i(){return this.listen=e(this.listen,this),this.render=e(this.render,this),this.id=e(this.id,this),this.onGoogleLoad=e(this.onGoogleLoad,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.initialize=function(t){var e,n=this;return e=_.extend({},t),["el","id","attributes","className","tagName"].map(function(t){return delete e[t]}),google.load("visualization","1",{packages:["corechart"],callback:function(){return n.onGoogleLoad("loaded")
263
263
  }}),this.onGoogleLoad(function(){var t,r;return n.google=google.visualization,e.dataTable instanceof Array&&(e.dataTable=n.google.arrayToDataTable(e.dataTable)),(e.beforeDraw||function(){})(n,e),(t=e.formatter)&&function(){r=[];for(var t=0,n=e.dataTable.getNumberOfRows()-1;n>=0?n>=t:t>=n;n>=0?t++:t--)r.push(t);return r}.apply(this).map(function(n){return t.columns.map(function(r){return e.dataTable.setFormattedValue(n,r,t.callback(e.dataTable.getValue(n,r)))})}),n.wrapper=new n.google.ChartWrapper(e),["ready","select","error"].map(n.listen)})},i.prototype.onGoogleLoad=function(t){return"loaded"===t?(this.googleLoaded=!0,_(this.onGoogleLoadItems).map(function(t){return t()})):this.googleLoaded?t():(this.onGoogleLoadItems||(this.onGoogleLoadItems=[])).push(t)},i.watch=function(t,e){var n,r;return(i._list||(i._list={}))[t]=e,i._watching?void 0:(i._watching=!0,r=10,(n=function(){return _(i._list).map(function(t,e){return $(e)[0]?t()||delete i._list[e]:void 0}),_(i._list).isEmpty()?i._watching=!1:setTimeout(n,r+=10)})())},i.prototype.id=function(){var t;return(null!=(t=this.el)?t.id:void 0)||this.randomID()},i.prototype.render=function(){var t=this;return this.onGoogleLoad(function(){return t.constructor.watch("#"+t.el.id,function(){return t.wrapper.draw(t.el.id)})}),this},i.prototype.listen=function(t){var e=this;return this.google.events.addListener(this.wrapper,t,function(){return e.trigger(t,e.wrapper.getChart())})},i.prototype.randomID=function(){return _.uniqueId("gc_")},i}.call(this,Backbone.View)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Views.Cluster=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.prototype.template=JST.cluster,r.prototype.render=function(){var t,e,n,r=this;return this.curIndex=this.collection.indexOf(this.model),this.nextCluster=this.collection.at(this.curIndex+1),this.prevCluster=this.collection.at(this.curIndex-1),this.$el.html(this.template({model:this.model,nextCluster:this.nextCluster,prevCluster:this.prevCluster})),n={is3D:!0,titleTextStyle:{fontSize:17.5,color:"#333333"},width:300,height:300,sliceVisibilityThreshold:0,chartArea:{width:"100%",height:"80%"},legend:{position:"bottom"}},e=[["Node","Node"]],this.model.get("nodes").map(function(t){return e.push([t.get("hostname"),t.get("maxMemory")])}),t=new Backbone.GoogleChart({formatter:{callback:humanize.filesize,columns:[1]},chartType:"PieChart",options:n,dataTable:e}),t.on("select",function(t){return Nutcracker.router.navigate(r.model.get("nodes").at(t.getSelection()[0].row).get("routeURL"),{trigger:!0})}),this.$el.find("#chart2").html(t.render().el),this.$el.find("#chart1").html(new Backbone.GoogleChart({formatter:{callback:humanize.filesize,columns:[1]},chartType:"PieChart",options:n,dataTable:[["Memory","Memory"],["Free",this.model.get("nodes").freeMemory()],["Used",this.model.get("nodes").usedMemory()]]}).render().el),this},r}(Backbone.View)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Views.Config=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.prototype.template=JST.config,r.prototype.render=function(){return this.$el.html(this.template({model:this.model})),this},r}(Backbone.View)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Views.Footer=function(n){function i(){return this.render=e(this.render,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.className="container navbar navbar-fixed-bottom navbar-inverse",i.prototype.template=JST.footer,i.prototype.render=function(){return this.$el.html(this.template({model:this.model})),this.$el.find("#lastUpdate").html("Last updated: "+humanize.relativeTime(this.model.get("initializeTime")/1e3)),setTimeout(this.render,1e3),this},i}(Backbone.View)}.call(this),function(){var t,e=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty,r=function(t,e){function r(){this.constructor=t}for(var i in e)n.call(e,i)&&(t[i]=e[i]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};Nutcracker.Views.Navbar=function(n){function i(){return this.render=e(this.render,this),this.activate=e(this.activate,this),this.autoRefresh=e(this.autoRefresh,this),this.resetButtons=e(this.resetButtons,this),this.initialize=e(this.initialize,this),t=i.__super__.constructor.apply(this,arguments)}return r(i,n),i.prototype.className="navbar navbar-inverse navbar-fixed-top",i.prototype.template=JST.navbar,i.prototype.events={"click .auto-refresh-button":"autoRefresh"},i.prototype.initialize=function(){return Backbone.history.bind("all",this.resetButtons),this.listenTo(this.model,"change",this.render),this.autoRefreshInterval=null},i.prototype.resetButtons=function(){var t;return this.$el.find("li").removeClass("active"),this.autoRefreshInterval?(this.$("#auto-refresh-drop-down").addClass("active"),this.$("#auto-refresh-value-"+this.autoRefreshInterval).addClass("active")):(this.$("#auto-refresh-drop-down").removeClass("active"),this.$("#auto-refresh-drop-down").find(".active").removeClass("active")),t=window.location.href,/#\/config$/.test(t)?this.activate("#config"):/#\/clusters\//.test(t)?this.activate("#clusters"):/#\/nodes\//.test(t)?this.activate("#nodes"):this.activate("#overview")},i.prototype.autoRefresh=function(t){var e,n=this;return e=parseInt($(t.currentTarget).attr("value")),this.autoRefreshTimer&&clearInterval(this.autoRefreshTimer),e===this.autoRefreshInterval?this.autoRefreshInterval=null:(this.autoRefreshInterval=e,this.autoRefreshTimer=setInterval(function(){return n.model.fetch()},1e3*this.autoRefreshInterval)),this.resetButtons(),t.preventDefault()},i.prototype.activate=function(t){return this.$(t).addClass("active")},i.prototype.render=function(){return this.$el.html(this.template({model:this.model})),this.resetButtons(),this},i}(Backbone.View)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Views.Node=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.prototype.template=JST.node,r.prototype.render=function(){var t;return this.curIndex=this.collection.indexOf(this.model),this.nextNode=this.collection.at(this.curIndex+1),this.prevNode=this.collection.at(this.curIndex-1),t={is3D:!0,titleTextStyle:{fontSize:17.5,color:"#333333"},titleTextStyle:{fontSize:17.5,color:"#333333"},width:300,height:300,sliceVisibilityThreshold:0,chartArea:{width:"100%",height:"80%"},legend:{position:"bottom"}},this.$el.html(this.template({model:this.model,nextNode:this.nextNode,prevNode:this.prevNode})),this.$el.find("#chart1").append(new Backbone.GoogleChart({chartType:"PieChart",formatter:{callback:humanize.filesize,columns:[1]},options:_({title:"Memory"}).extend(t),dataTable:[["Memory","Memory"],["Free",this.model.get("freeMemory")],["Used",this.model.get("usedMemory")]]}).render().el),this.$el.find("#chart2").append(new Backbone.GoogleChart({formatter:{callback:humanize.numberFormat,columns:[1]},chartType:"PieChart",options:_({title:"Hits"}).extend(t),dataTable:[["Memory","Memory"],["Hits",this.model.get("hits")],["Misses",this.model.get("misses")]]}).render().el),this},r}(Backbone.View)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function r(){this.constructor=t}for(var i in n)e.call(n,i)&&(t[i]=n[i]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t};Nutcracker.Views.Overview=function(e){function r(){return t=r.__super__.constructor.apply(this,arguments)}return n(r,e),r.prototype.template=JST.overview,r.prototype.render=function(){return this.$el.html(this.template({model:this.model})),this},r}(Backbone.View)}.call(this);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutcracker-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eran Barak Levi