webpackJsonp([18],{1830:function(e,i,t){"use strict";var n=t(0),o=t(6),s=t(15),p=t(565);t.d(i,"a",function(){return l});var l=function(){function PipelinesComponent(e,i,t,n){this.router=e,this.authService=i,this.userService=t,this.pipelinesService=n,this._apps=[],this._codebases=[],this._filteredPipelines=[],this._allPipelines=[],this._appliedFilters=[],this._currentSortField={id:"application",title:"Application",sortType:"alpha"},this.toolbarConfig={filterConfig:{fields:[{id:"application",title:"Application",placeholder:"Filter by Application...",type:"select",queries:this._apps},{id:"codebase",title:"Codebase",placeholder:"Filter by Codebase...",type:"select",queries:this._codebases}],appliedFilters:[],resultsCount:this.pipelines.length,tooltipPlacement:"right"},sortConfig:{fields:[{id:"application",title:"Application",sortType:"alpha"},{id:"codebase",title:"Codebase",sortType:"alpha"}]}}}return PipelinesComponent.prototype.filterChange=function(e){this._appliedFilters=e.appliedFilters,this.applyFilters()},PipelinesComponent.prototype.sortChange=function(e){this._currentSortField=e.field,this._ascending=e.isAscending,this.applySort()},PipelinesComponent.prototype.applySort=function(){var e=this;this._filteredPipelines.sort(function(i,t){return e.compare(i,t)})},PipelinesComponent.prototype.compare=function(e,i){var t=0;return"application"===this._currentSortField.id&&e.labels.app&&i.labels.app?t=e.labels.app.localeCompare(i.labels.app):"codebase"===this._currentSortField.id&&e.labels.codebase&&i.labels.codebase&&(t=e.labels.codebase.localeCompare(i.labels.codebase)),this._ascending||(t*=-1),t},PipelinesComponent.prototype.applyFilters=function(){var e=this;if(this._allPipelines){var i=[];this._allPipelines.forEach(function(t){var n=!0;e._appliedFilters.forEach(function(e){"application"===e.field.id?e.value!==t.labels.app&&(n=!1):"codebase"===e.field.id&&e.value!==t.labels.codebase&&(n=!1)}),n&&i.push(t)}),this._filteredPipelines=i}},PipelinesComponent.prototype.ngOnInit=function(){var e=this;this._pipelinesSubscription=this.pipelinesService.current.do(function(i){i.forEach(function(i){e._apps.find(function(e){return e.id===i.labels.app})||e._apps.push({id:i.labels.app,value:i.labels.app}),e._codebases.find(function(e){return e.id===i.labels.codebase})||e._codebases.push({id:i.labels.codebase,value:i.labels.codebase})})}).subscribe(function(i){console.log("Updating build configs:",i),e._allPipelines=i,e.applyFilters(),e.applySort()})},PipelinesComponent.prototype.ngOnDestroy=function(){this._pipelinesSubscription.unsubscribe()},Object.defineProperty(PipelinesComponent.prototype,"pipelines",{get:function(){return this._filteredPipelines},enumerable:!0,configurable:!0}),PipelinesComponent}();l=__decorate([t.i(n.Component)({selector:"alm-pipelines",template:t(2029),styles:[t(2063)]}),__metadata("design:paramtypes",[o.Router,s.a,s.c,p.a])],l)},1940:function(e,i,t){"use strict";var n=t(0),o=t(6),s=t(1830);t.d(i,"a",function(){return l});var p=[{path:"",component:s.a}],l=function(){function PipelinesRoutingModule(){}return PipelinesRoutingModule}();l=__decorate([t.i(n.NgModule)({imports:[o.RouterModule.forChild(p)],exports:[o.RouterModule]})],l)},1941:function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0),o=t(4),s=t(16),p=t(200),l=t(28),a=t(103),r=t(1830),c=t(1940);t.d(i,"PipelinesModule",function(){return u});var u=function(){function PipelinesModule(e){}return PipelinesModule}();u=__decorate([t.i(n.NgModule)({imports:[o.CommonModule,c.a,a.n,p.b,l.a],declarations:[r.a],providers:[l.d,l.b,l.e,l.f]}),__metadata("design:paramtypes",[s.Http])],u)},1995:function(e,i,t){i=e.exports=t(2)(!0),i.push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"pipelines.component.scss",sourceRoot:""}])},2029:function(e,i){e.exports='<div id="pipelines" class="content container"> <alm-toolbar [config]="toolbarConfig" (onFilterChange)="filterChange($event)" (onSortChange)="sortChange($event)"></alm-toolbar> <hr/> <fabric8-pipelines-list [pipelines]="pipelines" [loading]="false"></fabric8-pipelines-list> </div> '},2063:function(e,i,t){var n=t(1995);e.exports="string"==typeof n?n:n.toString()}});
//# sourceMappingURL=18.14d8921d641763c1b23a.bundle.map