my-test123
Version:
A planner front-end for Fabric8.
98 lines • 4.3 kB
JavaScript
import { ActivatedRoute } from '@angular/router';
import { Component, Input } from '@angular/core';
import { Broadcaster, Logger } from 'ngx-base';
import { AuthenticationService } from 'ngx-login-client';
import { Spaces } from 'ngx-fabric8-wit';
import { FilterService } from '../../services/filter.service';
import { GroupTypesService } from '../../services/group-types.service';
var GroupTypesComponent = /** @class */ (function () {
function GroupTypesComponent(log, auth, broadcaster, filterService, groupTypesService, route, spaces) {
this.log = log;
this.auth = auth;
this.broadcaster = broadcaster;
this.filterService = filterService;
this.groupTypesService = groupTypesService;
this.route = route;
this.spaces = spaces;
this.iterations = [];
this.sidePanelOpen = true;
this.authUser = null;
this.loggedIn = true;
this.spaceSubscription = null;
this.eventListeners = [];
}
Object.defineProperty(GroupTypesComponent.prototype, "groupTypesSetup", {
set: function (types) {
if (JSON.stringify(this.groupTypes) != JSON.stringify(types)) {
this.groupTypes = types;
this.selectedgroupType = types[0];
}
},
enumerable: true,
configurable: true
});
GroupTypesComponent.prototype.ngOnInit = function () {
var _this = this;
this.loggedIn = this.auth.isLoggedIn();
this.spaceSubscription = this.spaces.current.subscribe(function (space) {
if (space) {
_this.spaceId = space.id;
}
else {
console.log('[Guided Work Item Types] Space deselected.');
}
});
};
GroupTypesComponent.prototype.ngOnDestroy = function () {
// prevent memory leak when component is destroyed
this.spaceSubscription.unsubscribe();
};
GroupTypesComponent.prototype.fnBuildQueryParam = function (witGroup) {
//Query for work item type group
var type_query = this.filterService.queryBuilder('typegroup.name', this.filterService.equal_notation, witGroup.attributes.name);
//Query for space
var space_query = this.filterService.queryBuilder('space', this.filterService.equal_notation, this.spaceId);
//Join type and space query
var first_join = this.filterService.queryJoiner({}, this.filterService.and_notation, space_query);
var second_join = this.filterService.queryJoiner(first_join, this.filterService.and_notation, type_query);
//second_join gives json object
return this.filterService.jsonToQuery(second_join);
//reverse function jsonToQuery(second_join);
};
GroupTypesComponent.prototype.setGuidedTypeWI = function (witGroup) {
if (witGroup !== this.selectedgroupType) {
this.selectedgroupType = witGroup;
var matchingWITGroup = this.groupTypes.find(function (gt) {
return gt.id === witGroup.id;
});
var witIdArray = matchingWITGroup.relationships.typeList.data
.map(function (wit) { return wit.id; });
this.groupTypesService.setCurrentGroupType(witIdArray, matchingWITGroup.attributes.bucket);
}
};
GroupTypesComponent.decorators = [
{ type: Component, args: [{
selector: 'group-types',
template: require('./group-types-panel.component.html'),
styles: [require('./group-types-panel.component.css').toString()]
},] },
];
/** @nocollapse */
GroupTypesComponent.ctorParameters = function () { return [
{ type: Logger, },
{ type: AuthenticationService, },
{ type: Broadcaster, },
{ type: FilterService, },
{ type: GroupTypesService, },
{ type: ActivatedRoute, },
{ type: Spaces, },
]; };
GroupTypesComponent.propDecorators = {
'iterations': [{ type: Input },],
'sidePanelOpen': [{ type: Input },],
'groupTypesSetup': [{ type: Input, args: ['groupTypes',] },],
};
return GroupTypesComponent;
}());
export { GroupTypesComponent };
//# sourceMappingURL=group-types-panel.component.js.map