fabric8-planner
Version:
A planner front-end for Fabric8.
51 lines • 2.56 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 * as FilterActions from './../actions/filter.actions';
import { SpaceQuery } from './../models/space';
import { FilterService } from './../services/filter.service';
import { ErrorHandler, filterTypeWithSpace } from './work-item-utils';
var FilterEffects = /** @class */ (function () {
function FilterEffects(actions$, filterService, spaceQuery, errHandler) {
var _this = this;
this.actions$ = actions$;
this.filterService = filterService;
this.spaceQuery = spaceQuery;
this.errHandler = errHandler;
this.GetFilters$ = this.actions$
.pipe(filterTypeWithSpace(FilterActions.GET, this.spaceQuery.getCurrentSpace), switchMap(function (_a) {
var action = _a[0], space = _a[1];
return _this.filterService.getFilters(space.links.filters)
.pipe(map(function (types) {
return new FilterActions.GetSuccess(types);
}), catchError(function (err) { return _this.errHandler.handleError(err, 'Problem in fetching filters.', new FilterActions.GetError()); }));
}));
}
FilterEffects.decorators = [
{ type: Injectable },
];
/** @nocollapse */
FilterEffects.ctorParameters = function () { return [
{ type: Actions, },
{ type: FilterService, },
{ type: SpaceQuery, },
{ type: ErrorHandler, },
]; };
__decorate([
Effect(),
__metadata("design:type", Observable)
], FilterEffects.prototype, "GetFilters$", void 0);
return FilterEffects;
}());
export { FilterEffects };
//# sourceMappingURL=filter.effects.js.map