fabric8-planner
Version:
A planner front-end for Fabric8.
77 lines • 4.1 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, ofType } from '@ngrx/effects';
import { Spaces } from 'ngx-fabric8-wit';
import { Observable, of as ObservableOf } from 'rxjs';
import * as SpaceActions from './../actions/space.actions';
import { catchError, delay, distinctUntilChanged, filter, map, switchMap, tap } from 'rxjs/operators';
import * as AreaActions from './../actions/area.actions';
import * as BoardActions from './../actions/board.actions';
import * as CollaboratorActions from './../actions/collaborator.actions';
import * as CustomQueryActions from './../actions/custom-query.actions';
import * as FilterActions from './../actions/filter.actions';
import * as GroupTypeActions from './../actions/group-type.actions';
import * as InfotipActions from './../actions/infotip.actions';
import * as IterationActions from './../actions/iteration.actions';
import * as LabelActions from './../actions/label.actions';
import * as LinkTypeActions from './../actions/link-type.actions';
import * as WorkItemTypeActions from './../actions/work-item-type.actions';
import { ErrorHandler } from './work-item-utils';
var SpaceEffects = /** @class */ (function () {
function SpaceEffects(actions$, spaces, errHandler) {
var _this = this;
this.actions$ = actions$;
this.spaces = spaces;
this.errHandler = errHandler;
this.attempt = 0;
this.getSpace$ = this.actions$
.pipe(ofType(SpaceActions.GET), switchMap(function (action) { return _this.spaces.current; }), filter(function (space) { return !!space; }), switchMap(function (space) { return ObservableOf(new SpaceActions.GetSuccess(space)); }), catchError(function (err) { return _this.errHandler.handleError(err, "Problem in getting space", new SpaceActions.GetError()); }));
this.getSpaceSuccess$ = this.actions$
.pipe(ofType(SpaceActions.GET_SUCCESS), map(function (v) { return v; }), filter(function (v) { return !!v && !!v.payload; }), delay(this.attempt * 5000), tap(function () { return _this.attempt++; }), distinctUntilChanged(function (x, y) {
if (x && y) {
return x.payload.id === y.payload.id;
}
return false;
}), switchMap(function () { return [
new CollaboratorActions.Get(),
new AreaActions.Get(),
new FilterActions.Get(),
new GroupTypeActions.Get(),
new IterationActions.Get(),
new LabelActions.Get(),
new WorkItemTypeActions.Get(),
new LinkTypeActions.Get(),
new CustomQueryActions.Get(),
new InfotipActions.Get(),
new BoardActions.Get()
]; }));
}
SpaceEffects.decorators = [
{ type: Injectable },
];
/** @nocollapse */
SpaceEffects.ctorParameters = function () { return [
{ type: Actions, },
{ type: Spaces, },
{ type: ErrorHandler, },
]; };
__decorate([
Effect(),
__metadata("design:type", Observable)
], SpaceEffects.prototype, "getSpace$", void 0);
__decorate([
Effect(),
__metadata("design:type", Observable)
], SpaceEffects.prototype, "getSpaceSuccess$", void 0);
return SpaceEffects;
}());
export { SpaceEffects };
//# sourceMappingURL=space.effects.js.map