webpackJsonp([18],{2124:function(e,i,t){"use strict";var n=t(171),o=t(0),l=t(5),s=t(10),p=(t.n(s),t(25)),a=t(170);t.d(i,"a",function(){return r});var r=function(){function PipelinesComponent(e,i,t,n,o,l){this.router=e,this.authService=i,this.userService=t,this.pipelinesStore=n,this.buildStore=o,this.fabric8RuntimeConsoleService=l,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.fabric8RuntimeConsoleService.loading().switchMap(function(){return s.Observable.combineLatest(e.pipelinesStore.loadAll().distinctUntilChanged(),e.buildStore.loadAll().distinctUntilChanged(),a.k)}).map(a.l).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()})},Object.defineProperty(PipelinesComponent.prototype,"pipelines",{get:function(){return this._filteredPipelines},enumerable:!0,configurable:!0}),PipelinesComponent}();r=__decorate([t.i(o.Component)({selector:"alm-pipelines",template:t(2213),styles:[t(2238)]}),__metadata("design:paramtypes",[l.Router,p.a,p.b,a.m,a.n,n.a])],r)},2150:function(e,i,t){"use strict";var n=t(0),o=t(5),l=t(2124);t.d(i,"a",function(){return p});var s=[{path:"",component:l.a}],p=function(){function PipelinesRoutingModule(){}return PipelinesRoutingModule}();p=__decorate([t.i(n.NgModule)({imports:[o.RouterModule.forChild(s)],exports:[o.RouterModule]})],p)},2151:function(e,i,t){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=t(0),o=t(6),l=t(20),s=t(300),p=t(31),a=t(170),r=t(2124),c=t(2150);t.d(i,"PipelinesModule",function(){return d});var d=function(){function PipelinesModule(e){}return PipelinesModule}();d=__decorate([t.i(n.NgModule)({imports:[o.CommonModule,c.a,l.HttpModule,a.j,s.b,p.a],declarations:[r.a],providers:[p.d,p.b,p.e,p.f]}),__metadata("design:paramtypes",[l.Http])],d)},2188:function(e,i,t){i=e.exports=t(2)(),i.push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"pipelines.component.scss",sourceRoot:"webpack://"}])},2213: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> '},2238:function(e,i,t){var n=t(2188);"string"==typeof n?e.exports=n:e.exports=n.toString()}});
//# sourceMappingURL=18.961383332867478ce47d.bundle.map