mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
[CST-5337] remove deprecated @Effect decorators
This commit is contained in:
@@ -1,21 +1,26 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import {
|
|
||||||
AddSourceAction,
|
|
||||||
QualityAssuranceSourceActionTypes,
|
|
||||||
RetrieveAllSourceAction,
|
|
||||||
RetrieveAllSourceErrorAction,
|
|
||||||
} from './quality-assurance-source.actions';
|
|
||||||
|
|
||||||
import { QualityAssuranceSourceObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-source.model';
|
import {
|
||||||
|
AddSourceAction,
|
||||||
|
QualityAssuranceSourceActionTypes,
|
||||||
|
RetrieveAllSourceAction,
|
||||||
|
RetrieveAllSourceErrorAction,
|
||||||
|
} from './quality-assurance-source.actions';
|
||||||
|
import {
|
||||||
|
QualityAssuranceSourceObject
|
||||||
|
} from '../../../core/suggestion-notifications/qa/models/quality-assurance-source.model';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { QualityAssuranceSourceRestService } from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
import {
|
||||||
|
QualityAssuranceSourceRestService
|
||||||
|
} from '../../../core/suggestion-notifications/qa/source/quality-assurance-source-rest.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides effect methods for the Quality Assurance source actions.
|
* Provides effect methods for the Quality Assurance source actions.
|
||||||
@@ -26,7 +31,7 @@ export class QualityAssuranceSourceEffects {
|
|||||||
/**
|
/**
|
||||||
* Retrieve all Quality Assurance source managing pagination and errors.
|
* Retrieve all Quality Assurance source managing pagination and errors.
|
||||||
*/
|
*/
|
||||||
@Effect() retrieveAllSource$ = this.actions$.pipe(
|
retrieveAllSource$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE),
|
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE),
|
||||||
withLatestFrom(this.store$),
|
withLatestFrom(this.store$),
|
||||||
switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => {
|
switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => {
|
||||||
@@ -45,27 +50,27 @@ export class QualityAssuranceSourceEffects {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a notification on error.
|
* Show a notification on error.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) retrieveAllSourceErrorAction$ = this.actions$.pipe(
|
retrieveAllSourceErrorAction$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
|
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.notificationsService.error(null, this.translate.get('quality-assurance.source.error.service.retrieve'));
|
this.notificationsService.error(null, this.translate.get('quality-assurance.source.error.service.retrieve'));
|
||||||
})
|
})
|
||||||
);
|
), { dispatch: false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear find all source requests from cache.
|
* Clear find all source requests from cache.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) addSourceAction$ = this.actions$.pipe(
|
addSourceAction$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceSourceActionTypes.ADD_SOURCE),
|
ofType(QualityAssuranceSourceActionTypes.ADD_SOURCE),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.qualityAssuranceSourceDataService.clearFindAllSourceRequests();
|
this.qualityAssuranceSourceDataService.clearFindAllSourceRequests();
|
||||||
})
|
})
|
||||||
);
|
), { dispatch: false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the effect class variables.
|
* Initialize the effect class variables.
|
||||||
@@ -83,5 +88,6 @@ export class QualityAssuranceSourceEffects {
|
|||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService
|
private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService
|
||||||
) { }
|
) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +1,26 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AddTopicsAction,
|
AddTopicsAction,
|
||||||
QualityAssuranceTopicActionTypes,
|
QualityAssuranceTopicActionTypes,
|
||||||
RetrieveAllTopicsAction,
|
RetrieveAllTopicsAction,
|
||||||
RetrieveAllTopicsErrorAction,
|
RetrieveAllTopicsErrorAction,
|
||||||
} from './quality-assurance-topics.actions';
|
} from './quality-assurance-topics.actions';
|
||||||
|
import {
|
||||||
import { QualityAssuranceTopicObject } from '../../../core/suggestion-notifications/qa/models/quality-assurance-topic.model';
|
QualityAssuranceTopicObject
|
||||||
|
} from '../../../core/suggestion-notifications/qa/models/quality-assurance-topic.model';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { QualityAssuranceTopicRestService } from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
import {
|
||||||
|
QualityAssuranceTopicRestService
|
||||||
|
} from '../../../core/suggestion-notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides effect methods for the Quality Assurance topics actions.
|
* Provides effect methods for the Quality Assurance topics actions.
|
||||||
@@ -26,7 +31,7 @@ export class QualityAssuranceTopicsEffects {
|
|||||||
/**
|
/**
|
||||||
* Retrieve all Quality Assurance topics managing pagination and errors.
|
* Retrieve all Quality Assurance topics managing pagination and errors.
|
||||||
*/
|
*/
|
||||||
@Effect() retrieveAllTopics$ = this.actions$.pipe(
|
retrieveAllTopics$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
||||||
withLatestFrom(this.store$),
|
withLatestFrom(this.store$),
|
||||||
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
||||||
@@ -45,27 +50,27 @@ export class QualityAssuranceTopicsEffects {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
);
|
));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a notification on error.
|
* Show a notification on error.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe(
|
retrieveAllTopicsErrorAction$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.notificationsService.error(null, this.translate.get('quality-assurance.topic.error.service.retrieve'));
|
this.notificationsService.error(null, this.translate.get('quality-assurance.topic.error.service.retrieve'));
|
||||||
})
|
})
|
||||||
);
|
), { dispatch: false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear find all topics requests from cache.
|
* Clear find all topics requests from cache.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe(
|
addTopicsAction$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(QualityAssuranceTopicActionTypes.ADD_TOPICS),
|
ofType(QualityAssuranceTopicActionTypes.ADD_TOPICS),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.qualityAssuranceTopicDataService.clearFindAllTopicsRequests();
|
this.qualityAssuranceTopicDataService.clearFindAllTopicsRequests();
|
||||||
})
|
})
|
||||||
);
|
), { dispatch: false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the effect class variables.
|
* Initialize the effect class variables.
|
||||||
|
Reference in New Issue
Block a user