my-test123
Version:
A planner front-end for Fabric8.
114 lines • 4.71 kB
JavaScript
import { Component, Input } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Broadcaster, Logger } from 'ngx-base';
import { GroupTypesService } from '../../services/group-types.service';
import { WorkItemService } from '../../services/work-item.service';
import { IterationService } from '../../services/iteration.service';
var SidepanelComponent = /** @class */ (function () {
function SidepanelComponent(log, groupTypesService, workItemService, iterationService, router, route, broadcaster) {
this.log = log;
this.groupTypesService = groupTypesService;
this.workItemService = workItemService;
this.iterationService = iterationService;
this.router = router;
this.route = route;
this.broadcaster = broadcaster;
this.iterations = [];
this.sidePanelOpen = true;
this.rootIteration = null;
this.backlogSelected = true;
this.typeGroupSelected = true;
this.numberOfItemsInBacklog = 0;
this.eventListeners = [];
this.groupTypes = [];
}
Object.defineProperty(SidepanelComponent.prototype, "groupTypesSetup", {
set: function (types) {
if (JSON.stringify(this.groupTypes) != JSON.stringify(types)) {
this.groupTypes = types;
}
},
enumerable: true,
configurable: true
});
SidepanelComponent.prototype.ngOnInit = function () {
var _this = this;
// retrieve the root iteration
this.iterationService.getRootIteration()
.subscribe(function (resultIteration) {
_this.log.log('Got root iteration: ' + resultIteration.id);
_this.rootIteration = resultIteration;
// after getting the root iteration, complete the initialization
_this.refreshBacklogSize();
_this.listenToEvents();
}),
function (err) {
console.log('Error getting root iteration in the side panel');
};
};
SidepanelComponent.prototype.ngOnDestroy = function () {
this.eventListeners.forEach(function (e) { return e.unsubscribe(); });
};
SidepanelComponent.prototype.refreshBacklogSize = function () {
var _this = this;
// refreshing the root iteration size from service
this.iterationService.getWorkItemCountInIteration(this.rootIteration).first().subscribe(function (count) {
_this.log.log('Got root iteration size of ' + count);
_this.numberOfItemsInBacklog = count;
});
};
SidepanelComponent.prototype.setGuidedTypeWI = function () {
var witCollection = this.workItemService.workItemTypes.map(function (wit) { return wit.id; });
this.groupTypesService.setCurrentGroupType(witCollection);
};
SidepanelComponent.prototype.listenToEvents = function () {
var _this = this;
this.eventListeners = [
this.broadcaster.on('associate_iteration')
.subscribe(function (message) {
_this.refreshBacklogSize();
}),
this.broadcaster.on('delete_workitem')
.subscribe(function (message) {
_this.refreshBacklogSize();
}),
this.broadcaster.on('create_workitem')
.subscribe(function (message) {
_this.refreshBacklogSize();
}),
this.route.queryParams.subscribe(function (params) {
if (Object.keys(params).indexOf('q') > -1) {
_this.backlogSelected = false;
}
else {
_this.backlogSelected = true;
}
})
];
};
SidepanelComponent.decorators = [
{ type: Component, args: [{
selector: 'side-panel',
template: require('./side-panel.component.html'),
styles: [require('./side-panel.component.css').toString()]
},] },
];
/** @nocollapse */
SidepanelComponent.ctorParameters = function () { return [
{ type: Logger, },
{ type: GroupTypesService, },
{ type: WorkItemService, },
{ type: IterationService, },
{ type: Router, },
{ type: ActivatedRoute, },
{ type: Broadcaster, },
]; };
SidepanelComponent.propDecorators = {
'iterations': [{ type: Input },],
'sidePanelOpen': [{ type: Input },],
'groupTypesSetup': [{ type: Input, args: ['groupTypes',] },],
};
return SidepanelComponent;
}());
export { SidepanelComponent };
//# sourceMappingURL=side-panel.component.js.map