my-test123
Version:
A planner front-end for Fabric8.
82 lines • 3.78 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 { Actions, Effect } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import * as SpaceActions from './../actions/space.actions';
import { Observable } from 'rxjs';
import { Spaces } from 'ngx-fabric8-wit';
import { Notifications, NotificationType } from "ngx-base";
import * as CollaboratorActions from './../actions/collaborator.actions';
import * as AreaActions from './../actions/area.actions';
import * as FilterActions from './../actions/filter.actions';
import * as GroupTypeActions from './../actions/group-type.actions';
import * as IterationActions from './../actions/iteration.actions';
import * as LabelActions from './../actions/label.actions';
import * as WorkItemTypeActions from './../actions/work-item-type.actions';
var SpaceEffects = /** @class */ (function () {
function SpaceEffects(actions$, spaces, notifications) {
var _this = this;
this.actions$ = actions$;
this.spaces = spaces;
this.notifications = notifications;
this.oldSpaceId = null;
this.getSpace$ = this.actions$
.ofType(SpaceActions.GET)
.switchMap(function (action) { return _this.spaces.current; })
.switchMap(function (space) { return Observable.of(new SpaceActions.GetSuccess(space)); })
.catch(function (e) {
try {
_this.notifications.message({
message: "Problem in getting space",
type: NotificationType.DANGER
});
}
catch (e) {
console.log('Problem in getting space');
}
return Observable.of(new SpaceActions.GetError());
});
this.getSpaceSuccess$ = this.actions$
.ofType(SpaceActions.GET_SUCCESS)
.map(function (v) { return v; })
.filter(function (v) { return !!v && !!v.payload; })
.filter(function (action) { return action.payload.id !== _this.oldSpaceId; })
.do(function (action) { return _this.oldSpaceId = action.payload.id; })
.switchMap(function () { return [
new CollaboratorActions.Get(),
new AreaActions.Get(),
new FilterActions.Get(),
new GroupTypeActions.Get(),
new IterationActions.Get(),
new LabelActions.Get(),
new WorkItemTypeActions.Get()
]; });
}
SpaceEffects.decorators = [
{ type: Injectable },
];
/** @nocollapse */
SpaceEffects.ctorParameters = function () { return [
{ type: Actions, },
{ type: Spaces, },
{ type: Notifications, },
]; };
__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