fabric8-planner
Version:
A planner front-end for Fabric8.
53 lines • 2.84 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Injectable } from '@angular/core';
import { Actions, Effect } from '@ngrx/effects';
import { Observable } from 'rxjs';
import { catchError, map, switchMap } from 'rxjs/operators';
import { SpaceQuery } from '../models/space';
import * as GroupTypeActions from './../actions/group-type.actions';
import { GroupTypeMapper } from './../models/group-types.model';
import { GroupTypesService as GTService } from './../services/group-types.service';
import { ErrorHandler, filterTypeWithSpace } from './work-item-utils';
var GroupTypeEffects = /** @class */ (function () {
function GroupTypeEffects(actions$, groupTypeService, spaceQuery, errHandler) {
var _this = this;
this.actions$ = actions$;
this.groupTypeService = groupTypeService;
this.spaceQuery = spaceQuery;
this.errHandler = errHandler;
this.getGroupTypes$ = this.actions$
.pipe(filterTypeWithSpace(GroupTypeActions.GET, this.spaceQuery.getCurrentSpace), switchMap(function (_a) {
var action = _a[0], space = _a[1];
return _this.groupTypeService.getGroupTypes(space.relationships.workitemtypegroups.links.related)
.pipe(map(function (types) {
var gtm = new GroupTypeMapper();
return new GroupTypeActions.GetSuccess(types.map(function (t) { return gtm.toUIModel(t); }));
}), catchError(function (err) { return _this.errHandler.handleError(err, "Problem in fetching grouptypes.", new GroupTypeActions.GetError()); }));
}));
}
GroupTypeEffects.decorators = [
{ type: Injectable },
];
/** @nocollapse */
GroupTypeEffects.ctorParameters = function () { return [
{ type: Actions, },
{ type: GTService, },
{ type: SpaceQuery, },
{ type: ErrorHandler, },
]; };
__decorate([
Effect(),
__metadata("design:type", Observable)
], GroupTypeEffects.prototype, "getGroupTypes$", void 0);
return GroupTypeEffects;
}());
export { GroupTypeEffects };
//# sourceMappingURL=group-type.effects.js.map