incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [05/26] Removed the dependency on the bower management tool and added js libs directly
Date Tue, 08 Jul 2014 20:15:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/7e1546d8/blur-console/src/main/webapp/public/js/blurconsole.js
----------------------------------------------------------------------
diff --git a/blur-console/src/main/webapp/public/js/blurconsole.js b/blur-console/src/main/webapp/public/js/blurconsole.js
index 2bf1be7..dc33544 100644
--- a/blur-console/src/main/webapp/public/js/blurconsole.js
+++ b/blur-console/src/main/webapp/public/js/blurconsole.js
@@ -24,4 +24,4 @@ if(v)for(f=0;j>f;++f)k=i[e+f],null!=k&&(l=p[f],l.autoscale!==!1&&(l.x&&b(g.xaxis
 }else{var l=h*Math.cos(k.startAngle),m=h*Math.sin(k.startAngle),n=h*Math.cos(k.startAngle+k.angle/4),o=h*Math.sin(k.startAngle+k.angle/4),p=h*Math.cos(k.startAngle+k.angle/2),q=h*Math.sin(k.startAngle+k.angle/2),r=h*Math.cos(k.startAngle+k.angle/1.5),s=h*Math.sin(k.startAngle+k.angle/1.5),t=h*Math.cos(k.startAngle+k.angle),x=h*Math.sin(k.startAngle+k.angle),z=[[0,0],[l,m],[n,o],[p,q],[r,s],[t,x]],A=[d,e];if(i(z,A))return y.restore(),{datapoint:[k.percent,k.data],dataIndex:0,series:k,seriesIndex:j}}y.restore()}}return null}function k(a){m("plothover",a)}function l(a){m("plotclick",a)}function m(a,c){var d=b.offset(),e=parseInt(c.pageX-d.left),f=parseInt(c.pageY-d.top),g=j(e,f);if(t.grid.autoHighlight)for(var h=0;h<z.length;++h){var i=z[h];i.auto!=a||g&&i.series==g.series||o(i.series)}g&&n(g.series,a);var k={pageX:c.pageX,pageY:c.pageY};s.trigger(a,[k,g])}function n(a,c){var d=p(a);-1==d?(z.push({series:a,auto:c}),b.triggerRedrawOverlay()):c||(z[d].auto=!1)}function o(a){null==a&&(z=[
 ],b.triggerRedrawOverlay());var c=p(a);-1!=c&&(z.splice(c,1),b.triggerRedrawOverlay())}function p(a){for(var b=0;b<z.length;++b){var c=z[b];if(c.series==a)return b}return-1}function q(a,b){function c(a){a.angle<=0||isNaN(a.angle)||(b.fillStyle="rgba(255, 255, 255, "+d.series.pie.highlight.opacity+")",b.beginPath(),Math.abs(a.angle-2*Math.PI)>1e-9&&b.moveTo(0,0),b.arc(0,0,e,a.startAngle,a.startAngle+a.angle/2,!1),b.arc(0,0,e,a.startAngle+a.angle/2,a.startAngle+a.angle,!1),b.closePath(),b.fill())}var d=a.getOptions(),e=d.series.pie.radius>1?d.series.pie.radius:u*d.series.pie.radius;b.save(),b.translate(v,w),b.scale(1,d.series.pie.tilt);for(var f=0;f<z.length;++f)c(z[f].series);h(b),b.restore()}var r=null,s=null,t=null,u=null,v=null,w=null,x=!1,y=null,z=[];b.hooks.processOptions.push(function(a,b){b.series.pie.show&&(b.grid.show=!1,"auto"==b.series.pie.label.show&&(b.series.pie.label.show=b.legend.show?!1:!0),"auto"==b.series.pie.radius&&(b.series.pie.radius=b.series.pie.label.show?.75
 :1),b.series.pie.tilt>1?b.series.pie.tilt=1:b.series.pie.tilt<0&&(b.series.pie.tilt=0))}),b.hooks.bindEvents.push(function(a,b){var c=a.getOptions();c.series.pie.show&&(c.grid.hoverable&&b.unbind("mousemove").mousemove(k),c.grid.clickable&&b.unbind("click").click(l))}),b.hooks.processDatapoints.push(function(a,b,c,d){var f=a.getOptions();f.series.pie.show&&e(a,b,c,d)}),b.hooks.drawOverlay.push(function(a,b){var c=a.getOptions();c.series.pie.show&&q(a,b)}),b.hooks.draw.push(function(a,b){var c=a.getOptions();c.series.pie.show&&g(a,b)})}var c=10,d=.95,e={series:{pie:{show:!1,radius:"auto",innerRadius:0,startAngle:1.5,tilt:1,shadow:{left:5,top:15,alpha:.02},offset:{top:0,left:"auto"},stroke:{color:"#fff",width:1},label:{show:"auto",formatter:function(a,b){return"<div style='font-size:x-small;text-align:center;padding:2px;color:"+b.color+";'>"+a+"<br/>"+Math.round(b.percent)+"%</div>"},radius:1,background:{color:null,opacity:0},threshold:0},combine:{threshold:-1,color:null,label:"Other"
 },highlight:{opacity:.5}}}};a.plot.plugins.push({init:b,options:e,name:"pie",version:"1.1"})}(jQuery),function(a){function b(a,b,c,d){var e="categories"==b.xaxis.options.mode,f="categories"==b.yaxis.options.mode;if(e||f){var g=d.format;if(!g){var h=b;if(g=[],g.push({x:!0,number:!0,required:!0}),g.push({y:!0,number:!0,required:!0}),h.bars.show||h.lines.show&&h.lines.fill){var i=!!(h.bars.show&&h.bars.zero||h.lines.show&&h.lines.zero);g.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:i}),h.bars.horizontal&&(delete g[g.length-1].y,g[g.length-1].x=!0)}d.format=g}for(var j=0;j<g.length;++j)g[j].x&&e&&(g[j].number=!1),g[j].y&&f&&(g[j].number=!1)}}function c(a){var b=-1;for(var c in a)a[c]>b&&(b=a[c]);return b+1}function d(a){var b=[];for(var c in a.categories){var d=a.categories[c];d>=a.min&&d<=a.max&&b.push([d,c])}return b.sort(function(a,b){return a[0]-b[0]}),b}function e(b,c,e){if("categories"==b[c].options.mode){if(!b[c].categories){var g={},h=b[c].options.categories||{};if(
 a.isArray(h))for(var i=0;i<h.length;++i)g[h[i]]=i;else for(var j in h)g[j]=h[j];b[c].categories=g}b[c].options.ticks||(b[c].options.ticks=d),f(e,c,b[c].categories)}}function f(a,b,d){for(var e=a.points,f=a.pointsize,g=a.format,h=b.charAt(0),i=c(d),j=0;j<e.length;j+=f)if(null!=e[j])for(var k=0;f>k;++k){var l=e[j+k];null!=l&&g[k][h]&&(l in d||(d[l]=i,++i),e[j+k]=d[l])}}function g(a,b,c){e(b,"xaxis",c),e(b,"yaxis",c)}function h(a){a.hooks.processRawData.push(b),a.hooks.processDatapoints.push(g)}var i={xaxis:{categories:null},yaxis:{categories:null}};a.plot.plugins.push({init:h,options:i,name:"categories",version:"1.0"})}(jQuery),function(a){function b(a){function b(a,b){for(var c=null,d=0;d<b.length&&a!=b[d];++d)b[d].stack==a.stack&&(c=b[d]);return c}function c(a,c,d){if(null!=c.stack&&c.stack!==!1){var e=b(c,a.getData());if(e){for(var f,g,h,i,j,k,l,m,n=d.pointsize,o=d.points,p=e.datapoints.pointsize,q=e.datapoints.points,r=[],s=c.lines.show,t=c.bars.horizontal,u=n>2&&(t?d.format[2].x:
 d.format[2].y),v=s&&c.lines.steps,w=!0,x=t?1:0,y=t?0:1,z=0,A=0;;){if(z>=o.length)break;if(l=r.length,null==o[z]){for(m=0;n>m;++m)r.push(o[z+m]);z+=n}else if(A>=q.length){if(!s)for(m=0;n>m;++m)r.push(o[z+m]);z+=n}else if(null==q[A]){for(m=0;n>m;++m)r.push(null);w=!0,A+=p}else{if(f=o[z+x],g=o[z+y],i=q[A+x],j=q[A+y],k=0,f==i){for(m=0;n>m;++m)r.push(o[z+m]);r[l+y]+=j,k=j,z+=n,A+=p}else if(f>i){if(s&&z>0&&null!=o[z-n]){for(h=g+(o[z-n+y]-g)*(i-f)/(o[z-n+x]-f),r.push(i),r.push(h+j),m=2;n>m;++m)r.push(o[z+m]);k=j}A+=p}else{if(w&&s){z+=n;continue}for(m=0;n>m;++m)r.push(o[z+m]);s&&A>0&&null!=q[A-p]&&(k=j+(q[A-p+y]-j)*(f-i)/(q[A-p+x]-i)),r[l+y]+=k,z+=n}w=!1,l!=r.length&&u&&(r[l+2]+=k)}if(v&&l!=r.length&&l>0&&null!=r[l]&&r[l]!=r[l-n]&&r[l+1]!=r[l-n+1]){for(m=0;n>m;++m)r[l+n+m]=r[l+m];r[l+1]=r[l-n+1]}}d.points=r}}}a.hooks.processDatapoints.push(c)}var c={series:{stack:null}};a.plot.plugins.push({init:b,options:c,name:"stack",version:"1.2"})}(jQuery),function(a){var b={isMsie:function(){return/(m
 sie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,getUniqueId:function(){var a=0;return function(){return a++}}(),templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,
 b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},noop:function(){}},c={wrapper:'<span class="twitter-typeahead"></span>',dropdown:'<span class="tt-dropdown-menu"></span>',dataset:'<div class="tt-dataset-%CLASS%"></div>',suggestions:'<span class="tt-suggestions"></span>',suggestion:'<div class="tt-suggestion"></div>'},d={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",
 left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};b.isMsie()&&b.mixin(d.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),b.isMsie()&&b.isMsie()<=7&&b.mixin(d.input,{marginTop:"-1px"});var e=function(){function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d="typeahead:";return b.mixin(c.prototype,{trigger:function(a){var b=[].slice.call(arguments,1);this.$el.trigger(d+a,b)}}),c}(),f=function(){function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){va
 r b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0;!d&&e<a.length;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),g=function(a){function c(a,c,d){for(var e,f=[],g=0;g<a.length;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,case
 Sensitive:!1};return function(e){function f(b){var c,d;return(c=h.exec(b.data))&&(wrapperNode=a.createElement(e.tagName),e.className&&(wrapperNode.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),wrapperNode.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(wrapperNode,d)),!!c}function g(a,b){for(var c,d=3,e=0;e<a.childNodes.length;e++)c=a.childNodes[e],c.nodeType===d?e+=b(c)?1:0:g(c,b)}var h;e=b.mixin({},d,e),e.node&&e.pattern&&(e.pattern=b.isArray(e.pattern)?e.pattern:[e.pattern],h=c(e.pattern,e.caseSensitive,e.wordsOnly),g(e.node,f))}}(window.document),h=function(){function c(c){var e,f,g,i,j=this;c=c||{},c.input||a.error("input is missing"),e=b.bind(this._onBlur,this),f=b.bind(this._onFocus,this),g=b.bind(this._onKeydown,this),i=b.bind(this._onInput,this),this.$hint=a(c.hint),this.$input=a(c.input).on("blur.tt",e).on("focus.tt",f).on("keydown.tt",g),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=b.noop),b.isMsi
 e()?this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(a){h[a.which||a.keyCode]||b.defer(b.bind(j._onInput,j,a))}):this.$input.on("input.tt",i),this.query=this.$input.val(),this.$overflowHelper=d(this.$input)}function d(b){return a('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:b.css("font-family"),fontSize:b.css("font-size"),fontStyle:b.css("font-style"),fontVariant:b.css("font-variant"),fontWeight:b.css("font-weight"),wordSpacing:b.css("word-spacing"),letterSpacing:b.css("letter-spacing"),textIndent:b.css("text-indent"),textRendering:b.css("text-rendering"),textTransform:b.css("text-transform")}).insertAfter(b)}function e(a,b){return c.normalizeQuery(a)===c.normalizeQuery(b)}function g(a){return a.altKey||a.ctrlKey||a.metaKey||a.shiftKey}var h;return h={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},c.normalizeQuery=function(a){return(a||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},b.
 mixin(c.prototype,f,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(a){var b=h[a.which||a.keyCode];this._managePreventDefault(b,a),b&&this._shouldTrigger(b,a)&&this.trigger(b+"Keyed",a)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(a,b){var c,d,e;switch(a){case"tab":d=this.getHint(),e=this.getInputValue(),c=d&&d!==e&&!g(b);break;case"up":case"down":c=!g(b);break;default:c=!1}c&&b.preventDefault()},_shouldTrigger:function(a,b){var c;switch(a){case"tab":c=!g(b);break;default:c=!0}return c},_checkInputValue:function(){var a,b,c;a=this.getInputValue(),b=e(a,this.query),c=b?this.query.length!==a.length:!1,b?c&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query=a)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(a){this.query=a},getInputValue:function(){return 
 this.$input.val()},setInputValue:function(a,b){this.$input.val(a),b?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(a){this.$hint.val(a)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var a,b,c,d;a=this.getInputValue(),b=this.getHint(),c=a!==b&&0===b.indexOf(a),d=""!==a&&c&&!this.hasOverflow(),!d&&this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var a=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=a},isCursorAtEnd:function(){var a,c,d;return a=this.$input.val().length,c=this.$input[0].selectionStart,b.isNumber(c)?c===a:document.selection?(d=document.selection.createRange(),d.moveStart("character",-a),a===d.text.length):!0},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$hint=this.$in
 put=this.$overflowHelper=null}}),c}(),i=function(){function e(d){d=d||{},d.templates=d.templates||{},d.source||a.error("missing source"),d.name&&!j(d.name)&&a.error("invalid dataset name: "+d.name),this.query=null,this.highlight=!!d.highlight,this.name=d.name||b.getUniqueId(),this.source=d.source,this.displayFn=h(d.display||d.displayKey),this.templates=i(d.templates,this.displayFn),this.$el=a(c.dataset.replace("%CLASS%",this.name))}function h(a){function c(b){return b[a]}return a=a||"value",b.isFunction(a)?a:c}function i(a,c){function d(a){return"<p>"+c(a)+"</p>"}return{empty:a.empty&&b.templatify(a.empty),header:a.header&&b.templatify(a.header),footer:a.footer&&b.templatify(a.footer),suggestion:a.suggestion||d}}function j(a){return/^[_a-zA-Z0-9-]+$/.test(a)}var k="ttDataset",l="ttValue",m="ttDatum";return e.extractDatasetName=function(b){return a(b).data(k)},e.extractValue=function(b){return a(b).data(l)},e.extractDatum=function(b){return a(b).data(m)},b.mixin(e.prototype,f,{_rende
 r:function(e,f){function h(){return p.templates.empty({query:e,isEmpty:!0})}function i(){function h(b){var e;return e=a(c.suggestion).append(p.templates.suggestion(b)).data(k,p.name).data(l,p.displayFn(b)).data(m,b),e.children().each(function(){a(this).css(d.suggestionChild)}),e}var i,j;return i=a(c.suggestions).css(d.suggestions),j=b.map(f,h),i.append.apply(i,j),p.highlight&&g({node:i[0],pattern:e}),i}function j(){return p.templates.header({query:e,isEmpty:!o})}function n(){return p.templates.footer({query:e,isEmpty:!o})}if(this.$el){var o,p=this;this.$el.empty(),o=f&&f.length,!o&&this.templates.empty?this.$el.html(h()).prepend(p.templates.header?j():null).append(p.templates.footer?n():null):o&&this.$el.html(i()).prepend(p.templates.header?j():null).append(p.templates.footer?n():null),this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(a){function b(b){c.canceled||a!==c.query||c._render(a,b)}var c=this;this.query=a,this.canceled=!1,this.source(a,b)},cance
 l:function(){this.canceled=!0},clear:function(){this.cancel(),this.$el.empty(),this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),e}(),j=function(){function c(c){var d,f,g,h=this;c=c||{},c.menu||a.error("menu is required"),this.isOpen=!1,this.isEmpty=!0,this.datasets=b.map(c.datasets,e),d=b.bind(this._onSuggestionClick,this),f=b.bind(this._onSuggestionMouseEnter,this),g=b.bind(this._onSuggestionMouseLeave,this),this.$menu=a(c.menu).on("click.tt",".tt-suggestion",d).on("mouseenter.tt",".tt-suggestion",f).on("mouseleave.tt",".tt-suggestion",g),b.each(this.datasets,function(a){h.$menu.append(a.getRoot()),a.onSync("rendered",h._onRendered,h)})}function e(a){return new i(a)}return b.mixin(c.prototype,f,{_onSuggestionClick:function(b){this.trigger("suggestionClicked",a(b.currentTarget))},_onSuggestionMouseEnter:function(b){this._removeCursor(),this._setCursor(a(b.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._remove
 Cursor()},_onRendered:function(){function a(a){return a.isEmpty()}this.isEmpty=b.every(this.datasets,a),this.isEmpty?this._hide():this.isOpen&&this._show(),this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".tt-suggestion")},_getCursor:function(){return this.$menu.find(".tt-cursor").first()},_setCursor:function(a,b){a.first().addClass("tt-cursor"),!b&&this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("tt-cursor")},_moveCursor:function(a){var b,c,d,e;if(this.isOpen){if(c=this._getCursor(),b=this._getSuggestions(),this._removeCursor(),d=b.index(c)+a,d=(d+1)%(b.length+1)-1,-1===d)return void this.trigger("cursorRemoved");-1>d&&(d=b.length-1),this._setCursor(e=b.eq(d)),this._ensureVisible(e)}},_ensureVisible:function(a){var b,c,d,e;b=a.position().top,c=b+a.outerHeight(!0),d=this.$menu.scrollTop(),e=this.$menu.height()+parseInt(this.$m
 enu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),0>b?this.$menu.scrollTop(d+b):c>e&&this.$menu.scrollTop(d+(c-e))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,!this.isEmpty&&this._show(),this.trigger("opened"))},setLanguageDirection:function(a){this.$menu.css("ltr"===a?d.ltr:d.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(a){var b=null;return a.length&&(b={raw:i.extractDatum(a),value:i.extractValue(a),datasetName:i.extractDatasetName(a)}),b},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(a){function c(b){b.update(a)}b.each(this.datasets,c)},empty:function(){function a(a){a.clear()}b.each(this.datasets,a),this.isEmp
 ty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function a(a){a.destroy()}this.$menu.off(".tt"),this.$menu=null,b.each(this.datasets,a)}}),c}(),k=function(){function f(c){var d,f,i;c=c||{},c.input||a.error("missing input"),this.isActivated=!1,this.autoselect=!!c.autoselect,this.minLength=b.isNumber(c.minLength)?c.minLength:1,this.$node=g(c.input,c.withHint),d=this.$node.find(".tt-dropdown-menu"),f=this.$node.find(".tt-input"),i=this.$node.find(".tt-hint"),f.on("blur.tt",function(a){var c,e,g;c=document.activeElement,e=d.is(c),g=d.has(c).length>0,b.isMsie()&&(e||g)&&(a.preventDefault(),a.stopImmediatePropagation(),b.defer(function(){f.focus()}))}),d.on("mousedown.tt",function(a){a.preventDefault()}),this.eventBus=c.eventBus||new e({el:f}),this.dropdown=new j({menu:d,datasets:c.datasets}).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("
 opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=new h({input:f,hint:i}).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._setLanguageDirection()}function g(b,e){var f,g,h,j;f=a(b),g=a(c.wrapper).css(d.wrapper),h=a(c.dropdown).css(d.dropdown),j=f.clone().css(d.hint).css(i(f)),j.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder").prop("disabled",!0).attr({autocomplete:"off",spellcheck:"false"}),f.data(l,{dir:f.attr("dir"),autocomplete:f.attr("autoc
 omplete"),spellcheck:f.attr("spellcheck"),style:f.attr("style")}),f.addClass("tt-input").attr({autocomplete:"off",spellcheck:!1}).css(e?d.input:d.inputWithNoHint);try{!f.attr("dir")&&f.attr("dir","auto")}catch(k){}return f.wrap(g).parent().prepend(e?j:null).append(h)}function i(a){return{backgroundAttachment:a.css("background-attachment"),backgroundClip:a.css("background-clip"),backgroundColor:a.css("background-color"),backgroundImage:a.css("background-image"),backgroundOrigin:a.css("background-origin"),backgroundPosition:a.css("background-position"),backgroundRepeat:a.css("background-repeat"),backgroundSize:a.css("background-size")}}function k(a){var c=a.find(".tt-input");b.each(c.data(l),function(a,d){b.isUndefined(a)?c.removeAttr(d):c.attr(d,a)}),c.detach().removeData(l).removeClass("tt-input").insertAfter(a),a.remove()}var l="ttAttrs";return b.mixin(f.prototype,{_onSuggestionClicked:function(a,b){var c;(c=this.dropdown.getDatumForSuggestion(b))&&this._select(c)},_onCursorMoved:f
 unction(){var a=this.dropdown.getDatumForCursor();this.input.setInputValue(a.value,!0),this.eventBus.trigger("cursorchanged",a.raw,a.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint()},_onDatasetRendered:function(){this._updateHint()},_onOpened:function(){this._updateHint(),this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint(),this.eventBus.trigger("closed")},_onFocused:function(){this.isActivated=!0,this.dropdown.open()},_onBlurred:function(){this.isActivated=!1,this.dropdown.empty(),this.dropdown.close()},_onEnterKeyed:function(a,b){var c,d;c=this.dropdown.getDatumForCursor(),d=this.dropdown.getDatumForTopSuggestion(),c?(this._select(c),b.preventDefault()):this.autoselect&&d&&(this._select(d),b.preventDefault())},_onTabKeyed:function(a,b){var c;(c=this.dropdown.getDatumForCursor())?(this._select(c),b.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onU
 pKeyed:function(){var a=this.input.getQuery();this.dropdown.isEmpty&&a.length>=this.minLength?this.dropdown.update(a):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var a=this.input.getQuery();this.dropdown.isEmpty&&a.length>=this.minLength?this.dropdown.update(a):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(a,b){this.input.clearHintIfInvalid(),b.length>=this.minLength?this.dropdown.update(b):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var a;this.dir!==(a=this.input.getLanguageDirection())&&(this.dir=a,this.$node.css("direction",a),this.dropdown.setLanguageDirection(a))},_updateHint:function(){var a,c,d,e,f,g;a=this.dropdown.getDatumForTopSuggestion(),a&&this.drop
 down.isVisible()&&!this.input.hasOverflow()?(c=this.input.getInputValue(),d=h.normalizeQuery(c),e=b.escapeRegExChars(d),f=new RegExp("^(?:"+e+")(.+$)","i"),g=f.exec(a.value),g?this.input.setHint(c+g[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(a){var b,c,d,e;b=this.input.getHint(),c=this.input.getQuery(),d=a||this.input.isCursorAtEnd(),b&&c!==b&&d&&(e=this.dropdown.getDatumForTopSuggestion(),e&&this.input.setInputValue(e.value),this.eventBus.trigger("autocompleted",e.raw,e.datasetName))},_select:function(a){this.input.setQuery(a.value),this.input.setInputValue(a.value,!0),this._setLanguageDirection(),this.eventBus.trigger("selected",a.raw,a.datasetName),this.dropdown.close(),b.defer(b.bind(this.dropdown.empty,this.dropdown))},open:function(){this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(a){this.isActivated?this.input.setInputValue(a):(this.input.setQuery(a),this.input.setInputValue(a,!0)),this._setLanguageDirection()},get
 Val:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),k(this.$node),this.$node=null}}),f}();!function(){var c,d,f;c=a.fn.typeahead,d="ttTypeahead",f={initialize:function(c,f){function g(){var g,h,i=a(this);b.each(f,function(a){a.highlight=!!c.highlight}),h=new k({input:i,eventBus:g=new e({el:i}),withHint:b.isUndefined(c.hint)?!0:!!c.hint,minLength:c.minLength,autoselect:c.autoselect,datasets:f}),i.data(d,h)}return f=b.isArray(f)?f:[].slice.call(arguments,1),c=c||{},this.each(g)},open:function(){function b(){var b,c=a(this);(b=c.data(d))&&b.open()}return this.each(b)},close:function(){function b(){var b,c=a(this);(b=c.data(d))&&b.close()}return this.each(b)},val:function(b){function c(){var c,e=a(this);(c=e.data(d))&&c.setVal(b)}function e(a){var b,c;return(b=a.data(d))&&(c=b.getVal()),c}return arguments.length?this.each(c):e(this.first())},destroy:function(){function b(){var b,c=a(this);(b=c.data(d))&&(b.destroy(),c.removeData(d
 ))}return this.each(b)}},a.fn.typeahead=function(a){return f[a]?f[a].apply(this,[].slice.call(arguments,1)):f.initialize.apply(this,arguments)},a.fn.typeahead.noConflict=function(){return a.fn.typeahead=c,this}}()}(window.jQuery);var blurconsole=function(){"use strict";function a(a){blurconsole.model.initModule(),blurconsole.shell.initModule(a)}return{initModule:a}}();blurconsole.browserUtils=function(){"use strict";function a(a,b){var c;return c='<table class="table table-bordered table-condensed table-hover table-striped"><thead><tr>',$.each(a,function(a,b){c+="<th>"+b.label+"</th>"}),c+="</tr></thead><tbody>",b&&b.length>0?$.each(b,function(b,d){c+="<tr>",$.each(a,function(a,b){c+="<td>",c+=$.isFunction(b.key)?b.key(d):d[b.key],c+="</td>"}),c+="</tr>"}):c+='<tr><td colspan="'+a.length+'">There are no items here</td></tr>',c+="</tbody></table>"}function b(a,b,c,d,e){var f,g,h=d;switch(e){case"large":f="modal-lg";break;case"medium":f="modal-md";break;default:f="modal-sm"}return g='
 <div class="modal fade" id="'+a+'">',g+='<div class="modal-dialog '+f+'">',g+='<div class="modal-content">',g+='<div class="modal-header"><button type="button" class="close" data-dismiss="modal">&times;</button><h4 class="modal-title">'+b+"</h4></div>",g+='<div class="modal-body">'+("string"===$.type(c)?c:$(c).html())+"</div>",h&&($.isArray(h)||(h=[h]),g+='<div class="modal-footer">',$.each(h,function(a,b){g+='<button type="button" class="btn '+b.classes+'" id="'+b.id+'" ',b.data&&$.each(b.data,function(a,b){g+="data-"+a+'="'+b+'" '}),g+=">"+b.label+"</button> "}),g+="</div>"),g+="</div></div></div>"}function c(a){return a.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"_")}function d(a){return!a||a!==!0&&"yes"!==a&&"true"!==a?'<div class="label label-danger"><i class="glyphicon glyphicon-minus-sign"></i></div>':'<div class="label label-success"><i class="glyphicon glyphicon-ok-sign"></i></div>'}return{table:a,modal:b,cleanId:c,booleanImg:d}}(),blurconsole.dashboard=function(){"u
 se strict";function a(){var a=s.$container;t={$container:a,$zkChartHolder:$("#zookeeperNodes"),$zkInfoHolder:$("#zookeeperInfo"),$controllerChartHolder:$("#controllerNodes"),$controllerInfoHolder:$("#controllerInfo"),$shardChartHolder:$("#shardNodes"),$tableChartHolder:$("#tableCounts"),$queryLoadChartHolder:$("#queryLoad")}}function b(){$(document).on("click",".swapper-trigger",f),$(window).on("resize",n)}function c(){$(document).off("click",".swapper-trigger"),$(window).off("resize")}function d(){e(),j(),k()}function e(){blurconsole.model.nodes.isDataLoaded()&&(g(),h(),i())}function f(a){var b=$(a.currentTarget).closest("div.swapper-parent"),c=b.find(".swapper-chart"),d=b.find(".swapper-info");c.toggleClass("hidden"),d.toggleClass("hidden")}function g(){$.plot(t.$zkChartHolder,blurconsole.model.metrics.getZookeeperChartData(),r.pieOptions),t.$zkInfoHolder.html(l(blurconsole.model.nodes.getOnlineZookeeperNodes(),blurconsole.model.nodes.getOfflineZookeeperNodes()))}function h(){$.pl
 ot(t.$controllerChartHolder,blurconsole.model.metrics.getControllerChartData(),r.pieOptions),t.$controllerInfoHolder.html(l(blurconsole.model.nodes.getOnlineControllerNodes(),blurconsole.model.nodes.getOfflineControllerNodes()))}function i(){t.$shardChartHolder.find("img").length>0&&t.$shardChartHolder.html(""),$.each(blurconsole.model.metrics.getClusters(),function(a,b){var c=blurconsole.model.metrics.getShardChartData(b);if(c){var d=t.$shardChartHolder.find("#cluster_"+b+"_chart_holder"),e=t.$shardChartHolder.find("#cluster_"+b+"_info");if(0===d.length){var f=$('<div class="swapper-parent"></div>');f.append($('<div class="text-center"><strong>'+b+'</strong> <small class="text-muted"><i class="glyphicon glyphicon-retweet swapper-trigger" title="Swap Chart/Info"></i></small></div>')),d=$('<div id="cluster_'+b+'_chart_holder" class="shardClusterChartHolder simple-chart swapper-chart"></div>'),f.append(d);var g=t.$shardChartHolder.parent()[0].clientWidth-150;d.css({height:g,width:g}),
 e=$('<div id="cluster_'+b+'_info" class="swapper-info hidden"></div>'),f.append(e),t.$shardChartHolder.append(f)}$.plot(d,c,r.pieOptions),e.html(l([],blurconsole.model.nodes.getOfflineShardNodes(b)))}})}function j(){blurconsole.model.tables.isDataLoaded()&&$.plot(t.$tableChartHolder,blurconsole.model.metrics.getTableChartData(),{bars:{show:!0,barWidth:.6,align:"center"},yaxis:{min:0,tickDecimals:0},xaxis:{mode:"categories"}})}function k(){$.plot(t.$queryLoadChartHolder,blurconsole.model.metrics.getQueryLoadChartData(),{series:{shadowSize:0},yaxis:{min:0},xaxis:{show:!1}})}function l(a,b){var c='<table class="table table-condensed"><thead><tr><th>Offline Node</th></tr></thead><tbody>';return 0===b.length?c+="<tr><td>Everything is Online!</td></tr>":$.each(b,function(a,b){c+="<tr><td>"+b+"</td></tr>"}),c+="</tbody></table>",a.length>0&&(c+='<table class="table table-condensed"><thead><tr><th>Online Node</th></tr></thead><tbody>',$.each(a,function(a,b){c+="<tr><td>"+b+"</td></tr>"}),c+
 ="</tbody></table>"),$(c)}function m(a){var b;b=t[a].parent()[0].clientWidth-150,t[a].css({height:b,width:b})}function n(){m("$zkChartHolder"),m("$controllerChartHolder"),m("$tableChartHolder"),m("$queryLoadChartHolder");var a=t.$shardChartHolder.parent()[0].clientWidth-150,b=t.$shardChartHolder.find(".shardClusterChartHolder");b.each(function(){$(this).css({height:a,width:a})}),d()}function o(){blurconsole.model.metrics.getSlowQueryWarnings()?$("#slow-query-warnings").slideDown():$("#slow-query-warnings").slideUp()}function p(c){return c.load(r.view,function(){s.$container=c,a(),d(),o(),$.gevent.subscribe(t.$container,"node-status-updated",e),$.gevent.subscribe(t.$container,"tables-updated",j),$.gevent.subscribe(t.$container,"query-perf-updated",k),$.gevent.subscribe(t.$container,"queries-updated",o),n(),b()}),!0}function q(){$.gevent.unsubscribe(t.$container,"node-status-updated"),$.gevent.unsubscribe(t.$container,"tables-updated"),$.gevent.unsubscribe(t.$container,"query-perf-upd
 ated"),$.gevent.unsubscribe(t.$container,"queries-updated"),c()}var r={view:"views/dashboard.tpl.html",pieOptions:{series:{pie:{show:!0,radius:1,label:{show:!0,radius:2/3,formatter:function(a,b){return'<div style="font-size:10pt;font-weight:bold;text-align:center;padding:2px;color:white">'+a+"<br/>"+Math.round(b.percent)+"% ("+b.data[0][1]+")</div>"
 },threshold:.1}}},legend:{show:!1},title:"Test title"}},s={$container:null,zookeeperNodes:"chart",controllerNodes:"chart"},t={};return{initModule:p,unloadModule:q}}(),blurconsole.data=function(){"use strict";function a(a,b,c,d){blurconsole.model.logs.logError(b+" - "+a,c),d&&d("error")}function b(b){$.getJSON("/service/tables",b).fail(function(c){a(c.responseText,c.status,"tables",b)})}function c(b){$.getJSON("/service/nodes",b).fail(function(c){a(c.responseText,c.status,"tables",b)})}function d(b){$.getJSON("/service/queries/performance",b).fail(function(c){a(c.responseText,c.status,"tables",b)})}function e(b){$.getJSON("/service/queries",b).fail(function(c){a(c.responseText,c.status,"tables",b)})}function f(b,c){$.ajax("/service/queries/"+c+"/cancel",{data:{table:b},error:function(b){a(b.responseText,b.status,"tables")}})}function g(b){$.ajax("/service/tables/"+b+"/disable",{error:function(b){a(b.responseText,b.status,"tables")}})}function h(b){$.ajax("/service/tables/"+b+"/enable
 ",{error:function(b){a(b.responseText,b.status,"tables")}})}function i(b,c){$.ajax("/service/tables/"+b+"/delete",{data:{includeFiles:c},error:function(b){a(b.responseText,b.status,"tables")}})}function j(b,c){$.getJSON("/service/tables/"+b+"/schema",c).fail(function(b){a(b.responseText,b.status,"tables")})}function k(b,c,d,e,f){$.getJSON("/service/tables/"+b+"/"+c+"/"+d+"/terms",{startsWith:e},f).fail(function(b){a(b.responseText,b.status,"tables")})}function l(b,c,d,e){var f=$.extend({table:c,query:b},d);$.ajax("/service/search",{type:"POST",data:f,success:e,error:function(b){a(b.responseText,b.status,"tables")}})}return{getTableList:b,getNodeList:c,getQueryPerformance:d,getQueries:e,cancelQuery:f,disableTable:g,enableTable:h,deleteTable:i,getSchema:j,findTerms:k,sendSearch:l}}(),blurconsole.fake=function(){"use strict";function a(a,b){var c=Math.random()*a;return b||c++,Math.floor(c)}function b(){return a(2)%2===0}function c(){for(var a="",b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk
 lmnopqrstuvwxyz0123456789",c=0;c<Math.floor(30*Math.random()+1);c++)a+=b.charAt(Math.floor(Math.random()*b.length));return a}function d(){for(var c={},d=a(20),e=["string","long","int","date","stored","customType"],f=0;d>f;f++){var g,h={},i=a(30);for(g=0;i>g;g++){var j="col"+g;if(1===a(10)&&(j+=".sub"),h[j]={fieldLess:b(),type:e[a(6,!0)],extra:null},b()){var k,l=a(3),m={};for(k=0;l>k;k++)m["extra"+k]="val"+k;h[j].extra=m}}c["fam"+f]=h}return c}function e(b,c){setTimeout(function(){b(c)},a(1e3))}function f(){var a=$("#fake_freeze");"Freeze"===a.html()?(w=!0,a.html("Unfreeze")):(w=!1,a.html("Freeze"))}function g(c){if(!w||!s){for(var f=["prodA","prodB"],g=[],h=0;5>h;h++){var i=f[a(2,!0)],j=a(1e3),k=a(1e4)+1e3,l=b();g.push({cluster:i,name:"testtable"+h,enabled:l,rows:j,records:k,families:blurconsole.utils.keys(d())})}s={tables:g,clusters:f}}e(c,s)}function h(a){if(!w||!u){for(var c={online:[],offline:[]},d=[{name:"prodA",online:[],offline:[]},{name:"prodB",online:[],offline:[]}],f={onli
 ne:[],offline:[]},g=0;3>g;g++){var h=b();h?(c.online.push("controller"+g+".localhost"),d[0].online.push("prodA.shard"+g+".localhost"),d[1].online.push("prodB.shard"+g+".localhost"),f.online.push("zookeeper"+g+".localhost")):(c.offline.push("controller"+g+".localhost"),d[0].offline.push("prodA.shard"+g+".localhost"),d[1].offline.push("prodB.shard"+g+".localhost"),f.offline.push("zookeeper"+g+".localhost"))}u={controllers:c,clusters:d,zookeepers:f}}e(a,u)}function i(b){e(b,a(1e3,!0))}function j(b){if(!w||!v){for(var d=[],f=0;f<a(50);f++)d.push({uuid:c(),user:"user_"+a(10,!0),query:c(),table:"testtable"+a(5,!0),state:a(3,!0),percent:a(100,!0),startTime:(new Date).getTime()});v={slowQueries:1===a(10),queries:d}}e(b,v)}function k(a,b){}function l(a){}function m(a){}function n(a,b){}function o(a,b){w&&t||(t=d()),e(b,t)}function p(a,b,d,f,g){for(var h=[],i=0;10>i;i++){var j=c();f&&(j=f+j),h.push(j)}h=h.sort(function(a,b){return a.toLowerCase().localeCompare(b.toLowerCase())}),e(g,h)}functi
 on q(b,d,f,g){var h=f.families,i={},j=null!==h&&h.indexOf("rowid")>=0?1:a(1e3);null!==h&&$.each(h,function(b,d){var e=a(30,!0),g=null!==h&&h.indexOf("rowid")>=0?1:f.fetch;if(j-f.start<g&&(g=j-f.start),"recordrecord"===f.rowRecordOption){i[d]=[];for(var k=0;k<a(g);k++){var l={};l.recordid=a(1e6).toString();for(var m=0;e>m;m++)l["col"+m]=c();i[d].push(l)}}else{i[d]=[];for(var n=0;n<a(g);n++){var o=a(1e7).toString();i[d][n]={rowid:o,records:[]};for(var p=0;p<a(10);p++){var q={};q.recordid=a(1e6).toString();for(var r=0;e>r;r++)q["col"+r]=c();i[d][n].records.push(q)}}}}),h.indexOf("rowid")>=0?e(g,{total:j,results:i,families:h}):null===h||0===h.length?e(g,{total:j}):e(g,{families:h,results:i,total:j})}function r(){$("nav.navbar .pull-right").append('<button type="button" id="fake_freeze" class="btn btn-default btn-sm">Freeze</button>'),$("#fake_freeze").click(f)}var s,t,u,v,w=!1;return{initModule:r,getTableList:g,getNodeList:h,getQueryPerformance:i,getQueries:j,cancelQuery:k,disableTable:
 l,enableTable:m,deleteTable:n,getSchema:o,findTerms:p,sendSearch:q}}(),blurconsole.logging=function(){"use strict";function a(){null===f.modal?(f.modal=$(blurconsole.browserUtils.modal("error_log_modal","Error Logs",e.mainHtml,e.buttons,"large")),f.modal.modal().on("shown.bs.modal",function(){f.logHolder=$(".log_display",f.modal),c()}).on("click","#clear-log-button",b)):f.modal.modal("show")}function b(){f.logHolder.html(e.emptyLogMsg),blurconsole.model.logs.clearErrors()}function c(){var a=blurconsole.model.logs.getLogs();if(f.logHolder)if(0===a.length)f.logHolder.html(e.emptyLogMsg);else{var b="<ul>";a.sort(function(a,b){return a.timestamp.getTime()>b.timestamp.getTime()}),$.each(a,function(a,c){b+="<li><strong>"+c.error+" ("+c.module+')</strong><div class="pull-right"><em>'+c.timestamp.toTimeString()+"</em></div></li>"}),b+="</ul>",f.logHolder.html(b)}}function d(){$.gevent.subscribe($(document),"show-logging",a),$.gevent.subscribe($(document),"logging-updated",c)}var e={emptyLog
 Msg:"No Errors! Yay!",mainHtml:'<div class="log_display"></div>',buttons:[{classes:"btn-default",id:"clear-log-button",label:"Clear Logs"},{classes:"btn-primary",id:"close-logs",label:"Close",data:{dismiss:"modal"}}]},f={modal:null};return{initModule:d}}(),blurconsole.model=function(){"use strict";function a(){j.poller.getNodeList(e)}function b(){j.poller.getTableList(f)}function c(){j.poller.getQueryPerformance(g)}function d(){j.poller.getQueries(h)}function e(b){"error"===b||blurconsole.utils.equals(b,k.nodeMap)||(k.nodeMap=b,$.gevent.publish("node-status-updated")),setTimeout(a,5e3)}function f(a){if("error"!==a){var c=a.tables,d=a.clusters;blurconsole.utils.equals(c,k.currentTables)&&blurconsole.utils.equals(d,k.currentClusters)||(k.currentTables=c,k.currentClusters=d,$.gevent.publish("tables-updated"))}setTimeout(b,5e3)}function g(a){"error"!==a&&(100===k.queryPerformance.length&&k.queryPerformance.shift(),k.queryPerformance.push(a),$.gevent.publish("query-perf-updated")),setTim
 eout(c,5e3)}function h(a){"error"===a||blurconsole.utils.equals(a,k.queries)||(k.queries=a,$.gevent.publish("queries-updated")),setTimeout(d,5e3)}function i(){window.location.href.indexOf("fakeIt=")>-1?(blurconsole.fake.initModule(),j.poller=blurconsole.fake):j.poller=blurconsole.data,setTimeout(function(){a(),b(),c(),d()},1e3)}var j={poller:null},k={currentTables:null,currentClusters:[],nodeMap:null,queryPerformance:[],queries:{},errors:[],schema:{}},l=function(){function a(){return null===k.currentClusters?[]:blurconsole.utils.unique(k.currentClusters,!0)}function b(a){var b=[];return $.each(k.currentTables,function(c,d){d.cluster===a&&d.enabled&&b.push({name:d.name,rowCount:d.rows,recordCount:d.records})}),b}function c(a){var b=[];return $.each(k.currentTables,function(c,d){d.cluster!==a||d.enabled||b.push({name:d.name,rowCount:d.rows,recordCount:d.records})}),b}function d(){var c={};return $.each(a(),function(a,d){c[d]=b(d)}),c}function e(){return null!==k.currentTables}function
  f(a){j.poller.disableTable(a)}function g(a){j.poller.enableTable(a)}function h(a,b){j.poller.deleteTable(a,b)}function i(a,b){k.schema&&k.schema.tableName===a&&new Date-k.schema.date<6e4?setTimeout(function(){b(k.schema.data)},0):j.poller.getSchema(a,function(c){k.schema.tableName=a,k.schema.data=c,k.schema.date=new Date,b(c)})}function l(a){var b;return $.each(k.currentTables,function(c,d){return d.name===a?(b=d,!1):void 0}),b?b.families:[]}function m(a,b,c,d,e){j.poller.findTerms(a,b,c,d,e)}return{getClusters:a,getEnabledTables:b,getDisabledTables:c,isDataLoaded:e,disableTable:f,enableTable:g,deleteTable:h,getSchema:i,findTerms:m,getAllEnabledTables:d,getFamilies:l}}(),m=function(){function a(a){var b=$.grep(k.nodeMap.clusters,function(b){return b.name===a});return b.length>0?b[0]:null}function b(){return k.nodeMap.zookeepers.online}function c(){return k.nodeMap.zookeepers.offline}function d(){return k.nodeMap.controllers.online}function e(){return k.nodeMap.controllers.offline}f
 unction f(b){var c=a(b);return c?c.offline:[]}function g(b){var c=a(b);return c?c.online:[]}function h(){return null!==k.nodeMap}return{getOnlineZookeeperNodes:b,getOfflineZookeeperNodes:c,getOfflineControllerNodes:e,getOnlineControllerNodes:d,getOfflineShardNodes:f,getOnlineShardNodes:g,isDataLoaded:h}}(),n=function(){function a(a,b){var c={label:"Online",color:"#66CDCC",data:[[0,a]]},d={label:"Offline",color:"#FF1919",data:[[0,b]]};return[c,d]}function b(){return a(k.nodeMap.zookeepers.online.length,k.nodeMap.zookeepers.offline.length)}function c(){return a(k.nodeMap.controllers.online.length,k.nodeMap.controllers.offline.length)}function d(){return $.map(k.nodeMap.clusters,function(a){return a.name})}function e(b){var c=$.grep(k.nodeMap.clusters,function(a){return a.name===b});return c.length>0?a(c[0].online.length,c[0].offline.length):null}function f(){var a=blurconsole.utils.reduce(k.currentTables,[],function(a,b){var c=$.grep(a,function(a){return a[0]===b.cluster});return 0===
 c.length?(c=[b.cluster,0],a.push(c)):c=c[0],b.enabled&&(c[1]=c[1]+1),a}),b=blurconsole.utils.reduce(k.currentTables,[],function(a,b){var c=$.grep(a,function(a){return a[0]===b.cluster});return 0===c.length?(c=[b.cluster,0],a.push(c)):c=c[0],b.enabled||(c[1]=c[1]+1),a});return[{data:a,label:"Enabled",color:"#66CDCC",stack:!0},{data:b,label:"Disabled",color:"#333333",stack:!0}]}function g(){var a,b,c=0,d=[],e=[];return a=k.queryPerformance,$.each(a,function(a,b){c+=b}),b=0===a.length?0:c/a.length,$.each(a,function(a,c){d.push([a,c]),e.push([a,b])}),[{label:"Queries",data:d},{label:"Average",data:e}]}function h(){return k.queries.slowQueries}return{getZookeeperChartData:b,getControllerChartData:c,getClusters:d,getShardChartData:e,getTableChartData:f,getQueryLoadChartData:g,getSlowQueryWarnings:h}}(),o=function(){function a(a,b){var c=a.user+"~~~"+a.query+"~~~"+e[a.state];return null===b||""===b?!0:-1!==c.toLowerCase().indexOf(b.toLowerCase())}function b(b,c,d){var e,f,g,h=[];return e=(
 c||"startTime~desc").split("~"),f=e[0],g=e.length>1?e[1]:"asc",$.each(k.queries.queries,function(c,e){e.table===b&&a(e,d)&&h.push(e)}),h.sort(function(a,b){return"asc"===g?a[f]>b[f]:b[f]>b[f]}),h}function c(a,b){j.poller.cancelQuery(b)}function d(a){var b=!1;return $.each(k.queries.queries,function(c,d){return d.table===a?(b=!0,!1):void 0}),b}var e=["running","interrupted","complete","backpressureinterrupted"];return{queriesForTable:b,cancelQuery:c,tableHasActivity:d}}(),p=function(){function a(){j.poller.sendSearch(g,h,l,b)}function b(a){var b=a.families,c=a.results;k=a.total,"undefined"!=typeof c&&null!==c&&$.each(c,function(a,b){var c=i[a]||[];i[a]=c.concat(b)}),$.gevent.publish("results-updated",[b])}function c(b,c,d){var e=blurconsole.utils.findFamilies(b);g=b,h=c,l=$.extend(l,d),l.families=e,i={},-1===b.indexOf("rowid:")&&-1===b.indexOf("recordid:")&&a()}function d(){return i}function e(){return k}function f(b){var c=i[b];l.start="undefined"==typeof c||null===c?0:$.isArray(c)?
 c.length:blurconsole.utils.keys(c).length,l.fetch=10,l.families=[b],a()}var g,h,i={},k=0,l={start:0,fetch:10,rowRecordOption:"rowrow",families:null};return{runSearch:c,getResults:d,loadMoreResults:f,getTotal:e}}(),q=function(){function a(a,b){k.errors.push({error:a,module:b,timestamp:new Date}),$.gevent.publish("logging-updated")}function b(){delete k.errors,k.errors=[],$.gevent.publish("logging-updated")}function c(){return k.errors}return{logError:a,clearErrors:b,getLogs:c}}();return{initModule:i,tables:l,metrics:n,nodes:m,queries:o,search:p,logs:q}}(),blurconsole.queries=function(){"use strict";function a(){var a=n.$container;o={$container:a,$tableHolder:$("#tableHolder"),$queryHolder:$("#queryHolder"),$filterHolder:$("#filterOptions"),$filterText:$("#filterOptions .filterText")}}function b(){o.$tableHolder.on("click",".list-group-item",e),o.$queryHolder.on("click","a.cancelTrigger",f),o.$filterHolder.on("click",".filterTrigger",g)}function c(){o.$tableHolder&&o.$tableHolder.off(
 )}function d(){var a=blurconsole.model.tables.getClusters();a&&a.length>0?(h(),i()):setTimeout(d,100)}function e(a){return n.currentTable=$(a.currentTarget).attr("href"),$(".list-group-item",o.$tableHolder).removeClass("active"),$('.list-group-item[href="'+n.currentTable+'"]',o.$tableHolder).addClass("active"),i(),!1}function f(a){var b=$(a.currentTarget).data("uuid"),c=$(a.currentTarget).data("query"),d=$(a.currentTarget).data("table"),e=blurconsole.browserUtils.modal("confirmDelete","Confirm Query Cancel","You are about to cancel the query ["+c+"].  Are you sure you want to do this?",[{classes:"btn-primary killQuery",label:"Stop Query"},{classes:"btn-default cancel",label:"Cancel",data:{dismiss:"modal"}}],"medium"),f=$(e).modal().on("shown.bs.modal",function(a){$(a.currentTarget).on("click",".killQuery",function(){blurconsole.model.queries.cancelQuery(d,b),f.modal("hide")})}).on("hidden.bs.modal",function(a){$(a.currentTarget).remove()});return!1}function g(){var a=o.$filterText.v
 al();n.currentFilter=a,i()}function h(){var a=blurconsole.model.tables.getClusters();a?(o.$tableHolder.html(""),a.sort(),$.each(a,function(a,b){var c,d=blurconsole.model.tables.getEnabledTables(b);c='<div class="panel panel-default"><div class="panel-heading"><h3 class="panel-title">'+b+'</h3></div><div class="panel-body">',d.length>0?(d.sort(function(a,b){return a.name>b.name}),c+='<div class="list-group">',$.each(d,function(a,b){c+='<a href="'+b.name+'" class="list-group-item',b.name===n.currentTable&&(c+=" active",i()),c+='">'+b.name+' <i class="glyphicon glyphicon-exclamation-sign" data-table="'+b.name+'" style="display:none"></i></a>'}),c+="</div>"):c+='<div class="alert alert-warning">There are not any enabled tables!</div>',c+="</div></div>",o.$tableHolder.append(c)})):o.$tableHolder.html('<div class="alert alert-warning">There are no clusters of tables!</div>')}function i(){o.$queryHolder.html(n.currentTable?blurconsole.browserUtils.table(m.queryDef,blurconsole.model.queries
 .queriesForTable(n.currentTable,n.currentSort,n.currentFilter)):'<div class="alert alert-info">Select a table on the left to see the current queries</div>')}function j(){var a=blurconsole.model.tables.getClusters();$.each(a,function(a,b){var c=!1,d=blurconsole.model.tables.getEnabledTables(b);$.each(d,function(a,b){blurconsole.model.queries.tableHasActivity(b.name)?(c=!0,$('i[data-table="'+b.name+'"]').show()):$('i[data-table="'+b.name+'"]').hide()})})}function k(c){return c.load(m.view,function(){n.$container=c,a(),$.gevent.subscribe(o.$container,"queries-updated",function(){i(),j()}),$.gevent.subscribe(o.$container,"tables-updated",h),b(),d()}),!0}function l(){$.gevent.unsubscribe(o.$container,"queries-updated"),$.gevent.unsubscribe(o.$container,"tables-updated"),c()}var m={view:"views/queries.tpl.html",states:["Running","Interrupted","Complete","Back Pressure Interrupted"],queryDef:[{label:"User",key:"user"},{label:"Query",key:"query"},{label:"Time Started",key:function(a){var b=
 new Date(a.startTime);return b.toTimeString()}},{label:"State",key:function(a){var b=m.states[a.state];return 0===a.state&&(b+=' <div class="badge badge-info">'+a.percent+"%</div>"),b}},{label:"Actions",key:function(a){var b="";return 0===a.state&&(b+='<a href="#" class="cancelTrigger btn btn-danger" data-uuid="'+a.uuid+'" data-query="'+a.query+'" data-table="'+a.table+'"><i class="glyphicon glyphicon-ban-circle"></i> Cancel</a> '),b}}]},n={$container:null,currentTable:null,currentFilter:null,currentSort:null},o={};return{initModule:k,unloadModule:l}}(),blurconsole.schema=function(){"use strict";function a(){blurconsole.model.tables.findTerms(k.table,k.termFamily,k.termColumn,l.termSearch.val(),g)}function b(a,b){k.table=b,k.modalId=k.table+"_modal",blurconsole.model.tables.getSchema(k.table,c)}function c(b){k.schema=b,l.contentHolder=$(j.mainHtml),l.contentHolder.find(".schemaList").html(d()),l.contentHolder.find(".schemaColumnInfo").append(e()),l.modal=$(blurconsole.browserUtils.m
 odal(k.modalId,"Schema Definition for "+k.table,l.contentHolder,null,"large")),l.modal.modal().on("shown.bs.modal",function(a){l.columnTermsSection=$(".schemaColumnTerms",l.modal),l.termSearch=$(".termSearch",l.modal),l.termList=$(".termList",l.modal),l.termSearchButton=$(".schemaColumnTerms button",l.modal),$(".collapse",a.currentTarget).collapse({toggle:!1})}).on("hidden.bs.modal",function(a){$(a.currentTarget).remove(),l.contentHolder.remove(),l={},k={}}).on("click","li.schemaColumn",function(){var a=$(this).find("a").attr("href");return $("div.schemaColumnDef").removeClass("in"),$(a).addClass("in"),l.columnTermsSection.hide(),!1}).on("click","a.termsTrigger",f).on("click",".schemaColumnTerms button",a).on("click",".searchTrigger",h)}function d(){var a="";return $.each(k.schema,function(b,c){var d=blurconsole.browserUtils.cleanId(b);a+='<div class="panel panel-default"><div class="panel-heading">',a+='<h4 class="panel-title" data-toggle="collapse" data-parent=".schemaList" data-t
 arget="#'+d+'">'+b+"</h4></div>",a+='<div id="'+d+'" class="panel-collapse collapse"><div class="panel-body"><ul class="list-group">',$.each(c,function(b,c){var e=blurconsole.browserUtils.cleanId(b);a+='<li class="list-group-item schemaColumn"><a href="#'+d+"_"+e+'">'+b,a+='</a><div class="pull-right">',"stored"!==c.type&&(a+=' <span class="badge">searchable</span>'),a+='<i class="glyphicon glyphicon-chevron-right"></i></div></li>'}),a+="</ul></div></div></div>"}),a}function e(){var a="";return $.each(k.schema,function(b,c){var d=blurconsole.browserUtils.cleanId(b);$.each(c,function(c,e){var f=blurconsole.browserUtils.cleanId(c);a+='<div class="schemaColumnDef" id="'+d+"_"+f+'"><ul class="list-group">',a+='<li class="list-group-item"><strong>Field Name:</strong> '+c+"</li>",a+='<li class="list-group-item"><strong>Fieldless Searching:</strong> '+blurconsole.browserUtils.booleanImg(e.fieldLess)+"</li>",a+='<li class="list-group-item"><strong>Field Type:</strong> '+e.type+"</li>",e.ext
 ra&&$.each(e.extra,function(b,c){a+='<li class="list-group-item"><strong>'+b+":</strong> "+c+"</li>"}),"stored"!==e.type&&(a+='<li class="list-group-item"><a href="#" class="termsTrigger" data-fam="'+b+'" data-col="'+c+'">View Terms</a></li>'),a+="</ul></div>"})}),a}function f(a){l.termList.html('<div class="center-block"><img src="img/ajax-loader.gif"></div>'),l.termSearch.val(""),l.columnTermsSection.show();var b=$(a.currentTarget);k.termFamily=b.data("fam"),k.termColumn=b.data("col"),l.termSearchButton.trigger("click")}function g(a){l.termList.html(""),$.each(a,function(a,b){l.termList.append('<li class="list-group-item">'+b+' <span class="badge badge-success searchTrigger" title="Search for this value" data-value="'+b+'" data-table="'+k.table+'"><i class="glyphicon glyphicon-search"></i></span></li>')})}function h(a){blurconsole.shell.changeAnchorPart({tab:"search",_tab:{query:encodeURIComponent(k.termFamily+"."+k.termColumn+":"+$(a.currentTarget).data("value")),table:$(a.curren
 tTarget).data("table"),rr:"rowrow"}}),l.modal.modal("hide")}function i(){$.gevent.subscribe($(document),"schema-show",b)}var j={mainHtml:String()+'<div class="container-fluid"><div class="row"><div class="col-md-6"><div class="panel-group schemaList"></div></div><div class="col-md-6"><div class="row"><div class="col-md-12 schemaColumnInfo"><div class="schemaColumnDef in"><strong>Choose a column on the left to see def</strong></div></div></div><div class="row"><div class="col-md-12 schemaColumnTerms"><div class="input-group"><input class="form-control termSearch" placeholder="Starts With" type="text"><span class="input-group-btn"><button class="btn btn-default" type="button">Go!</button></span></div><ul class="list-group termList"></ul></div></div></div></div></div>'},k={},l={};return{initModule:i}}(),blurconsole.search=function(){"use strict";function a(){var a=s.$container;t={$container:a,$queryField:$("#queryField"),$tableField:$("#tableChooser"),$tableSelectorStatusOption:$("#sta
 tusOption"),$tableWarning:$("#tableGoneWarning"),$resultsHolder:$("#results"),$optionsDisplay:$("#searchOptionsDisplay"),$countHolder:$("#resultCount"),$facetTrigger:$("#facetTrigger"),$optionsTrigger:$("#searchOptionsTrigger"),$searchTrigger:$("#searchTrigger")}}function b(a){var b={family:null,column:null,term:null,mode:null};a=a.toLowerCase();var c=a.lastIndexOf("."),d=a.lastIndexOf(":"),e=a.lastIndexOf("("),f=a.lastIndexOf(")"),g=e>-1&&e>f,h=a.lastIndexOf(" "),i=Math.max(0,c,d,e,f,h);if(c===i)b.family=a.substring(h+1,c),b.column=a.substring(c+1),b.mode="column";else if(d===i||g&&e===d+1){var j=a.lastIndexOf(" ",c);-1===j&&(j=0),b.family=a.substring(j,c),b.column=a.substring(c+1,d),b.term=a.substring(i+1),b.mode="term"}else(1===a.length||a.length-1!==i)&&(b.family=a.substring(h+1),b.mode="family");return b.family&&(b.family=b.family.replace(/[\.\:\(\)\+\- ]/g,"")),b.term&&(b.term=b.term.replace(/[\+\-]/g,"")),b}function c(){t.$searchTrigger.on("click",i),t.$queryField.typeahead({
 },u),t.$queryField.on("keyup",function(a){13===a.keyCode&&i()}),t.$resultsHolder.on("shown.bs.collapse",".panel-collapse:not(.loaded)",j),t.$resultsHolder.on("click",".nextPage",j),t.$optionsTrigger.popover({html:!0,placement:"bottom",title:"Extra Search Options",container:"body",content:r.optionsHtml}),t.$optionsTrigger.on("shown.bs.popover",g),$(document).on("change",".popover select",h),t.$facetTrigger.on("click",o),t.$tableField.on("change",function(a){s.$currentTable=$(a.currentTarget).val()})}function d(){t.$searchTrigger&&(t.$searchTrigger.off("click"),t.$queryField.typeahead("destroy"),t.$queryField.off("keyup"),t.$resultsHolder.off("shown.bs.collapse"),t.$resultsHolder.off("click"),t.$optionsTrigger.popover("destroy"),t.$optionsTrigger.off("shown.bs.popover"),$(document).off("change"),t.$tableField.off("change"))}function e(a){var b=blurconsole.utils.reject(blurconsole.utils.keys(a),function(a){return"recordid"===a});return 0===b.length?[]:(b.sort(),b=["recordid"].concat(b)
 )}function f(){var a="";a+=r.superQueryMap[s.$rowRecordOption],t.$optionsDisplay.html(a)}function g(){$("#superQuery").length>0&&$("#superQuery").val(s.$rowRecordOption)}function h(){var a=!1;if(t.$resultsHolder.children().length>0){if(!confirm("You have existing results on the screen, changing the search options will erase your results.  Continue?"))return $("#superQuery").val(s.$rowRecordOption),!1;a=!0}s.$rowRecordOption=$("#superQuery").val(),a&&i(),f(),$("#searchOptionsTrigger").popover("hide")}function i(){s.$currentTable=t.$tableField.val(),s.$currentQuery=t.$queryField.val(),blurconsole.shell.changeAnchorPart({tab:"search",_tab:{query:encodeURIComponent(s.$currentQuery),table:s.$currentTable,rr:s.$rowRecordOption}}),l(),t.$countHolder.html(""),blurconsole.model.search.runSearch(s.$currentQuery,s.$currentTable,{start:0,fetch:10,rowRecordOption:s.$rowRecordOption})}function j(a){var b=$(a.currentTarget).attr("href")?$(a.currentTarget).attr("href").substring(1):$(a.currentTarge
 t).attr("id");return blurconsole.model.search.loadMoreResults(b),!1}function k(){var a=!1;if(s.$currentTable){var b=blurconsole.model.tables.getAllEnabledTables();$.each(b,function(b,c){var d=$.map(c,function(a){return a.name});d.indexOf(s.$currentTable)>-1&&(a=!0)})}a?(t.$tableWarning.hide(),n()):s.$currentTable?t.$tableWarning.show():n()}function l(){var a="",b=blurconsole.utils.findFamilies(s.$currentQuery);t.$resultsHolder.html("");var c=blurconsole.model.tables.getFamilies(s.$currentTable),d=blurconsole.utils.reject(c,function(a){return b.indexOf(a)>=0});b.sort(),d.sort();var e=b.concat(d);$.each(e,function(c,d){var e=blurconsole.browserUtils.cleanId(d);a+='<div class="panel panel-default"><div class="panel-heading">',a+='<h4 class="panel-title" data-toggle="collapse" data-parent="#results" data-target="#'+e+'">'+d+"</h4></div>",a+='<div id="'+e+'" class="panel-collapse collapse'+(b.indexOf(d)>=0?" in":"")+'">',a+='<div class="panel-body"><img src="img/ajax-loader.gif"></div></
 div></div>'}),t.$resultsHolder.html(a)}function m(a,b){var c=blurconsole.model.search.getResults();t.$countHolder.html("<small>Found "+blurconsole.model.search.getTotal()+" total results</small>"),"undefined"!=typeof b&&null!==b&&$.each(b,function(a,b){var d=c[b],f="#"+blurconsole.browserUtils.cleanId(b),g=$(f+" .panel-body");if("undefined"==typeof d||0===d.length)g.html('<div class="alert alert-info">No Data Found</div>');else{var h,i;-1===blurconsole.utils.keys(d[0]).indexOf("rowid")?(h='<table class="table table-condensed table-hover table-bordered"><thead><tr>',i=e(d[0]),$.each(i,function(a,b){h+="<th>"+b+"</th>"}),h+="</tr></thead><tbody>",$.each(d,function(a,b){h+="<tr>",$.each(i,function(a,c){h+="<td>"+(b[c]||"")+"</td>"}),h+="</tr>"}),h+="</tbody></table>"):($.each(d,function(a,b){if(b.records.length>0){var c=e(b.records[0]);if(c.length>0)return i=c,!1}}),i=i||[],h="",$.each(d,function(a,b){h+='<table class="table table-condensed table-hover table-bordered"><thead>',h+='<tr 
 class="row-separator"><th colspan="'+(0===i.length?1:i.length)+'">'+(a+1)+". <strong>rowid:</strong> "+b.rowid+" (<em>"+(null===b.records?0:b.records.length)+" records</em>)</th></tr>",h+="<tr>",$.each(i,function(a,b){h+="<th>"+b+"</th>"}),h+="</tr></thead><tbody>",null===b.records||0===b.records.length?h+='<tr><td colspan="'+(0===i.length?1:i.length)+'"><em>No Data Found</em></td></tr>':$.each(b.records,function(a,b){h+="<tr>",$.each(i,function(a,c){h+="<td>"+(b[c]||"")+"</td>"}),h+="</tr>"}),h+="</tbody></table>"})),d.length<blurconsole.model.search.getTotal()&&(h+='<div class="pull-left"><a href="'+f+'" class="btn btn-primary nextPage">Load More...</a></div>'),g.html(h)}$(f).hasClass("loaded")||$(f).addClass("loaded")})}function n(){var a=blurconsole.model.tables.getAllEnabledTables();t.$tableField.find("optgroup").remove(),$.each(a,function(a,b){var c;b.length>0&&(c='<optgroup label="'+a+'">',$.each(b,function(a,b){c+='<option value="'+b.name+'"'+(b.name===s.$currentTable?" sele
 cted":"")+">"+b.name+"</option>"}),c+="</optgroup>",t.$tableField.append(c))}),t.$tableSelectorStatusOption&&blurconsole.utils.keys(a).length>0&&(t.$tableSelectorStatusOption.remove(),t.$tableSelectorStatusOption=null)}function o(){t.facetModal=$(blurconsole.browserUtils.modal("facetDialog","Facets for Current Search","TBD",null,"large")),t.facetModal.modal()}function p(b){return b.load(r.view,function(){s.$container=b,a(),$.gevent.subscribe(t.$container,"tables-updated",k),$.gevent.subscribe(t.$container,"results-updated",m),c(),n();var d=$.uriAnchor.makeAnchorMap();d._tab&&(s.$currentQuery=d._tab.query,t.$queryField.val(s.$currentQuery),s.$currentTable=d._tab.table,t.$tableField.val(s.$currentTable),s.$rowRecordOption=d._tab.rr),f(),s.loaded=!0}),!0}function q(){$.gevent.unsubscribe(t.$container,"tables-updated"),d()}var r={view:"views/search.tpl.html",superQueryMap:{rowrow:"Search Row / Retrieve Row",recordrow:"Search Record / Retrieve Row",recordrecord:"Search Record / Retrieve 
 Record"},optionsHtml:'<label for="superQuery">Search & Retrieve</label><select id="superQuery"><option value="rowrow">Search Row / Retrieve Row</option><option value="recordrow">Search Record / Retrieve Row</option><option value="recordrecord">Search Record / Retrieve Record</option></select>'},s={$container:null,$currentTable:null,$currentQuery:null,$schemaForCurrentTable:null,$start:0,$fetch:10,$filter:null,$rowRecordOption:"rowrow"},t={},u={name:"query-dataset",source:function(a,c){function d(a,b,c){return{value:a.substring(0,a.lastIndexOf(b))+c,display:c}}var e=s.$currentTable;if(e&&""!==e&&blurconsole.model.tables.isDataLoaded()){a=a.toLowerCase();var f=b(a);switch(f.mode){case"family":var g=blurconsole.model.tables.getFamilies(e);g=$.map(g,function(b){return 0===b.indexOf(f.family)?d(a,f.family,b):void 0}),c(g);break;case"column":blurconsole.model.tables.getSchema(e,function(b){var e=b[f.family];if(e){var g=$.map(e,function(b,c){return 0===c.indexOf(f.column)?d(a,f.column,c):v
 oid 0});c(g)}});break;case"term":f.term.length>0?blurconsole.model.tables.findTerms(e,f.family,f.column,f.term,function(b){b=$.map(b,function(b){return d(a,f.term,b)}),c(b)}):c(null);break;default:c(null)}}},templates:{suggestion:function(a){return"<p>"+a.display+"</p>"}}};return{initModule:p,unloadModule:q}}(),blurconsole.shell=function(){"use strict";function a(){var a=i.$container;j={$container:a,$sideNavTabs:$(".side-nav a")}}function b(){return $.extend(!0,{},i.anchorMap)}function c(a){if(i.currentTab!==a){for(var b=0;b<h.allTabs.length;b++)blurconsole[h.allTabs[b]]&&blurconsole[h.allTabs[b]].unloadModule();i.currentTab=a,j.$sideNavTabs.removeClass("active"),j.$sideNavTabs.filter('a[href$="'+a+'"]').addClass("active"),blurconsole[a]&&blurconsole[a].initModule(j.$container)}return!0}function d(){var a,d=b();try{a=$.uriAnchor.makeAnchorMap()}catch(e){return $.uriAnchor.setAnchor(d,null,!0),!1}i.anchorMap=a;var f=d._s_tab,g=a._s_tab;if(!d||f!==g){var h=a.tab;switch(h){case"dashboa
 rd":case"tables":case"queries":case"search":c(h);break;default:$.uriAnchor.setAnchor(d,null,!0)}}return!1}function e(a){var b=$(a.currentTarget);return f({tab:b.attr("href").split("=")[1]}),!1}function f(a){var c=b(),d=!0;a:for(var e in a)if(a.hasOwnProperty(e)){if(0===e.indexOf("_"))continue a;c[e]=a[e];var f="_"+e;a[f]?c[f]=a[f]:(delete c[f],delete c["_s"+f])}try{$.uriAnchor.setAnchor(c)}catch(g){$.uriAnchor.setAnchor(i.anchorMap,null,!0),d=!1}return d}function g(b){i.$container=b,a(),blurconsole.schema.initModule(),blurconsole.logging.initModule(),$("#view_logging_trigger").on("click",function(){$.gevent.publish("show-logging")}),$(".side-nav li").tooltip(),j.$sideNavTabs.click(e),$.uriAnchor.configModule({schema_map:h.anchorSchemaMap}),$(window).bind("hashchange",d).trigger("hashchange");var c=$.uriAnchor.makeAnchorMap();c.tab||f({tab:h.defaultTab}),$.gevent.subscribe($(document),"logging-updated",function(){var a=blurconsole.model.logs.getLogs();$("#view_logging_trigger .badge"
 ).html(0===a.length?"":a.length)})}var h={anchorSchemaMap:{tab:{dashboard:!0,tables:!0,queries:!0,search:!0},_tab:{query:!0,table:!0,rr:!0}},defaultTab:"dashboard",allTabs:["dashboard","tables","queries","search"]},i={$container:null,currentTab:null,anchorMap:{}},j={};return{initModule:g,changeAnchorPart:f}}(),blurconsole.tables=function(){"use strict";function a(){var a=k.$container;l={$container:a,$tableInfoHolder:$("#tableInfoHolder"),$tables:{}}}function b(){blurconsole.model.tables.getClusters().length>0?e():setTimeout(b,100)}function c(){l.$tableInfoHolder.on("click","ul.nav a",function(a){a.preventDefault(),$(this).tab("show")}),l.$tableInfoHolder.on("click","a.schemaTrigger",function(){return $.gevent.publish("schema-show",$(this).data("name")),!1}),l.$tableInfoHolder.on("click","a.disableTrigger",function(){return blurconsole.model.tables.disableTable($(this).data("name")),!1}),l.$tableInfoHolder.on("click","a.enableTrigger",function(){return blurconsole.model.tables.enable
 Table($(this).data("name")),!1}),l.$tableInfoHolder.on("click","a.deleteTrigger",function(){var a=$(this).data("name"),b=blurconsole.browserUtils.modal("confirmDelete","Confirm Table Deletion","You are about to delete table "+a+".  Are you sure you want to do this? If so, do you also want to delete the underlying table data?",[{classes:"btn-warning tableOnly",label:"Table Only"},{classes:"btn-danger tableAndData",label:"Table And Data"},{classes:"btn-default cancel",label:"Cancel",data:{dismiss:"modal"}}],"medium"),c=$(b).modal().on("shown.bs.modal",function(b){$(b.currentTarget).on("click",".tableOnly",function(){blurconsole.model.tables.deleteTable(a,!1),c.modal("hide")
 }).on("click",".tableAndData",function(){blurconsole.model.tables.deleteTable(a,!0),c.modal("hide")})}).on("hidden.bs.modal",function(a){$(a.currentTarget).remove()});return!1})}function d(){l.$tableInfoHolder&&l.$tableInfoHolder.off()}function e(){var a=blurconsole.model.tables.getClusters(),b=a.length>1;if(b){var c='<ul class="nav nav-tabs">';c+=$.map(a,function(a,b){return'<li class="'+(0===b?"active":"")+'"><a href="#'+a+'_pane" data-toggle="tab">'+a+' <i class="glyphicon glyphicon-exclamation-sign" style="display:none" title="Activity detected"></i></a></li>'}).join(""),c+="</ul>",l.$tableInfoHolder.html($(c))}var d=b?'<div class="tab-content">':"";d+=$.map(a,function(a,b){return'<div id="'+a+'_pane" class="tab-pane'+(0===b?" active":"")+'"><h3>Enabled Tables</h3><div class="enabledSection"></div><h3>Disabled Tables</h3><div class="disabledSection"></div></div>'}).join(""),d+=b?"</div>":"",b?l.$tableInfoHolder.append(d):l.$tableInfoHolder.html(d),$.each(a,function(a,b){var c=$(
 "#"+b+"_pane");c.find(".enabledSection").html(blurconsole.browserUtils.table(j.enabledDef,blurconsole.model.tables.getEnabledTables(b))),c.find(".disabledSection").html(blurconsole.browserUtils.table(j.disabledDef,blurconsole.model.tables.getDisabledTables(b)))})}function f(){var a=blurconsole.model.tables.getClusters();$.each(a,function(a,b){var c,d,e=$("#"+b+"_pane");c=e.find(".enabledSection"),d=e.find(".disabledSection"),c.length>0&&c.html(blurconsole.browserUtils.table(j.enabledDef,blurconsole.model.tables.getEnabledTables(b))),d.length>0&&d.html(blurconsole.browserUtils.table(j.disabledDef,blurconsole.model.tables.getDisabledTables(b)))})}function g(){var a=blurconsole.model.tables.getClusters();$.each(a,function(a,b){var c=!1,d=blurconsole.model.tables.getEnabledTables(b);$.each(d,function(a,b){blurconsole.model.queries.tableHasActivity(b.name)?(c=!0,$('i[data-table="'+b.name+'"]').show()):$('i[data-table="'+b.name+'"]').hide()}),c?$('a[href="#'+b+'_pane"] i').show():$('a[hre
 f="#'+b+'_pane"] i').hide()})}function h(){$.gevent.unsubscribe(l.$container,"tables-updated"),$.gevent.unsubscribe(l.$container,"queries-updated"),d()}function i(d){return d.load(j.view,function(){k.$container=d,a(),$.gevent.subscribe(l.$container,"tables-updated",f),$.gevent.subscribe(l.$container,"queries-updated",g),b(),c()}),!0}var j={view:"views/tables.tpl.html",enabledDef:[{label:"Table Name",key:function(a){return a.name+' <i class="glyphicon glyphicon-exclamation-sign" data-table="'+a.name+'" style="display:none" title="Activity detected"></i>'}},{label:"Row Count",key:"rowCount"},{label:"Record Count",key:"recordCount"},{label:"Actions",key:function(a){var b="",c=a.name;return b+='<a href="#" class="schemaTrigger btn btn-default" data-name="'+c+'"><i class="glyphicon glyphicon-list-alt"></i> Schema</a> ',b+='<a href="#" class="disableTrigger btn btn-danger" data-name="'+c+'"><i class="glyphicon glyphicon-cloud-download"></i> Disable</a> '}}],disabledDef:[{label:"Table Name
 ",key:"name"},{label:"Actions",key:function(a){var b="",c=a.name;return b+='<a href="#" class="enableTrigger btn btn-default" data-name="'+c+'"><i class="glyphicon glyphicon-cloud-upload"></i> Enable</a> ',b+='<a href="#" class="deleteTrigger btn btn-danger" data-name="'+c+'"><i class="glyphicon glyphicon-trash"></i> Delete</a> '}}]},k={$container:null},l={};return{initModule:i,unloadModule:h}}(),blurconsole.utils=function(){"use strict";function a(a,b,c){if(null===a||0===a.length)return b;var d=null==b?a[0]:b;return $.each(a,function(a,b){d=c(d,b)}),d}function b(a,b){var c=[];return $.each(a,function(a,b){-1===c.indexOf(b)&&c.push(b)}),b&&c.sort(),c}function c(a,b){return JSON.stringify(a)===JSON.stringify(b)}function d(a){return $.map(a,function(a,b){return b})}function e(a){var b=a.match(/[^ \(\)\+\-]+(\w+)\.\w+:/g);if(null===b)return[];var c=[];return $.each(b,function(a,b){c.push(b.split(".")[0])}),c}function f(a,b){var c=[];return $.each(a,function(a,d){b(d)||c.push(d)}),c}ret
 urn{inject:a,reduce:a,unique:b,equals:c,keys:d,findFamilies:e,reject:f}}();
-//# sourceMappingURL=blurconsole.js.61680973ed09804cc51c7fee1133d126.map
\ No newline at end of file
+//# sourceMappingURL=blurconsole.js.3d61abd256a11df56d1a1f64c87da231.map
\ No newline at end of file


Mime
View raw message