You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2017/06/23 13:29:16 UTC
[21/42] ambari git commit: AMBARI-21330.Remove slider view from
Ambari-3.0.0(Venkata Sairam)
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-button.min.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-button.min.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-button.min.js
deleted file mode 100644
index cac67e5..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-button.min.js
+++ /dev/null
@@ -1 +0,0 @@
-+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");"radio"===b.prop("type")&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=functio
n(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),function(){Bootstrap.BsButtonComponent=Ember.Component.extend(Bootstrap.TypeSupport,Bootstrap.SizeSupport,{layoutName:"components/bs-button",tagName:"button",classNames:["btn"],classNameBindings:["blockClass"],classTypePrefix:"btn",clickedParam:null,block:null,attributeBindings:["disabled","dismiss:data-dismiss","_type:type","style"],_type:"button",bubbles:!0,allowedProperties:["title","type","size","block","disabled","clicked","dismiss","class"],icon_active:void 0,icon_inactive:void 0},{init:function(){var a,b,c,d,e,f,g;if(this._super(),null!=this.get("content")&&"instance"===Ember.typeOf(this.get("content")))for(b=this.get("content"),f=this.get("allowedProperties"),d=0,e=f.length;e>d;d++)c=f[d],null!=b[c]&&this.set(c,b[c]);else null==this.get("title")&&this.set
("title",this.get("content"));g=[];for(a in this)null!=a.match(/^data-[\w-]*$/)&&g.push(this.attributeBindings.pushObject(a));return g},blockClass:function(){return this.block?""+this.classTypePrefix+"-block":null}.property("block").cacheable(),click:function(a){return this.get("bubbles")||a.stopPropagation(),this.sendAction("clicked",this.get("clickedParam"))},loadingChanged:function(){var a;return a=null!==this.get("loading")?this.get("loading"):"reset",Ember.$("#"+this.elementId).button(a)}.observes("loading"),icon:function(){return this.get("isActive")?this.get("icon_active"):this.get("icon_inactive")}.property("isActive")}),Ember.Handlebars.helper("bs-button",Bootstrap.BsButtonComponent)}.call(this),function(){Bootstrap.BsBtnGroup=Bootstrap.ItemsView.extend(Bootstrap.SizeSupport,Bootstrap.ItemsSelection,{classTypePrefix:["btn-group"],classNames:["btn-group"],classNameBindings:["vertical:btn-group-vertical"],itemViewClass:Bootstrap.BsButtonComponent.extend(Bootstrap.ItemValue,Bo
otstrap.ItemSelection,{init:function(){return this._super(),this.set("icon_active",this.get("parentView.icon_active")),this.set("icon_inactive",this.get("parentView.icon_inactive"))}})}),Ember.Handlebars.helper("bs-btn-group",Bootstrap.BsBtnGroup)}.call(this),function(){Bootstrap.BsBtnToolbarComponent=Ember.Component.extend({layoutName:"components/bs-btn-toolbar",classNames:["btn-toolbar"]}),Ember.Handlebars.helper("bs-btn-toolbar",Bootstrap.BsBtnToolbarComponent)}.call(this),this.Ember=this.Ember||{},this.Ember.TEMPLATES=this.Ember.TEMPLATES||{},this.Ember.TEMPLATES["components/bs-button"]=Ember.Handlebars.template(function(a,b,c,d,e){function f(a,b){var d,e,f,g,h="";return b.buffer.push("\n <i "),e={"class":a},f={"class":"STRING"},g={hash:{"class":"icon"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(l((d=c["bind-attr"]||a["bind-attr"],d?d.call(a,g):k.call(a,"bind-attr",g)))),b.buffer.push("></i>\n"),h}this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Embe
r.Handlebars.helpers),e=e||{};var g,h,i,j="",k=c.helperMissing,l=this.escapeExpression,m=this;return h={},i={},g=c["if"].call(b,"icon",{hash:{},inverse:m.noop,fn:m.program(1,f,e),contexts:[b],types:["ID"],hashContexts:i,hashTypes:h,data:e}),(g||0===g)&&e.buffer.push(g),e.buffer.push("\n"),h={},i={},e.buffer.push(l(c._triageMustache.call(b,"title",{hash:{},contexts:[b],types:["ID"],hashContexts:i,hashTypes:h,data:e}))),h={},i={},e.buffer.push(l(c._triageMustache.call(b,"yield",{hash:{},contexts:[b],types:["ID"],hashContexts:i,hashTypes:h,data:e}))),j}),this.Ember=this.Ember||{},this.Ember.TEMPLATES=this.Ember.TEMPLATES||{},this.Ember.TEMPLATES["components/bs-btn-toolbar"]=Ember.Handlebars.template(function(a,b,c,d,e){this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var f,g,h=this.escapeExpression;f={},g={},e.buffer.push(h(c._triageMustache.call(b,"yield",{hash:{},contexts:[b],types:["ID"],hashContexts:g,hashTypes:f,data:e})))});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-core.min.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-core.min.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-core.min.js
deleted file mode 100644
index 37d145d..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-core.min.js
+++ /dev/null
@@ -1 +0,0 @@
-+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery),function(){var a;a=window.Bootstrap=Ember.Namespace.create()}.call(this),function(){var a,b;a=window.Bootstrap,b=Ember.get,a.WithRouter=Ember.Mixin.create({router:Ember.computed(function(){return b(this,"controller").container.lookup("router:main")})})}.call(this),function(){var a,b,c;a=window.Bootstrap,b=Ember.get,c=Ember.set,a.TypeSupport=Ember.Mixin.create({classTypePrefix:Ember.required(String),classNameBindings:["typeClass"],type:"default",typeClass:func
tion(){var a,b;return b=this.get("type"),null==b&&(b="default"),a=this.get("classTypePrefix"),""+a+"-"+b}.property("type").cacheable()})}.call(this),function(){var a,b,c;a=window.Bootstrap,b=Ember.get,c=Ember.set,a.SizeSupport=Ember.Mixin.create({classTypePrefix:Ember.required(String),classNameBindings:["sizeClass","largeSizeClass","smallSizeClass","extraSmallSizeClass"],size:null,xs:null,small:null,large:null,extraSmallSizeClass:function(){var a;return a=this.get("classTypePrefix"),this.xs?""+a+"-xs":null}.property("xs").cacheable(),smallSizeClass:function(){var a;return a=this.get("classTypePrefix"),this.small?""+a+"-sm":null}.property("small").cacheable(),largeSizeClass:function(){var a;return a=this.get("classTypePrefix"),this.large?""+a+"-lg":null}.property("large").cacheable(),sizeClass:function(){var a,b;return b=this.get("size"),a=this.get("classTypePrefix"),b?""+a+"-"+b:null}.property("size").cacheable()})}.call(this),function(){Bootstrap.ItemValue=Ember.Mixin.create({value
:function(){var a,b;return a=this.get("parentView"),null!=a?b=this.get("content"):void 0}.property("content").cacheable()})}.call(this),function(){Bootstrap.ItemSelection=Ember.Mixin.create(Bootstrap.ItemValue,Bootstrap.WithRouter,{classNameBindings:["isActive:active"],init:function(){return this._super(),this.didRouteChange()},didRouteChange:function(){var a,b,c;return b=this.get("content.linkTo"),null!=b&&(a=this.get("parentView"),null!=a)?(null!=(c=this.get("router"))?c.isActive(b):void 0)?a.set("selected",this.get("value")):void 0:void 0}.observes("router.url"),isActive:function(){var a,b,c;return a=this.get("parentView"),null==a?!1:(b=a.get("selected"),c=this.get("value"),null==c?!1:b===c)}.property("value","parentView.selected","content.linkTo").cacheable(),click:function(a){var b,c;return a.preventDefault(),c=this.get("parentView"),null==c||(b=this.get("content"),"object"==typeof b&&b.get("disabled")||null!=this.get("content.linkTo"))?void 0:c.set("selected",this.get("value")
)}})}.call(this),function(){Bootstrap.ItemsSelection=Ember.Mixin.create({multiSelection:!1,selected:[]})}.call(this),function(){Bootstrap.Nav=Ember.Mixin.create({classNames:["nav"],classNameBindings:["navTypeClass"],tagName:"ul",navType:null,navTypeClass:function(){return null!=this.navType?"nav-"+this.navType:null}.property("navType").cacheable()})}.call(this),function(){Bootstrap.NavItem=Ember.Mixin.create(Bootstrap.SelectableView)}.call(this),function(){var a,b;a=function(a){var b,c;if(a&&(c=a.get("parentView")))return b=c instanceof Bootstrap.ItemsView,Ember.assert("The parent view must be an instance of Bootstrap.ItemsView or any inherited class",b),b?c:void 0},b=function(a,b,c){return"instance"===Ember.typeOf(a)||Ember.canInvoke(a,"get")?a.get(b):c},Bootstrap.ItemView=Ember.View.extend({isItem:!0,classNameBindings:["disabled"],title:function(){var c,d,e;if(e=a(this))return d=e.get("itemTitleKey")||"title",c=this.get("content"),b(c,d,c)}.property("content").cacheable(),disabled
:function(){var c,d,e;if(e=a(this))return c=this.get("content"),d=!!b(c,"disabled",!1),d&&this.get("isActive")&&e.set("selected",null),d}.property("content","content.disabled").cacheable()})}.call(this),function(){Bootstrap.ItemsView=Ember.CollectionView.extend({didInsertElement:function(){var a,b,c,d,e,f;if(this.get("default")){for(a=this.get("default"),e=this._childViews,c=0,d=e.length;d>c;c++)b=e[c],(null!=(f=b.get("content"))?f.get("title"):void 0)===a&&this.set("selected",b.get("content"));return Ember.assert("Could not activate default tab "+a+" as it doesnt exist",a)}}})}.call(this),function(){Bootstrap.ItemPaneView=Ember.View.extend({template:Ember.Handlebars.compile(["{{#if view.content.template}}","{{bsItemPanePartial view.content.template}}","{{/if}}"].join("\n")),corrItem:function(){var a,b,c,d;if(null!=this.get("parentView").get("corrItemsView"))for(d=this.get("parentView").get("corrItemsView")._childViews,b=0,c=d.length;c>b;b++)if(a=d[b],a.content===this.get("content")
)return a}.property("parentView.corrItemsView"),isVisible:function(){var a;return null!=(a=this.get("corrItem"))?a.get("isActive"):void 0}.property("corrItem.isActive"),controller:function(){var a,b;return a=this.get("parentView.controller"),this.get("content.controller")&&(b=this.get("container").lookup("controller:"+this.get("content.controller")),b&&(a=b)),a}.property("content")}),Ember.Handlebars.helper("bsItemPanePartial",function(a,b){var c,d;return d=b.data.view,c=d.templateForName(a),Ember.assert("Unable to find template with name '"+a+"'",c),c(this,{data:b.data})})}.call(this),function(){Bootstrap.ItemsPanesView=Ember.CollectionView.extend({viewsInserted:!1,corrItemsView:function(){var a;return a=Ember.View.views[this.get("items-id")]}.property("viewsInserted"),didInsertElement:function(){return this._super(),this.set("viewsInserted",!0)}})}.call(this);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-modal.min.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-modal.min.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-modal.min.js
deleted file mode 100644
index c56a0d0..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-modal.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(){Bootstrap.BsModalComponent=Ember.Component.extend(Ember.Evented,{layoutName:"components/bs-modal",classNames:["modal"],attributeBindings:["role","aria-labelledby","isAriaHidden:aria-hidden","ariaLabelledBy:aria-labelledby"],isAriaHidden:function(){return""+this.get("isVisible")}.property("isVisible"),modalBackdrop:'<div class="modal-backdrop fade in"></div>',role:"dialog",footerViews:[],backdrop:!0,title:null,isVisible:!1,manual:!1,didInsertElement:function(){var a;return this._super(),this.setupBinders(),a=this.get("name"),Ember.assert("Modal name is required for modal view "+this.get("elementId"),this.get("name")),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.add(a,this),this.manual?this.show():void 0},becameVisible:function(){return this.get("backdrop")?this.appendBackdrop():void 0},becameHidden:function(){return this._backdrop?this._backdrop.remove():void 0},appendBackdrop:function(){var a;return a=this.$().parent(),this._backdrop=Em.$(this.modalBackdrop)
.appendTo(a)},show:function(){return this.set("isVisible",!0)},hide:function(){return this.set("isVisible",!1)},toggle:function(){return this.toggleProperty("isVisible")},click:function(a){var b,c;return b=a.target,c=b.getAttribute("data-dismiss"),"modal"===c?this.close():void 0},keyPressed:function(a){return 27===a.keyCode?this.close(a):void 0},close:function(){return this.get("manual")?this.destroy():this.hide(),this.trigger("closed")},willDestroyElement:function(){var a;return this.removeHandlers(),a=this.get("name"),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.remove(a,this),this._backdrop?this._backdrop.remove():void 0},removeHandlers:function(){return jQuery(window.document).unbind("keyup",this._keyUpHandler)},setupBinders:function(){var a,b=this;return a=function(a){return b.keyPressed(a)},jQuery(window.document).bind("keyup",a),this._keyUpHandler=a}}),Bootstrap.ModalManager=Ember.Object.create({add:function(a,b){return this.set(a,b)},register:function(a,b){retur
n this.add(a,b),b.appendTo(b.get("targetObject").namespace.rootElement)},remove:function(a){return this.set(a,null)},close:function(a){return this.get(a).close()},hide:function(a){return this.get(a).hide()},show:function(a){return this.get(a).show()},toggle:function(a){return this.get(a).toggle()},confirm:function(a,b,c,d,e){var f,g;return null==d&&(d="Confirm"),null==e&&(e="Cancel"),f=Ember.View.extend({template:Ember.Handlebars.compile(c||"Are you sure you would like to perform this action?")}),g=[Ember.Object.create({title:d,clicked:"modalConfirmed",dismiss:"modal"}),Ember.Object.create({title:e,clicked:"modalCanceled",dismiss:"modal"})],this.open("confirm-modal",b||"Confirmation required!",f,g,a)},openModal:function(a,b){var c,d;return null==b&&(b={}),d=b.rootElement||".ember-application",c=a.create(b),c.appendTo(d)},open:function(a,b,c,d,e){var f,g,h;return f=e.container.lookup("component-lookup:main"),g=f.lookupFactory("bs-modal",e.get("container")).create(),g.setProperties({n
ame:a,title:b,manual:!0,footerButtons:d,targetObject:e}),"string"===Ember.typeOf(c)?(h=e.container.lookup("template:"+c),Ember.assert("Template "+c+" was specified for Modal but template could not be found.",h),h&&g.setProperties({body:Ember.View.extend({template:h,controller:e})})):"class"===Ember.typeOf(c)&&g.setProperties({body:c,controller:e}),g.appendTo(e.namespace.rootElement)}}),Ember.Application.initializer({name:"bs-modal",initialize:function(a){return a.register("component:bs-modal",Bootstrap.BsModalComponent)}})}.call(this),this.Ember=this.Ember||{},this.Ember.TEMPLATES=this.Ember.TEMPLATES||{},this.Ember.TEMPLATES["components/bs-modal"]=Ember.Handlebars.template(function(a,b,c,d,e){function f(a,b){var d,e,f,g,h="";return b.buffer.push("\n <i "),e={"class":a},f={"class":"STRING"},g={hash:{"class":"titleIconClasses"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(p((d=c["bind-attr"]||a["bind-attr"],d?d.call(a,g):o.call(a,"bind-attr
",g)))),b.buffer.push("></i>\n "),h}function g(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(p(c.view.call(a,"view.body",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function h(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(p(c._triageMustache.call(a,"yield",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function i(a,b){var d,e,f,g,h="";return b.buffer.push("\n "),e={content:a,targetObjectBinding:a},f={content:"ID",targetObjectBinding:"STRING"},g={hash:{content:"",targetObjectBinding:"view.targetObject"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(p((d=c["bs-button"]||a["bs-button"],d?d.call(a,g):o.call(a,"bs-button",g)))),b.buffer.push("\n "),h}function j(a,b){var d,e,f="";return b.buffer.push("\n "),d={},
e={},b.buffer.push(p(c.view.call(a,"",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var k,l,m,n="",o=c.helperMissing,p=this.escapeExpression,q=this;return e.buffer.push('<div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-header">\n <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n <h4 class="modal-title">\n '),l={},m={},k=c["if"].call(b,"titleIconClasses",{hash:{},inverse:q.noop,fn:q.program(1,f,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n "),m={unescaped:b},l={unescaped:"STRING"},k=c._triageMustache.call(b,"title",{hash:{unescaped:"true"},contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push('\n
</h4>\n </div>\n <div class="modal-body">\n '),l={},m={},k=c["if"].call(b,"body",{hash:{},inverse:q.program(5,h,e),fn:q.program(3,g,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push('\n </div>\n <div class="modal-footer">\n '),l={},m={},k=c.each.call(b,"footerButtons",{hash:{},inverse:q.noop,fn:q.program(7,i,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n "),l={},m={},k=c.each.call(b,"footerViews",{hash:{},inverse:q.noop,fn:q.program(9,j,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n </div>\n </div>\n</div>"),n});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-nav.min.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-nav.min.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-nav.min.js
deleted file mode 100644
index 8f9f7af..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-nav.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(){Bootstrap.BsPill=Bootstrap.ItemView.extend(Bootstrap.NavItem,Bootstrap.ItemSelection,{template:Ember.Handlebars.compile("{{#if view.content.linkTo}}\n {{#if view.parentView.dynamicLink}}\n {{#link-to view.content.linkTo model}}{{view.title}}{{/link-to}}\n {{else}}\n {{#link-to view.content.linkTo}}{{view.title}}{{/link-to}}\n {{/if}}\n{{else}}\n {{view view.pillAsLinkView}}\n{{/if}}"),pillAsLinkView:Ember.View.extend({tagName:"a",template:Ember.Handlebars.compile("{{view.parentView.title}}"),attributeBindings:["href"],href:"#"})})}.call(this),function(){Bootstrap.BsPills=Bootstrap.ItemsView.extend(Bootstrap.Nav,{navType:"pills",classNameBindings:["stacked:nav-stacked","justified:nav-justified"],attributeBindings:["style"],itemViewClass:Bootstrap.BsPill}),Ember.Handlebars.helper("bs-pills",Bootstrap.BsPills)}.call(this),function(){Bootstrap.BsTabPane=Bootstrap.ItemPaneView.extend()}.call(this),function(){Bootstrap.BsTabsPanes=Bootstrap.ItemsPanes
View.extend({classNames:["tab-content"],itemViewClass:Bootstrap.BsTabPane}),Ember.Handlebars.helper("bs-tabs-panes",Bootstrap.BsTabsPanes)}.call(this),function(){Bootstrap.BsTabs=Bootstrap.ItemsView.extend(Bootstrap.Nav,{navType:"tabs",classNameBindings:["justified:nav-justified"],attributeBindings:["style"],itemViewClass:Bootstrap.BsPill}),Ember.Handlebars.helper("bs-tabs",Bootstrap.BsTabs)}.call(this);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-popover.min.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-popover.min.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-popover.min.js
deleted file mode 100644
index 48e7b05..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/bs-popover.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(){var a,b,c;a='<div class="arrow"></div>{{#if title}}<h3 class="popover-title">{{title}}</h3>{{/if}}<div class="popover-content">{{#if template}} {{partial partialTemplateName}}{{else}} {{#if content}} {{#if html}} {{{content}}} {{else}} {{content}} {{/if}} {{else}} {{yield}} {{/if}}{{/if}} </div>',Ember.TEMPLATES["components/bs-popover"]=Ember.Handlebars.compile(a),c='<div class="tooltip-arrow"></div><div class="tooltip-inner">{{#if html}} {{{content}}}{{else}} {{content}}{{/if}}</div>',Ember.TEMPLATES["components/bs-tooltip"]=Ember.Handlebars.compile(c),Bootstrap.BsPopoverComponent=Ember.Component.extend({layoutName:"components/bs-popover",classNames:"popover",classNameBindings:["fade","in","top","left","right","bottom"],top:function(){return"top"===this.get("realPlacement")}.property("realPlacement"),left:function(){return"left"===this.get("realPlacement")}.property("realPlacement"),right:function(){return"right
"===this.get("realPlacement")}.property("realPlacement"),bottom:function(){return"bottom"===this.get("realPlacement")}.property("realPlacement"),titleBinding:"data.title",content:Ember.computed.alias("data.content"),html:!1,delay:0,animation:!0,fade:function(){return this.get("animation")}.property("animation"),"in":function(){return this.get("isVisible")}.property("isVisible"),placement:function(){return this.get("data.placement")||"top"}.property("data.placement"),$element:null,$tip:null,inserted:!1,styleUpdater:function(){var a,b,c,d,e;if(this.$tip&&this.get("isVisible"))return this.$tip.css({top:0,left:0,display:"block"}).addClass(this.get("realPlacement")),d=this.get("realPlacement"),e=this.getPosition(),b=this.$tip[0].offsetWidth,a=this.$tip[0].offsetHeight,c=this.getCalculatedOffset(d,e,b,a),this.$tip.css("top",c.top),this.$tip.css("left",c.left),this.firstTime?(this.firstTime=!1,this.styleUpdater(),this.firstTime=!0):void 0}.observes("content","realPlacement","inserted","isV
isible"),init:function(){var a,b;return this._super(),this.set("html",this.get("data.html")||!1),this.set("template",void 0!==this.get("data.template")),this.get("template")?(a="components/bs-popover/_partial-content-"+this.get("tip_id"),b=this.get("data.template"),Ember.TEMPLATES[a]="function"==typeof b?b:Ember.Handlebars.compile(b),this.set("partialTemplateName",a)):void 0},didInsertElement:function(){var a,b=this;return this.$tip=this.$(),a=Bootstrap.TooltipBoxManager.attribute,a="["+a+"='"+this.get("tip_id")+"']",this.$element=$(a),this.set("inserted",!0),"hover"===this.get("data.trigger")&&this.get("data.sticky")&&this.$().on("mouseenter",function(){return clearTimeout(Bootstrap.TooltipBoxManager.timeout)}),this.$().on("mouseleave",function(){return Bootstrap.TooltipBoxManager.removeTip(b.get("tip_id"))}),this.$().find("img").load(function(){return b.afterRender()})},afterRender:function(){return this.notifyPropertyChange("content")},realPlacement:function(){var a,b,c,d,e,f,g,h
,i,j,k,l;return this.$tip?(k=this.get("placement")||"",e=/\s?auto?\s?/i,d=e.test(k),d&&(k=k.replace(e,"")||"top"),l=this.getPosition(),c=this.$tip[0].offsetWidth,b=this.$tip[0].offsetHeight,d&&(a=this.$element.parent(),g=k,f=document.documentElement.scrollTop||document.body.scrollTop,j=window.innerWidth,h=window.innerHeight,i=0,k="bottom"===k&&l.top+l.height+b-f>h?"top":"top"===k&&l.top-f-b<0?"bottom":"right"===k&&l.right+c>j?"left":"left"===k&&l.left-c<i?"right":k),k):null}.property("placement","inserted"),hasContent:function(){return this.get("title")},getPosition:function(){var a;return a=this.$element[0],$.extend({},"function"==typeof a.getBoundingClientRect?a.getBoundingClientRect():{width:a.offsetWidth,height:a.offsetHeight},this.$element.offset())},getCalculatedOffset:function(a,b,c,d){return"bottom"===a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"===a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"===a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2
,left:b.left+b.width}},actions:{close:function(){return Bootstrap.TooltipBoxManager.removeTip(this.get("tip_id"))}}}),Ember.Handlebars.helper("bs-popover",Bootstrap.BsPopoverComponent),Bootstrap.BsTooltipComponent=Bootstrap.BsPopoverComponent.extend({classNames:"tooltip",layoutName:"components/bs-tooltip",init:function(){return this._super(),this.classNames.removeObject("popover"),this.set("content",this.get("content")||this.get("title"))}}),Ember.Handlebars.helper("bs-tooltip",Bootstrap.BsTooltipComponent),Bootstrap.TooltipBoxController=Ember.Controller.extend({popoversBinding:"Bootstrap.TooltipBoxManager.popovers",tooltipsBinding:"Bootstrap.TooltipBoxManager.tooltips"}),b="{{#each pop in popovers}} {{bs-popover tip_id=pop.tip_id data=pop.data }}{{/each}}{{#each pop in tooltips}} {{bs-tooltip tip_id=pop.tip_id data=pop.data }}{{/each}}",Ember.TEMPLATES["bs-tooltip-box"]=Ember.Handlebars.compile(b),Bootstrap.TooltipBoxManager=Ember.Object.create({uuid
:0,attribute:"bootstrap-tip-id",willSetup:!1,registeredTips:{},registerTip:function(a,b,c){var d,e;return d=++this.uuid,e=this,this.registeredTips[d]={id:d,data:b,eventName:b.trigger||("popover"===a?"click":"hover"),bound:!1,type:a,sticky:b.sticky,show:function(){e.showTip(d)},hide:function(){e.hideTip(d,!0)},toggle:function(){e.toggleTip(d)}},this.willSetup||(this.willSetup=!0,Ember.run.scheduleOnce("afterRender",this,function(){e.setupBindings()})),c.data.view.on("willClearRender",function(){Bootstrap.TooltipBoxManager.removeTip(d),$("["+e.attribute+"='"+d+"']").unbind(),delete Bootstrap.TooltipBoxManager.registeredTips[d]}),d},setupBindings:function(){var a,b,c;for(b in this.registeredTips)if(c=this.registeredTips[b],c.bound===!1)switch(c.bound=!0,a=$("["+this.attribute+"='"+b+"']"),c.eventName){case"click":a.on("click",$.proxy(c.toggle,c));break;case"hover":a.on("mouseenter",$.proxy(c.show,c)),a.on("mouseleave",$.proxy(c.hide,c));break;case"focus":a.on("focusin",$.proxy(c.show,c
)),a.on("focusout",$.proxy(c.hide,c));break;case"manual":c.data.addObserver("show",c,function(a,b){var c;c=a.get(b),c?this.show():this.hide()}),c.data.show&&this.show()}this.willSetup=!1},popovers:[],tooltips:[],showing:{},timeout:null,showTip:function(a){var b,c,d;b=this.registeredTips[a].data,d=this.registeredTips[a].type,this.showing[a]||(this.showing[a]=!0,c=Ember.Object.create({data:b,tip_id:a}),"tooltip"===d?this.tooltips.pushObject(c):this.popovers.pushObject(c))},hideTip:function(a,b){var c;this.showing[a]&&(c=this.registeredTips[a].data,b&&c.sticky?this.timedRemove(a):this.removeTip(a))},toggleTip:function(a){this.showing[a]?this.hideTip(a):this.showTip(a)},timedRemove:function(a){var b;b=this,this.timeout=setTimeout(function(){b.removeTip(a)},100)},removeTip:function(a){var b;b=this.popovers.findProperty("tip_id",a)||this.tooltips.findProperty("tip_id"),this.popovers.removeObject(b),this.tooltips.removeObject(b),delete this.showing[a]},addFromView:function(a,b,c){var d,e;r
eturn a.attributeBindings.contains(Bootstrap.TooltipBoxManager.attribute)?(e={data:{view:a}},d=Bootstrap.TooltipBoxManager.registerTip(b,c,e),a.set(Bootstrap.TooltipBoxManager.attribute,d),void 0):(console.warn('TooltipBoxManager.addFromView: You need to add "TooltipBoxManager.attribute" to the attributeBindings!'),void 0)},helper:function(a,b,c){var d,e,f,g,h,i,j;if("string"==typeof a&&""!==a&&(h=a.split("."),e=h[0],g=c.data.keywords[e],g?(h.removeAt(0),h.insertAt(0,"this"),h=h.join("."),b=g.get(h)):b=this.get(a)),a instanceof Object){b=Ember.Object.create({});for(f in a.hash)j=a.hash[f],i=c.hashTypes[f],"STRING"===i?b.set(f,j):"ID"===i&&(h=j.split("."),e=h[0],g=c.data.keywords[e],g?h.removeAt(0):g=this,b._bindings||(b._bindings=g),h.insertAt(0,"_bindings"),h=h.join("."),b[f]="",d=Ember.Binding.from(h).to(f),d.connect(b))}return b}}),Ember.Handlebars.registerHelper("bs-bind-popover",function(a){var b,c,d;return d=arguments[arguments.length-1],c=this,c=Bootstrap.TooltipBoxManager.he
lper.call(this,a,c,d),b=Bootstrap.TooltipBoxManager.registerTip("popover",c,d),new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute+"='"+b+"'")}),Ember.Handlebars.registerHelper("bs-bind-tooltip",function(a){var b,c,d;return d=arguments[arguments.length-1],c=this,c=Bootstrap.TooltipBoxManager.helper.call(this,a,c,d),b=Bootstrap.TooltipBoxManager.registerTip("tooltip",c,d),new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute+"='"+b+"'")})}.call(this);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
deleted file mode 100755
index 615d1f9..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/console-polyfill.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// Console-polyfill. MIT license.
-// https://github.com/paulmillr/console-polyfill
-// Make it safe to do console.log() always.
-(function (con) {
- var method;
- var dummy = function() {};
- var methods = ('assert,count,debug,dir,dirxml,error,exception,group,' +
- 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,' +
- 'time,timeEnd,trace,warn').split(',');
- while (method = methods.pop()) {
- con[method] = con[method] || dummy;
- }
-})(window.console = window.console || {});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec8deeba/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/cubism.v1.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/cubism.v1.js b/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/cubism.v1.js
deleted file mode 100644
index be9ff4d..0000000
--- a/contrib/views/slider/src/main/resources/ui/vendor/scripts/common/cubism.v1.js
+++ /dev/null
@@ -1,1085 +0,0 @@
-(function (exports) {
- var cubism = exports.cubism = {version:"1.2.0"};
- var cubism_id = 0;
-
- function cubism_identity(d) {
- return d;
- }
-
- cubism.option = function (name, defaultValue) {
- var values = cubism.options(name);
- return values.length ? values[0] : defaultValue;
- };
-
- cubism.options = function (name, defaultValues) {
- var options = location.search.substring(1).split("&"),
- values = [],
- i = -1,
- n = options.length,
- o;
- while (++i < n) {
- if ((o = options[i].split("="))[0] == name) {
- values.push(decodeURIComponent(o[1]));
- }
- }
- return values.length || arguments.length < 2 ? values : defaultValues;
- };
- cubism.context = function () {
- var context = new cubism_context,
- step = 1e4, // ten seconds, in milliseconds
- size = 1440, // four hours at ten seconds, in pixels
- start0, stop0, // the start and stop for the previous change event
- start1, stop1, // the start and stop for the next prepare event
- serverDelay = 5e3,
- clientDelay = 5e3,
- event = d3.dispatch("prepare", "beforechange", "change", "focus"),
- scale = context.scale = d3.time.scale().range([0, size]),
- timeout,
- focus;
-
- function update() {
- var now = Date.now();
- stop0 = new Date(Math.floor((now - serverDelay - clientDelay) / step) * step);
- start0 = new Date(stop0 - size * step);
- stop1 = new Date(Math.floor((now - serverDelay) / step) * step);
- start1 = new Date(stop1 - size * step);
- scale.domain([start0, stop0]);
- return context;
- }
-
- context.start = function () {
- if (timeout) clearTimeout(timeout);
- var delay = +stop1 + serverDelay - Date.now();
-
- // If we're too late for the first prepare event, skip it.
- if (delay < clientDelay) delay += step;
-
- timeout = setTimeout(function prepare() {
- stop1 = new Date(Math.floor((Date.now() - serverDelay) / step) * step);
- start1 = new Date(stop1 - size * step);
- event.prepare.call(context, start1, stop1);
-
- setTimeout(function () {
- scale.domain([start0 = start1, stop0 = stop1]);
- event.beforechange.call(context, start1, stop1);
- event.change.call(context, start1, stop1);
- event.focus.call(context, focus);
- }, clientDelay);
-
- timeout = setTimeout(prepare, step);
- }, delay);
- return context;
- };
-
- context.stop = function () {
- timeout = clearTimeout(timeout);
- return context;
- };
-
- timeout = setTimeout(context.start, 10);
-
- // Set or get the step interval in milliseconds.
- // Defaults to ten seconds.
- context.step = function (_) {
- if (!arguments.length) return step;
- step = +_;
- return update();
- };
-
- // Set or get the context size (the count of metric values).
- // Defaults to 1440 (four hours at ten seconds).
- context.size = function (_) {
- if (!arguments.length) return size;
- scale.range([0, size = +_]);
- return update();
- };
-
- // The server delay is the amount of time we wait for the server to compute a
- // metric. This delay may result from clock skew or from delays collecting
- // metrics from various hosts. Defaults to 4 seconds.
- context.serverDelay = function (_) {
- if (!arguments.length) return serverDelay;
- serverDelay = +_;
- return update();
- };
-
- // The client delay is the amount of additional time we wait to fetch those
- // metrics from the server. The client and server delay combined represent the
- // age of the most recent displayed metric. Defaults to 1 second.
- context.clientDelay = function (_) {
- if (!arguments.length) return clientDelay;
- clientDelay = +_;
- return update();
- };
-
- // Sets the focus to the specified index, and dispatches a "focus" event.
- context.focus = function (i) {
- event.focus.call(context, focus = i);
- return context;
- };
-
- // Add, remove or get listeners for events.
- context.on = function (type, listener) {
- if (arguments.length < 2) return event.on(type);
-
- event.on(type, listener);
-
- // Notify the listener of the current start and stop time, as appropriate.
- // This way, metrics can make requests for data immediately,
- // and likewise the axis can display itself synchronously.
- if (listener != null) {
- if (/^prepare(\.|$)/.test(type)) listener.call(context, start1, stop1);
- if (/^beforechange(\.|$)/.test(type)) listener.call(context, start0, stop0);
- if (/^change(\.|$)/.test(type)) listener.call(context, start0, stop0);
- if (/^focus(\.|$)/.test(type)) listener.call(context, focus);
- }
-
- return context;
- };
-
- d3.select(window).on("keydown.context-" + ++cubism_id, function () {
- switch (!d3.event.metaKey && d3.event.keyCode) {
- case 37: // left
- if (focus == null) focus = size - 1;
- if (focus > 0) context.focus(--focus);
- break;
- case 39: // right
- if (focus == null) focus = size - 2;
- if (focus < size - 1) context.focus(++focus);
- break;
- default:
- return;
- }
- d3.event.preventDefault();
- });
-
- return update();
- };
-
- function cubism_context() {
- }
-
- var cubism_contextPrototype = cubism.context.prototype = cubism_context.prototype;
-
- cubism_contextPrototype.constant = function (value) {
- return new cubism_metricConstant(this, +value);
- };
- cubism_contextPrototype.cube = function (host) {
- if (!arguments.length) host = "";
- var source = {},
- context = this;
-
- source.metric = function (expression) {
- return context.metric(function (start, stop, step, callback) {
- d3.json(host + "/1.0/metric"
- + "?expression=" + encodeURIComponent(expression)
- + "&start=" + cubism_cubeFormatDate(start)
- + "&stop=" + cubism_cubeFormatDate(stop)
- + "&step=" + step, function (data) {
- if (!data) return callback(new Error("unable to load data"));
- callback(null, data.map(function (d) {
- return d.value;
- }));
- });
- }, expression += "");
- };
-
- // Returns the Cube host.
- source.toString = function () {
- return host;
- };
-
- return source;
- };
-
- var cubism_cubeFormatDate = d3.time.format.iso;
- cubism_contextPrototype.graphite = function (host) {
- if (!arguments.length) host = "";
- var source = {},
- context = this;
-
- source.metric = function (expression) {
- var sum = "sum";
-
- var metric = context.metric(function (start, stop, step, callback) {
- var target = expression;
-
- // Apply the summarize, if necessary.
- if (step !== 1e4) target = "summarize(" + target + ",'"
- + (!(step % 36e5) ? step / 36e5 + "hour" : !(step % 6e4) ? step / 6e4 + "min" : step + "sec")
- + "','" + sum + "')";
-
- d3.text(host + "/render?format=raw"
- + "&target=" + encodeURIComponent("alias(" + target + ",'')")
- + "&from=" + cubism_graphiteFormatDate(start - 2 * step) // off-by-two?
- + "&until=" + cubism_graphiteFormatDate(stop - 1000), function (text) {
- if (!text) return callback(new Error("unable to load data"));
- callback(null, cubism_graphiteParse(text));
- });
- }, expression += "");
-
- metric.summarize = function (_) {
- sum = _;
- return metric;
- };
-
- return metric;
- };
-
- source.find = function (pattern, callback) {
- d3.json(host + "/metrics/find?format=completer"
- + "&query=" + encodeURIComponent(pattern), function (result) {
- if (!result) return callback(new Error("unable to find metrics"));
- callback(null, result.metrics.map(function (d) {
- return d.path;
- }));
- });
- };
-
- // Returns the graphite host.
- source.toString = function () {
- return host;
- };
-
- return source;
- };
-
-// Graphite understands seconds since UNIX epoch.
- function cubism_graphiteFormatDate(time) {
- return Math.floor(time / 1000);
- }
-
-// Helper method for parsing graphite's raw format.
- function cubism_graphiteParse(text) {
- var i = text.indexOf("|"),
- meta = text.substring(0, i),
- c = meta.lastIndexOf(","),
- b = meta.lastIndexOf(",", c - 1),
- a = meta.lastIndexOf(",", b - 1),
- start = meta.substring(a + 1, b) * 1000,
- step = meta.substring(c + 1) * 1000;
- return text
- .substring(i + 1)
- .split(",")
- .slice(1)// the first value is always None?
- .map(function (d) {
- return +d;
- });
- }
-
- function cubism_metric(context) {
- if (!(context instanceof cubism_context)) throw new Error("invalid context");
- this.context = context;
- }
-
- var cubism_metricPrototype = cubism_metric.prototype;
-
- cubism.metric = cubism_metric;
-
- cubism_metricPrototype.valueAt = function () {
- return NaN;
- };
-
- cubism_metricPrototype.alias = function (name) {
- this.toString = function () {
- return name;
- };
- return this;
- };
-
- cubism_metricPrototype.extent = function () {
- var i = 0,
- n = this.context.size(),
- value,
- min = Infinity,
- max = -Infinity;
- while (++i < n) {
- value = this.valueAt(i);
- if (value < min) min = value;
- if (value > max) max = value;
- }
- return [min, max];
- };
-
- cubism_metricPrototype.on = function (type, listener) {
- return arguments.length < 2 ? null : this;
- };
-
- cubism_metricPrototype.shift = function () {
- return this;
- };
-
- cubism_metricPrototype.on = function () {
- return arguments.length < 2 ? null : this;
- };
-
- cubism_contextPrototype.metric = function (request, name) {
- var context = this,
- metric = new cubism_metric(context),
- id = ".metric-" + ++cubism_id,
- start = -Infinity,
- stop,
- step = context.step(),
- size = context.size(),
- values = [],
- event = d3.dispatch("change"),
- listening = 0,
- fetching;
-
- // Prefetch new data into a temporary array.
- function prepare(start1, stop) {
- var steps = Math.min(size, Math.round((start1 - start) / step));
- if (!steps || fetching) return; // already fetched, or fetching!
- fetching = true;
- steps = Math.min(size, steps + cubism_metricOverlap);
- var start0 = new Date(stop - steps * step);
- request(start0, stop, step, function (error, data) {
- fetching = false;
- if (error) return console.warn(error);
- var i = isFinite(start) ? Math.round((start0 - start) / step) : 0;
- for (var j = 0, m = data.length; j < m; ++j) values[j + i] = data[j];
- event.change.call(metric, start, stop);
- });
- }
-
- // When the context changes, switch to the new data, ready-or-not!
- function beforechange(start1, stop1) {
- if (!isFinite(start)) start = start1;
- values.splice(0, Math.max(0, Math.min(size, Math.round((start1 - start) / step))));
- start = start1;
- stop = stop1;
- }
-
- //
- metric.valueAt = function (i) {
- return values[i];
- };
-
- //
- metric.shift = function (offset) {
- return context.metric(cubism_metricShift(request, +offset));
- };
-
- //
- metric.on = function (type, listener) {
- if (!arguments.length) return event.on(type);
-
- // If there are no listeners, then stop listening to the context,
- // and avoid unnecessary fetches.
- if (listener == null) {
- if (event.on(type) != null && --listening == 0) {
- context.on("prepare" + id, null).on("beforechange" + id, null);
- }
- } else {
- if (event.on(type) == null && ++listening == 1) {
- context.on("prepare" + id, prepare).on("beforechange" + id, beforechange);
- }
- }
-
- event.on(type, listener);
-
- // Notify the listener of the current start and stop time, as appropriate.
- // This way, charts can display synchronous metrics immediately.
- if (listener != null) {
- if (/^change(\.|$)/.test(type)) listener.call(context, start, stop);
- }
-
- return metric;
- };
-
- //
- if (arguments.length > 1) metric.toString = function () {
- return name;
- };
-
- return metric;
- };
-
-// Number of metric to refetch each period, in case of lag.
- var cubism_metricOverlap = 6;
-
-// Wraps the specified request implementation, and shifts time by the given offset.
- function cubism_metricShift(request, offset) {
- return function (start, stop, step, callback) {
- request(new Date(+start + offset), new Date(+stop + offset), step, callback);
- };
- }
-
- function cubism_metricConstant(context, value) {
- cubism_metric.call(this, context);
- value = +value;
- var name = value + "";
- this.valueOf = function () {
- return value;
- };
- this.toString = function () {
- return name;
- };
- }
-
- var cubism_metricConstantPrototype = cubism_metricConstant.prototype = Object.create(cubism_metric.prototype);
-
- cubism_metricConstantPrototype.valueAt = function () {
- return +this;
- };
-
- cubism_metricConstantPrototype.extent = function () {
- return [+this, +this];
- };
- function cubism_metricOperator(name, operate) {
-
- function cubism_metricOperator(left, right) {
- if (!(right instanceof cubism_metric)) right = new cubism_metricConstant(left.context, right);
- else if (left.context !== right.context) throw new Error("mismatch context");
- cubism_metric.call(this, left.context);
- this.left = left;
- this.right = right;
- this.toString = function () {
- return left + " " + name + " " + right;
- };
- }
-
- var cubism_metricOperatorPrototype = cubism_metricOperator.prototype = Object.create(cubism_metric.prototype);
-
- cubism_metricOperatorPrototype.valueAt = function (i) {
- return operate(this.left.valueAt(i), this.right.valueAt(i));
- };
-
- cubism_metricOperatorPrototype.shift = function (offset) {
- return new cubism_metricOperator(this.left.shift(offset), this.right.shift(offset));
- };
-
- cubism_metricOperatorPrototype.on = function (type, listener) {
- if (arguments.length < 2) return this.left.on(type);
- this.left.on(type, listener);
- this.right.on(type, listener);
- return this;
- };
-
- return function (right) {
- return new cubism_metricOperator(this, right);
- };
- }
-
- cubism_metricPrototype.add = cubism_metricOperator("+", function (left, right) {
- return left + right;
- });
-
- cubism_metricPrototype.subtract = cubism_metricOperator("-", function (left, right) {
- return left - right;
- });
-
- cubism_metricPrototype.multiply = cubism_metricOperator("*", function (left, right) {
- return left * right;
- });
-
- cubism_metricPrototype.divide = cubism_metricOperator("/", function (left, right) {
- return left / right;
- });
- cubism_contextPrototype.horizon = function () {
- var context = this,
- mode = "offset",
- buffer = document.createElement("canvas"),
- width = buffer.width = context.size(),
- height = buffer.height = 30,
- scale = d3.scale.linear().interpolate(d3.interpolateRound),
- metric = cubism_identity,
- extent = null,
- title = cubism_identity,
- format = d3.format(".2s"),
- colors = ["#08519c", "#3182bd", "#6baed6", "#bdd7e7", "#bae4b3", "#74c476", "#31a354", "#006d2c"];
-
- function horizon(selection) {
-
- selection
- .on("mousemove.horizon", function () {
- context.focus(d3.mouse(this)[0]);
- })
- .on("mouseout.horizon", function () {
- context.focus(null);
- });
-
- selection.append("canvas")
- .attr("width", width)
- .attr("height", height);
-
- selection.append("span")
- .attr("class", "title")
- .text(title);
-
- selection.append("span")
- .attr("class", "value");
-
- selection.each(function (d, i) {
- var that = this,
- id = ++cubism_id,
- metric_ = typeof metric === "function" ? metric.call(that, d, i) : metric,
- colors_ = typeof colors === "function" ? colors.call(that, d, i) : colors,
- extent_ = typeof extent === "function" ? extent.call(that, d, i) : extent,
- start = -Infinity,
- step = context.step(),
- canvas = d3.select(that).select("canvas"),
- span = d3.select(that).select(".value"),
- max_,
- m = colors_.length >> 1,
- ready;
-
- canvas.datum({id:id, metric:metric_});
- canvas = canvas.node().getContext("2d");
-
- function change(start1, stop) {
- canvas.save();
-
- // compute the new extent and ready flag
- var extent = metric_.extent();
- ready = extent.every(isFinite);
- if (extent_ != null) extent = extent_;
-
- // if this is an update (with no extent change), copy old values!
- var i0 = 0, max = Math.max(-extent[0], extent[1]);
- if (this === context) {
- if (max == max_) {
- i0 = width - cubism_metricOverlap;
- var dx = (start1 - start) / step;
- if (dx < width) {
- var canvas0 = buffer.getContext("2d");
- canvas0.clearRect(0, 0, width, height);
- canvas0.drawImage(canvas.canvas, dx, 0, width - dx, height, 0, 0, width - dx, height);
- canvas.clearRect(0, 0, width, height);
- canvas.drawImage(canvas0.canvas, 0, 0);
- }
- }
- start = start1;
- }
-
- // update the domain
- scale.domain([0, max_ = max]);
-
- // clear for the new data
- canvas.clearRect(i0, 0, width - i0, height);
-
- // record whether there are negative values to display
- var negative;
-
- // positive bands
- for (var j = 0; j < m; ++j) {
- canvas.fillStyle = colors_[m + j];
-
- // Adjust the range based on the current band index.
- var y0 = (j - m + 1) * height;
- scale.range([m * height + y0, y0]);
- y0 = scale(0);
-
- for (var i = i0, n = width, y1; i < n; ++i) {
- y1 = metric_.valueAt(i);
- if (y1 <= 0) {
- negative = true;
- continue;
- }
- canvas.fillRect(i, y1 = scale(y1), 1, y0 - y1);
- }
- }
-
- if (negative) {
- // enable offset mode
- if (mode === "offset") {
- canvas.translate(0, height);
- canvas.scale(1, -1);
- }
-
- // negative bands
- for (var j = 0; j < m; ++j) {
- canvas.fillStyle = colors_[m - 1 - j];
-
- // Adjust the range based on the current band index.
- var y0 = (j - m + 1) * height;
- scale.range([m * height + y0, y0]);
- y0 = scale(0);
-
- for (var i = i0, n = width, y1; i < n; ++i) {
- y1 = metric_.valueAt(i);
- if (y1 >= 0) continue;
- canvas.fillRect(i, scale(-y1), 1, y0 - scale(-y1));
- }
- }
- }
-
- canvas.restore();
- }
-
- function focus(i) {
- if (i == null) i = width - 1;
- var value = metric_.valueAt(i);
- span.datum(value).text(isNaN(value) ? null : format);
- }
-
- // Update the chart when the context changes.
- context.on("change.horizon-" + id, change);
- context.on("focus.horizon-" + id, focus);
-
- // Display the first metric change immediately,
- // but defer subsequent updates to the canvas change.
- // Note that someone still needs to listen to the metric,
- // so that it continues to update automatically.
- metric_.on("change.horizon-" + id, function (start, stop) {
- change(start, stop), focus();
- if (ready) metric_.on("change.horizon-" + id, cubism_identity);
- });
- });
- }
-
- horizon.remove = function (selection) {
-
- selection
- .on("mousemove.horizon", null)
- .on("mouseout.horizon", null);
-
- selection.selectAll("canvas")
- .each(remove)
- .remove();
-
- selection.selectAll(".title,.value")
- .remove();
-
- function remove(d) {
- d.metric.on("change.horizon-" + d.id, null);
- context.on("change.horizon-" + d.id, null);
- context.on("focus.horizon-" + d.id, null);
- }
- };
-
- horizon.mode = function (_) {
- if (!arguments.length) return mode;
- mode = _ + "";
- return horizon;
- };
-
- horizon.height = function (_) {
- if (!arguments.length) return height;
- buffer.height = height = +_;
- return horizon;
- };
-
- horizon.metric = function (_) {
- if (!arguments.length) return metric;
- metric = _;
- return horizon;
- };
-
- horizon.scale = function (_) {
- if (!arguments.length) return scale;
- scale = _;
- return horizon;
- };
-
- horizon.extent = function (_) {
- if (!arguments.length) return extent;
- extent = _;
- return horizon;
- };
-
- horizon.title = function (_) {
- if (!arguments.length) return title;
- title = _;
- return horizon;
- };
-
- horizon.format = function (_) {
- if (!arguments.length) return format;
- format = _;
- return horizon;
- };
-
- horizon.colors = function (_) {
- if (!arguments.length) return colors;
- colors = _;
- return horizon;
- };
-
- return horizon;
- };
- cubism_contextPrototype.comparison = function () {
- var context = this,
- width = context.size(),
- height = 120,
- scale = d3.scale.linear().interpolate(d3.interpolateRound),
- primary = function (d) {
- return d[0];
- },
- secondary = function (d) {
- return d[1];
- },
- extent = null,
- title = cubism_identity,
- formatPrimary = cubism_comparisonPrimaryFormat,
- formatChange = cubism_comparisonChangeFormat,
- colors = ["#9ecae1", "#225b84", "#a1d99b", "#22723a"],
- strokeWidth = 1.5;
-
- function comparison(selection) {
-
- selection
- .on("mousemove.comparison", function () {
- context.focus(d3.mouse(this)[0]);
- })
- .on("mouseout.comparison", function () {
- context.focus(null);
- });
-
- selection.append("canvas")
- .attr("width", width)
- .attr("height", height);
-
- selection.append("span")
- .attr("class", "title")
- .text(title);
-
- selection.append("span")
- .attr("class", "value primary");
-
- selection.append("span")
- .attr("class", "value change");
-
- selection.each(function (d, i) {
- var that = this,
- id = ++cubism_id,
- primary_ = typeof primary === "function" ? primary.call(that, d, i) : primary,
- secondary_ = typeof secondary === "function" ? secondary.call(that, d, i) : secondary,
- extent_ = typeof extent === "function" ? extent.call(that, d, i) : extent,
- div = d3.select(that),
- canvas = div.select("canvas"),
- spanPrimary = div.select(".value.primary"),
- spanChange = div.select(".value.change"),
- ready;
-
- canvas.datum({id:id, primary:primary_, secondary:secondary_});
- canvas = canvas.node().getContext("2d");
-
- function change(start, stop) {
- canvas.save();
- canvas.clearRect(0, 0, width, height);
-
- // update the scale
- var primaryExtent = primary_.extent(),
- secondaryExtent = secondary_.extent(),
- extent = extent_ == null ? primaryExtent : extent_;
- scale.domain(extent).range([height, 0]);
- ready = primaryExtent.concat(secondaryExtent).every(isFinite);
-
- // consistent overplotting
- var round = start / context.step() & 1
- ? cubism_comparisonRoundOdd
- : cubism_comparisonRoundEven;
-
- // positive changes
- canvas.fillStyle = colors[2];
- for (var i = 0, n = width; i < n; ++i) {
- var y0 = scale(primary_.valueAt(i)),
- y1 = scale(secondary_.valueAt(i));
- if (y0 < y1) canvas.fillRect(round(i), y0, 1, y1 - y0);
- }
-
- // negative changes
- canvas.fillStyle = colors[0];
- for (i = 0; i < n; ++i) {
- var y0 = scale(primary_.valueAt(i)),
- y1 = scale(secondary_.valueAt(i));
- if (y0 > y1) canvas.fillRect(round(i), y1, 1, y0 - y1);
- }
-
- // positive values
- canvas.fillStyle = colors[3];
- for (i = 0; i < n; ++i) {
- var y0 = scale(primary_.valueAt(i)),
- y1 = scale(secondary_.valueAt(i));
- if (y0 <= y1) canvas.fillRect(round(i), y0, 1, strokeWidth);
- }
-
- // negative values
- canvas.fillStyle = colors[1];
- for (i = 0; i < n; ++i) {
- var y0 = scale(primary_.valueAt(i)),
- y1 = scale(secondary_.valueAt(i));
- if (y0 > y1) canvas.fillRect(round(i), y0 - strokeWidth, 1, strokeWidth);
- }
-
- canvas.restore();
- }
-
- function focus(i) {
- if (i == null) i = width - 1;
- var valuePrimary = primary_.valueAt(i),
- valueSecondary = secondary_.valueAt(i),
- valueChange = (valuePrimary - valueSecondary) / valueSecondary;
-
- spanPrimary
- .datum(valuePrimary)
- .text(isNaN(valuePrimary) ? null : formatPrimary);
-
- spanChange
- .datum(valueChange)
- .text(isNaN(valueChange) ? null : formatChange)
- .attr("class", "value change " + (valueChange > 0 ? "positive" : valueChange < 0 ? "negative" : ""));
- }
-
- // Display the first primary change immediately,
- // but defer subsequent updates to the context change.
- // Note that someone still needs to listen to the metric,
- // so that it continues to update automatically.
- primary_.on("change.comparison-" + id, firstChange);
- secondary_.on("change.comparison-" + id, firstChange);
- function firstChange(start, stop) {
- change(start, stop), focus();
- if (ready) {
- primary_.on("change.comparison-" + id, cubism_identity);
- secondary_.on("change.comparison-" + id, cubism_identity);
- }
- }
-
- // Update the chart when the context changes.
- context.on("change.comparison-" + id, change);
- context.on("focus.comparison-" + id, focus);
- });
- }
-
- comparison.remove = function (selection) {
-
- selection
- .on("mousemove.comparison", null)
- .on("mouseout.comparison", null);
-
- selection.selectAll("canvas")
- .each(remove)
- .remove();
-
- selection.selectAll(".title,.value")
- .remove();
-
- function remove(d) {
- d.primary.on("change.comparison-" + d.id, null);
- d.secondary.on("change.comparison-" + d.id, null);
- context.on("change.comparison-" + d.id, null);
- context.on("focus.comparison-" + d.id, null);
- }
- };
-
- comparison.height = function (_) {
- if (!arguments.length) return height;
- height = +_;
- return comparison;
- };
-
- comparison.primary = function (_) {
- if (!arguments.length) return primary;
- primary = _;
- return comparison;
- };
-
- comparison.secondary = function (_) {
- if (!arguments.length) return secondary;
- secondary = _;
- return comparison;
- };
-
- comparison.scale = function (_) {
- if (!arguments.length) return scale;
- scale = _;
- return comparison;
- };
-
- comparison.extent = function (_) {
- if (!arguments.length) return extent;
- extent = _;
- return comparison;
- };
-
- comparison.title = function (_) {
- if (!arguments.length) return title;
- title = _;
- return comparison;
- };
-
- comparison.formatPrimary = function (_) {
- if (!arguments.length) return formatPrimary;
- formatPrimary = _;
- return comparison;
- };
-
- comparison.formatChange = function (_) {
- if (!arguments.length) return formatChange;
- formatChange = _;
- return comparison;
- };
-
- comparison.colors = function (_) {
- if (!arguments.length) return colors;
- colors = _;
- return comparison;
- };
-
- comparison.strokeWidth = function (_) {
- if (!arguments.length) return strokeWidth;
- strokeWidth = _;
- return comparison;
- };
-
- return comparison;
- };
-
- var cubism_comparisonPrimaryFormat = d3.format(".2s"),
- cubism_comparisonChangeFormat = d3.format("+.0%");
-
- function cubism_comparisonRoundEven(i) {
- return i & 0xfffffe;
- }
-
- function cubism_comparisonRoundOdd(i) {
- return ((i + 1) & 0xfffffe) - 1;
- }
-
- cubism_contextPrototype.axis = function () {
- var context = this,
- scale = context.scale,
- axis_ = d3.svg.axis().scale(scale);
-
- var format = context.step() < 6e4 ? cubism_axisFormatSeconds
- : context.step() < 864e5 ? cubism_axisFormatMinutes
- : cubism_axisFormatDays;
-
- function axis(selection) {
- var id = ++cubism_id,
- tick;
-
- var g = selection.append("svg")
- .datum({id:id})
- .attr("width", context.size())
- .attr("height", Math.max(28, -axis.tickSize()))
- .append("g")
- .attr("transform", "translate(0," + (axis_.orient() === "top" ? 27 : 4) + ")")
- .call(axis_);
-
- context.on("change.axis-" + id, function () {
- g.call(axis_);
- if (!tick) tick = d3.select(g.node().appendChild(g.selectAll("text").node().cloneNode(true)))
- .style("display", "none")
- .text(null);
- });
-
- context.on("focus.axis-" + id, function (i) {
- if (tick) {
- if (i == null) {
- tick.style("display", "none");
- g.selectAll("text").style("fill-opacity", null);
- } else {
- tick.style("display", null).attr("x", i).text(format(scale.invert(i)));
- var dx = tick.node().getComputedTextLength() + 6;
- g.selectAll("text").style("fill-opacity", function (d) {
- return Math.abs(scale(d) - i) < dx ? 0 : 1;
- });
- }
- }
- });
- }
-
- axis.remove = function (selection) {
-
- selection.selectAll("svg")
- .each(remove)
- .remove();
-
- function remove(d) {
- context.on("change.axis-" + d.id, null);
- context.on("focus.axis-" + d.id, null);
- }
- };
-
- return d3.rebind(axis, axis_,
- "orient",
- "ticks",
- "tickSubdivide",
- "tickSize",
- "tickPadding",
- "tickFormat");
- };
-
- var cubism_axisFormatSeconds = d3.time.format("%I:%M:%S %p"),
- cubism_axisFormatMinutes = d3.time.format("%I:%M %p"),
- cubism_axisFormatDays = d3.time.format("%B %d");
- cubism_contextPrototype.rule = function () {
- var context = this,
- metric = cubism_identity;
-
- function rule(selection) {
- var id = ++cubism_id;
-
- var line = selection.append("div")
- .datum({id:id})
- .attr("class", "line")
- .call(cubism_ruleStyle);
-
- selection.each(function (d, i) {
- var that = this,
- id = ++cubism_id,
- metric_ = typeof metric === "function" ? metric.call(that, d, i) : metric;
-
- if (!metric_) return;
-
- function change(start, stop) {
- var values = [];
-
- for (var i = 0, n = context.size(); i < n; ++i) {
- if (metric_.valueAt(i)) {
- values.push(i);
- }
- }
-
- var lines = selection.selectAll(".metric").data(values);
- lines.exit().remove();
- lines.enter().append("div").attr("class", "metric line").call(cubism_ruleStyle);
- lines.style("left", cubism_ruleLeft);
- }
-
- context.on("change.rule-" + id, change);
- metric_.on("change.rule-" + id, change);
- });
-
- context.on("focus.rule-" + id, function (i) {
- line.datum(i)
- .style("display", i == null ? "none" : null)
- .style("left", cubism_ruleLeft);
- });
- }
-
- rule.remove = function (selection) {
-
- selection.selectAll(".line")
- .each(remove)
- .remove();
-
- function remove(d) {
- context.on("focus.rule-" + d.id, null);
- }
- };
-
- rule.metric = function (_) {
- if (!arguments.length) return metric;
- metric = _;
- return rule;
- };
-
- return rule;
- };
-
- function cubism_ruleStyle(line) {
- line
- .style("position", "absolute")
- .style("top", 0)
- .style("bottom", 0)
- .style("width", "1px")
- .style("pointer-events", "none");
- }
-
- function cubism_ruleLeft(i) {
- return i + "px";
- }
-})(this);