[CST-5337] Replace Notifications broker with Quality assurance

This commit is contained in:
Luca Giamminonni
2022-07-06 17:04:11 +02:00
parent df93058881
commit d5c1b11d77
77 changed files with 1198 additions and 1198 deletions

View File

@@ -1 +0,0 @@
<ds-notifications-broker-events></ds-notifications-broker-events>

View File

@@ -1,26 +0,0 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page.component';
describe('AdminNotificationsBrokerEventsPageComponent', () => {
let component: AdminNotificationsBrokerEventsPageComponent;
let fixture: ComponentFixture<AdminNotificationsBrokerEventsPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminNotificationsBrokerEventsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminNotificationsBrokerEventsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminNotificationsBrokerEventsPageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,9 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'ds-notifications-broker-events-page',
templateUrl: './admin-notifications-broker-events-page.component.html'
})
export class AdminNotificationsBrokerEventsPageComponent {
}

View File

@@ -1 +0,0 @@
<ds-notifications-broker-source></ds-notifications-broker-source>

View File

@@ -1,27 +0,0 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminNotificationsBrokerSourcePageComponent } from './admin-notifications-broker-source-page.component';
describe('AdminNotificationsBrokerSourcePageComponent', () => {
let component: AdminNotificationsBrokerSourcePageComponent;
let fixture: ComponentFixture<AdminNotificationsBrokerSourcePageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AdminNotificationsBrokerSourcePageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AdminNotificationsBrokerSourcePageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminNotificationsBrokerSourcePageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,7 +0,0 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ds-admin-notifications-broker-source-page-component',
templateUrl: './admin-notifications-broker-source-page.component.html',
})
export class AdminNotificationsBrokerSourcePageComponent {}

View File

@@ -1 +0,0 @@
<ds-notifications-broker-topic></ds-notifications-broker-topic>

View File

@@ -1,26 +0,0 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page.component';
describe('AdminNotificationsBrokerTopicsPageComponent', () => {
let component: AdminNotificationsBrokerTopicsPageComponent;
let fixture: ComponentFixture<AdminNotificationsBrokerTopicsPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminNotificationsBrokerTopicsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminNotificationsBrokerTopicsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminNotificationsBrokerTopicsPageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -1,9 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'ds-notification-broker-page',
templateUrl: './admin-notifications-broker-topics-page.component.html'
})
export class AdminNotificationsBrokerTopicsPageComponent {
}

View File

@@ -1,8 +1,8 @@
import { URLCombiner } from '../../core/url-combiner/url-combiner'; import { URLCombiner } from '../../core/url-combiner/url-combiner';
import { getNotificationsModuleRoute } from '../admin-routing-paths'; import { getNotificationsModuleRoute } from '../admin-routing-paths';
export const NOTIFICATIONS_EDIT_PATH = 'notifications-broker'; export const QUALITY_ASSURANCE_EDIT_PATH = 'quality-assurance';
export function getNotificationsBrokerbrokerRoute(id: string) { export function getQualityAssuranceRoute(id: string) {
return new URLCombiner(getNotificationsModuleRoute(), NOTIFICATIONS_EDIT_PATH, id).toString(); return new URLCombiner(getNotificationsModuleRoute(), QUALITY_ASSURANCE_EDIT_PATH, id).toString();
} }

View File

@@ -4,26 +4,26 @@ import { RouterModule } from '@angular/router';
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard'; import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver'; import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service'; import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
import { NOTIFICATIONS_EDIT_PATH } from './admin-notifications-routing-paths'; import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component'; import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component'; import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
import { AdminNotificationsBrokerTopicsPageResolver } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page-resolver.service'; import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
import { AdminNotificationsBrokerEventsPageResolver } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.resolver'; import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver';
import { AdminNotificationsBrokerSourcePageComponent } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-page.component'; import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
import { AdminNotificationsBrokerSourcePageResolver } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-page-resolver.service'; import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
import { SourceDataResolver } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-data.reslover'; import { SourceDataResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.reslover';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ {
canActivate: [ AuthenticatedGuard ], canActivate: [ AuthenticatedGuard ],
path: `${NOTIFICATIONS_EDIT_PATH}/:sourceId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
component: AdminNotificationsBrokerTopicsPageComponent, component: AdminQualityAssuranceTopicsPageComponent,
pathMatch: 'full', pathMatch: 'full',
resolve: { resolve: {
breadcrumb: I18nBreadcrumbResolver, breadcrumb: I18nBreadcrumbResolver,
openaireBrokerTopicsParams: AdminNotificationsBrokerTopicsPageResolver openaireBrokerTopicsParams: AdminQualityAssuranceTopicsPageResolver
}, },
data: { data: {
title: 'admin.notifications.broker.page.title', title: 'admin.notifications.broker.page.title',
@@ -33,12 +33,12 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
}, },
{ {
canActivate: [ AuthenticatedGuard ], canActivate: [ AuthenticatedGuard ],
path: `${NOTIFICATIONS_EDIT_PATH}`, path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
component: AdminNotificationsBrokerSourcePageComponent, component: AdminQualityAssuranceSourcePageComponent,
pathMatch: 'full', pathMatch: 'full',
resolve: { resolve: {
breadcrumb: I18nBreadcrumbResolver, breadcrumb: I18nBreadcrumbResolver,
openaireBrokerSourceParams: AdminNotificationsBrokerSourcePageResolver, openaireBrokerSourceParams: AdminQualityAssuranceSourcePageResolver,
sourceData: SourceDataResolver sourceData: SourceDataResolver
}, },
data: { data: {
@@ -49,12 +49,12 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
}, },
{ {
canActivate: [ AuthenticatedGuard ], canActivate: [ AuthenticatedGuard ],
path: `${NOTIFICATIONS_EDIT_PATH}/:sourceId/:topicId`, path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
component: AdminNotificationsBrokerEventsPageComponent, component: AdminQualityAssuranceEventsPageComponent,
pathMatch: 'full', pathMatch: 'full',
resolve: { resolve: {
breadcrumb: I18nBreadcrumbResolver, breadcrumb: I18nBreadcrumbResolver,
openaireBrokerEventsParams: AdminNotificationsBrokerEventsPageResolver openaireBrokerEventsParams: AdminQualityAssuranceEventsPageResolver
}, },
data: { data: {
title: 'admin.notifications.event.page.title', title: 'admin.notifications.event.page.title',
@@ -68,9 +68,9 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
I18nBreadcrumbResolver, I18nBreadcrumbResolver,
I18nBreadcrumbsService, I18nBreadcrumbsService,
SourceDataResolver, SourceDataResolver,
AdminNotificationsBrokerTopicsPageResolver, AdminQualityAssuranceTopicsPageResolver,
AdminNotificationsBrokerEventsPageResolver, AdminQualityAssuranceEventsPageResolver,
AdminNotificationsBrokerSourcePageResolver AdminQualityAssuranceSourcePageResolver
] ]
}) })
/** /**

View File

@@ -3,10 +3,10 @@ import { NgModule } from '@angular/core';
import { CoreModule } from '../../core/core.module'; import { CoreModule } from '../../core/core.module';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../shared/shared.module';
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module'; import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component'; import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component'; import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
import { NotificationsModule } from '../../notifications/notifications.module'; import { NotificationsModule } from '../../notifications/notifications.module';
import { AdminNotificationsBrokerSourcePageComponent } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-page.component'; import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
@NgModule({ @NgModule({
imports: [ imports: [
@@ -17,9 +17,9 @@ import { AdminNotificationsBrokerSourcePageComponent } from './admin-notificatio
NotificationsModule NotificationsModule
], ],
declarations: [ declarations: [
AdminNotificationsBrokerTopicsPageComponent, AdminQualityAssuranceTopicsPageComponent,
AdminNotificationsBrokerEventsPageComponent, AdminQualityAssuranceEventsPageComponent,
AdminNotificationsBrokerSourcePageComponent AdminQualityAssuranceSourcePageComponent
], ],
entryComponents: [] entryComponents: []
}) })

View File

@@ -0,0 +1 @@
<ds-quality-assurance-events></ds-quality-assurance-events>

View File

@@ -0,0 +1,26 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page.component';
describe('AdminQualityAssuranceEventsPageComponent', () => {
let component: AdminQualityAssuranceEventsPageComponent;
let fixture: ComponentFixture<AdminQualityAssuranceEventsPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceEventsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminQualityAssuranceEventsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminQualityAssuranceEventsPageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'ds-quality-assurance-events-page',
templateUrl: './admin-quality-assurance-events-page.component.html'
})
export class AdminQualityAssuranceEventsPageComponent {
}

View File

@@ -4,7 +4,7 @@ import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/r
/** /**
* Interface for the route parameters. * Interface for the route parameters.
*/ */
export interface AdminNotificationsBrokerEventsPageParams { export interface AdminQualityAssuranceEventsPageParams {
pageId?: string; pageId?: string;
pageSize?: number; pageSize?: number;
currentPage?: number; currentPage?: number;
@@ -14,15 +14,15 @@ export interface AdminNotificationsBrokerEventsPageParams {
* This class represents a resolver that retrieve the route data before the route is activated. * This class represents a resolver that retrieve the route data before the route is activated.
*/ */
@Injectable() @Injectable()
export class AdminNotificationsBrokerEventsPageResolver implements Resolve<AdminNotificationsBrokerEventsPageParams> { export class AdminQualityAssuranceEventsPageResolver implements Resolve<AdminQualityAssuranceEventsPageParams> {
/** /**
* Method for resolving the parameters in the current route. * Method for resolving the parameters in the current route.
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
* @param {RouterStateSnapshot} state The current RouterStateSnapshot * @param {RouterStateSnapshot} state The current RouterStateSnapshot
* @returns AdminNotificationsBrokerEventsPageParams Emits the route parameters * @returns AdminQualityAssuranceEventsPageParams Emits the route parameters
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsBrokerEventsPageParams { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceEventsPageParams {
return { return {
pageId: route.queryParams.pageId, pageId: route.queryParams.pageId,
pageSize: parseInt(route.queryParams.pageSize, 10), pageSize: parseInt(route.queryParams.pageSize, 10),

View File

@@ -3,30 +3,30 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Router } from '@a
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
import { NotificationsBrokerSourceService } from '../../../notifications/broker/source/notifications-broker-source.service'; import { QualityAssuranceSourceService } from '../../../notifications/qa/source/quality-assurance-source.service';
/** /**
* This class represents a resolver that retrieve the route data before the route is activated. * This class represents a resolver that retrieve the route data before the route is activated.
*/ */
@Injectable() @Injectable()
export class SourceDataResolver implements Resolve<Observable<NotificationsBrokerSourceObject[]>> { export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSourceObject[]>> {
/** /**
* Initialize the effect class variables. * Initialize the effect class variables.
* @param {NotificationsBrokerSourceService} notificationsBrokerSourceService * @param {QualityAssuranceSourceService} qualityAssuranceSourceService
*/ */
constructor( constructor(
private notificationsBrokerSourceService: NotificationsBrokerSourceService, private qualityAssuranceSourceService: QualityAssuranceSourceService,
private router: Router private router: Router
) { } ) { }
/** /**
* Method for resolving the parameters in the current route. * Method for resolving the parameters in the current route.
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
* @param {RouterStateSnapshot} state The current RouterStateSnapshot * @param {RouterStateSnapshot} state The current RouterStateSnapshot
* @returns Observable<NotificationsBrokerSourceObject[]> * @returns Observable<QualityAssuranceSourceObject[]>
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<NotificationsBrokerSourceObject[]> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
return this.notificationsBrokerSourceService.getSources(5,0).pipe( return this.qualityAssuranceSourceService.getSources(5,0).pipe(
map((sources: PaginatedList<NotificationsBrokerSourceObject>) => { map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
if (sources.page.length === 1) { if (sources.page.length === 1) {
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]); this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
} }

View File

@@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
/** /**
* Interface for the route parameters. * Interface for the route parameters.
*/ */
export interface AdminNotificationsBrokerTopicsPageParams { export interface AdminQualityAssuranceSourcePageParams {
pageId?: string; pageId?: string;
pageSize?: number; pageSize?: number;
currentPage?: number; currentPage?: number;
@@ -14,15 +14,15 @@ export interface AdminNotificationsBrokerTopicsPageParams {
* This class represents a resolver that retrieve the route data before the route is activated. * This class represents a resolver that retrieve the route data before the route is activated.
*/ */
@Injectable() @Injectable()
export class AdminNotificationsBrokerTopicsPageResolver implements Resolve<AdminNotificationsBrokerTopicsPageParams> { export class AdminQualityAssuranceSourcePageResolver implements Resolve<AdminQualityAssuranceSourcePageParams> {
/** /**
* Method for resolving the parameters in the current route. * Method for resolving the parameters in the current route.
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
* @param {RouterStateSnapshot} state The current RouterStateSnapshot * @param {RouterStateSnapshot} state The current RouterStateSnapshot
* @returns AdminNotificationsBrokerTopicsPageParams Emits the route parameters * @returns AdminQualityAssuranceSourcePageParams Emits the route parameters
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsBrokerTopicsPageParams { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceSourcePageParams {
return { return {
pageId: route.queryParams.pageId, pageId: route.queryParams.pageId,
pageSize: parseInt(route.queryParams.pageSize, 10), pageSize: parseInt(route.queryParams.pageSize, 10),

View File

@@ -0,0 +1 @@
<ds-quality-assurance-source></ds-quality-assurance-source>

View File

@@ -0,0 +1,27 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page.component';
describe('AdminQualityAssuranceSourcePageComponent', () => {
let component: AdminQualityAssuranceSourcePageComponent;
let fixture: ComponentFixture<AdminQualityAssuranceSourcePageComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceSourcePageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AdminQualityAssuranceSourcePageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminQualityAssuranceSourcePageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,7 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ds-admin-quality-assurance-source-page-component',
templateUrl: './admin-quality-assurance-source-page.component.html',
})
export class AdminQualityAssuranceSourcePageComponent {}

View File

@@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
/** /**
* Interface for the route parameters. * Interface for the route parameters.
*/ */
export interface AdminNotificationsBrokerSourcePageParams { export interface AdminQualityAssuranceTopicsPageParams {
pageId?: string; pageId?: string;
pageSize?: number; pageSize?: number;
currentPage?: number; currentPage?: number;
@@ -14,15 +14,15 @@ export interface AdminNotificationsBrokerSourcePageParams {
* This class represents a resolver that retrieve the route data before the route is activated. * This class represents a resolver that retrieve the route data before the route is activated.
*/ */
@Injectable() @Injectable()
export class AdminNotificationsBrokerSourcePageResolver implements Resolve<AdminNotificationsBrokerSourcePageParams> { export class AdminQualityAssuranceTopicsPageResolver implements Resolve<AdminQualityAssuranceTopicsPageParams> {
/** /**
* Method for resolving the parameters in the current route. * Method for resolving the parameters in the current route.
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot * @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
* @param {RouterStateSnapshot} state The current RouterStateSnapshot * @param {RouterStateSnapshot} state The current RouterStateSnapshot
* @returns AdminNotificationsBrokerSourcePageParams Emits the route parameters * @returns AdminQualityAssuranceTopicsPageParams Emits the route parameters
*/ */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsBrokerSourcePageParams { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminQualityAssuranceTopicsPageParams {
return { return {
pageId: route.queryParams.pageId, pageId: route.queryParams.pageId,
pageSize: parseInt(route.queryParams.pageSize, 10), pageSize: parseInt(route.queryParams.pageSize, 10),

View File

@@ -0,0 +1 @@
<ds-quality-assurance-topic></ds-quality-assurance-topic>

View File

@@ -0,0 +1,26 @@
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page.component';
describe('AdminQualityAssuranceTopicsPageComponent', () => {
let component: AdminQualityAssuranceTopicsPageComponent;
let fixture: ComponentFixture<AdminQualityAssuranceTopicsPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceTopicsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminQualityAssuranceTopicsPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create AdminQualityAssuranceTopicsPageComponent', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'ds-notification-broker-page',
templateUrl: './admin-quality-assurance-topics-page.component.html'
})
export class AdminQualityAssuranceTopicsPageComponent {
}

View File

@@ -167,9 +167,9 @@ import { SequenceService } from './shared/sequence.service';
import { CoreState } from './core-state.model'; import { CoreState } from './core-state.model';
import { GroupDataService } from './eperson/group-data.service'; import { GroupDataService } from './eperson/group-data.service';
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model'; import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
import { NotificationsBrokerTopicObject } from './notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from './notifications/qa/models/quality-assurance-topic.model';
import { NotificationsBrokerEventObject } from './notifications/broker/models/notifications-broker-event.model'; import { QualityAssuranceEventObject } from './notifications/qa/models/quality-assurance-event.model';
import { NotificationsBrokerSourceObject } from './notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from './notifications/qa/models/quality-assurance-source.model';
import { AccessStatusObject } from '../shared/object-list/access-status-badge/access-status.model'; import { AccessStatusObject } from '../shared/object-list/access-status-badge/access-status.model';
import { AccessStatusDataService } from './data/access-status-data.service'; import { AccessStatusDataService } from './data/access-status-data.service';
import { LinkHeadService } from './services/link-head.service'; import { LinkHeadService } from './services/link-head.service';
@@ -369,12 +369,12 @@ export const models =
ShortLivedToken, ShortLivedToken,
Registration, Registration,
UsageReport, UsageReport,
NotificationsBrokerTopicObject, QualityAssuranceTopicObject,
NotificationsBrokerEventObject, QualityAssuranceEventObject,
Root, Root,
SearchConfig, SearchConfig,
SubmissionAccessesModel, SubmissionAccessesModel,
NotificationsBrokerSourceObject, QualityAssuranceSourceObject,
AccessStatusObject, AccessStatusObject,
ResearcherProfile, ResearcherProfile,
OrcidQueue, OrcidQueue,

View File

@@ -6,8 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { buildPaginatedList } from '../../../data/paginated-list.model'; import { buildPaginatedList } from '../../../data/paginated-list.model';
import { RequestEntry } from '../../../data/request.reducer';
import { FindListOptions } from '../../../data/request.models';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { RestResponse } from '../../../cache/response.models'; import { RestResponse } from '../../../cache/response.models';
@@ -15,17 +13,19 @@ import { PageInfo } from '../../../shared/page-info.model';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
import { NotificationsBrokerEventRestService } from './notifications-broker-event-rest.service'; import { QualityAssuranceEventRestService } from './quality-assurance-event-rest.service';
import { import {
notificationsBrokerEventObjectMissingPid, qualityAssuranceEventObjectMissingPid,
notificationsBrokerEventObjectMissingPid2, qualityAssuranceEventObjectMissingPid2,
notificationsBrokerEventObjectMissingProjectFound qualityAssuranceEventObjectMissingProjectFound
} from '../../../../shared/mocks/notifications.mock'; } from '../../../../shared/mocks/notifications.mock';
import { ReplaceOperation } from 'fast-json-patch'; import { ReplaceOperation } from 'fast-json-patch';
import {RequestEntry} from '../../../data/request-entry.model';
import {FindListOptions} from '../../../data/find-list-options.model';
describe('NotificationsBrokerEventRestService', () => { describe('QualityAssuranceEventRestService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: NotificationsBrokerEventRestService; let service: QualityAssuranceEventRestService;
let serviceASAny: any; let serviceASAny: any;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let responseCacheEntryB: RequestEntry; let responseCacheEntryB: RequestEntry;
@@ -43,10 +43,10 @@ describe('NotificationsBrokerEventRestService', () => {
const topic = 'ENRICH!MORE!PID'; const topic = 'ENRICH!MORE!PID';
const pageInfo = new PageInfo(); const pageInfo = new PageInfo();
const array = [ notificationsBrokerEventObjectMissingPid, notificationsBrokerEventObjectMissingPid2 ]; const array = [ qualityAssuranceEventObjectMissingPid, qualityAssuranceEventObjectMissingPid2 ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const brokerEventObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid); const brokerEventObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid);
const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound); const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
const status = 'ACCEPTED'; const status = 'ACCEPTED';
@@ -99,7 +99,7 @@ describe('NotificationsBrokerEventRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new NotificationsBrokerEventRestService( service = new QualityAssuranceEventRestService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,
@@ -138,7 +138,7 @@ describe('NotificationsBrokerEventRestService', () => {
expect(serviceASAny.dataService.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true); expect(serviceASAny.dataService.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true);
}); });
it('should return a RemoteData<PaginatedList<NotificationsBrokerEventObject>> for the object with the given Topic', () => { it('should return a RemoteData<PaginatedList<QualityAssuranceEventObject>> for the object with the given Topic', () => {
const result = service.getEventsByTopic(topic); const result = service.getEventsByTopic(topic);
const expected = cold('(a)', { const expected = cold('(a)', {
a: paginatedListRD a: paginatedListRD
@@ -155,15 +155,15 @@ describe('NotificationsBrokerEventRestService', () => {
}); });
it('should proxy the call to dataservice.findById', () => { it('should proxy the call to dataservice.findById', () => {
service.getEvent(notificationsBrokerEventObjectMissingPid.id).subscribe( service.getEvent(qualityAssuranceEventObjectMissingPid.id).subscribe(
(res) => { (res) => {
expect(serviceASAny.dataService.findById).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingPid.id, true, true); expect(serviceASAny.dataService.findById).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid.id, true, true);
} }
); );
}); });
it('should return a RemoteData<NotificationsBrokerEventObject> for the object with the given URL', () => { it('should return a RemoteData<QualityAssuranceEventObject> for the object with the given URL', () => {
const result = service.getEvent(notificationsBrokerEventObjectMissingPid.id); const result = service.getEvent(qualityAssuranceEventObjectMissingPid.id);
const expected = cold('(a)', { const expected = cold('(a)', {
a: brokerEventObjectRD a: brokerEventObjectRD
}); });
@@ -179,17 +179,17 @@ describe('NotificationsBrokerEventRestService', () => {
}); });
it('should proxy the call to dataservice.patch', () => { it('should proxy the call to dataservice.patch', () => {
service.patchEvent(status, notificationsBrokerEventObjectMissingPid).subscribe( service.patchEvent(status, qualityAssuranceEventObjectMissingPid).subscribe(
(res) => { (res) => {
expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingPid, operation); expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid, operation);
} }
); );
}); });
it('should return a RemoteData with HTTP 200', () => { it('should return a RemoteData with HTTP 200', () => {
const result = service.patchEvent(status, notificationsBrokerEventObjectMissingPid); const result = service.patchEvent(status, qualityAssuranceEventObjectMissingPid);
const expected = cold('(a|)', { const expected = cold('(a|)', {
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid) a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid)
}); });
expect(result).toBeObservable(expected); expect(result).toBeObservable(expected);
}); });
@@ -203,17 +203,17 @@ describe('NotificationsBrokerEventRestService', () => {
}); });
it('should proxy the call to dataservice.postOnRelated', () => { it('should proxy the call to dataservice.postOnRelated', () => {
service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID).subscribe( service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID).subscribe(
(res) => { (res) => {
expect(serviceASAny.dataService.postOnRelated).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID); expect(serviceASAny.dataService.postOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
} }
); );
}); });
it('should return a RestResponse with HTTP 201', () => { it('should return a RestResponse with HTTP 201', () => {
const result = service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID); const result = service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
const expected = cold('(a|)', { const expected = cold('(a|)', {
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound) a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound)
}); });
expect(result).toBeObservable(expected); expect(result).toBeObservable(expected);
}); });
@@ -227,15 +227,15 @@ describe('NotificationsBrokerEventRestService', () => {
}); });
it('should proxy the call to dataservice.deleteOnRelated', () => { it('should proxy the call to dataservice.deleteOnRelated', () => {
service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id).subscribe( service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id).subscribe(
(res) => { (res) => {
expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingProjectFound.id); expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id);
} }
); );
}); });
it('should return a RestResponse with HTTP 204', () => { it('should return a RestResponse with HTTP 204', () => {
const result = service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id); const result = service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id);
const expected = cold('(a|)', { const expected = cold('(a|)', {
a: createSuccessfulRemoteDataObject({}) a: createSuccessfulRemoteDataObject({})
}); });

View File

@@ -4,7 +4,6 @@ import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { CoreState } from '../../../core.reducers';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
@@ -12,24 +11,25 @@ import { RestResponse } from '../../../cache/response.models';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { dataService } from '../../../cache/builders/build-decorators'; import { dataService } from '../../../cache/builders/build-decorators';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { FindListOptions } from '../../../data/request.models';
import { DataService } from '../../../data/data.service'; import { DataService } from '../../../data/data.service';
import { ChangeAnalyzer } from '../../../data/change-analyzer'; import { ChangeAnalyzer } from '../../../data/change-analyzer';
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
import { RemoteData } from '../../../data/remote-data'; import { RemoteData } from '../../../data/remote-data';
import { NotificationsBrokerEventObject } from '../models/notifications-broker-event.model'; import { QualityAssuranceEventObject } from '../models/quality-assurance-event.model';
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from '../models/notifications-broker-event-object.resource-type'; import { QUALITY_ASSURANCE_EVENT_OBJECT } from '../models/quality-assurance-event-object.resource-type';
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
import { PaginatedList } from '../../../data/paginated-list.model'; import { PaginatedList } from '../../../data/paginated-list.model';
import { ReplaceOperation } from 'fast-json-patch'; import { ReplaceOperation } from 'fast-json-patch';
import { NoContent } from '../../../shared/NoContent.model'; import { NoContent } from '../../../shared/NoContent.model';
import {CoreState} from '../../../core-state.model';
import {FindListOptions} from '../../../data/find-list-options.model';
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class DataServiceImpl extends DataService<NotificationsBrokerEventObject> { class DataServiceImpl extends DataService<QualityAssuranceEventObject> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -44,7 +44,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<NotificationsBrokerEventObject>} comparator * @param {ChangeAnalyzer<QualityAssuranceEventObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -54,17 +54,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<NotificationsBrokerEventObject>) { protected comparator: ChangeAnalyzer<QualityAssuranceEventObject>) {
super(); super();
} }
} }
/** /**
* The service handling all Notifications Broker topic REST requests. * The service handling all Quality Assurance topic REST requests.
*/ */
@Injectable() @Injectable()
@dataService(NOTIFICATIONS_BROKER_EVENT_OBJECT) @dataService(QUALITY_ASSURANCE_EVENT_OBJECT)
export class NotificationsBrokerEventRestService { export class QualityAssuranceEventRestService {
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
@@ -78,7 +78,7 @@ export class NotificationsBrokerEventRestService {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {DefaultChangeAnalyzer<NotificationsBrokerEventObject>} comparator * @param {DefaultChangeAnalyzer<QualityAssuranceEventObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -87,23 +87,23 @@ export class NotificationsBrokerEventRestService {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerEventObject>) { protected comparator: DefaultChangeAnalyzer<QualityAssuranceEventObject>) {
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator); this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
} }
/** /**
* Return the list of Notifications Broker events by topic. * Return the list of Quality Assurance events by topic.
* *
* @param topic * @param topic
* The Notifications Broker topic * The Quality Assurance topic
* @param options * @param options
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerEventObject>>> * @return Observable<RemoteData<PaginatedList<QualityAssuranceEventObject>>>
* The list of Notifications Broker events. * The list of Quality Assurance events.
*/ */
public getEventsByTopic(topic: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<NotificationsBrokerEventObject>[]): Observable<RemoteData<PaginatedList<NotificationsBrokerEventObject>>> { public getEventsByTopic(topic: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceEventObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceEventObject>>> {
options.searchParams = [ options.searchParams = [
{ {
fieldName: 'topic', fieldName: 'topic',
@@ -121,32 +121,32 @@ export class NotificationsBrokerEventRestService {
} }
/** /**
* Return a single Notifications Broker event. * Return a single Quality Assurance event.
* *
* @param id * @param id
* The Notifications Broker event id * The Quality Assurance event id
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
* @return Observable<RemoteData<NotificationsBrokerEventObject>> * @return Observable<RemoteData<QualityAssuranceEventObject>>
* The Notifications Broker event. * The Quality Assurance event.
*/ */
public getEvent(id: string, ...linksToFollow: FollowLinkConfig<NotificationsBrokerEventObject>[]): Observable<RemoteData<NotificationsBrokerEventObject>> { public getEvent(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceEventObject>[]): Observable<RemoteData<QualityAssuranceEventObject>> {
return this.dataService.findById(id, true, true, ...linksToFollow); return this.dataService.findById(id, true, true, ...linksToFollow);
} }
/** /**
* Save the new status of a Notifications Broker event. * Save the new status of a Quality Assurance event.
* *
* @param status * @param status
* The new status * The new status
* @param dso NotificationsBrokerEventObject * @param dso QualityAssuranceEventObject
* The event item * The event item
* @param reason * @param reason
* The optional reason (not used for now; for future implementation) * The optional reason (not used for now; for future implementation)
* @return Observable<RestResponse> * @return Observable<RestResponse>
* The REST response. * The REST response.
*/ */
public patchEvent(status, dso, reason?: string): Observable<RemoteData<NotificationsBrokerEventObject>> { public patchEvent(status, dso, reason?: string): Observable<RemoteData<QualityAssuranceEventObject>> {
const operation: ReplaceOperation<string>[] = [ const operation: ReplaceOperation<string>[] = [
{ {
path: '/status', path: '/status',
@@ -158,24 +158,24 @@ export class NotificationsBrokerEventRestService {
} }
/** /**
* Bound a project to a Notifications Broker event publication. * Bound a project to a Quality Assurance event publication.
* *
* @param itemId * @param itemId
* The Id of the Notifications Broker event * The Id of the Quality Assurance event
* @param projectId * @param projectId
* The project Id to bound * The project Id to bound
* @return Observable<RestResponse> * @return Observable<RestResponse>
* The REST response. * The REST response.
*/ */
public boundProject(itemId: string, projectId: string): Observable<RemoteData<NotificationsBrokerEventObject>> { public boundProject(itemId: string, projectId: string): Observable<RemoteData<QualityAssuranceEventObject>> {
return this.dataService.postOnRelated(itemId, projectId); return this.dataService.postOnRelated(itemId, projectId);
} }
/** /**
* Remove a project from a Notifications Broker event publication. * Remove a project from a Quality Assurance event publication.
* *
* @param itemId * @param itemId
* The Id of the Notifications Broker event * The Id of the Quality Assurance event
* @return Observable<RestResponse> * @return Observable<RestResponse>
* The REST response. * The REST response.
*/ */

View File

@@ -1,9 +1,9 @@
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
/** /**
* The resource type for the Notifications Broker topic * The resource type for the Quality Assurance event
* *
* Needs to be in a separate file to prevent circular * Needs to be in a separate file to prevent circular
* dependencies in webpack. * dependencies in webpack.
*/ */
export const NOTIFICATIONS_BROKER_TOPIC_OBJECT = new ResourceType('nbtopic'); export const QUALITY_ASSURANCE_EVENT_OBJECT = new ResourceType('nbevent');

View File

@@ -1,7 +1,6 @@
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
import { CacheableObject } from '../../../cache/object-cache.reducer'; import { QUALITY_ASSURANCE_EVENT_OBJECT } from './quality-assurance-event-object.resource-type';
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from './notifications-broker-event-object.resource-type';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
@@ -9,11 +8,12 @@ import { Item } from '../../../shared/item.model';
import { ITEM } from '../../../shared/item.resource-type'; import { ITEM } from '../../../shared/item.resource-type';
import { link, typedObject } from '../../../cache/builders/build-decorators'; import { link, typedObject } from '../../../cache/builders/build-decorators';
import { RemoteData } from '../../../data/remote-data'; import { RemoteData } from '../../../data/remote-data';
import {CacheableObject} from '../../../cache/cacheable-object.model';
/** /**
* The interface representing the Notifications Broker event message * The interface representing the Notifications Broker event message
*/ */
export interface NotificationsBrokerEventMessageObject { export interface QualityAssuranceEventMessageObject {
} }
@@ -77,11 +77,11 @@ export interface OpenaireBrokerEventMessageObject {
* The interface representing the Notifications Broker event model * The interface representing the Notifications Broker event model
*/ */
@typedObject @typedObject
export class NotificationsBrokerEventObject implements CacheableObject { export class QualityAssuranceEventObject implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */
static type = NOTIFICATIONS_BROKER_EVENT_OBJECT; static type = QUALITY_ASSURANCE_EVENT_OBJECT;
/** /**
* The Notifications Broker event uuid inside DSpace * The Notifications Broker event uuid inside DSpace

View File

@@ -1,9 +1,9 @@
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
/** /**
* The resource type for the Notifications Broker event * The resource type for the Quality Assurance source
* *
* Needs to be in a separate file to prevent circular * Needs to be in a separate file to prevent circular
* dependencies in webpack. * dependencies in webpack.
*/ */
export const NOTIFICATIONS_BROKER_EVENT_OBJECT = new ResourceType('nbevent'); export const QUALITY_ASSURANCE_SOURCE_OBJECT = new ResourceType('nbsource');

View File

@@ -1,24 +1,24 @@
import { autoserialize, deserialize } from 'cerialize'; import { autoserialize, deserialize } from 'cerialize';
import { CacheableObject } from '../../../cache/object-cache.reducer';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
import { typedObject } from '../../../cache/builders/build-decorators'; import { typedObject } from '../../../cache/builders/build-decorators';
import { NOTIFICATIONS_BROKER_SOURCE_OBJECT } from './notifications-broker-source-object.resource-type'; import { QUALITY_ASSURANCE_SOURCE_OBJECT } from './quality-assurance-source-object.resource-type';
import {CacheableObject} from '../../../cache/cacheable-object.model';
/** /**
* The interface representing the Notifications Broker source model * The interface representing the Quality Assurance source model
*/ */
@typedObject @typedObject
export class NotificationsBrokerSourceObject implements CacheableObject { export class QualityAssuranceSourceObject implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */
static type = NOTIFICATIONS_BROKER_SOURCE_OBJECT; static type = QUALITY_ASSURANCE_SOURCE_OBJECT;
/** /**
* The Notifications Broker source id * The Quality Assurance source id
*/ */
@autoserialize @autoserialize
id: string; id: string;

View File

@@ -1,9 +1,9 @@
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
/** /**
* The resource type for the Notifications Broker source * The resource type for the Quality Assurance topic
* *
* Needs to be in a separate file to prevent circular * Needs to be in a separate file to prevent circular
* dependencies in webpack. * dependencies in webpack.
*/ */
export const NOTIFICATIONS_BROKER_SOURCE_OBJECT = new ResourceType('nbsource'); export const QUALITY_ASSURANCE_TOPIC_OBJECT = new ResourceType('nbtopic');

View File

@@ -1,30 +1,30 @@
import { autoserialize, deserialize } from 'cerialize'; import { autoserialize, deserialize } from 'cerialize';
import { CacheableObject } from '../../../cache/object-cache.reducer'; import { QUALITY_ASSURANCE_TOPIC_OBJECT } from './quality-assurance-topic-object.resource-type';
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from './notifications-broker-topic-object.resource-type';
import { excludeFromEquals } from '../../../utilities/equals.decorators'; import { excludeFromEquals } from '../../../utilities/equals.decorators';
import { ResourceType } from '../../../shared/resource-type'; import { ResourceType } from '../../../shared/resource-type';
import { HALLink } from '../../../shared/hal-link.model'; import { HALLink } from '../../../shared/hal-link.model';
import { typedObject } from '../../../cache/builders/build-decorators'; import { typedObject } from '../../../cache/builders/build-decorators';
import {CacheableObject} from '../../../cache/cacheable-object.model';
/** /**
* The interface representing the Notifications Broker topic model * The interface representing the Quality Assurance topic model
*/ */
@typedObject @typedObject
export class NotificationsBrokerTopicObject implements CacheableObject { export class QualityAssuranceTopicObject implements CacheableObject {
/** /**
* A string representing the kind of object, e.g. community, item, * A string representing the kind of object, e.g. community, item,
*/ */
static type = NOTIFICATIONS_BROKER_TOPIC_OBJECT; static type = QUALITY_ASSURANCE_TOPIC_OBJECT;
/** /**
* The Notifications Broker topic id * The Quality Assurance topic id
*/ */
@autoserialize @autoserialize
id: string; id: string;
/** /**
* The Notifications Broker topic name to display * The Quality Assurance topic name to display
*/ */
@autoserialize @autoserialize
name: string; name: string;

View File

@@ -6,7 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { buildPaginatedList } from '../../../data/paginated-list.model'; import { buildPaginatedList } from '../../../data/paginated-list.model';
import { RequestEntry } from '../../../data/request.reducer';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { RestResponse } from '../../../cache/response.models'; import { RestResponse } from '../../../cache/response.models';
@@ -14,15 +13,16 @@ import { PageInfo } from '../../../shared/page-info.model';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
import { NotificationsBrokerSourceRestService } from './notifications-broker-source-rest.service';
import { import {
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMorePid qualityAssuranceSourceObjectMorePid
} from '../../../../shared/mocks/notifications.mock'; } from '../../../../shared/mocks/notifications.mock';
import {RequestEntry} from '../../../data/request-entry.model';
import {QualityAssuranceSourceRestService} from './quality-assurance-source-rest.service';
describe('NotificationsBrokerSourceRestService', () => { describe('QualityAssuranceSourceRestService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: NotificationsBrokerSourceRestService; let service: QualityAssuranceSourceRestService;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let requestService: RequestService; let requestService: RequestService;
let rdbService: RemoteDataBuildService; let rdbService: RemoteDataBuildService;
@@ -36,9 +36,9 @@ describe('NotificationsBrokerSourceRestService', () => {
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a'; const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
const pageInfo = new PageInfo(); const pageInfo = new PageInfo();
const array = [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ]; const array = [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const brokerSourceObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerSourceObjectMorePid); const brokerSourceObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceSourceObjectMorePid);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
beforeEach(() => { beforeEach(() => {
@@ -72,7 +72,7 @@ describe('NotificationsBrokerSourceRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new NotificationsBrokerSourceRestService( service = new QualityAssuranceSourceRestService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,
@@ -96,7 +96,7 @@ describe('NotificationsBrokerSourceRestService', () => {
done(); done();
}); });
it('should return a RemoteData<PaginatedList<NotificationsBrokerSourceObject>> for the object with the given URL', () => { it('should return a RemoteData<PaginatedList<QualityAssuranceSourceObject>> for the object with the given URL', () => {
const result = service.getSources(); const result = service.getSources();
const expected = cold('(a)', { const expected = cold('(a)', {
a: paginatedListRD a: paginatedListRD
@@ -107,16 +107,16 @@ describe('NotificationsBrokerSourceRestService', () => {
describe('getSource', () => { describe('getSource', () => {
it('should proxy the call to dataservice.findByHref', (done) => { it('should proxy the call to dataservice.findByHref', (done) => {
service.getSource(notificationsBrokerSourceObjectMorePid.id).subscribe( service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
(res) => { (res) => {
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + notificationsBrokerSourceObjectMorePid.id, true, true); expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceSourceObjectMorePid.id, true, true);
} }
); );
done(); done();
}); });
it('should return a RemoteData<NotificationsBrokerSourceObject> for the object with the given URL', () => { it('should return a RemoteData<QualityAssuranceSourceObject> for the object with the given URL', () => {
const result = service.getSource(notificationsBrokerSourceObjectMorePid.id); const result = service.getSource(qualityAssuranceSourceObjectMorePid.id);
const expected = cold('(a)', { const expected = cold('(a)', {
a: brokerSourceObjectRD a: brokerSourceObjectRD
}); });

View File

@@ -5,29 +5,29 @@ import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { mergeMap, take } from 'rxjs/operators'; import { mergeMap, take } from 'rxjs/operators';
import { CoreState } from '../../../core.reducers';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { dataService } from '../../../cache/builders/build-decorators'; import { dataService } from '../../../cache/builders/build-decorators';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { FindListOptions } from '../../../data/request.models';
import { DataService } from '../../../data/data.service'; import { DataService } from '../../../data/data.service';
import { ChangeAnalyzer } from '../../../data/change-analyzer'; import { ChangeAnalyzer } from '../../../data/change-analyzer';
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
import { RemoteData } from '../../../data/remote-data'; import { RemoteData } from '../../../data/remote-data';
import { NotificationsBrokerSourceObject } from '../models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../models/quality-assurance-source.model';
import { NOTIFICATIONS_BROKER_SOURCE_OBJECT } from '../models/notifications-broker-source-object.resource-type'; import { QUALITY_ASSURANCE_SOURCE_OBJECT } from '../models/quality-assurance-source-object.resource-type';
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
import { PaginatedList } from '../../../data/paginated-list.model'; import { PaginatedList } from '../../../data/paginated-list.model';
import {CoreState} from '../../../core-state.model';
import {FindListOptions} from '../../../data/find-list-options.model';
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> { class DataServiceImpl extends DataService<QualityAssuranceSourceObject> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -42,7 +42,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<NotificationsBrokerSourceObject>} comparator * @param {ChangeAnalyzer<QualityAssuranceSourceObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -52,17 +52,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<NotificationsBrokerSourceObject>) { protected comparator: ChangeAnalyzer<QualityAssuranceSourceObject>) {
super(); super();
} }
} }
/** /**
* The service handling all Notifications Broker source REST requests. * The service handling all Quality Assurance source REST requests.
*/ */
@Injectable() @Injectable()
@dataService(NOTIFICATIONS_BROKER_SOURCE_OBJECT) @dataService(QUALITY_ASSURANCE_SOURCE_OBJECT)
export class NotificationsBrokerSourceRestService { export class QualityAssuranceSourceRestService {
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
@@ -76,7 +76,7 @@ export class NotificationsBrokerSourceRestService {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {DefaultChangeAnalyzer<NotificationsBrokerSourceObject>} comparator * @param {DefaultChangeAnalyzer<QualityAssuranceSourceObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -85,21 +85,21 @@ export class NotificationsBrokerSourceRestService {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerSourceObject>) { protected comparator: DefaultChangeAnalyzer<QualityAssuranceSourceObject>) {
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator); this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
} }
/** /**
* Return the list of Notifications Broker source. * Return the list of Quality Assurance source.
* *
* @param options * @param options
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerSourceObject>>> * @return Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>>
* The list of Notifications Broker source. * The list of Quality Assurance source.
*/ */
public getSources(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<NotificationsBrokerSourceObject>[]): Observable<RemoteData<PaginatedList<NotificationsBrokerSourceObject>>> { public getSources(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>> {
return this.dataService.getBrowseEndpoint(options, 'nbsources').pipe( return this.dataService.getBrowseEndpoint(options, 'nbsources').pipe(
take(1), take(1),
mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)), mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)),
@@ -114,16 +114,16 @@ export class NotificationsBrokerSourceRestService {
} }
/** /**
* Return a single Notifications Broker source. * Return a single Quality Assurance source.
* *
* @param id * @param id
* The Notifications Broker source id * The Quality Assurance source id
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<NotificationsBrokerSourceObject>> * @return Observable<RemoteData<QualityAssuranceSourceObject>>
* The Notifications Broker source. * The Quality Assurance source.
*/ */
public getSource(id: string, ...linksToFollow: FollowLinkConfig<NotificationsBrokerSourceObject>[]): Observable<RemoteData<NotificationsBrokerSourceObject>> { public getSource(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceSourceObject>[]): Observable<RemoteData<QualityAssuranceSourceObject>> {
const options = {}; const options = {};
return this.dataService.getBrowseEndpoint(options, 'nbsources').pipe( return this.dataService.getBrowseEndpoint(options, 'nbsources').pipe(
take(1), take(1),

View File

@@ -6,7 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { buildPaginatedList } from '../../../data/paginated-list.model'; import { buildPaginatedList } from '../../../data/paginated-list.model';
import { RequestEntry } from '../../../data/request.reducer';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { RestResponse } from '../../../cache/response.models'; import { RestResponse } from '../../../cache/response.models';
@@ -14,15 +13,16 @@ import { PageInfo } from '../../../shared/page-info.model';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
import { NotificationsBrokerTopicRestService } from './notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from './quality-assurance-topic-rest.service';
import { import {
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../../../../shared/mocks/notifications.mock'; } from '../../../../shared/mocks/notifications.mock';
import {RequestEntry} from '../../../data/request-entry.model';
describe('NotificationsBrokerTopicRestService', () => { describe('QualityAssuranceTopicRestService', () => {
let scheduler: TestScheduler; let scheduler: TestScheduler;
let service: NotificationsBrokerTopicRestService; let service: QualityAssuranceTopicRestService;
let responseCacheEntry: RequestEntry; let responseCacheEntry: RequestEntry;
let requestService: RequestService; let requestService: RequestService;
let rdbService: RemoteDataBuildService; let rdbService: RemoteDataBuildService;
@@ -36,9 +36,9 @@ describe('NotificationsBrokerTopicRestService', () => {
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a'; const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
const pageInfo = new PageInfo(); const pageInfo = new PageInfo();
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ]; const array = [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const brokerTopicObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerTopicObjectMorePid); const brokerTopicObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceTopicObjectMorePid);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
beforeEach(() => { beforeEach(() => {
@@ -72,7 +72,7 @@ describe('NotificationsBrokerTopicRestService', () => {
http = {} as HttpClient; http = {} as HttpClient;
comparator = {} as any; comparator = {} as any;
service = new NotificationsBrokerTopicRestService( service = new QualityAssuranceTopicRestService(
requestService, requestService,
rdbService, rdbService,
objectCache, objectCache,
@@ -96,7 +96,7 @@ describe('NotificationsBrokerTopicRestService', () => {
done(); done();
}); });
it('should return a RemoteData<PaginatedList<NotificationsBrokerTopicObject>> for the object with the given URL', () => { it('should return a RemoteData<PaginatedList<QualityAssuranceTopicObject>> for the object with the given URL', () => {
const result = service.getTopics(); const result = service.getTopics();
const expected = cold('(a)', { const expected = cold('(a)', {
a: paginatedListRD a: paginatedListRD
@@ -107,16 +107,16 @@ describe('NotificationsBrokerTopicRestService', () => {
describe('getTopic', () => { describe('getTopic', () => {
it('should proxy the call to dataservice.findByHref', (done) => { it('should proxy the call to dataservice.findByHref', (done) => {
service.getTopic(notificationsBrokerTopicObjectMorePid.id).subscribe( service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
(res) => { (res) => {
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + notificationsBrokerTopicObjectMorePid.id, true, true); expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + qualityAssuranceTopicObjectMorePid.id, true, true);
} }
); );
done(); done();
}); });
it('should return a RemoteData<NotificationsBrokerTopicObject> for the object with the given URL', () => { it('should return a RemoteData<QualityAssuranceTopicObject> for the object with the given URL', () => {
const result = service.getTopic(notificationsBrokerTopicObjectMorePid.id); const result = service.getTopic(qualityAssuranceTopicObjectMorePid.id);
const expected = cold('(a)', { const expected = cold('(a)', {
a: brokerTopicObjectRD a: brokerTopicObjectRD
}); });

View File

@@ -5,29 +5,29 @@ import { Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { mergeMap, take } from 'rxjs/operators'; import { mergeMap, take } from 'rxjs/operators';
import { CoreState } from '../../../core.reducers';
import { HALEndpointService } from '../../../shared/hal-endpoint.service'; import { HALEndpointService } from '../../../shared/hal-endpoint.service';
import { NotificationsService } from '../../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service';
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../../../cache/object-cache.service'; import { ObjectCacheService } from '../../../cache/object-cache.service';
import { dataService } from '../../../cache/builders/build-decorators'; import { dataService } from '../../../cache/builders/build-decorators';
import { RequestService } from '../../../data/request.service'; import { RequestService } from '../../../data/request.service';
import { FindListOptions } from '../../../data/request.models';
import { DataService } from '../../../data/data.service'; import { DataService } from '../../../data/data.service';
import { ChangeAnalyzer } from '../../../data/change-analyzer'; import { ChangeAnalyzer } from '../../../data/change-analyzer';
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service'; import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
import { RemoteData } from '../../../data/remote-data'; import { RemoteData } from '../../../data/remote-data';
import { NotificationsBrokerTopicObject } from '../models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../models/quality-assurance-topic.model';
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from '../models/notifications-broker-topic-object.resource-type'; import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model'; import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
import { PaginatedList } from '../../../data/paginated-list.model'; import { PaginatedList } from '../../../data/paginated-list.model';
import {CoreState} from '../../../core-state.model';
import {FindListOptions} from '../../../data/find-list-options.model';
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> { class DataServiceImpl extends DataService<QualityAssuranceTopicObject> {
/** /**
* The REST endpoint. * The REST endpoint.
*/ */
@@ -42,7 +42,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {ChangeAnalyzer<NotificationsBrokerTopicObject>} comparator * @param {ChangeAnalyzer<QualityAssuranceTopicObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -52,17 +52,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: ChangeAnalyzer<NotificationsBrokerTopicObject>) { protected comparator: ChangeAnalyzer<QualityAssuranceTopicObject>) {
super(); super();
} }
} }
/** /**
* The service handling all Notifications Broker topic REST requests. * The service handling all Quality Assurance topic REST requests.
*/ */
@Injectable() @Injectable()
@dataService(NOTIFICATIONS_BROKER_TOPIC_OBJECT) @dataService(QUALITY_ASSURANCE_TOPIC_OBJECT)
export class NotificationsBrokerTopicRestService { export class QualityAssuranceTopicRestService {
/** /**
* A private DataService implementation to delegate specific methods to. * A private DataService implementation to delegate specific methods to.
*/ */
@@ -76,7 +76,7 @@ export class NotificationsBrokerTopicRestService {
* @param {HALEndpointService} halService * @param {HALEndpointService} halService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {HttpClient} http * @param {HttpClient} http
* @param {DefaultChangeAnalyzer<NotificationsBrokerTopicObject>} comparator * @param {DefaultChangeAnalyzer<QualityAssuranceTopicObject>} comparator
*/ */
constructor( constructor(
protected requestService: RequestService, protected requestService: RequestService,
@@ -85,21 +85,21 @@ export class NotificationsBrokerTopicRestService {
protected halService: HALEndpointService, protected halService: HALEndpointService,
protected notificationsService: NotificationsService, protected notificationsService: NotificationsService,
protected http: HttpClient, protected http: HttpClient,
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerTopicObject>) { protected comparator: DefaultChangeAnalyzer<QualityAssuranceTopicObject>) {
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator); this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
} }
/** /**
* Return the list of Notifications Broker topics. * Return the list of Quality Assurance topics.
* *
* @param options * @param options
* Find list options object. * Find list options object.
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerTopicObject>>> * @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>
* The list of Notifications Broker topics. * The list of Quality Assurance topics.
*/ */
public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<NotificationsBrokerTopicObject>[]): Observable<RemoteData<PaginatedList<NotificationsBrokerTopicObject>>> { public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>> {
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe( return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
take(1), take(1),
mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)), mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)),
@@ -114,16 +114,16 @@ export class NotificationsBrokerTopicRestService {
} }
/** /**
* Return a single Notifications Broker topic. * Return a single Quality Assurance topic.
* *
* @param id * @param id
* The Notifications Broker topic id * The Quality Assurance topic id
* @param linksToFollow * @param linksToFollow
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved. * List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
* @return Observable<RemoteData<NotificationsBrokerTopicObject>> * @return Observable<RemoteData<QualityAssuranceTopicObject>>
* The Notifications Broker topic. * The Quality Assurance topic.
*/ */
public getTopic(id: string, ...linksToFollow: FollowLinkConfig<NotificationsBrokerTopicObject>[]): Observable<RemoteData<NotificationsBrokerTopicObject>> { public getTopic(id: string, ...linksToFollow: FollowLinkConfig<QualityAssuranceTopicObject>[]): Observable<RemoteData<QualityAssuranceTopicObject>> {
const options = {}; const options = {};
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe( return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
take(1), take(1),

View File

@@ -1,72 +0,0 @@
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model';
import { NotificationsBrokerSourceActionTypes, NotificationsBrokerSourceActions } from './notifications-broker-source.actions';
/**
* The interface representing the Notifications Broker source state.
*/
export interface NotificationsBrokerSourceState {
source: NotificationsBrokerSourceObject[];
processing: boolean;
loaded: boolean;
totalPages: number;
currentPage: number;
totalElements: number;
}
/**
* Used for the Notifications Broker source state initialization.
*/
const notificationsBrokerSourceInitialState: NotificationsBrokerSourceState = {
source: [],
processing: false,
loaded: false,
totalPages: 0,
currentPage: 0,
totalElements: 0
};
/**
* The Notifications Broker Source Reducer
*
* @param state
* the current state initialized with notificationsBrokerSourceInitialState
* @param action
* the action to perform on the state
* @return NotificationsBrokerSourceState
* the new state
*/
export function notificationsBrokerSourceReducer(state = notificationsBrokerSourceInitialState, action: NotificationsBrokerSourceActions): NotificationsBrokerSourceState {
switch (action.type) {
case NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE: {
return Object.assign({}, state, {
source: [],
processing: true
});
}
case NotificationsBrokerSourceActionTypes.ADD_SOURCE: {
return Object.assign({}, state, {
source: action.payload.source,
processing: false,
loaded: true,
totalPages: action.payload.totalPages,
currentPage: state.currentPage,
totalElements: action.payload.totalElements
});
}
case NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR: {
return Object.assign({}, state, {
processing: false,
loaded: true,
totalPages: 0,
currentPage: 0,
totalElements: 0
});
}
default: {
return state;
}
}
}

View File

@@ -1,55 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { find, map } from 'rxjs/operators';
import { NotificationsBrokerSourceRestService } from '../../../core/notifications/broker/source/notifications-broker-source-rest.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { FindListOptions } from '../../../core/data/request.models';
import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model';
/**
* The service handling all Notifications Broker source requests to the REST service.
*/
@Injectable()
export class NotificationsBrokerSourceService {
/**
* Initialize the service variables.
* @param {NotificationsBrokerSourceRestService} notificationsBrokerSourceRestService
*/
constructor(
private notificationsBrokerSourceRestService: NotificationsBrokerSourceRestService
) { }
/**
* Return the list of Notifications Broker source managing pagination and errors.
*
* @param elementsPerPage
* The number of the source per page
* @param currentPage
* The page number to retrieve
* @return Observable<PaginatedList<NotificationsBrokerSourceObject>>
* The list of Notifications Broker source.
*/
public getSources(elementsPerPage, currentPage): Observable<PaginatedList<NotificationsBrokerSourceObject>> {
const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = {
elementsPerPage: elementsPerPage,
currentPage: currentPage,
sort: sortOptions
};
return this.notificationsBrokerSourceRestService.getSources(findListOptions).pipe(
find((rd: RemoteData<PaginatedList<NotificationsBrokerSourceObject>>) => !rd.isResponsePending),
map((rd: RemoteData<PaginatedList<NotificationsBrokerSourceObject>>) => {
if (rd.hasSucceeded) {
return rd.payload;
} else {
throw new Error('Can\'t retrieve Notifications Broker source from the Broker source REST service');
}
})
);
}
}

View File

@@ -1,72 +0,0 @@
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model';
import { NotificationsBrokerTopicActionTypes, NotificationsBrokerTopicsActions } from './notifications-broker-topics.actions';
/**
* The interface representing the Notifications Broker topic state.
*/
export interface NotificationsBrokerTopicState {
topics: NotificationsBrokerTopicObject[];
processing: boolean;
loaded: boolean;
totalPages: number;
currentPage: number;
totalElements: number;
}
/**
* Used for the Notifications Broker topic state initialization.
*/
const notificationsBrokerTopicInitialState: NotificationsBrokerTopicState = {
topics: [],
processing: false,
loaded: false,
totalPages: 0,
currentPage: 0,
totalElements: 0
};
/**
* The Notifications Broker Topic Reducer
*
* @param state
* the current state initialized with notificationsBrokerTopicInitialState
* @param action
* the action to perform on the state
* @return NotificationsBrokerTopicState
* the new state
*/
export function notificationsBrokerTopicsReducer(state = notificationsBrokerTopicInitialState, action: NotificationsBrokerTopicsActions): NotificationsBrokerTopicState {
switch (action.type) {
case NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS: {
return Object.assign({}, state, {
topics: [],
processing: true
});
}
case NotificationsBrokerTopicActionTypes.ADD_TOPICS: {
return Object.assign({}, state, {
topics: action.payload.topics,
processing: false,
loaded: true,
totalPages: action.payload.totalPages,
currentPage: state.currentPage,
totalElements: action.payload.totalElements
});
}
case NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR: {
return Object.assign({}, state, {
processing: false,
loaded: true,
totalPages: 0,
currentPage: 0,
totalElements: 0
});
}
default: {
return state;
}
}
}

View File

@@ -5,15 +5,15 @@ import { cold } from 'jasmine-marbles';
import { notificationsReducers } from './notifications.reducer'; import { notificationsReducers } from './notifications.reducer';
import { NotificationsStateService } from './notifications-state.service'; import { NotificationsStateService } from './notifications-state.service';
import { import {
notificationsBrokerSourceObjectMissingPid, qualityAssuranceSourceObjectMissingPid,
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
notificationsBrokerTopicObjectMissingPid, qualityAssuranceTopicObjectMissingPid,
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../shared/mocks/notifications.mock'; } from '../shared/mocks/notifications.mock';
import { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions'; import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
import { RetrieveAllSourceAction } from './broker/source/notifications-broker-source.actions'; import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
describe('NotificationsStateService', () => { describe('NotificationsStateService', () => {
let service: NotificationsStateService; let service: NotificationsStateService;
@@ -42,9 +42,9 @@ describe('NotificationsStateService', () => {
notifications: { notifications: {
brokerTopic: { brokerTopic: {
topics: [ topics: [
notificationsBrokerTopicObjectMorePid, qualityAssuranceTopicObjectMorePid,
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMissingPid qualityAssuranceTopicObjectMissingPid
], ],
processing: false, processing: false,
loaded: true, loaded: true,
@@ -79,9 +79,9 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('getNotificationsBrokerTopics', () => { describe('getQualityAssuranceTopics', () => {
it('Should return an empty array', () => { it('Should return an empty array', () => {
const result = service.getNotificationsBrokerTopics(); const result = service.getQualityAssuranceTopics();
const expected = cold('(a)', { const expected = cold('(a)', {
a: [] a: []
}); });
@@ -89,9 +89,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerTopicsTotalPages', () => { describe('getQualityAssuranceTopicsTotalPages', () => {
it('Should return zero (0)', () => { it('Should return zero (0)', () => {
const result = service.getNotificationsBrokerTopicsTotalPages(); const result = service.getQualityAssuranceTopicsTotalPages();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -99,9 +99,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerTopicsCurrentPage', () => { describe('getQualityAssuranceTopicsCurrentPage', () => {
it('Should return minus one (0)', () => { it('Should return minus one (0)', () => {
const result = service.getNotificationsBrokerTopicsCurrentPage(); const result = service.getQualityAssuranceTopicsCurrentPage();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -109,9 +109,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerTopicsTotals', () => { describe('getQualityAssuranceTopicsTotals', () => {
it('Should return zero (0)', () => { it('Should return zero (0)', () => {
const result = service.getNotificationsBrokerTopicsTotals(); const result = service.getQualityAssuranceTopicsTotals();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -119,9 +119,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsLoading', () => { describe('isQualityAssuranceTopicsLoading', () => {
it('Should return TRUE', () => { it('Should return TRUE', () => {
const result = service.isNotificationsBrokerTopicsLoading(); const result = service.isQualityAssuranceTopicsLoading();
const expected = cold('(a)', { const expected = cold('(a)', {
a: true a: true
}); });
@@ -129,9 +129,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsLoaded', () => { describe('isQualityAssuranceTopicsLoaded', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerTopicsLoaded(); const result = service.isQualityAssuranceTopicsLoaded();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -139,9 +139,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsProcessing', () => { describe('isQualityAssuranceTopicsProcessing', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerTopicsProcessing(); const result = service.isQualityAssuranceTopicsProcessing();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -171,23 +171,23 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('getNotificationsBrokerTopics', () => { describe('getQualityAssuranceTopics', () => {
it('Should return an array of topics', () => { it('Should return an array of topics', () => {
const result = service.getNotificationsBrokerTopics(); const result = service.getQualityAssuranceTopics();
const expected = cold('(a)', { const expected = cold('(a)', {
a: [ a: [
notificationsBrokerTopicObjectMorePid, qualityAssuranceTopicObjectMorePid,
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMissingPid qualityAssuranceTopicObjectMissingPid
] ]
}); });
expect(result).toBeObservable(expected); expect(result).toBeObservable(expected);
}); });
}); });
describe('getNotificationsBrokerTopicsTotalPages', () => { describe('getQualityAssuranceTopicsTotalPages', () => {
it('Should return one (1)', () => { it('Should return one (1)', () => {
const result = service.getNotificationsBrokerTopicsTotalPages(); const result = service.getQualityAssuranceTopicsTotalPages();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 1 a: 1
}); });
@@ -195,9 +195,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerTopicsCurrentPage', () => { describe('getQualityAssuranceTopicsCurrentPage', () => {
it('Should return minus zero (1)', () => { it('Should return minus zero (1)', () => {
const result = service.getNotificationsBrokerTopicsCurrentPage(); const result = service.getQualityAssuranceTopicsCurrentPage();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 1 a: 1
}); });
@@ -205,9 +205,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerTopicsTotals', () => { describe('getQualityAssuranceTopicsTotals', () => {
it('Should return three (3)', () => { it('Should return three (3)', () => {
const result = service.getNotificationsBrokerTopicsTotals(); const result = service.getQualityAssuranceTopicsTotals();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 3 a: 3
}); });
@@ -215,9 +215,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsLoading', () => { describe('isQualityAssuranceTopicsLoading', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerTopicsLoading(); const result = service.isQualityAssuranceTopicsLoading();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -225,9 +225,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsLoaded', () => { describe('isQualityAssuranceTopicsLoaded', () => {
it('Should return TRUE', () => { it('Should return TRUE', () => {
const result = service.isNotificationsBrokerTopicsLoaded(); const result = service.isQualityAssuranceTopicsLoaded();
const expected = cold('(a)', { const expected = cold('(a)', {
a: true a: true
}); });
@@ -235,9 +235,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerTopicsProcessing', () => { describe('isQualityAssuranceTopicsProcessing', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerTopicsProcessing(); const result = service.isQualityAssuranceTopicsProcessing();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -267,12 +267,12 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('dispatchRetrieveNotificationsBrokerTopics', () => { describe('dispatchRetrieveQualityAssuranceTopics', () => {
it('Should call store.dispatch', () => { it('Should call store.dispatch', () => {
const elementsPerPage = 3; const elementsPerPage = 3;
const currentPage = 1; const currentPage = 1;
const action = new RetrieveAllTopicsAction(elementsPerPage, currentPage); const action = new RetrieveAllTopicsAction(elementsPerPage, currentPage);
service.dispatchRetrieveNotificationsBrokerTopics(elementsPerPage, currentPage); service.dispatchRetrieveQualityAssuranceTopics(elementsPerPage, currentPage);
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action); expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
}); });
}); });
@@ -300,9 +300,9 @@ describe('NotificationsStateService', () => {
notifications: { notifications: {
brokerSource: { brokerSource: {
source: [ source: [
notificationsBrokerSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMissingPid qualityAssuranceSourceObjectMissingPid
], ],
processing: false, processing: false,
loaded: true, loaded: true,
@@ -337,9 +337,9 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('getNotificationsBrokerSource', () => { describe('getQualityAssuranceSource', () => {
it('Should return an empty array', () => { it('Should return an empty array', () => {
const result = service.getNotificationsBrokerSource(); const result = service.getQualityAssuranceSource();
const expected = cold('(a)', { const expected = cold('(a)', {
a: [] a: []
}); });
@@ -347,9 +347,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerSourceTotalPages', () => { describe('getQualityAssuranceSourceTotalPages', () => {
it('Should return zero (0)', () => { it('Should return zero (0)', () => {
const result = service.getNotificationsBrokerSourceTotalPages(); const result = service.getQualityAssuranceSourceTotalPages();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -357,9 +357,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerSourcesCurrentPage', () => { describe('getQualityAssuranceSourcesCurrentPage', () => {
it('Should return minus one (0)', () => { it('Should return minus one (0)', () => {
const result = service.getNotificationsBrokerSourceCurrentPage(); const result = service.getQualityAssuranceSourceCurrentPage();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -367,9 +367,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerSourceTotals', () => { describe('getQualityAssuranceSourceTotals', () => {
it('Should return zero (0)', () => { it('Should return zero (0)', () => {
const result = service.getNotificationsBrokerSourceTotals(); const result = service.getQualityAssuranceSourceTotals();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 0 a: 0
}); });
@@ -377,9 +377,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceLoading', () => { describe('isQualityAssuranceSourceLoading', () => {
it('Should return TRUE', () => { it('Should return TRUE', () => {
const result = service.isNotificationsBrokerSourceLoading(); const result = service.isQualityAssuranceSourceLoading();
const expected = cold('(a)', { const expected = cold('(a)', {
a: true a: true
}); });
@@ -387,9 +387,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceLoaded', () => { describe('isQualityAssuranceSourceLoaded', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerSourceLoaded(); const result = service.isQualityAssuranceSourceLoaded();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -397,9 +397,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceProcessing', () => { describe('isQualityAssuranceSourceProcessing', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerSourceProcessing(); const result = service.isQualityAssuranceSourceProcessing();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -429,23 +429,23 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('getNotificationsBrokerSource', () => { describe('getQualityAssuranceSource', () => {
it('Should return an array of Source', () => { it('Should return an array of Source', () => {
const result = service.getNotificationsBrokerSource(); const result = service.getQualityAssuranceSource();
const expected = cold('(a)', { const expected = cold('(a)', {
a: [ a: [
notificationsBrokerSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMissingPid qualityAssuranceSourceObjectMissingPid
] ]
}); });
expect(result).toBeObservable(expected); expect(result).toBeObservable(expected);
}); });
}); });
describe('getNotificationsBrokerSourceTotalPages', () => { describe('getQualityAssuranceSourceTotalPages', () => {
it('Should return one (1)', () => { it('Should return one (1)', () => {
const result = service.getNotificationsBrokerSourceTotalPages(); const result = service.getQualityAssuranceSourceTotalPages();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 1 a: 1
}); });
@@ -453,9 +453,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerSourceCurrentPage', () => { describe('getQualityAssuranceSourceCurrentPage', () => {
it('Should return minus zero (1)', () => { it('Should return minus zero (1)', () => {
const result = service.getNotificationsBrokerSourceCurrentPage(); const result = service.getQualityAssuranceSourceCurrentPage();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 1 a: 1
}); });
@@ -463,9 +463,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('getNotificationsBrokerSourceTotals', () => { describe('getQualityAssuranceSourceTotals', () => {
it('Should return three (3)', () => { it('Should return three (3)', () => {
const result = service.getNotificationsBrokerSourceTotals(); const result = service.getQualityAssuranceSourceTotals();
const expected = cold('(a)', { const expected = cold('(a)', {
a: 3 a: 3
}); });
@@ -473,9 +473,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceLoading', () => { describe('isQualityAssuranceSourceLoading', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerSourceLoading(); const result = service.isQualityAssuranceSourceLoading();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -483,9 +483,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceLoaded', () => { describe('isQualityAssuranceSourceLoaded', () => {
it('Should return TRUE', () => { it('Should return TRUE', () => {
const result = service.isNotificationsBrokerSourceLoaded(); const result = service.isQualityAssuranceSourceLoaded();
const expected = cold('(a)', { const expected = cold('(a)', {
a: true a: true
}); });
@@ -493,9 +493,9 @@ describe('NotificationsStateService', () => {
}); });
}); });
describe('isNotificationsBrokerSourceProcessing', () => { describe('isQualityAssuranceSourceProcessing', () => {
it('Should return FALSE', () => { it('Should return FALSE', () => {
const result = service.isNotificationsBrokerSourceProcessing(); const result = service.isQualityAssuranceSourceProcessing();
const expected = cold('(a)', { const expected = cold('(a)', {
a: false a: false
}); });
@@ -525,12 +525,12 @@ describe('NotificationsStateService', () => {
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');
}); });
describe('dispatchRetrieveNotificationsBrokerSource', () => { describe('dispatchRetrieveQualityAssuranceSource', () => {
it('Should call store.dispatch', () => { it('Should call store.dispatch', () => {
const elementsPerPage = 3; const elementsPerPage = 3;
const currentPage = 1; const currentPage = 1;
const action = new RetrieveAllSourceAction(elementsPerPage, currentPage); const action = new RetrieveAllSourceAction(elementsPerPage, currentPage);
service.dispatchRetrieveNotificationsBrokerSource(elementsPerPage, currentPage); service.dispatchRetrieveQualityAssuranceSource(elementsPerPage, currentPage);
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action); expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
}); });
}); });

View File

@@ -3,24 +3,24 @@ import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { import {
getNotificationsBrokerTopicsCurrentPageSelector, getQualityAssuranceTopicsCurrentPageSelector,
getNotificationsBrokerTopicsTotalPagesSelector, getQualityAssuranceTopicsTotalPagesSelector,
getNotificationsBrokerTopicsTotalsSelector, getQualityAssuranceTopicsTotalsSelector,
isNotificationsBrokerTopicsLoadedSelector, isQualityAssuranceTopicsLoadedSelector,
notificationsBrokerTopicsObjectSelector, qualityAssuranceTopicsObjectSelector,
isNotificationsBrokerTopicsProcessingSelector, isQualityAssuranceTopicsProcessingSelector,
notificationsBrokerSourceObjectSelector, qualityAssuranceSourceObjectSelector,
isNotificationsBrokerSourceLoadedSelector, isQualityAssuranceSourceLoadedSelector,
isNotificationsBrokerSourceProcessingSelector, isQualityAssuranceSourceProcessingSelector,
getNotificationsBrokerSourceTotalPagesSelector, getQualityAssuranceSourceTotalPagesSelector,
getNotificationsBrokerSourceCurrentPageSelector, getQualityAssuranceSourceCurrentPageSelector,
getNotificationsBrokerSourceTotalsSelector getQualityAssuranceSourceTotalsSelector
} from './selectors'; } from './selectors';
import { NotificationsBrokerTopicObject } from '../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
import { NotificationsState } from './notifications.reducer'; import { NotificationsState } from './notifications.reducer';
import { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions'; import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
import { NotificationsBrokerSourceObject } from '../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
import { RetrieveAllSourceAction } from './broker/source/notifications-broker-source.actions'; import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
/** /**
* The service handling the Notifications State. * The service handling the Notifications State.
@@ -34,179 +34,179 @@ export class NotificationsStateService {
*/ */
constructor(private store: Store<NotificationsState>) { } constructor(private store: Store<NotificationsState>) { }
// Notifications Broker topics // Quality Assurance topics
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Returns the list of Notifications Broker topics from the state. * Returns the list of Quality Assurance topics from the state.
* *
* @return Observable<NotificationsBrokerTopicObject> * @return Observable<QualityAssuranceTopicObject>
* The list of Notifications Broker topics. * The list of Quality Assurance topics.
*/ */
public getNotificationsBrokerTopics(): Observable<NotificationsBrokerTopicObject[]> { public getQualityAssuranceTopics(): Observable<QualityAssuranceTopicObject[]> {
return this.store.pipe(select(notificationsBrokerTopicsObjectSelector())); return this.store.pipe(select(qualityAssuranceTopicsObjectSelector()));
} }
/** /**
* Returns the information about the loading status of the Notifications Broker topics (if it's running or not). * Returns the information about the loading status of the Quality Assurance topics (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the topics are loading, 'false' otherwise. * 'true' if the topics are loading, 'false' otherwise.
*/ */
public isNotificationsBrokerTopicsLoading(): Observable<boolean> { public isQualityAssuranceTopicsLoading(): Observable<boolean> {
return this.store.pipe( return this.store.pipe(
select(isNotificationsBrokerTopicsLoadedSelector), select(isQualityAssuranceTopicsLoadedSelector),
map((loaded: boolean) => !loaded) map((loaded: boolean) => !loaded)
); );
} }
/** /**
* Returns the information about the loading status of the Notifications Broker topics (whether or not they were loaded). * Returns the information about the loading status of the Quality Assurance topics (whether or not they were loaded).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the topics are loaded, 'false' otherwise. * 'true' if the topics are loaded, 'false' otherwise.
*/ */
public isNotificationsBrokerTopicsLoaded(): Observable<boolean> { public isQualityAssuranceTopicsLoaded(): Observable<boolean> {
return this.store.pipe(select(isNotificationsBrokerTopicsLoadedSelector)); return this.store.pipe(select(isQualityAssuranceTopicsLoadedSelector));
} }
/** /**
* Returns the information about the processing status of the Notifications Broker topics (if it's running or not). * Returns the information about the processing status of the Quality Assurance topics (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise. * 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
*/ */
public isNotificationsBrokerTopicsProcessing(): Observable<boolean> { public isQualityAssuranceTopicsProcessing(): Observable<boolean> {
return this.store.pipe(select(isNotificationsBrokerTopicsProcessingSelector)); return this.store.pipe(select(isQualityAssuranceTopicsProcessingSelector));
} }
/** /**
* Returns, from the state, the total available pages of the Notifications Broker topics. * Returns, from the state, the total available pages of the Quality Assurance topics.
* *
* @return Observable<number> * @return Observable<number>
* The number of the Notifications Broker topics pages. * The number of the Quality Assurance topics pages.
*/ */
public getNotificationsBrokerTopicsTotalPages(): Observable<number> { public getQualityAssuranceTopicsTotalPages(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerTopicsTotalPagesSelector)); return this.store.pipe(select(getQualityAssuranceTopicsTotalPagesSelector));
} }
/** /**
* Returns the current page of the Notifications Broker topics, from the state. * Returns the current page of the Quality Assurance topics, from the state.
* *
* @return Observable<number> * @return Observable<number>
* The number of the current Notifications Broker topics page. * The number of the current Quality Assurance topics page.
*/ */
public getNotificationsBrokerTopicsCurrentPage(): Observable<number> { public getQualityAssuranceTopicsCurrentPage(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerTopicsCurrentPageSelector)); return this.store.pipe(select(getQualityAssuranceTopicsCurrentPageSelector));
} }
/** /**
* Returns the total number of the Notifications Broker topics. * Returns the total number of the Quality Assurance topics.
* *
* @return Observable<number> * @return Observable<number>
* The number of the Notifications Broker topics. * The number of the Quality Assurance topics.
*/ */
public getNotificationsBrokerTopicsTotals(): Observable<number> { public getQualityAssuranceTopicsTotals(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerTopicsTotalsSelector)); return this.store.pipe(select(getQualityAssuranceTopicsTotalsSelector));
} }
/** /**
* Dispatch a request to change the Notifications Broker topics state, retrieving the topics from the server. * Dispatch a request to change the Quality Assurance topics state, retrieving the topics from the server.
* *
* @param elementsPerPage * @param elementsPerPage
* The number of the topics per page. * The number of the topics per page.
* @param currentPage * @param currentPage
* The number of the current page. * The number of the current page.
*/ */
public dispatchRetrieveNotificationsBrokerTopics(elementsPerPage: number, currentPage: number): void { public dispatchRetrieveQualityAssuranceTopics(elementsPerPage: number, currentPage: number): void {
this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage)); this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage));
} }
// Notifications Broker source // Quality Assurance source
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Returns the list of Notifications Broker source from the state. * Returns the list of Quality Assurance source from the state.
* *
* @return Observable<NotificationsBrokerSourceObject> * @return Observable<QualityAssuranceSourceObject>
* The list of Notifications Broker source. * The list of Quality Assurance source.
*/ */
public getNotificationsBrokerSource(): Observable<NotificationsBrokerSourceObject[]> { public getQualityAssuranceSource(): Observable<QualityAssuranceSourceObject[]> {
return this.store.pipe(select(notificationsBrokerSourceObjectSelector())); return this.store.pipe(select(qualityAssuranceSourceObjectSelector()));
} }
/** /**
* Returns the information about the loading status of the Notifications Broker source (if it's running or not). * Returns the information about the loading status of the Quality Assurance source (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the source are loading, 'false' otherwise. * 'true' if the source are loading, 'false' otherwise.
*/ */
public isNotificationsBrokerSourceLoading(): Observable<boolean> { public isQualityAssuranceSourceLoading(): Observable<boolean> {
return this.store.pipe( return this.store.pipe(
select(isNotificationsBrokerSourceLoadedSelector), select(isQualityAssuranceSourceLoadedSelector),
map((loaded: boolean) => !loaded) map((loaded: boolean) => !loaded)
); );
} }
/** /**
* Returns the information about the loading status of the Notifications Broker source (whether or not they were loaded). * Returns the information about the loading status of the Quality Assurance source (whether or not they were loaded).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the source are loaded, 'false' otherwise. * 'true' if the source are loaded, 'false' otherwise.
*/ */
public isNotificationsBrokerSourceLoaded(): Observable<boolean> { public isQualityAssuranceSourceLoaded(): Observable<boolean> {
return this.store.pipe(select(isNotificationsBrokerSourceLoadedSelector)); return this.store.pipe(select(isQualityAssuranceSourceLoadedSelector));
} }
/** /**
* Returns the information about the processing status of the Notifications Broker source (if it's running or not). * Returns the information about the processing status of the Quality Assurance source (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise. * 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise.
*/ */
public isNotificationsBrokerSourceProcessing(): Observable<boolean> { public isQualityAssuranceSourceProcessing(): Observable<boolean> {
return this.store.pipe(select(isNotificationsBrokerSourceProcessingSelector)); return this.store.pipe(select(isQualityAssuranceSourceProcessingSelector));
} }
/** /**
* Returns, from the state, the total available pages of the Notifications Broker source. * Returns, from the state, the total available pages of the Quality Assurance source.
* *
* @return Observable<number> * @return Observable<number>
* The number of the Notifications Broker source pages. * The number of the Quality Assurance source pages.
*/ */
public getNotificationsBrokerSourceTotalPages(): Observable<number> { public getQualityAssuranceSourceTotalPages(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerSourceTotalPagesSelector)); return this.store.pipe(select(getQualityAssuranceSourceTotalPagesSelector));
} }
/** /**
* Returns the current page of the Notifications Broker source, from the state. * Returns the current page of the Quality Assurance source, from the state.
* *
* @return Observable<number> * @return Observable<number>
* The number of the current Notifications Broker source page. * The number of the current Quality Assurance source page.
*/ */
public getNotificationsBrokerSourceCurrentPage(): Observable<number> { public getQualityAssuranceSourceCurrentPage(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerSourceCurrentPageSelector)); return this.store.pipe(select(getQualityAssuranceSourceCurrentPageSelector));
} }
/** /**
* Returns the total number of the Notifications Broker source. * Returns the total number of the Quality Assurance source.
* *
* @return Observable<number> * @return Observable<number>
* The number of the Notifications Broker source. * The number of the Quality Assurance source.
*/ */
public getNotificationsBrokerSourceTotals(): Observable<number> { public getQualityAssuranceSourceTotals(): Observable<number> {
return this.store.pipe(select(getNotificationsBrokerSourceTotalsSelector)); return this.store.pipe(select(getQualityAssuranceSourceTotalsSelector));
} }
/** /**
* Dispatch a request to change the Notifications Broker source state, retrieving the source from the server. * Dispatch a request to change the Quality Assurance source state, retrieving the source from the server.
* *
* @param elementsPerPage * @param elementsPerPage
* The number of the source per page. * The number of the source per page.
* @param currentPage * @param currentPage
* The number of the current page. * The number of the current page.
*/ */
public dispatchRetrieveNotificationsBrokerSource(elementsPerPage: number, currentPage: number): void { public dispatchRetrieveQualityAssuranceSource(elementsPerPage: number, currentPage: number): void {
this.store.dispatch(new RetrieveAllSourceAction(elementsPerPage, currentPage)); this.store.dispatch(new RetrieveAllSourceAction(elementsPerPage, currentPage));
} }
} }

View File

@@ -1,7 +1,7 @@
import { NotificationsBrokerSourceEffects } from './broker/source/notifications-broker-source.effects'; import { QualityAssuranceSourceEffects } from './qa/source/quality-assurance-source.effects';
import { NotificationsBrokerTopicsEffects } from './broker/topics/notifications-broker-topics.effects'; import { QualityAssuranceTopicsEffects } from './qa/topics/quality-assurance-topics.effects';
export const notificationsEffects = [ export const notificationsEffects = [
NotificationsBrokerTopicsEffects, QualityAssuranceTopicsEffects,
NotificationsBrokerSourceEffects QualityAssuranceSourceEffects
]; ];

View File

@@ -6,20 +6,20 @@ import { EffectsModule } from '@ngrx/effects';
import { CoreModule } from '../core/core.module'; import { CoreModule } from '../core/core.module';
import { SharedModule } from '../shared/shared.module'; import { SharedModule } from '../shared/shared.module';
import { storeModuleConfig } from '../app.reducer'; import { storeModuleConfig } from '../app.reducer';
import { NotificationsBrokerTopicsComponent } from './broker/topics/notifications-broker-topics.component'; import { QualityAssuranceTopicsComponent } from './qa/topics/quality-assurance-topics.component';
import { NotificationsBrokerEventsComponent } from './broker/events/notifications-broker-events.component'; import { QualityAssuranceEventsComponent } from './qa/events/quality-assurance-events.component';
import { NotificationsStateService } from './notifications-state.service'; import { NotificationsStateService } from './notifications-state.service';
import { notificationsReducers, NotificationsState } from './notifications.reducer'; import { notificationsReducers, NotificationsState } from './notifications.reducer';
import { notificationsEffects } from './notifications.effects'; import { notificationsEffects } from './notifications.effects';
import { NotificationsBrokerTopicsService } from './broker/topics/notifications-broker-topics.service'; import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
import { NotificationsBrokerTopicRestService } from '../core/notifications/broker/topics/notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from '../core/notifications/qa/topics/quality-assurance-topic-rest.service';
import { NotificationsBrokerEventRestService } from '../core/notifications/broker/events/notifications-broker-event-rest.service'; import { QualityAssuranceEventRestService } from '../core/notifications/qa/events/quality-assurance-event-rest.service';
import { ProjectEntryImportModalComponent } from './broker/project-entry-import-modal/project-entry-import-modal.component'; import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { SearchModule } from '../shared/search/search.module'; import { SearchModule } from '../shared/search/search.module';
import { NotificationsBrokerSourceComponent } from './broker/source/notifications-broker-source.component'; import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component';
import { NotificationsBrokerSourceService } from './broker/source/notifications-broker-source.service'; import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service';
import { NotificationsBrokerSourceRestService } from '../core/notifications/broker/source/notifications-broker-source-rest.service'; import { QualityAssuranceSourceRestService } from '../core/notifications/qa/source/quality-assurance-source-rest.service';
const MODULES = [ const MODULES = [
CommonModule, CommonModule,
@@ -31,9 +31,9 @@ const MODULES = [
]; ];
const COMPONENTS = [ const COMPONENTS = [
NotificationsBrokerTopicsComponent, QualityAssuranceTopicsComponent,
NotificationsBrokerEventsComponent, QualityAssuranceEventsComponent,
NotificationsBrokerSourceComponent QualityAssuranceSourceComponent
]; ];
const DIRECTIVES = [ ]; const DIRECTIVES = [ ];
@@ -44,11 +44,11 @@ const ENTRY_COMPONENTS = [
const PROVIDERS = [ const PROVIDERS = [
NotificationsStateService, NotificationsStateService,
NotificationsBrokerTopicsService, QualityAssuranceTopicsService,
NotificationsBrokerSourceService, QualityAssuranceSourceService,
NotificationsBrokerTopicRestService, QualityAssuranceTopicRestService,
NotificationsBrokerSourceRestService, QualityAssuranceSourceRestService,
NotificationsBrokerEventRestService QualityAssuranceEventRestService
]; ];
@NgModule({ @NgModule({

View File

@@ -1,18 +1,18 @@
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store'; import { ActionReducerMap, createFeatureSelector } from '@ngrx/store';
import { notificationsBrokerSourceReducer, NotificationsBrokerSourceState } from './broker/source/notifications-broker-source.reducer'; import { qualityAssuranceSourceReducer, QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState, } from './broker/topics/notifications-broker-topics.reducer'; import { qualityAssuranceTopicsReducer, QualityAssuranceTopicState, } from './qa/topics/quality-assurance-topics.reducer';
/** /**
* The OpenAIRE State * The OpenAIRE State
*/ */
export interface NotificationsState { export interface NotificationsState {
'brokerTopic': NotificationsBrokerTopicState; 'brokerTopic': QualityAssuranceTopicState;
'brokerSource': NotificationsBrokerSourceState; 'brokerSource': QualityAssuranceSourceState;
} }
export const notificationsReducers: ActionReducerMap<NotificationsState> = { export const notificationsReducers: ActionReducerMap<NotificationsState> = {
brokerTopic: notificationsBrokerTopicsReducer, brokerTopic: qualityAssuranceTopicsReducer,
brokerSource: notificationsBrokerSourceReducer brokerSource: qualityAssuranceSourceReducer
}; };
export const notificationsSelector = createFeatureSelector<NotificationsState>('notifications'); export const notificationsSelector = createFeatureSelector<NotificationsState>('notifications');

View File

@@ -4,7 +4,7 @@
<h2 class="border-bottom pb-2">{{'notifications.events.title'| translate}}</h2> <h2 class="border-bottom pb-2">{{'notifications.events.title'| translate}}</h2>
<p>{{'notifications.broker.events.description'| translate}}</p> <p>{{'notifications.broker.events.description'| translate}}</p>
<p> <p>
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/notifications-broker']"> <a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/quality-assurance']">
<i class="fas fa-angle-double-left"></i> <i class="fas fa-angle-double-left"></i>
{{'notifications.broker.events.back' | translate}} {{'notifications.broker.events.back' | translate}}
</a> </a>
@@ -23,7 +23,7 @@
[paginationOptions]="paginationConfig" [paginationOptions]="paginationConfig"
[collectionSize]="(totalElements$ | async)" [collectionSize]="(totalElements$ | async)"
[sortOptions]="paginationSortConfig" [sortOptions]="paginationSortConfig"
(paginationChange)="getNotificationsBrokerEvents()"> (paginationChange)="getQualityAssuranceEvents()">
<ds-loading class="container" *ngIf="(isEventLoading | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading> <ds-loading class="container" *ngIf="(isEventLoading | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
<ng-container *ngIf="!(isEventLoading | async)"> <ng-container *ngIf="!(isEventLoading | async)">
@@ -140,7 +140,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/notifications-broker']"> <a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/quality-assurance']">
<i class="fas fa-angle-double-left"></i> <i class="fas fa-angle-double-left"></i>
{{'notifications.broker.events.back' | translate}} {{'notifications.broker.events.back' | translate}}
</a> </a>

View File

@@ -5,15 +5,15 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service'; import { QualityAssuranceEventRestService } from '../../../core/notifications/qa/events/quality-assurance-event-rest.service';
import { NotificationsBrokerEventsComponent } from './notifications-broker-events.component'; import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
import { import {
getMockNotificationsBrokerEventRestService, getMockQualityAssuranceEventRestService,
ItemMockPid10, ItemMockPid10,
ItemMockPid8, ItemMockPid8,
ItemMockPid9, ItemMockPid9,
notificationsBrokerEventObjectMissingProjectFound, qualityAssuranceEventObjectMissingProjectFound,
notificationsBrokerEventObjectMissingProjectNotFound, qualityAssuranceEventObjectMissingProjectNotFound,
NotificationsMockDspaceObject NotificationsMockDspaceObject
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub'; import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
@@ -22,8 +22,8 @@ import { getMockTranslateService } from '../../../shared/mocks/translate.service
import { createTestComponent } from '../../../shared/testing/utils.test'; import { createTestComponent } from '../../../shared/testing/utils.test';
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub'; import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { NotificationsBrokerEventObject } from '../../../core/notifications/broker/models/notifications-broker-event.model'; import { QualityAssuranceEventObject } from '../../../core/notifications/qa/models/quality-assurance-event.model';
import { NotificationsBrokerEventData } from '../project-entry-import-modal/project-entry-import-modal.component'; import { QualityAssuranceEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
import { TestScheduler } from 'rxjs/testing'; import { TestScheduler } from 'rxjs/testing';
import { getTestScheduler } from 'jasmine-marbles'; import { getTestScheduler } from 'jasmine-marbles';
import { followLink } from '../../../shared/utils/follow-link-config.model'; import { followLink } from '../../../shared/utils/follow-link-config.model';
@@ -34,14 +34,14 @@ import {
createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject,
createSuccessfulRemoteDataObject$ createSuccessfulRemoteDataObject$
} from '../../../shared/remote-data.utils'; } from '../../../shared/remote-data.utils';
import { FindListOptions } from '../../../core/data/request.models';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub'; import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
import {FindListOptions} from '../../../core/data/find-list-options.model';
describe('NotificationsBrokerEventsComponent test suite', () => { describe('QualityAssuranceEventsComponent test suite', () => {
let fixture: ComponentFixture<NotificationsBrokerEventsComponent>; let fixture: ComponentFixture<QualityAssuranceEventsComponent>;
let comp: NotificationsBrokerEventsComponent; let comp: QualityAssuranceEventsComponent;
let compAsAny: any; let compAsAny: any;
let scheduler: TestScheduler; let scheduler: TestScheduler;
@@ -50,9 +50,9 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
close: () => null, close: () => null,
dismiss: () => null dismiss: () => null
}; };
const notificationsBrokerEventRestServiceStub: any = getMockNotificationsBrokerEventRestService(); const qualityAssuranceEventRestServiceStub: any = getMockQualityAssuranceEventRestService();
const activatedRouteParams = { const activatedRouteParams = {
notificationsBrokerEventsParams: { qualityAssuranceEventsParams: {
currentPage: 0, currentPage: 0,
pageSize: 10 pageSize: 10
} }
@@ -61,19 +61,19 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
id: 'ENRICH!MISSING!PROJECT' id: 'ENRICH!MISSING!PROJECT'
}; };
const events: NotificationsBrokerEventObject[] = [ const events: QualityAssuranceEventObject[] = [
notificationsBrokerEventObjectMissingProjectFound, qualityAssuranceEventObjectMissingProjectFound,
notificationsBrokerEventObjectMissingProjectNotFound qualityAssuranceEventObjectMissingProjectNotFound
]; ];
const paginationService = new PaginationServiceStub(); const paginationService = new PaginationServiceStub();
function getNotificationsBrokerEventData1(): NotificationsBrokerEventData { function getQualityAssuranceEventData1(): QualityAssuranceEventData {
return { return {
event: notificationsBrokerEventObjectMissingProjectFound, event: qualityAssuranceEventObjectMissingProjectFound,
id: notificationsBrokerEventObjectMissingProjectFound.id, id: qualityAssuranceEventObjectMissingProjectFound.id,
title: notificationsBrokerEventObjectMissingProjectFound.title, title: qualityAssuranceEventObjectMissingProjectFound.title,
hasProject: true, hasProject: true,
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title, projectTitle: qualityAssuranceEventObjectMissingProjectFound.message.title,
projectId: ItemMockPid10.id, projectId: ItemMockPid10.id,
handle: ItemMockPid10.handle, handle: ItemMockPid10.handle,
reason: null, reason: null,
@@ -82,11 +82,11 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
}; };
} }
function getNotificationsBrokerEventData2(): NotificationsBrokerEventData { function getQualityAssuranceEventData2(): QualityAssuranceEventData {
return { return {
event: notificationsBrokerEventObjectMissingProjectNotFound, event: qualityAssuranceEventObjectMissingProjectNotFound,
id: notificationsBrokerEventObjectMissingProjectNotFound.id, id: qualityAssuranceEventObjectMissingProjectNotFound.id,
title: notificationsBrokerEventObjectMissingProjectNotFound.title, title: qualityAssuranceEventObjectMissingProjectNotFound.title,
hasProject: false, hasProject: false,
projectTitle: null, projectTitle: null,
projectId: null, projectId: null,
@@ -104,17 +104,17 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
TranslateModule.forRoot(), TranslateModule.forRoot(),
], ],
declarations: [ declarations: [
NotificationsBrokerEventsComponent, QualityAssuranceEventsComponent,
TestComponent, TestComponent,
], ],
providers: [ providers: [
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
{ provide: NotificationsBrokerEventRestService, useValue: notificationsBrokerEventRestServiceStub }, { provide: QualityAssuranceEventRestService, useValue: qualityAssuranceEventRestServiceStub },
{ provide: NgbModal, useValue: modalStub }, { provide: NgbModal, useValue: modalStub },
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: NotificationsService, useValue: new NotificationsServiceStub() },
{ provide: TranslateService, useValue: getMockTranslateService() }, { provide: TranslateService, useValue: getMockTranslateService() },
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
NotificationsBrokerEventsComponent QualityAssuranceEventsComponent
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(); }).compileComponents().then();
@@ -129,7 +129,7 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
// synchronous beforeEach // synchronous beforeEach
beforeEach(() => { beforeEach(() => {
const html = ` const html = `
<ds-notifications-broker-event></ds-notifications-broker-event>`; <ds-quality-assurance-event></ds-quality-assurance-event>`;
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>; testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance; testComp = testFixture.componentInstance;
}); });
@@ -138,14 +138,14 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
testFixture.destroy(); testFixture.destroy();
}); });
it('should create NotificationsBrokerEventsComponent', inject([NotificationsBrokerEventsComponent], (app: NotificationsBrokerEventsComponent) => { it('should create QualityAssuranceEventsComponent', inject([QualityAssuranceEventsComponent], (app: QualityAssuranceEventsComponent) => {
expect(app).toBeDefined(); expect(app).toBeDefined();
})); }));
}); });
describe('Main tests', () => { describe('Main tests', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(NotificationsBrokerEventsComponent); fixture = TestBed.createComponent(QualityAssuranceEventsComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
}); });
@@ -159,8 +159,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
describe('setEventUpdated', () => { describe('setEventUpdated', () => {
it('should update events', () => { it('should update events', () => {
const expected = [ const expected = [
getNotificationsBrokerEventData1(), getQualityAssuranceEventData1(),
getNotificationsBrokerEventData2() getQualityAssuranceEventData2()
]; ];
scheduler.schedule(() => { scheduler.schedule(() => {
compAsAny.setEventUpdated(events); compAsAny.setEventUpdated(events);
@@ -179,14 +179,14 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
it('should call executeAction if a project is present', () => { it('should call executeAction if a project is present', () => {
const action = 'ACCEPTED'; const action = 'ACCEPTED';
comp.modalChoice(action, getNotificationsBrokerEventData1(), modalStub); comp.modalChoice(action, getQualityAssuranceEventData1(), modalStub);
expect(comp.executeAction).toHaveBeenCalledWith(action, getNotificationsBrokerEventData1()); expect(comp.executeAction).toHaveBeenCalledWith(action, getQualityAssuranceEventData1());
}); });
it('should call openModal if a project is not present', () => { it('should call openModal if a project is not present', () => {
const action = 'ACCEPTED'; const action = 'ACCEPTED';
comp.modalChoice(action, getNotificationsBrokerEventData2(), modalStub); comp.modalChoice(action, getQualityAssuranceEventData2(), modalStub);
expect(comp.openModal).toHaveBeenCalledWith(action, getNotificationsBrokerEventData2(), modalStub); expect(comp.openModal).toHaveBeenCalledWith(action, getQualityAssuranceEventData2(), modalStub);
}); });
}); });
@@ -197,7 +197,7 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
spyOn(compAsAny.modalService, 'open').and.returnValue({ result: new Promise((res, rej) => 'do' ) }); spyOn(compAsAny.modalService, 'open').and.returnValue({ result: new Promise((res, rej) => 'do' ) });
spyOn(comp, 'executeAction'); spyOn(comp, 'executeAction');
comp.openModal(action, getNotificationsBrokerEventData1(), modalStub); comp.openModal(action, getQualityAssuranceEventData1(), modalStub);
expect(compAsAny.modalService.open).toHaveBeenCalled(); expect(compAsAny.modalService.open).toHaveBeenCalled();
}); });
}); });
@@ -217,7 +217,7 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
} }
); );
scheduler.schedule(() => { scheduler.schedule(() => {
comp.openModalLookup(getNotificationsBrokerEventData1()); comp.openModalLookup(getQualityAssuranceEventData1());
}); });
scheduler.flush(); scheduler.flush();
@@ -227,27 +227,27 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
}); });
describe('executeAction', () => { describe('executeAction', () => {
it('should call getNotificationsBrokerEvents on 200 response from REST', () => { it('should call getQualityAssuranceEvents on 200 response from REST', () => {
const action = 'ACCEPTED'; const action = 'ACCEPTED';
spyOn(compAsAny, 'getNotificationsBrokerEvents'); spyOn(compAsAny, 'getQualityAssuranceEvents');
notificationsBrokerEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({})); qualityAssuranceEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
scheduler.schedule(() => { scheduler.schedule(() => {
comp.executeAction(action, getNotificationsBrokerEventData1()); comp.executeAction(action, getQualityAssuranceEventData1());
}); });
scheduler.flush(); scheduler.flush();
expect(compAsAny.getNotificationsBrokerEvents).toHaveBeenCalled(); expect(compAsAny.getQualityAssuranceEvents).toHaveBeenCalled();
}); });
}); });
describe('boundProject', () => { describe('boundProject', () => {
it('should populate the project data inside "eventData"', () => { it('should populate the project data inside "eventData"', () => {
const eventData = getNotificationsBrokerEventData2(); const eventData = getQualityAssuranceEventData2();
const projectId = 'UUID-23943-34u43-38344'; const projectId = 'UUID-23943-34u43-38344';
const projectName = 'Test Project'; const projectName = 'Test Project';
const projectHandle = '1000/1000'; const projectHandle = '1000/1000';
notificationsBrokerEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({})); qualityAssuranceEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({}));
scheduler.schedule(() => { scheduler.schedule(() => {
comp.boundProject(eventData, projectId, projectName, projectHandle); comp.boundProject(eventData, projectId, projectName, projectHandle);
@@ -263,8 +263,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
describe('removeProject', () => { describe('removeProject', () => {
it('should remove the project data inside "eventData"', () => { it('should remove the project data inside "eventData"', () => {
const eventData = getNotificationsBrokerEventData1(); const eventData = getQualityAssuranceEventData1();
notificationsBrokerEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$()); qualityAssuranceEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$());
scheduler.schedule(() => { scheduler.schedule(() => {
comp.removeProject(eventData); comp.removeProject(eventData);
@@ -278,8 +278,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
}); });
}); });
describe('getNotificationsBrokerEvents', () => { describe('getQualityAssuranceEvents', () => {
it('should call the "notificationsBrokerEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => { it('should call the "qualityAssuranceEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => {
comp.paginationConfig = new PaginationComponentOptions(); comp.paginationConfig = new PaginationComponentOptions();
comp.paginationConfig.currentPage = 1; comp.paginationConfig.currentPage = 1;
comp.paginationConfig.pageSize = 20; comp.paginationConfig.pageSize = 20;
@@ -297,20 +297,20 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
currentPage: comp.paginationConfig.currentPage currentPage: comp.paginationConfig.currentPage
}); });
const array = [ const array = [
notificationsBrokerEventObjectMissingProjectFound, qualityAssuranceEventObjectMissingProjectFound,
notificationsBrokerEventObjectMissingProjectNotFound, qualityAssuranceEventObjectMissingProjectNotFound,
]; ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
notificationsBrokerEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD)); qualityAssuranceEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
spyOn(compAsAny, 'setEventUpdated'); spyOn(compAsAny, 'setEventUpdated');
scheduler.schedule(() => { scheduler.schedule(() => {
compAsAny.getNotificationsBrokerEvents(); compAsAny.getQualityAssuranceEvents();
}); });
scheduler.flush(); scheduler.flush();
expect(compAsAny.notificationsBrokerEventRestService.getEventsByTopic).toHaveBeenCalledWith( expect(compAsAny.qualityAssuranceEventRestService.getEventsByTopic).toHaveBeenCalledWith(
activatedRouteParamsMap.id, activatedRouteParamsMap.id,
options, options,
followLink('target'),followLink('related') followLink('target'),followLink('related')

View File

@@ -9,12 +9,11 @@ import { distinctUntilChanged, map, mergeMap, scan, switchMap, take } from 'rxjs
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
import { RemoteData } from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import { FindListOptions } from '../../../core/data/request.models';
import { import {
NotificationsBrokerEventObject, QualityAssuranceEventObject,
OpenaireBrokerEventMessageObject OpenaireBrokerEventMessageObject
} from '../../../core/notifications/broker/models/notifications-broker-event.model'; } from '../../../core/notifications/qa/models/quality-assurance-event.model';
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service'; import { QualityAssuranceEventRestService } from '../../../core/notifications/qa/events/quality-assurance-event-rest.service';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { Metadata } from '../../../core/shared/metadata.utils'; import { Metadata } from '../../../core/shared/metadata.utils';
import { followLink } from '../../../shared/utils/follow-link-config.model'; import { followLink } from '../../../shared/utils/follow-link-config.model';
@@ -22,23 +21,24 @@ import { hasValue } from '../../../shared/empty.util';
import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model'; import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { import {
NotificationsBrokerEventData, QualityAssuranceEventData,
ProjectEntryImportModalComponent ProjectEntryImportModalComponent
} from '../project-entry-import-modal/project-entry-import-modal.component'; } from '../project-entry-import-modal/project-entry-import-modal.component';
import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
import { combineLatest } from 'rxjs/internal/observable/combineLatest'; import { combineLatest } from 'rxjs/internal/observable/combineLatest';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import {FindListOptions} from '../../../core/data/find-list-options.model';
/** /**
* Component to display the Notifications Broker event list. * Component to display the Quality Assurance event list.
*/ */
@Component({ @Component({
selector: 'ds-notifications-broker-events', selector: 'ds-quality-assurance-events',
templateUrl: './notifications-broker-events.component.html', templateUrl: './quality-assurance-events.component.html',
styleUrls: ['./notifications-broker-events.scomponent.scss'], styleUrls: ['./quality-assurance-events.scomponent.scss'],
}) })
export class NotificationsBrokerEventsComponent implements OnInit { export class QualityAssuranceEventsComponent implements OnInit {
/** /**
* The pagination system configuration for HTML listing. * The pagination system configuration for HTML listing.
* @type {PaginationComponentOptions} * @type {PaginationComponentOptions}
@@ -50,27 +50,27 @@ export class NotificationsBrokerEventsComponent implements OnInit {
pageSizeOptions: [5, 10, 20, 40, 60] pageSizeOptions: [5, 10, 20, 40, 60]
}); });
/** /**
* The Notifications Broker event list sort options. * The Quality Assurance event list sort options.
* @type {SortOptions} * @type {SortOptions}
*/ */
public paginationSortConfig: SortOptions = new SortOptions('trust', SortDirection.DESC); public paginationSortConfig: SortOptions = new SortOptions('trust', SortDirection.DESC);
/** /**
* Array to save the presence of a project inside an Notifications Broker event. * Array to save the presence of a project inside an Quality Assurance event.
* @type {NotificationsBrokerEventData[]>} * @type {QualityAssuranceEventData[]>}
*/ */
public eventsUpdated$: BehaviorSubject<NotificationsBrokerEventData[]> = new BehaviorSubject([]); public eventsUpdated$: BehaviorSubject<QualityAssuranceEventData[]> = new BehaviorSubject([]);
/** /**
* The total number of Notifications Broker events. * The total number of Quality Assurance events.
* @type {Observable<number>} * @type {Observable<number>}
*/ */
public totalElements$: Observable<number>; public totalElements$: Observable<number>;
/** /**
* The topic of the Notifications Broker events; suitable for displaying. * The topic of the Quality Assurance events; suitable for displaying.
* @type {string} * @type {string}
*/ */
public showTopic: string; public showTopic: string;
/** /**
* The topic of the Notifications Broker events; suitable for HTTP calls. * The topic of the Quality Assurance events; suitable for HTTP calls.
* @type {string} * @type {string}
*/ */
public topic: string; public topic: string;
@@ -114,7 +114,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
* @param {ActivatedRoute} activatedRoute * @param {ActivatedRoute} activatedRoute
* @param {NgbModal} modalService * @param {NgbModal} modalService
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {NotificationsBrokerEventRestService} notificationsBrokerEventRestService * @param {QualityAssuranceEventRestService} qualityAssuranceEventRestService
* @param {PaginationService} paginationService * @param {PaginationService} paginationService
* @param {TranslateService} translateService * @param {TranslateService} translateService
*/ */
@@ -122,7 +122,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private modalService: NgbModal, private modalService: NgbModal,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private notificationsBrokerEventRestService: NotificationsBrokerEventRestService, private qualityAssuranceEventRestService: QualityAssuranceEventRestService,
private paginationService: PaginationService, private paginationService: PaginationService,
private translateService: TranslateService private translateService: TranslateService
) { ) {
@@ -142,7 +142,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
this.showTopic = id.replace(regEx, '/'); this.showTopic = id.replace(regEx, '/');
this.topic = id; this.topic = id;
this.isEventPageLoading.next(false); this.isEventPageLoading.next(false);
this.getNotificationsBrokerEvents(); this.getQualityAssuranceEvents();
}); });
} }
@@ -162,12 +162,12 @@ export class NotificationsBrokerEventsComponent implements OnInit {
* *
* @param {string} action * @param {string} action
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING) * the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event data * the Quality Assurance event data
* @param {any} content * @param {any} content
* Reference to the modal * Reference to the modal
*/ */
public modalChoice(action: string, eventData: NotificationsBrokerEventData, content: any): void { public modalChoice(action: string, eventData: QualityAssuranceEventData, content: any): void {
if (eventData.hasProject) { if (eventData.hasProject) {
this.executeAction(action, eventData); this.executeAction(action, eventData);
} else { } else {
@@ -180,12 +180,12 @@ export class NotificationsBrokerEventsComponent implements OnInit {
* *
* @param {string} action * @param {string} action
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING) * the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event data * the Quality Assurance event data
* @param {any} content * @param {any} content
* Reference to the modal * Reference to the modal
*/ */
public openModal(action: string, eventData: NotificationsBrokerEventData, content: any): void { public openModal(action: string, eventData: QualityAssuranceEventData, content: any): void {
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then( this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then(
(result) => { (result) => {
if (result === 'do') { if (result === 'do') {
@@ -203,10 +203,10 @@ export class NotificationsBrokerEventsComponent implements OnInit {
/** /**
* Open a modal where the user can select the project. * Open a modal where the user can select the project.
* *
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event item data * the Quality Assurance event item data
*/ */
public openModalLookup(eventData: NotificationsBrokerEventData): void { public openModalLookup(eventData: QualityAssuranceEventData): void {
this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, { this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, {
size: 'lg' size: 'lg'
}); });
@@ -232,19 +232,19 @@ export class NotificationsBrokerEventsComponent implements OnInit {
* *
* @param {string} action * @param {string} action
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING) * the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event data * the Quality Assurance event data
*/ */
public executeAction(action: string, eventData: NotificationsBrokerEventData): void { public executeAction(action: string, eventData: QualityAssuranceEventData): void {
eventData.isRunning = true; eventData.isRunning = true;
this.subs.push( this.subs.push(
this.notificationsBrokerEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData()) this.qualityAssuranceEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData())
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => { .subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
if (rd.isSuccess && rd.statusCode === 200) { if (rd.isSuccess && rd.statusCode === 200) {
this.notificationsService.success( this.notificationsService.success(
this.translateService.instant('notifications.broker.event.action.saved') this.translateService.instant('notifications.broker.event.action.saved')
); );
this.getNotificationsBrokerEvents(); this.getQualityAssuranceEvents();
} else { } else {
this.notificationsService.error( this.notificationsService.error(
this.translateService.instant('notifications.broker.event.action.error') this.translateService.instant('notifications.broker.event.action.error')
@@ -256,10 +256,10 @@ export class NotificationsBrokerEventsComponent implements OnInit {
} }
/** /**
* Bound a project to the publication described in the Notifications Broker event calling the REST service. * Bound a project to the publication described in the Quality Assurance event calling the REST service.
* *
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event item data * the Quality Assurance event item data
* @param {string} projectId * @param {string} projectId
* the project Id to bound * the project Id to bound
* @param {string} projectTitle * @param {string} projectTitle
@@ -267,11 +267,11 @@ export class NotificationsBrokerEventsComponent implements OnInit {
* @param {string} projectHandle * @param {string} projectHandle
* the project handle * the project handle
*/ */
public boundProject(eventData: NotificationsBrokerEventData, projectId: string, projectTitle: string, projectHandle: string): void { public boundProject(eventData: QualityAssuranceEventData, projectId: string, projectTitle: string, projectHandle: string): void {
eventData.isRunning = true; eventData.isRunning = true;
this.subs.push( this.subs.push(
this.notificationsBrokerEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData()) this.qualityAssuranceEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData())
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => { .subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
if (rd.isSuccess) { if (rd.isSuccess) {
this.notificationsService.success( this.notificationsService.success(
this.translateService.instant('notifications.broker.event.project.bounded') this.translateService.instant('notifications.broker.event.project.bounded')
@@ -291,16 +291,16 @@ export class NotificationsBrokerEventsComponent implements OnInit {
} }
/** /**
* Remove the bounded project from the publication described in the Notifications Broker event calling the REST service. * Remove the bounded project from the publication described in the Quality Assurance event calling the REST service.
* *
* @param {NotificationsBrokerEventData} eventData * @param {QualityAssuranceEventData} eventData
* the Notifications Broker event data * the Quality Assurance event data
*/ */
public removeProject(eventData: NotificationsBrokerEventData): void { public removeProject(eventData: QualityAssuranceEventData): void {
eventData.isRunning = true; eventData.isRunning = true;
this.subs.push( this.subs.push(
this.notificationsBrokerEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData()) this.qualityAssuranceEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData())
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => { .subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
if (rd.isSuccess) { if (rd.isSuccess) {
this.notificationsService.success( this.notificationsService.success(
this.translateService.instant('notifications.broker.event.project.removed') this.translateService.instant('notifications.broker.event.project.removed')
@@ -337,26 +337,26 @@ export class NotificationsBrokerEventsComponent implements OnInit {
/** /**
* Dispatch the Notifications Broker events retrival. * Dispatch the Quality Assurance events retrival.
*/ */
public getNotificationsBrokerEvents(): void { public getQualityAssuranceEvents(): void {
this.paginationService.getFindListOptions(this.paginationConfig.id, this.defaultConfig).pipe( this.paginationService.getFindListOptions(this.paginationConfig.id, this.defaultConfig).pipe(
distinctUntilChanged(), distinctUntilChanged(),
switchMap((options: FindListOptions) => this.notificationsBrokerEventRestService.getEventsByTopic( switchMap((options: FindListOptions) => this.qualityAssuranceEventRestService.getEventsByTopic(
this.topic, this.topic,
options, options,
followLink('target'), followLink('related') followLink('target'), followLink('related')
)), )),
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
).subscribe((rd: RemoteData<PaginatedList<NotificationsBrokerEventObject>>) => { ).subscribe((rd: RemoteData<PaginatedList<QualityAssuranceEventObject>>) => {
if (rd.hasSucceeded) { if (rd.hasSucceeded) {
this.isEventLoading.next(false); this.isEventLoading.next(false);
this.totalElements$ = observableOf(rd.payload.totalElements); this.totalElements$ = observableOf(rd.payload.totalElements);
this.setEventUpdated(rd.payload.page); this.setEventUpdated(rd.payload.page);
} else { } else {
throw new Error('Can\'t retrieve Notifications Broker events from the Broker events REST service'); throw new Error('Can\'t retrieve Quality Assurance events from the Broker events REST service');
} }
this.notificationsBrokerEventRestService.clearFindByTopicRequests(); this.qualityAssuranceEventRestService.clearFindByTopicRequests();
}); });
} }
@@ -370,15 +370,15 @@ export class NotificationsBrokerEventsComponent implements OnInit {
} }
/** /**
* Set the project status for the Notifications Broker events. * Set the project status for the Quality Assurance events.
* *
* @param {NotificationsBrokerEventObject[]} events * @param {QualityAssuranceEventObject[]} events
* the Notifications Broker event item * the Quality Assurance event item
*/ */
protected setEventUpdated(events: NotificationsBrokerEventObject[]): void { protected setEventUpdated(events: QualityAssuranceEventObject[]): void {
this.subs.push( this.subs.push(
from(events).pipe( from(events).pipe(
mergeMap((event: NotificationsBrokerEventObject) => { mergeMap((event: QualityAssuranceEventObject) => {
const related$ = event.related.pipe( const related$ = event.related.pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
); );
@@ -387,7 +387,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
); );
return combineLatest([related$, target$]).pipe( return combineLatest([related$, target$]).pipe(
map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => { map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => {
const data: NotificationsBrokerEventData = { const data: QualityAssuranceEventData = {
event: event, event: event,
id: event.id, id: event.id,
title: event.title, title: event.title,

View File

@@ -17,16 +17,16 @@ import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { PageInfo } from '../../../core/shared/page-info.model'; import { PageInfo } from '../../../core/shared/page-info.model';
import { import {
ItemMockPid10, ItemMockPid10,
notificationsBrokerEventObjectMissingProjectFound, qualityAssuranceEventObjectMissingProjectFound,
NotificationsMockDspaceObject NotificationsMockDspaceObject
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
const eventData = { const eventData = {
event: notificationsBrokerEventObjectMissingProjectFound, event: qualityAssuranceEventObjectMissingProjectFound,
id: notificationsBrokerEventObjectMissingProjectFound.id, id: qualityAssuranceEventObjectMissingProjectFound.id,
title: notificationsBrokerEventObjectMissingProjectFound.title, title: qualityAssuranceEventObjectMissingProjectFound.title,
hasProject: true, hasProject: true,
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title, projectTitle: qualityAssuranceEventObjectMissingProjectFound.message.title,
projectId: ItemMockPid10.id, projectId: ItemMockPid10.id,
handle: ItemMockPid10.handle, handle: ItemMockPid10.handle,
reason: null, reason: null,

View File

@@ -13,10 +13,10 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
import { SearchService } from '../../../core/shared/search/search.service'; import { SearchService } from '../../../core/shared/search/search.service';
import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { import {
NotificationsBrokerEventObject, QualityAssuranceEventObject,
NotificationsBrokerEventMessageObject, QualityAssuranceEventMessageObject,
OpenaireBrokerEventMessageObject, OpenaireBrokerEventMessageObject,
} from '../../../core/notifications/broker/models/notifications-broker-event.model'; } from '../../../core/notifications/qa/models/quality-assurance-event.model';
import { hasValue, isNotEmpty } from '../../../shared/empty.util'; import { hasValue, isNotEmpty } from '../../../shared/empty.util';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
@@ -34,13 +34,13 @@ export enum ImportType {
/** /**
* The data type passed from the parent page * The data type passed from the parent page
*/ */
export interface NotificationsBrokerEventData { export interface QualityAssuranceEventData {
/** /**
* The Notifications Broker event * The Quality Assurance event
*/ */
event: NotificationsBrokerEventObject; event: QualityAssuranceEventObject;
/** /**
* The Notifications Broker event Id (uuid) * The Quality Assurance event Id (uuid)
*/ */
id: string; id: string;
/** /**
@@ -83,14 +83,14 @@ export interface NotificationsBrokerEventData {
templateUrl: './project-entry-import-modal.component.html' templateUrl: './project-entry-import-modal.component.html'
}) })
/** /**
* Component to display a modal window for linking a project to an Notifications Broker event * Component to display a modal window for linking a project to an Quality Assurance event
* Shows information about the selected project and a selectable list. * Shows information about the selected project and a selectable list.
*/ */
export class ProjectEntryImportModalComponent implements OnInit { export class ProjectEntryImportModalComponent implements OnInit {
/** /**
* The external source entry * The external source entry
*/ */
@Input() externalSourceEntry: NotificationsBrokerEventData; @Input() externalSourceEntry: QualityAssuranceEventData;
/** /**
* The number of results per page * The number of results per page
*/ */

View File

@@ -1,6 +1,6 @@
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { type } from '../../../shared/ngrx/type'; import { type } from '../../../shared/ngrx/type';
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
/** /**
* For each action type in an action group, make a simple * For each action type in an action group, make a simple
@@ -10,19 +10,19 @@ import { NotificationsBrokerSourceObject } from '../../../core/notifications/bro
* literal types and runs a simple check to guarantee all * literal types and runs a simple check to guarantee all
* action types in the application are unique. * action types in the application are unique.
*/ */
export const NotificationsBrokerSourceActionTypes = { export const QualityAssuranceSourceActionTypes = {
ADD_SOURCE: type('dspace/integration/notifications/broker/ADD_SOURCE'), ADD_SOURCE: type('dspace/integration/notifications/qa/ADD_SOURCE'),
RETRIEVE_ALL_SOURCE: type('dspace/integration/notifications/broker/RETRIEVE_ALL_SOURCE'), RETRIEVE_ALL_SOURCE: type('dspace/integration/notifications/qa/RETRIEVE_ALL_SOURCE'),
RETRIEVE_ALL_SOURCE_ERROR: type('dspace/integration/notifications/broker/RETRIEVE_ALL_SOURCE_ERROR'), RETRIEVE_ALL_SOURCE_ERROR: type('dspace/integration/notifications/qa/RETRIEVE_ALL_SOURCE_ERROR'),
}; };
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
/** /**
* An ngrx action to retrieve all the Notifications Broker source. * An ngrx action to retrieve all the Quality Assurance source.
*/ */
export class RetrieveAllSourceAction implements Action { export class RetrieveAllSourceAction implements Action {
type = NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE; type = QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE;
payload: { payload: {
elementsPerPage: number; elementsPerPage: number;
currentPage: number; currentPage: number;
@@ -45,20 +45,20 @@ export class RetrieveAllSourceAction implements Action {
} }
/** /**
* An ngrx action for retrieving 'all Notifications Broker source' error. * An ngrx action for retrieving 'all Quality Assurance source' error.
*/ */
export class RetrieveAllSourceErrorAction implements Action { export class RetrieveAllSourceErrorAction implements Action {
type = NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR; type = QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR;
} }
/** /**
* An ngrx action to load the Notifications Broker source objects. * An ngrx action to load the Quality Assurance source objects.
* Called by the ??? effect. * Called by the ??? effect.
*/ */
export class AddSourceAction implements Action { export class AddSourceAction implements Action {
type = NotificationsBrokerSourceActionTypes.ADD_SOURCE; type = QualityAssuranceSourceActionTypes.ADD_SOURCE;
payload: { payload: {
source: NotificationsBrokerSourceObject[]; source: QualityAssuranceSourceObject[];
totalPages: number; totalPages: number;
currentPage: number; currentPage: number;
totalElements: number; totalElements: number;
@@ -74,9 +74,9 @@ export class AddSourceAction implements Action {
* @param currentPage * @param currentPage
* the current page * the current page
* @param totalElements * @param totalElements
* the total available Notifications Broker source * the total available Quality Assurance source
*/ */
constructor(source: NotificationsBrokerSourceObject[], totalPages: number, currentPage: number, totalElements: number) { constructor(source: QualityAssuranceSourceObject[], totalPages: number, currentPage: number, totalElements: number) {
this.payload = { this.payload = {
source, source,
totalPages, totalPages,
@@ -93,7 +93,7 @@ export class AddSourceAction implements Action {
* Export a type alias of all actions in this action group * Export a type alias of all actions in this action group
* so that reducers can easily compose action types. * so that reducers can easily compose action types.
*/ */
export type NotificationsBrokerSourceActions export type QualityAssuranceSourceActions
= RetrieveAllSourceAction = RetrieveAllSourceAction
|RetrieveAllSourceErrorAction |RetrieveAllSourceErrorAction
|AddSourceAction; |AddSourceAction;

View File

@@ -15,7 +15,7 @@
[collectionSize]="(totalElements$ | async)" [collectionSize]="(totalElements$ | async)"
[hideGear]="false" [hideGear]="false"
[hideSortOptions]="true" [hideSortOptions]="true"
(paginationChange)="getNotificationsBrokerSource()"> (paginationChange)="getQualityAssuranceSource()">
<ds-loading class="container" *ngIf="(isSourceProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading> <ds-loading class="container" *ngIf="(isSourceProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading>
<ng-container *ngIf="!(isSourceProcessing() | async)"> <ng-container *ngIf="!(isSourceProcessing() | async)">

View File

@@ -7,22 +7,22 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
import { createTestComponent } from '../../../shared/testing/utils.test'; import { createTestComponent } from '../../../shared/testing/utils.test';
import { import {
getMockNotificationsStateService, getMockNotificationsStateService,
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMorePid qualityAssuranceSourceObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
import { NotificationsBrokerSourceComponent } from './notifications-broker-source.component'; import { QualityAssuranceSourceComponent } from './quality-assurance-source.component';
import { NotificationsStateService } from '../../notifications-state.service'; import { NotificationsStateService } from '../../notifications-state.service';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub'; import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
describe('NotificationsBrokerSourceComponent test suite', () => { describe('QualityAssuranceSourceComponent test suite', () => {
let fixture: ComponentFixture<NotificationsBrokerSourceComponent>; let fixture: ComponentFixture<QualityAssuranceSourceComponent>;
let comp: NotificationsBrokerSourceComponent; let comp: QualityAssuranceSourceComponent;
let compAsAny: any; let compAsAny: any;
const mockNotificationsStateService = getMockNotificationsStateService(); const mockNotificationsStateService = getMockNotificationsStateService();
const activatedRouteParams = { const activatedRouteParams = {
notificationsBrokerSourceParams: { qualityAssuranceSourceParams: {
currentPage: 0, currentPage: 0,
pageSize: 5 pageSize: 5
} }
@@ -36,27 +36,27 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
TranslateModule.forRoot(), TranslateModule.forRoot(),
], ],
declarations: [ declarations: [
NotificationsBrokerSourceComponent, QualityAssuranceSourceComponent,
TestComponent, TestComponent,
], ],
providers: [ providers: [
{ provide: NotificationsStateService, useValue: mockNotificationsStateService }, { provide: NotificationsStateService, useValue: mockNotificationsStateService },
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } }, { provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
NotificationsBrokerSourceComponent QualityAssuranceSourceComponent
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => { }).compileComponents().then(() => {
mockNotificationsStateService.getNotificationsBrokerSource.and.returnValue(observableOf([ mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([
notificationsBrokerSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
notificationsBrokerSourceObjectMoreAbstract qualityAssuranceSourceObjectMoreAbstract
])); ]));
mockNotificationsStateService.getNotificationsBrokerSourceTotalPages.and.returnValue(observableOf(1)); mockNotificationsStateService.getQualityAssuranceSourceTotalPages.and.returnValue(observableOf(1));
mockNotificationsStateService.getNotificationsBrokerSourceCurrentPage.and.returnValue(observableOf(0)); mockNotificationsStateService.getQualityAssuranceSourceCurrentPage.and.returnValue(observableOf(0));
mockNotificationsStateService.getNotificationsBrokerSourceTotals.and.returnValue(observableOf(2)); mockNotificationsStateService.getQualityAssuranceSourceTotals.and.returnValue(observableOf(2));
mockNotificationsStateService.isNotificationsBrokerSourceLoaded.and.returnValue(observableOf(true)); mockNotificationsStateService.isQualityAssuranceSourceLoaded.and.returnValue(observableOf(true));
mockNotificationsStateService.isNotificationsBrokerSourceLoading.and.returnValue(observableOf(false)); mockNotificationsStateService.isQualityAssuranceSourceLoading.and.returnValue(observableOf(false));
mockNotificationsStateService.isNotificationsBrokerSourceProcessing.and.returnValue(observableOf(false)); mockNotificationsStateService.isQualityAssuranceSourceProcessing.and.returnValue(observableOf(false));
}); });
})); }));
@@ -68,7 +68,7 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
// synchronous beforeEach // synchronous beforeEach
beforeEach(() => { beforeEach(() => {
const html = ` const html = `
<ds-notifications-broker-source></ds-notifications-broker-source>`; <ds-quality-assurance-source></ds-quality-assurance-source>`;
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>; testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance; testComp = testFixture.componentInstance;
}); });
@@ -77,14 +77,14 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
testFixture.destroy(); testFixture.destroy();
}); });
it('should create NotificationsBrokerSourceComponent', inject([NotificationsBrokerSourceComponent], (app: NotificationsBrokerSourceComponent) => { it('should create QualityAssuranceSourceComponent', inject([QualityAssuranceSourceComponent], (app: QualityAssuranceSourceComponent) => {
expect(app).toBeDefined(); expect(app).toBeDefined();
})); }));
}); });
describe('Main tests running with two Source', () => { describe('Main tests running with two Source', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(NotificationsBrokerSourceComponent); fixture = TestBed.createComponent(QualityAssuranceSourceComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
@@ -102,8 +102,8 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
expect(comp.sources$).toBeObservable(cold('(a|)', { expect(comp.sources$).toBeObservable(cold('(a|)', {
a: [ a: [
notificationsBrokerSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
notificationsBrokerSourceObjectMoreAbstract qualityAssuranceSourceObjectMoreAbstract
] ]
})); }));
expect(comp.totalElements$).toBeObservable(cold('(a|)', { expect(comp.totalElements$).toBeObservable(cold('(a|)', {
@@ -112,12 +112,12 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
}); });
it(('Should set data properly after the view init'), () => { it(('Should set data properly after the view init'), () => {
spyOn(compAsAny, 'getNotificationsBrokerSource'); spyOn(compAsAny, 'getQualityAssuranceSource');
comp.ngAfterViewInit(); comp.ngAfterViewInit();
fixture.detectChanges(); fixture.detectChanges();
expect(compAsAny.getNotificationsBrokerSource).toHaveBeenCalled(); expect(compAsAny.getQualityAssuranceSource).toHaveBeenCalled();
}); });
it(('isSourceLoading should return FALSE'), () => { it(('isSourceLoading should return FALSE'), () => {
@@ -132,12 +132,12 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
})); }));
}); });
it(('getNotificationsBrokerSource should call the service to dispatch a STATE change'), () => { it(('getQualityAssuranceSource should call the service to dispatch a STATE change'), () => {
comp.ngOnInit(); comp.ngOnInit();
fixture.detectChanges(); fixture.detectChanges();
compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerSource(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough(); compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceSource(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
expect(compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerSource).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage); expect(compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceSource).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
}); });
}); });
}); });

View File

@@ -3,18 +3,18 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
import { Observable, Subscription } from 'rxjs'; import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, take } from 'rxjs/operators'; import { distinctUntilChanged, take } from 'rxjs/operators';
import { SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortOptions } from '../../../core/cache/models/sort-options.model';
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { NotificationsStateService } from '../../notifications-state.service'; import { NotificationsStateService } from '../../notifications-state.service';
import { AdminNotificationsBrokerSourcePageParams } from '../../../admin/admin-notifications/admin-notifications-broker-source-page-component/admin-notifications-broker-source-page-resolver.service'; import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
@Component({ @Component({
selector: 'ds-notifications-broker-source', selector: 'ds-quality-assurance-source',
templateUrl: './notifications-broker-source.component.html', templateUrl: './quality-assurance-source.component.html',
styleUrls: ['./notifications-broker-source.component.scss'] styleUrls: ['./quality-assurance-source.component.scss']
}) })
export class NotificationsBrokerSourceComponent implements OnInit { export class QualityAssuranceSourceComponent implements OnInit {
/** /**
* The pagination system configuration for HTML listing. * The pagination system configuration for HTML listing.
@@ -26,16 +26,16 @@ export class NotificationsBrokerSourceComponent implements OnInit {
pageSizeOptions: [5, 10, 20, 40, 60] pageSizeOptions: [5, 10, 20, 40, 60]
}); });
/** /**
* The Notifications Broker source list sort options. * The Quality Assurance source list sort options.
* @type {SortOptions} * @type {SortOptions}
*/ */
public paginationSortConfig: SortOptions; public paginationSortConfig: SortOptions;
/** /**
* The Notifications Broker source list. * The Quality Assurance source list.
*/ */
public sources$: Observable<NotificationsBrokerSourceObject[]>; public sources$: Observable<QualityAssuranceSourceObject[]>;
/** /**
* The total number of Notifications Broker sources. * The total number of Quality Assurance sources.
*/ */
public totalElements$: Observable<number>; public totalElements$: Observable<number>;
/** /**
@@ -58,51 +58,51 @@ export class NotificationsBrokerSourceComponent implements OnInit {
* Component initialization. * Component initialization.
*/ */
ngOnInit(): void { ngOnInit(): void {
this.sources$ = this.notificationsStateService.getNotificationsBrokerSource(); this.sources$ = this.notificationsStateService.getQualityAssuranceSource();
this.totalElements$ = this.notificationsStateService.getNotificationsBrokerSourceTotals(); this.totalElements$ = this.notificationsStateService.getQualityAssuranceSourceTotals();
} }
/** /**
* First Notifications Broker source loading after view initialization. * First Quality Assurance source loading after view initialization.
*/ */
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.subs.push( this.subs.push(
this.notificationsStateService.isNotificationsBrokerSourceLoaded().pipe( this.notificationsStateService.isQualityAssuranceSourceLoaded().pipe(
take(1) take(1)
).subscribe(() => { ).subscribe(() => {
this.getNotificationsBrokerSource(); this.getQualityAssuranceSource();
}) })
); );
} }
/** /**
* Returns the information about the loading status of the Notifications Broker source (if it's running or not). * Returns the information about the loading status of the Quality Assurance source (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the source are loading, 'false' otherwise. * 'true' if the source are loading, 'false' otherwise.
*/ */
public isSourceLoading(): Observable<boolean> { public isSourceLoading(): Observable<boolean> {
return this.notificationsStateService.isNotificationsBrokerSourceLoading(); return this.notificationsStateService.isQualityAssuranceSourceLoading();
} }
/** /**
* Returns the information about the processing status of the Notifications Broker source (if it's running or not). * Returns the information about the processing status of the Quality Assurance source (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise. * 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise.
*/ */
public isSourceProcessing(): Observable<boolean> { public isSourceProcessing(): Observable<boolean> {
return this.notificationsStateService.isNotificationsBrokerSourceProcessing(); return this.notificationsStateService.isQualityAssuranceSourceProcessing();
} }
/** /**
* Dispatch the Notifications Broker source retrival. * Dispatch the Quality Assurance source retrival.
*/ */
public getNotificationsBrokerSource(): void { public getQualityAssuranceSource(): void {
this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe( this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe(
distinctUntilChanged(), distinctUntilChanged(),
).subscribe((options: PaginationComponentOptions) => { ).subscribe((options: PaginationComponentOptions) => {
this.notificationsStateService.dispatchRetrieveNotificationsBrokerSource( this.notificationsStateService.dispatchRetrieveQualityAssuranceSource(
options.pageSize, options.pageSize,
options.currentPage options.currentPage
); );
@@ -114,7 +114,7 @@ export class NotificationsBrokerSourceComponent implements OnInit {
* *
* @param eventsRouteParams * @param eventsRouteParams
*/ */
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsBrokerSourcePageParams) { protected updatePaginationFromRouteParams(eventsRouteParams: AdminQualityAssuranceSourcePageParams) {
if (eventsRouteParams.currentPage) { if (eventsRouteParams.currentPage) {
this.paginationConfig.currentPage = eventsRouteParams.currentPage; this.paginationConfig.currentPage = eventsRouteParams.currentPage;
} }

View File

@@ -6,35 +6,35 @@ import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators'
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { import {
AddSourceAction, AddSourceAction,
NotificationsBrokerSourceActionTypes, QualityAssuranceSourceActionTypes,
RetrieveAllSourceAction, RetrieveAllSourceAction,
RetrieveAllSourceErrorAction, RetrieveAllSourceErrorAction,
} from './notifications-broker-source.actions'; } from './quality-assurance-source.actions';
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerSourceService } from './notifications-broker-source.service'; import { QualityAssuranceSourceService } from './quality-assurance-source.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { NotificationsBrokerSourceRestService } from '../../../core/notifications/broker/source/notifications-broker-source-rest.service'; import { QualityAssuranceSourceRestService } from '../../../core/notifications/qa/source/quality-assurance-source-rest.service';
/** /**
* Provides effect methods for the Notifications Broker source actions. * Provides effect methods for the Quality Assurance source actions.
*/ */
@Injectable() @Injectable()
export class NotificationsBrokerSourceEffects { export class QualityAssuranceSourceEffects {
/** /**
* Retrieve all Notifications Broker source managing pagination and errors. * Retrieve all Quality Assurance source managing pagination and errors.
*/ */
@Effect() retrieveAllSource$ = this.actions$.pipe( @Effect() retrieveAllSource$ = this.actions$.pipe(
ofType(NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE), ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE),
withLatestFrom(this.store$), withLatestFrom(this.store$),
switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => { switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => {
return this.notificationsBrokerSourceService.getSources( return this.qualityAssuranceSourceService.getSources(
action.payload.elementsPerPage, action.payload.elementsPerPage,
action.payload.currentPage action.payload.currentPage
).pipe( ).pipe(
map((sources: PaginatedList<NotificationsBrokerSourceObject>) => map((sources: PaginatedList<QualityAssuranceSourceObject>) =>
new AddSourceAction(sources.page, sources.totalPages, sources.currentPage, sources.totalElements) new AddSourceAction(sources.page, sources.totalPages, sources.currentPage, sources.totalElements)
), ),
catchError((error: Error) => { catchError((error: Error) => {
@@ -51,7 +51,7 @@ export class NotificationsBrokerSourceEffects {
* Show a notification on error. * Show a notification on error.
*/ */
@Effect({ dispatch: false }) retrieveAllSourceErrorAction$ = this.actions$.pipe( @Effect({ dispatch: false }) retrieveAllSourceErrorAction$ = this.actions$.pipe(
ofType(NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR), ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
tap(() => { tap(() => {
this.notificationsService.error(null, this.translate.get('notifications.broker.source.error.service.retrieve')); this.notificationsService.error(null, this.translate.get('notifications.broker.source.error.service.retrieve'));
}) })
@@ -61,9 +61,9 @@ export class NotificationsBrokerSourceEffects {
* Clear find all source requests from cache. * Clear find all source requests from cache.
*/ */
@Effect({ dispatch: false }) addSourceAction$ = this.actions$.pipe( @Effect({ dispatch: false }) addSourceAction$ = this.actions$.pipe(
ofType(NotificationsBrokerSourceActionTypes.ADD_SOURCE), ofType(QualityAssuranceSourceActionTypes.ADD_SOURCE),
tap(() => { tap(() => {
this.notificationsBrokerSourceDataService.clearFindAllSourceRequests(); this.qualityAssuranceSourceDataService.clearFindAllSourceRequests();
}) })
); );
@@ -73,15 +73,15 @@ export class NotificationsBrokerSourceEffects {
* @param {Store<any>} store$ * @param {Store<any>} store$
* @param {TranslateService} translate * @param {TranslateService} translate
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {NotificationsBrokerSourceService} notificationsBrokerSourceService * @param {QualityAssuranceSourceService} qualityAssuranceSourceService
* @param {NotificationsBrokerSourceRestService} notificationsBrokerSourceDataService * @param {QualityAssuranceSourceRestService} qualityAssuranceSourceDataService
*/ */
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private store$: Store<any>, private store$: Store<any>,
private translate: TranslateService, private translate: TranslateService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private notificationsBrokerSourceService: NotificationsBrokerSourceService, private qualityAssuranceSourceService: QualityAssuranceSourceService,
private notificationsBrokerSourceDataService: NotificationsBrokerSourceRestService private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService
) { } ) { }
} }

View File

@@ -2,20 +2,20 @@ import {
AddSourceAction, AddSourceAction,
RetrieveAllSourceAction, RetrieveAllSourceAction,
RetrieveAllSourceErrorAction RetrieveAllSourceErrorAction
} from './notifications-broker-source.actions'; } from './quality-assurance-source.actions';
import { notificationsBrokerSourceReducer, NotificationsBrokerSourceState } from './notifications-broker-source.reducer'; import { qualityAssuranceSourceReducer, QualityAssuranceSourceState } from './quality-assurance-source.reducer';
import { import {
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMorePid qualityAssuranceSourceObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
describe('notificationsBrokerSourceReducer test suite', () => { describe('qualityAssuranceSourceReducer test suite', () => {
let notificationsBrokerSourceInitialState: NotificationsBrokerSourceState; let qualityAssuranceSourceInitialState: QualityAssuranceSourceState;
const elementPerPage = 3; const elementPerPage = 3;
const currentPage = 0; const currentPage = 0;
beforeEach(() => { beforeEach(() => {
notificationsBrokerSourceInitialState = { qualityAssuranceSourceInitialState = {
source: [], source: [],
processing: false, processing: false,
loaded: false, loaded: false,
@@ -26,30 +26,30 @@ import {
}); });
it('Action RETRIEVE_ALL_SOURCE should set the State property "processing" to TRUE', () => { it('Action RETRIEVE_ALL_SOURCE should set the State property "processing" to TRUE', () => {
const expectedState = notificationsBrokerSourceInitialState; const expectedState = qualityAssuranceSourceInitialState;
expectedState.processing = true; expectedState.processing = true;
const action = new RetrieveAllSourceAction(elementPerPage, currentPage); const action = new RetrieveAllSourceAction(elementPerPage, currentPage);
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action); const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });
it('Action RETRIEVE_ALL_SOURCE_ERROR should change the State to initial State but processing, loaded, and currentPage', () => { it('Action RETRIEVE_ALL_SOURCE_ERROR should change the State to initial State but processing, loaded, and currentPage', () => {
const expectedState = notificationsBrokerSourceInitialState; const expectedState = qualityAssuranceSourceInitialState;
expectedState.processing = false; expectedState.processing = false;
expectedState.loaded = true; expectedState.loaded = true;
expectedState.currentPage = 0; expectedState.currentPage = 0;
const action = new RetrieveAllSourceErrorAction(); const action = new RetrieveAllSourceErrorAction();
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action); const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });
it('Action ADD_SOURCE should populate the State with Notifications Broker source', () => { it('Action ADD_SOURCE should populate the State with Quality Assurance source', () => {
const expectedState = { const expectedState = {
source: [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ], source: [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
processing: false, processing: false,
loaded: true, loaded: true,
totalPages: 1, totalPages: 1,
@@ -58,10 +58,10 @@ import {
}; };
const action = new AddSourceAction( const action = new AddSourceAction(
[ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ], [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
1, 0, 2 1, 0, 2
); );
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action); const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });

View File

@@ -0,0 +1,72 @@
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
import { QualityAssuranceSourceActionTypes, QualityAssuranceSourceActions } from './quality-assurance-source.actions';
/**
* The interface representing the Quality Assurance source state.
*/
export interface QualityAssuranceSourceState {
source: QualityAssuranceSourceObject[];
processing: boolean;
loaded: boolean;
totalPages: number;
currentPage: number;
totalElements: number;
}
/**
* Used for the Quality Assurance source state initialization.
*/
const qualityAssuranceSourceInitialState: QualityAssuranceSourceState = {
source: [],
processing: false,
loaded: false,
totalPages: 0,
currentPage: 0,
totalElements: 0
};
/**
* The Quality Assurance Source Reducer
*
* @param state
* the current state initialized with qualityAssuranceSourceInitialState
* @param action
* the action to perform on the state
* @return QualityAssuranceSourceState
* the new state
*/
export function qualityAssuranceSourceReducer(state = qualityAssuranceSourceInitialState, action: QualityAssuranceSourceActions): QualityAssuranceSourceState {
switch (action.type) {
case QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE: {
return Object.assign({}, state, {
source: [],
processing: true
});
}
case QualityAssuranceSourceActionTypes.ADD_SOURCE: {
return Object.assign({}, state, {
source: action.payload.source,
processing: false,
loaded: true,
totalPages: action.payload.totalPages,
currentPage: state.currentPage,
totalElements: action.payload.totalElements
});
}
case QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR: {
return Object.assign({}, state, {
processing: false,
loaded: true,
totalPages: 0,
currentPage: 0,
totalElements: 0
});
}
default: {
return state;
}
}
}

View File

@@ -1,28 +1,28 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { NotificationsBrokerSourceService } from './notifications-broker-source.service'; import { QualityAssuranceSourceService } from './quality-assurance-source.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { PageInfo } from '../../../core/shared/page-info.model'; import { PageInfo } from '../../../core/shared/page-info.model';
import { FindListOptions } from '../../../core/data/request.models';
import { import {
getMockNotificationsBrokerSourceRestService, getMockQualityAssuranceSourceRestService,
notificationsBrokerSourceObjectMoreAbstract, qualityAssuranceSourceObjectMoreAbstract,
notificationsBrokerSourceObjectMorePid qualityAssuranceSourceObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerSourceRestService } from '../../../core/notifications/broker/source/notifications-broker-source-rest.service'; import { QualityAssuranceSourceRestService } from '../../../core/notifications/qa/source/quality-assurance-source-rest.service';
import { RequestParam } from '../../../core/cache/models/request-param.model'; import { RequestParam } from '../../../core/cache/models/request-param.model';
import {FindListOptions} from '../../../core/data/find-list-options.model';
describe('NotificationsBrokerSourceService', () => { describe('QualityAssuranceSourceService', () => {
let service: NotificationsBrokerSourceService; let service: QualityAssuranceSourceService;
let restService: NotificationsBrokerSourceRestService; let restService: QualityAssuranceSourceRestService;
let serviceAsAny: any; let serviceAsAny: any;
let restServiceAsAny: any; let restServiceAsAny: any;
const pageInfo = new PageInfo(); const pageInfo = new PageInfo();
const array = [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ]; const array = [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
const elementsPerPage = 3; const elementsPerPage = 3;
@@ -31,22 +31,22 @@ describe('NotificationsBrokerSourceService', () => {
beforeEach(async () => { beforeEach(async () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{ provide: NotificationsBrokerSourceRestService, useClass: getMockNotificationsBrokerSourceRestService }, { provide: QualityAssuranceSourceRestService, useClass: getMockQualityAssuranceSourceRestService },
{ provide: NotificationsBrokerSourceService, useValue: service } { provide: QualityAssuranceSourceService, useValue: service }
] ]
}).compileComponents(); }).compileComponents();
}); });
beforeEach(() => { beforeEach(() => {
restService = TestBed.get(NotificationsBrokerSourceRestService); restService = TestBed.get(QualityAssuranceSourceRestService);
restServiceAsAny = restService; restServiceAsAny = restService;
restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD)); restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD));
service = new NotificationsBrokerSourceService(restService); service = new QualityAssuranceSourceService(restService);
serviceAsAny = service; serviceAsAny = service;
}); });
describe('getSources', () => { describe('getSources', () => {
it('Should proxy the call to notificationsBrokerSourceRestService.getSources', () => { it('Should proxy the call to qualityAssuranceSourceRestService.getSources', () => {
const sortOptions = new SortOptions('name', SortDirection.ASC); const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = { const findListOptions: FindListOptions = {
elementsPerPage: elementsPerPage, elementsPerPage: elementsPerPage,
@@ -54,10 +54,10 @@ describe('NotificationsBrokerSourceService', () => {
sort: sortOptions sort: sortOptions
}; };
const result = service.getSources(elementsPerPage, currentPage); const result = service.getSources(elementsPerPage, currentPage);
expect((service as any).notificationsBrokerSourceRestService.getSources).toHaveBeenCalledWith(findListOptions); expect((service as any).qualityAssuranceSourceRestService.getSources).toHaveBeenCalledWith(findListOptions);
}); });
it('Should return a paginated list of Notifications Broker Source', () => { it('Should return a paginated list of Quality Assurance Source', () => {
const expected = cold('(a|)', { const expected = cold('(a|)', {
a: paginatedList a: paginatedList
}); });

View File

@@ -0,0 +1,55 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { find, map } from 'rxjs/operators';
import { QualityAssuranceSourceRestService } from '../../../core/notifications/qa/source/quality-assurance-source-rest.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model';
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
import {FindListOptions} from '../../../core/data/find-list-options.model';
/**
* The service handling all Quality Assurance source requests to the REST service.
*/
@Injectable()
export class QualityAssuranceSourceService {
/**
* Initialize the service variables.
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceRestService
*/
constructor(
private qualityAssuranceSourceRestService: QualityAssuranceSourceRestService
) { }
/**
* Return the list of Quality Assurance source managing pagination and errors.
*
* @param elementsPerPage
* The number of the source per page
* @param currentPage
* The page number to retrieve
* @return Observable<PaginatedList<QualityAssuranceSourceObject>>
* The list of Quality Assurance source.
*/
public getSources(elementsPerPage, currentPage): Observable<PaginatedList<QualityAssuranceSourceObject>> {
const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = {
elementsPerPage: elementsPerPage,
currentPage: currentPage,
sort: sortOptions
};
return this.qualityAssuranceSourceRestService.getSources(findListOptions).pipe(
find((rd: RemoteData<PaginatedList<QualityAssuranceSourceObject>>) => !rd.isResponsePending),
map((rd: RemoteData<PaginatedList<QualityAssuranceSourceObject>>) => {
if (rd.hasSucceeded) {
return rd.payload;
} else {
throw new Error('Can\'t retrieve Quality Assurance source from the Broker source REST service');
}
})
);
}
}

View File

@@ -1,6 +1,6 @@
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { type } from '../../../shared/ngrx/type'; import { type } from '../../../shared/ngrx/type';
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
/** /**
* For each action type in an action group, make a simple * For each action type in an action group, make a simple
@@ -10,19 +10,19 @@ import { NotificationsBrokerTopicObject } from '../../../core/notifications/brok
* literal types and runs a simple check to guarantee all * literal types and runs a simple check to guarantee all
* action types in the application are unique. * action types in the application are unique.
*/ */
export const NotificationsBrokerTopicActionTypes = { export const QualityAssuranceTopicActionTypes = {
ADD_TOPICS: type('dspace/integration/notifications/broker/topic/ADD_TOPICS'), ADD_TOPICS: type('dspace/integration/notifications/qa/topic/ADD_TOPICS'),
RETRIEVE_ALL_TOPICS: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS'), RETRIEVE_ALL_TOPICS: type('dspace/integration/notifications/qa/topic/RETRIEVE_ALL_TOPICS'),
RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS_ERROR'), RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/notifications/qa/topic/RETRIEVE_ALL_TOPICS_ERROR'),
}; };
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
/** /**
* An ngrx action to retrieve all the Notifications Broker topics. * An ngrx action to retrieve all the Quality Assurance topics.
*/ */
export class RetrieveAllTopicsAction implements Action { export class RetrieveAllTopicsAction implements Action {
type = NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS; type = QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS;
payload: { payload: {
elementsPerPage: number; elementsPerPage: number;
currentPage: number; currentPage: number;
@@ -45,20 +45,20 @@ export class RetrieveAllTopicsAction implements Action {
} }
/** /**
* An ngrx action for retrieving 'all Notifications Broker topics' error. * An ngrx action for retrieving 'all Quality Assurance topics' error.
*/ */
export class RetrieveAllTopicsErrorAction implements Action { export class RetrieveAllTopicsErrorAction implements Action {
type = NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR; type = QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR;
} }
/** /**
* An ngrx action to load the Notifications Broker topic objects. * An ngrx action to load the Quality Assurance topic objects.
* Called by the ??? effect. * Called by the ??? effect.
*/ */
export class AddTopicsAction implements Action { export class AddTopicsAction implements Action {
type = NotificationsBrokerTopicActionTypes.ADD_TOPICS; type = QualityAssuranceTopicActionTypes.ADD_TOPICS;
payload: { payload: {
topics: NotificationsBrokerTopicObject[]; topics: QualityAssuranceTopicObject[];
totalPages: number; totalPages: number;
currentPage: number; currentPage: number;
totalElements: number; totalElements: number;
@@ -74,9 +74,9 @@ export class AddTopicsAction implements Action {
* @param currentPage * @param currentPage
* the current page * the current page
* @param totalElements * @param totalElements
* the total available Notifications Broker topics * the total available Quality Assurance topics
*/ */
constructor(topics: NotificationsBrokerTopicObject[], totalPages: number, currentPage: number, totalElements: number) { constructor(topics: QualityAssuranceTopicObject[], totalPages: number, currentPage: number, totalElements: number) {
this.payload = { this.payload = {
topics, topics,
totalPages, totalPages,
@@ -93,7 +93,7 @@ export class AddTopicsAction implements Action {
* Export a type alias of all actions in this action group * Export a type alias of all actions in this action group
* so that reducers can easily compose action types. * so that reducers can easily compose action types.
*/ */
export type NotificationsBrokerTopicsActions export type QualityAssuranceTopicsActions
= AddTopicsAction = AddTopicsAction
|RetrieveAllTopicsAction |RetrieveAllTopicsAction
|RetrieveAllTopicsErrorAction; |RetrieveAllTopicsErrorAction;

View File

@@ -15,7 +15,7 @@
[collectionSize]="(totalElements$ | async)" [collectionSize]="(totalElements$ | async)"
[hideGear]="false" [hideGear]="false"
[hideSortOptions]="true" [hideSortOptions]="true"
(paginationChange)="getNotificationsBrokerTopics()"> (paginationChange)="getQualityAssuranceTopics()">
<ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading> <ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading>
<ng-container *ngIf="!(isTopicsProcessing() | async)"> <ng-container *ngIf="!(isTopicsProcessing() | async)">

View File

@@ -7,23 +7,23 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
import { createTestComponent } from '../../../shared/testing/utils.test'; import { createTestComponent } from '../../../shared/testing/utils.test';
import { import {
getMockNotificationsStateService, getMockNotificationsStateService,
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
import { NotificationsBrokerTopicsComponent } from './notifications-broker-topics.component'; import { QualityAssuranceTopicsComponent } from './quality-assurance-topics.component';
import { NotificationsStateService } from '../../notifications-state.service'; import { NotificationsStateService } from '../../notifications-state.service';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub'; import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
describe('NotificationsBrokerTopicsComponent test suite', () => { describe('QualityAssuranceTopicsComponent test suite', () => {
let fixture: ComponentFixture<NotificationsBrokerTopicsComponent>; let fixture: ComponentFixture<QualityAssuranceTopicsComponent>;
let comp: NotificationsBrokerTopicsComponent; let comp: QualityAssuranceTopicsComponent;
let compAsAny: any; let compAsAny: any;
const mockNotificationsStateService = getMockNotificationsStateService(); const mockNotificationsStateService = getMockNotificationsStateService();
const activatedRouteParams = { const activatedRouteParams = {
notificationsBrokerTopicsParams: { qualityAssuranceTopicsParams: {
currentPage: 0, currentPage: 0,
pageSize: 5 pageSize: 5
} }
@@ -37,7 +37,7 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
TranslateModule.forRoot(), TranslateModule.forRoot(),
], ],
declarations: [ declarations: [
NotificationsBrokerTopicsComponent, QualityAssuranceTopicsComponent,
TestComponent, TestComponent,
], ],
providers: [ providers: [
@@ -48,22 +48,22 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
}, },
}}}, }}},
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
NotificationsBrokerTopicsComponent, QualityAssuranceTopicsComponent,
// tslint:disable-next-line: no-empty // tslint:disable-next-line: no-empty
{ provide: NotificationsBrokerTopicsService, useValue: { setSourceId: (sourceId: string) => { } }} { provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } }}
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => { }).compileComponents().then(() => {
mockNotificationsStateService.getNotificationsBrokerTopics.and.returnValue(observableOf([ mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([
notificationsBrokerTopicObjectMorePid, qualityAssuranceTopicObjectMorePid,
notificationsBrokerTopicObjectMoreAbstract qualityAssuranceTopicObjectMoreAbstract
])); ]));
mockNotificationsStateService.getNotificationsBrokerTopicsTotalPages.and.returnValue(observableOf(1)); mockNotificationsStateService.getQualityAssuranceTopicsTotalPages.and.returnValue(observableOf(1));
mockNotificationsStateService.getNotificationsBrokerTopicsCurrentPage.and.returnValue(observableOf(0)); mockNotificationsStateService.getQualityAssuranceTopicsCurrentPage.and.returnValue(observableOf(0));
mockNotificationsStateService.getNotificationsBrokerTopicsTotals.and.returnValue(observableOf(2)); mockNotificationsStateService.getQualityAssuranceTopicsTotals.and.returnValue(observableOf(2));
mockNotificationsStateService.isNotificationsBrokerTopicsLoaded.and.returnValue(observableOf(true)); mockNotificationsStateService.isQualityAssuranceTopicsLoaded.and.returnValue(observableOf(true));
mockNotificationsStateService.isNotificationsBrokerTopicsLoading.and.returnValue(observableOf(false)); mockNotificationsStateService.isQualityAssuranceTopicsLoading.and.returnValue(observableOf(false));
mockNotificationsStateService.isNotificationsBrokerTopicsProcessing.and.returnValue(observableOf(false)); mockNotificationsStateService.isQualityAssuranceTopicsProcessing.and.returnValue(observableOf(false));
}); });
})); }));
@@ -75,7 +75,7 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
// synchronous beforeEach // synchronous beforeEach
beforeEach(() => { beforeEach(() => {
const html = ` const html = `
<ds-notifications-broker-topic></ds-notifications-broker-topic>`; <ds-quality-assurance-topic></ds-quality-assurance-topic>`;
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>; testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance; testComp = testFixture.componentInstance;
}); });
@@ -84,14 +84,14 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
testFixture.destroy(); testFixture.destroy();
}); });
it('should create NotificationsBrokerTopicsComponent', inject([NotificationsBrokerTopicsComponent], (app: NotificationsBrokerTopicsComponent) => { it('should create QualityAssuranceTopicsComponent', inject([QualityAssuranceTopicsComponent], (app: QualityAssuranceTopicsComponent) => {
expect(app).toBeDefined(); expect(app).toBeDefined();
})); }));
}); });
describe('Main tests running with two topics', () => { describe('Main tests running with two topics', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(NotificationsBrokerTopicsComponent); fixture = TestBed.createComponent(QualityAssuranceTopicsComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
@@ -109,8 +109,8 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
expect(comp.topics$).toBeObservable(cold('(a|)', { expect(comp.topics$).toBeObservable(cold('(a|)', {
a: [ a: [
notificationsBrokerTopicObjectMorePid, qualityAssuranceTopicObjectMorePid,
notificationsBrokerTopicObjectMoreAbstract qualityAssuranceTopicObjectMoreAbstract
] ]
})); }));
expect(comp.totalElements$).toBeObservable(cold('(a|)', { expect(comp.totalElements$).toBeObservable(cold('(a|)', {
@@ -119,12 +119,12 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
}); });
it(('Should set data properly after the view init'), () => { it(('Should set data properly after the view init'), () => {
spyOn(compAsAny, 'getNotificationsBrokerTopics'); spyOn(compAsAny, 'getQualityAssuranceTopics');
comp.ngAfterViewInit(); comp.ngAfterViewInit();
fixture.detectChanges(); fixture.detectChanges();
expect(compAsAny.getNotificationsBrokerTopics).toHaveBeenCalled(); expect(compAsAny.getQualityAssuranceTopics).toHaveBeenCalled();
}); });
it(('isTopicsLoading should return FALSE'), () => { it(('isTopicsLoading should return FALSE'), () => {
@@ -139,12 +139,12 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
})); }));
}); });
it(('getNotificationsBrokerTopics should call the service to dispatch a STATE change'), () => { it(('getQualityAssuranceTopics should call the service to dispatch a STATE change'), () => {
comp.ngOnInit(); comp.ngOnInit();
fixture.detectChanges(); fixture.detectChanges();
compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough(); compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
expect(compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage); expect(compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
}); });
}); });
}); });

View File

@@ -4,24 +4,24 @@ import { Observable, Subscription } from 'rxjs';
import { distinctUntilChanged, map, take } from 'rxjs/operators'; import { distinctUntilChanged, map, take } from 'rxjs/operators';
import { SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortOptions } from '../../../core/cache/models/sort-options.model';
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
import { NotificationsStateService } from '../../notifications-state.service'; import { NotificationsStateService } from '../../notifications-state.service';
import { AdminNotificationsBrokerTopicsPageParams } from '../../../admin/admin-notifications/admin-notifications-broker-topics-page/admin-notifications-broker-topics-page-resolver.service'; import { AdminQualityAssuranceTopicsPageParams } from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
/** /**
* Component to display the Notifications Broker topic list. * Component to display the Quality Assurance topic list.
*/ */
@Component({ @Component({
selector: 'ds-notifications-broker-topic', selector: 'ds-quality-assurance-topic',
templateUrl: './notifications-broker-topics.component.html', templateUrl: './quality-assurance-topics.component.html',
styleUrls: ['./notifications-broker-topics.component.scss'], styleUrls: ['./quality-assurance-topics.component.scss'],
}) })
export class NotificationsBrokerTopicsComponent implements OnInit { export class QualityAssuranceTopicsComponent implements OnInit {
/** /**
* The pagination system configuration for HTML listing. * The pagination system configuration for HTML listing.
* @type {PaginationComponentOptions} * @type {PaginationComponentOptions}
@@ -32,16 +32,16 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
pageSizeOptions: [5, 10, 20, 40, 60] pageSizeOptions: [5, 10, 20, 40, 60]
}); });
/** /**
* The Notifications Broker topic list sort options. * The Quality Assurance topic list sort options.
* @type {SortOptions} * @type {SortOptions}
*/ */
public paginationSortConfig: SortOptions; public paginationSortConfig: SortOptions;
/** /**
* The Notifications Broker topic list. * The Quality Assurance topic list.
*/ */
public topics$: Observable<NotificationsBrokerTopicObject[]>; public topics$: Observable<QualityAssuranceTopicObject[]>;
/** /**
* The total number of Notifications Broker topics. * The total number of Quality Assurance topics.
*/ */
public totalElements$: Observable<number>; public totalElements$: Observable<number>;
/** /**
@@ -65,7 +65,7 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
private paginationService: PaginationService, private paginationService: PaginationService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private notificationsStateService: NotificationsStateService, private notificationsStateService: NotificationsStateService,
private notificationsBrokerTopicsService: NotificationsBrokerTopicsService private qualityAssuranceTopicsService: QualityAssuranceTopicsService
) { ) {
} }
@@ -74,52 +74,52 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
*/ */
ngOnInit(): void { ngOnInit(): void {
this.sourceId = this.activatedRoute.snapshot.paramMap.get('sourceId'); this.sourceId = this.activatedRoute.snapshot.paramMap.get('sourceId');
this.notificationsBrokerTopicsService.setSourceId(this.sourceId); this.qualityAssuranceTopicsService.setSourceId(this.sourceId);
this.topics$ = this.notificationsStateService.getNotificationsBrokerTopics(); this.topics$ = this.notificationsStateService.getQualityAssuranceTopics();
this.totalElements$ = this.notificationsStateService.getNotificationsBrokerTopicsTotals(); this.totalElements$ = this.notificationsStateService.getQualityAssuranceTopicsTotals();
} }
/** /**
* First Notifications Broker topics loading after view initialization. * First Quality Assurance topics loading after view initialization.
*/ */
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.subs.push( this.subs.push(
this.notificationsStateService.isNotificationsBrokerTopicsLoaded().pipe( this.notificationsStateService.isQualityAssuranceTopicsLoaded().pipe(
take(1) take(1)
).subscribe(() => { ).subscribe(() => {
this.getNotificationsBrokerTopics(); this.getQualityAssuranceTopics();
}) })
); );
} }
/** /**
* Returns the information about the loading status of the Notifications Broker topics (if it's running or not). * Returns the information about the loading status of the Quality Assurance topics (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if the topics are loading, 'false' otherwise. * 'true' if the topics are loading, 'false' otherwise.
*/ */
public isTopicsLoading(): Observable<boolean> { public isTopicsLoading(): Observable<boolean> {
return this.notificationsStateService.isNotificationsBrokerTopicsLoading(); return this.notificationsStateService.isQualityAssuranceTopicsLoading();
} }
/** /**
* Returns the information about the processing status of the Notifications Broker topics (if it's running or not). * Returns the information about the processing status of the Quality Assurance topics (if it's running or not).
* *
* @return Observable<boolean> * @return Observable<boolean>
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise. * 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
*/ */
public isTopicsProcessing(): Observable<boolean> { public isTopicsProcessing(): Observable<boolean> {
return this.notificationsStateService.isNotificationsBrokerTopicsProcessing(); return this.notificationsStateService.isQualityAssuranceTopicsProcessing();
} }
/** /**
* Dispatch the Notifications Broker topics retrival. * Dispatch the Quality Assurance topics retrival.
*/ */
public getNotificationsBrokerTopics(): void { public getQualityAssuranceTopics(): void {
this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe( this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe(
distinctUntilChanged(), distinctUntilChanged(),
).subscribe((options: PaginationComponentOptions) => { ).subscribe((options: PaginationComponentOptions) => {
this.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics( this.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(
options.pageSize, options.pageSize,
options.currentPage options.currentPage
); );
@@ -131,7 +131,7 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
* *
* @param eventsRouteParams * @param eventsRouteParams
*/ */
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsBrokerTopicsPageParams) { protected updatePaginationFromRouteParams(eventsRouteParams: AdminQualityAssuranceTopicsPageParams) {
if (eventsRouteParams.currentPage) { if (eventsRouteParams.currentPage) {
this.paginationConfig.currentPage = eventsRouteParams.currentPage; this.paginationConfig.currentPage = eventsRouteParams.currentPage;
} }

View File

@@ -6,35 +6,35 @@ 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,
NotificationsBrokerTopicActionTypes, QualityAssuranceTopicActionTypes,
RetrieveAllTopicsAction, RetrieveAllTopicsAction,
RetrieveAllTopicsErrorAction, RetrieveAllTopicsErrorAction,
} from './notifications-broker-topics.actions'; } from './quality-assurance-topics.actions';
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { NotificationsBrokerTopicRestService } from '../../../core/notifications/broker/topics/notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from '../../../core/notifications/qa/topics/quality-assurance-topic-rest.service';
/** /**
* Provides effect methods for the Notifications Broker topics actions. * Provides effect methods for the Quality Assurance topics actions.
*/ */
@Injectable() @Injectable()
export class NotificationsBrokerTopicsEffects { export class QualityAssuranceTopicsEffects {
/** /**
* Retrieve all Notifications Broker topics managing pagination and errors. * Retrieve all Quality Assurance topics managing pagination and errors.
*/ */
@Effect() retrieveAllTopics$ = this.actions$.pipe( @Effect() retrieveAllTopics$ = this.actions$.pipe(
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS), ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS),
withLatestFrom(this.store$), withLatestFrom(this.store$),
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => { switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
return this.notificationsBrokerTopicService.getTopics( return this.qualityAssuranceTopicService.getTopics(
action.payload.elementsPerPage, action.payload.elementsPerPage,
action.payload.currentPage action.payload.currentPage
).pipe( ).pipe(
map((topics: PaginatedList<NotificationsBrokerTopicObject>) => map((topics: PaginatedList<QualityAssuranceTopicObject>) =>
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements) new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)
), ),
catchError((error: Error) => { catchError((error: Error) => {
@@ -51,7 +51,7 @@ export class NotificationsBrokerTopicsEffects {
* Show a notification on error. * Show a notification on error.
*/ */
@Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe( @Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe(
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR), ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
tap(() => { tap(() => {
this.notificationsService.error(null, this.translate.get('notifications.broker.topic.error.service.retrieve')); this.notificationsService.error(null, this.translate.get('notifications.broker.topic.error.service.retrieve'));
}) })
@@ -61,9 +61,9 @@ export class NotificationsBrokerTopicsEffects {
* Clear find all topics requests from cache. * Clear find all topics requests from cache.
*/ */
@Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe( @Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe(
ofType(NotificationsBrokerTopicActionTypes.ADD_TOPICS), ofType(QualityAssuranceTopicActionTypes.ADD_TOPICS),
tap(() => { tap(() => {
this.notificationsBrokerTopicDataService.clearFindAllTopicsRequests(); this.qualityAssuranceTopicDataService.clearFindAllTopicsRequests();
}) })
); );
@@ -73,15 +73,15 @@ export class NotificationsBrokerTopicsEffects {
* @param {Store<any>} store$ * @param {Store<any>} store$
* @param {TranslateService} translate * @param {TranslateService} translate
* @param {NotificationsService} notificationsService * @param {NotificationsService} notificationsService
* @param {NotificationsBrokerTopicsService} notificationsBrokerTopicService * @param {QualityAssuranceTopicsService} qualityAssuranceTopicService
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicDataService * @param {QualityAssuranceTopicRestService} qualityAssuranceTopicDataService
*/ */
constructor( constructor(
private actions$: Actions, private actions$: Actions,
private store$: Store<any>, private store$: Store<any>,
private translate: TranslateService, private translate: TranslateService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private notificationsBrokerTopicService: NotificationsBrokerTopicsService, private qualityAssuranceTopicService: QualityAssuranceTopicsService,
private notificationsBrokerTopicDataService: NotificationsBrokerTopicRestService private qualityAssuranceTopicDataService: QualityAssuranceTopicRestService
) { } ) { }
} }

View File

@@ -2,20 +2,20 @@ import {
AddTopicsAction, AddTopicsAction,
RetrieveAllTopicsAction, RetrieveAllTopicsAction,
RetrieveAllTopicsErrorAction RetrieveAllTopicsErrorAction
} from './notifications-broker-topics.actions'; } from './quality-assurance-topics.actions';
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState } from './notifications-broker-topics.reducer'; import { qualityAssuranceTopicsReducer, QualityAssuranceTopicState } from './quality-assurance-topics.reducer';
import { import {
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
describe('notificationsBrokerTopicsReducer test suite', () => { describe('qualityAssuranceTopicsReducer test suite', () => {
let notificationsBrokerTopicInitialState: NotificationsBrokerTopicState; let qualityAssuranceTopicInitialState: QualityAssuranceTopicState;
const elementPerPage = 3; const elementPerPage = 3;
const currentPage = 0; const currentPage = 0;
beforeEach(() => { beforeEach(() => {
notificationsBrokerTopicInitialState = { qualityAssuranceTopicInitialState = {
topics: [], topics: [],
processing: false, processing: false,
loaded: false, loaded: false,
@@ -26,30 +26,30 @@ describe('notificationsBrokerTopicsReducer test suite', () => {
}); });
it('Action RETRIEVE_ALL_TOPICS should set the State property "processing" to TRUE', () => { it('Action RETRIEVE_ALL_TOPICS should set the State property "processing" to TRUE', () => {
const expectedState = notificationsBrokerTopicInitialState; const expectedState = qualityAssuranceTopicInitialState;
expectedState.processing = true; expectedState.processing = true;
const action = new RetrieveAllTopicsAction(elementPerPage, currentPage); const action = new RetrieveAllTopicsAction(elementPerPage, currentPage);
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action); const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });
it('Action RETRIEVE_ALL_TOPICS_ERROR should change the State to initial State but processing, loaded, and currentPage', () => { it('Action RETRIEVE_ALL_TOPICS_ERROR should change the State to initial State but processing, loaded, and currentPage', () => {
const expectedState = notificationsBrokerTopicInitialState; const expectedState = qualityAssuranceTopicInitialState;
expectedState.processing = false; expectedState.processing = false;
expectedState.loaded = true; expectedState.loaded = true;
expectedState.currentPage = 0; expectedState.currentPage = 0;
const action = new RetrieveAllTopicsErrorAction(); const action = new RetrieveAllTopicsErrorAction();
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action); const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });
it('Action ADD_TOPICS should populate the State with Notifications Broker topics', () => { it('Action ADD_TOPICS should populate the State with Quality Assurance topics', () => {
const expectedState = { const expectedState = {
topics: [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ], topics: [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ],
processing: false, processing: false,
loaded: true, loaded: true,
totalPages: 1, totalPages: 1,
@@ -58,10 +58,10 @@ describe('notificationsBrokerTopicsReducer test suite', () => {
}; };
const action = new AddTopicsAction( const action = new AddTopicsAction(
[ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ], [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ],
1, 0, 2 1, 0, 2
); );
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action); const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
expect(newState).toEqual(expectedState); expect(newState).toEqual(expectedState);
}); });

View File

@@ -0,0 +1,72 @@
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
import { QualityAssuranceTopicActionTypes, QualityAssuranceTopicsActions } from './quality-assurance-topics.actions';
/**
* The interface representing the Quality Assurance topic state.
*/
export interface QualityAssuranceTopicState {
topics: QualityAssuranceTopicObject[];
processing: boolean;
loaded: boolean;
totalPages: number;
currentPage: number;
totalElements: number;
}
/**
* Used for the Quality Assurance topic state initialization.
*/
const qualityAssuranceTopicInitialState: QualityAssuranceTopicState = {
topics: [],
processing: false,
loaded: false,
totalPages: 0,
currentPage: 0,
totalElements: 0
};
/**
* The Quality Assurance Topic Reducer
*
* @param state
* the current state initialized with qualityAssuranceTopicInitialState
* @param action
* the action to perform on the state
* @return QualityAssuranceTopicState
* the new state
*/
export function qualityAssuranceTopicsReducer(state = qualityAssuranceTopicInitialState, action: QualityAssuranceTopicsActions): QualityAssuranceTopicState {
switch (action.type) {
case QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS: {
return Object.assign({}, state, {
topics: [],
processing: true
});
}
case QualityAssuranceTopicActionTypes.ADD_TOPICS: {
return Object.assign({}, state, {
topics: action.payload.topics,
processing: false,
loaded: true,
totalPages: action.payload.totalPages,
currentPage: state.currentPage,
totalElements: action.payload.totalElements
});
}
case QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR: {
return Object.assign({}, state, {
processing: false,
loaded: true,
totalPages: 0,
currentPage: 0,
totalElements: 0
});
}
default: {
return state;
}
}
}

View File

@@ -1,28 +1,28 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { NotificationsBrokerTopicRestService } from '../../../core/notifications/broker/topics/notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from '../../../core/notifications/qa/topics/quality-assurance-topic-rest.service';
import { PageInfo } from '../../../core/shared/page-info.model'; import { PageInfo } from '../../../core/shared/page-info.model';
import { FindListOptions } from '../../../core/data/request.models';
import { import {
getMockNotificationsBrokerTopicRestService, getMockQualityAssuranceTopicRestService,
notificationsBrokerTopicObjectMoreAbstract, qualityAssuranceTopicObjectMoreAbstract,
notificationsBrokerTopicObjectMorePid qualityAssuranceTopicObjectMorePid
} from '../../../shared/mocks/notifications.mock'; } from '../../../shared/mocks/notifications.mock';
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
import { cold } from 'jasmine-marbles'; import { cold } from 'jasmine-marbles';
import { buildPaginatedList } from '../../../core/data/paginated-list.model'; import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { RequestParam } from '../../../core/cache/models/request-param.model'; import { RequestParam } from '../../../core/cache/models/request-param.model';
import {FindListOptions} from '../../../core/data/find-list-options.model';
describe('NotificationsBrokerTopicsService', () => { describe('QualityAssuranceTopicsService', () => {
let service: NotificationsBrokerTopicsService; let service: QualityAssuranceTopicsService;
let restService: NotificationsBrokerTopicRestService; let restService: QualityAssuranceTopicRestService;
let serviceAsAny: any; let serviceAsAny: any;
let restServiceAsAny: any; let restServiceAsAny: any;
const pageInfo = new PageInfo(); const pageInfo = new PageInfo();
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ]; const array = [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ];
const paginatedList = buildPaginatedList(pageInfo, array); const paginatedList = buildPaginatedList(pageInfo, array);
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList); const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
const elementsPerPage = 3; const elementsPerPage = 3;
@@ -31,22 +31,22 @@ describe('NotificationsBrokerTopicsService', () => {
beforeEach(async () => { beforeEach(async () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
{ provide: NotificationsBrokerTopicRestService, useClass: getMockNotificationsBrokerTopicRestService }, { provide: QualityAssuranceTopicRestService, useClass: getMockQualityAssuranceTopicRestService },
{ provide: NotificationsBrokerTopicsService, useValue: service } { provide: QualityAssuranceTopicsService, useValue: service }
] ]
}).compileComponents(); }).compileComponents();
}); });
beforeEach(() => { beforeEach(() => {
restService = TestBed.get(NotificationsBrokerTopicRestService); restService = TestBed.get(QualityAssuranceTopicRestService);
restServiceAsAny = restService; restServiceAsAny = restService;
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD)); restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
service = new NotificationsBrokerTopicsService(restService); service = new QualityAssuranceTopicsService(restService);
serviceAsAny = service; serviceAsAny = service;
}); });
describe('getTopics', () => { describe('getTopics', () => {
it('Should proxy the call to notificationsBrokerTopicRestService.getTopics', () => { it('Should proxy the call to qualityAssuranceTopicRestService.getTopics', () => {
const sortOptions = new SortOptions('name', SortDirection.ASC); const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = { const findListOptions: FindListOptions = {
elementsPerPage: elementsPerPage, elementsPerPage: elementsPerPage,
@@ -56,10 +56,10 @@ describe('NotificationsBrokerTopicsService', () => {
}; };
service.setSourceId('ENRICH!MORE!ABSTRACT'); service.setSourceId('ENRICH!MORE!ABSTRACT');
const result = service.getTopics(elementsPerPage, currentPage); const result = service.getTopics(elementsPerPage, currentPage);
expect((service as any).notificationsBrokerTopicRestService.getTopics).toHaveBeenCalledWith(findListOptions); expect((service as any).qualityAssuranceTopicRestService.getTopics).toHaveBeenCalledWith(findListOptions);
}); });
it('Should return a paginated list of Notifications Broker topics', () => { it('Should return a paginated list of Quality Assurance topics', () => {
const expected = cold('(a|)', { const expected = cold('(a|)', {
a: paginatedList a: paginatedList
}); });

View File

@@ -1,26 +1,26 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { find, map } from 'rxjs/operators'; import { find, map } from 'rxjs/operators';
import { NotificationsBrokerTopicRestService } from '../../../core/notifications/broker/topics/notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from '../../../core/notifications/qa/topics/quality-assurance-topic-rest.service';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model'; import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { FindListOptions } from '../../../core/data/request.models';
import { RemoteData } from '../../../core/data/remote-data'; import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.model';
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
import { RequestParam } from '../../../core/cache/models/request-param.model'; import { RequestParam } from '../../../core/cache/models/request-param.model';
import {FindListOptions} from '../../../core/data/find-list-options.model';
/** /**
* The service handling all Notifications Broker topic requests to the REST service. * The service handling all Quality Assurance topic requests to the REST service.
*/ */
@Injectable() @Injectable()
export class NotificationsBrokerTopicsService { export class QualityAssuranceTopicsService {
/** /**
* Initialize the service variables. * Initialize the service variables.
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicRestService * @param {QualityAssuranceTopicRestService} qualityAssuranceTopicRestService
*/ */
constructor( constructor(
private notificationsBrokerTopicRestService: NotificationsBrokerTopicRestService private qualityAssuranceTopicRestService: QualityAssuranceTopicRestService
) { } ) { }
/** /**
@@ -29,16 +29,16 @@ export class NotificationsBrokerTopicsService {
sourceId: string; sourceId: string;
/** /**
* Return the list of Notifications Broker topics managing pagination and errors. * Return the list of Quality Assurance topics managing pagination and errors.
* *
* @param elementsPerPage * @param elementsPerPage
* The number of the topics per page * The number of the topics per page
* @param currentPage * @param currentPage
* The page number to retrieve * The page number to retrieve
* @return Observable<PaginatedList<NotificationsBrokerTopicObject>> * @return Observable<PaginatedList<QualityAssuranceTopicObject>>
* The list of Notifications Broker topics. * The list of Quality Assurance topics.
*/ */
public getTopics(elementsPerPage, currentPage): Observable<PaginatedList<NotificationsBrokerTopicObject>> { public getTopics(elementsPerPage, currentPage): Observable<PaginatedList<QualityAssuranceTopicObject>> {
const sortOptions = new SortOptions('name', SortDirection.ASC); const sortOptions = new SortOptions('name', SortDirection.ASC);
const findListOptions: FindListOptions = { const findListOptions: FindListOptions = {
@@ -48,13 +48,13 @@ export class NotificationsBrokerTopicsService {
searchParams: [new RequestParam('source', this.sourceId)] searchParams: [new RequestParam('source', this.sourceId)]
}; };
return this.notificationsBrokerTopicRestService.getTopics(findListOptions).pipe( return this.qualityAssuranceTopicRestService.getTopics(findListOptions).pipe(
find((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => !rd.isResponsePending), find((rd: RemoteData<PaginatedList<QualityAssuranceTopicObject>>) => !rd.isResponsePending),
map((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => { map((rd: RemoteData<PaginatedList<QualityAssuranceTopicObject>>) => {
if (rd.hasSucceeded) { if (rd.hasSucceeded) {
return rd.payload; return rd.payload;
} else { } else {
throw new Error('Can\'t retrieve Notifications Broker topics from the Broker topics REST service'); throw new Error('Can\'t retrieve Quality Assurance topics from the Broker topics REST service');
} }
}) })
); );

View File

@@ -1,10 +1,10 @@
import { createSelector, MemoizedSelector } from '@ngrx/store'; import { createSelector, MemoizedSelector } from '@ngrx/store';
import { subStateSelector } from '../shared/selector.util'; import { subStateSelector } from '../shared/selector.util';
import { notificationsSelector, NotificationsState } from './notifications.reducer'; import { notificationsSelector, NotificationsState } from './notifications.reducer';
import { NotificationsBrokerTopicObject } from '../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
import { NotificationsBrokerTopicState } from './broker/topics/notifications-broker-topics.reducer'; import { QualityAssuranceTopicState } from './qa/topics/quality-assurance-topics.reducer';
import { NotificationsBrokerSourceState } from './broker/source/notifications-broker-source.reducer'; import { QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
import { NotificationsBrokerSourceObject } from '../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
/** /**
* Returns the Notifications state. * Returns the Notifications state.
@@ -14,33 +14,33 @@ import { NotificationsBrokerSourceObject } from '../core/notifications/broker/mo
*/ */
const _getNotificationsState = (state: any) => state.notifications; const _getNotificationsState = (state: any) => state.notifications;
// Notifications Broker topics // Quality Assurance topics
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** /**
* Returns the Notifications Broker topics State. * Returns the Quality Assurance topics State.
* @function notificationsBrokerTopicsStateSelector * @function qualityAssuranceTopicsStateSelector
* @return {NotificationsBrokerTopicState} * @return {QualityAssuranceTopicState}
*/ */
export function notificationsBrokerTopicsStateSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicState> { export function qualityAssuranceTopicsStateSelector(): MemoizedSelector<NotificationsState, QualityAssuranceTopicState> {
return subStateSelector<NotificationsState,NotificationsBrokerTopicState>(notificationsSelector, 'brokerTopic'); return subStateSelector<NotificationsState,QualityAssuranceTopicState>(notificationsSelector, 'brokerTopic');
} }
/** /**
* Returns the Notifications Broker topics list. * Returns the Quality Assurance topics list.
* @function notificationsBrokerTopicsObjectSelector * @function qualityAssuranceTopicsObjectSelector
* @return {NotificationsBrokerTopicObject[]} * @return {QualityAssuranceTopicObject[]}
*/ */
export function notificationsBrokerTopicsObjectSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicObject[]> { export function qualityAssuranceTopicsObjectSelector(): MemoizedSelector<NotificationsState, QualityAssuranceTopicObject[]> {
return subStateSelector<NotificationsState, NotificationsBrokerTopicObject[]>(notificationsBrokerTopicsStateSelector(), 'topics'); return subStateSelector<NotificationsState, QualityAssuranceTopicObject[]>(qualityAssuranceTopicsStateSelector(), 'topics');
} }
/** /**
* Returns true if the Notifications Broker topics are loaded. * Returns true if the Quality Assurance topics are loaded.
* @function isNotificationsBrokerTopicsLoadedSelector * @function isQualityAssuranceTopicsLoadedSelector
* @return {boolean} * @return {boolean}
*/ */
export const isNotificationsBrokerTopicsLoadedSelector = createSelector(_getNotificationsState, export const isQualityAssuranceTopicsLoadedSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerTopic.loaded (state: NotificationsState) => state.brokerTopic.loaded
); );
@@ -49,64 +49,64 @@ export const isNotificationsBrokerTopicsLoadedSelector = createSelector(_getNoti
* @function isDeduplicationSetsProcessingSelector * @function isDeduplicationSetsProcessingSelector
* @return {boolean} * @return {boolean}
*/ */
export const isNotificationsBrokerTopicsProcessingSelector = createSelector(_getNotificationsState, export const isQualityAssuranceTopicsProcessingSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerTopic.processing (state: NotificationsState) => state.brokerTopic.processing
); );
/** /**
* Returns the total available pages of Notifications Broker topics. * Returns the total available pages of Quality Assurance topics.
* @function getNotificationsBrokerTopicsTotalPagesSelector * @function getQualityAssuranceTopicsTotalPagesSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerTopicsTotalPagesSelector = createSelector(_getNotificationsState, export const getQualityAssuranceTopicsTotalPagesSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerTopic.totalPages (state: NotificationsState) => state.brokerTopic.totalPages
); );
/** /**
* Returns the current page of Notifications Broker topics. * Returns the current page of Quality Assurance topics.
* @function getNotificationsBrokerTopicsCurrentPageSelector * @function getQualityAssuranceTopicsCurrentPageSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerTopicsCurrentPageSelector = createSelector(_getNotificationsState, export const getQualityAssuranceTopicsCurrentPageSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerTopic.currentPage (state: NotificationsState) => state.brokerTopic.currentPage
); );
/** /**
* Returns the total number of Notifications Broker topics. * Returns the total number of Quality Assurance topics.
* @function getNotificationsBrokerTopicsTotalsSelector * @function getQualityAssuranceTopicsTotalsSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerTopicsTotalsSelector = createSelector(_getNotificationsState, export const getQualityAssuranceTopicsTotalsSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerTopic.totalElements (state: NotificationsState) => state.brokerTopic.totalElements
); );
// Notifications Broker source // Quality Assurance source
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** /**
* Returns the Notifications Broker source State. * Returns the Quality Assurance source State.
* @function notificationsBrokerSourceStateSelector * @function qualityAssuranceSourceStateSelector
* @return {NotificationsBrokerSourceState} * @return {QualityAssuranceSourceState}
*/ */
export function notificationsBrokerSourceStateSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerSourceState> { export function qualityAssuranceSourceStateSelector(): MemoizedSelector<NotificationsState, QualityAssuranceSourceState> {
return subStateSelector<NotificationsState,NotificationsBrokerSourceState>(notificationsSelector, 'brokerSource'); return subStateSelector<NotificationsState,QualityAssuranceSourceState>(notificationsSelector, 'brokerSource');
} }
/** /**
* Returns the Notifications Broker source list. * Returns the Quality Assurance source list.
* @function notificationsBrokerSourceObjectSelector * @function qualityAssuranceSourceObjectSelector
* @return {NotificationsBrokerSourceObject[]} * @return {QualityAssuranceSourceObject[]}
*/ */
export function notificationsBrokerSourceObjectSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerSourceObject[]> { export function qualityAssuranceSourceObjectSelector(): MemoizedSelector<NotificationsState, QualityAssuranceSourceObject[]> {
return subStateSelector<NotificationsState, NotificationsBrokerSourceObject[]>(notificationsBrokerSourceStateSelector(), 'source'); return subStateSelector<NotificationsState, QualityAssuranceSourceObject[]>(qualityAssuranceSourceStateSelector(), 'source');
} }
/** /**
* Returns true if the Notifications Broker source are loaded. * Returns true if the Quality Assurance source are loaded.
* @function isNotificationsBrokerSourceLoadedSelector * @function isQualityAssuranceSourceLoadedSelector
* @return {boolean} * @return {boolean}
*/ */
export const isNotificationsBrokerSourceLoadedSelector = createSelector(_getNotificationsState, export const isQualityAssuranceSourceLoadedSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerSource.loaded (state: NotificationsState) => state.brokerSource.loaded
); );
@@ -115,33 +115,33 @@ export const isNotificationsBrokerSourceLoadedSelector = createSelector(_getNoti
* @function isDeduplicationSetsProcessingSelector * @function isDeduplicationSetsProcessingSelector
* @return {boolean} * @return {boolean}
*/ */
export const isNotificationsBrokerSourceProcessingSelector = createSelector(_getNotificationsState, export const isQualityAssuranceSourceProcessingSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerSource.processing (state: NotificationsState) => state.brokerSource.processing
); );
/** /**
* Returns the total available pages of Notifications Broker source. * Returns the total available pages of Quality Assurance source.
* @function getNotificationsBrokerSourceTotalPagesSelector * @function getQualityAssuranceSourceTotalPagesSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerSourceTotalPagesSelector = createSelector(_getNotificationsState, export const getQualityAssuranceSourceTotalPagesSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerSource.totalPages (state: NotificationsState) => state.brokerSource.totalPages
); );
/** /**
* Returns the current page of Notifications Broker source. * Returns the current page of Quality Assurance source.
* @function getNotificationsBrokerSourceCurrentPageSelector * @function getQualityAssuranceSourceCurrentPageSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerSourceCurrentPageSelector = createSelector(_getNotificationsState, export const getQualityAssuranceSourceCurrentPageSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerSource.currentPage (state: NotificationsState) => state.brokerSource.currentPage
); );
/** /**
* Returns the total number of Notifications Broker source. * Returns the total number of Quality Assurance source.
* @function getNotificationsBrokerSourceTotalsSelector * @function getQualityAssuranceSourceTotalsSelector
* @return {number} * @return {number}
*/ */
export const getNotificationsBrokerSourceTotalsSelector = createSelector(_getNotificationsState, export const getQualityAssuranceSourceTotalsSelector = createSelector(_getNotificationsState,
(state: NotificationsState) => state.brokerSource.totalElements (state: NotificationsState) => state.brokerSource.totalElements
); );

View File

@@ -1,9 +1,9 @@
import { of as observableOf } from 'rxjs'; import { of as observableOf } from 'rxjs';
import { ResourceType } from '../../core/shared/resource-type'; import { ResourceType } from '../../core/shared/resource-type';
import { NotificationsBrokerTopicObject } from '../../core/notifications/broker/models/notifications-broker-topic.model'; import { QualityAssuranceTopicObject } from '../../core/notifications/qa/models/quality-assurance-topic.model';
import { NotificationsBrokerEventObject } from '../../core/notifications/broker/models/notifications-broker-event.model'; import { QualityAssuranceEventObject } from '../../core/notifications/qa/models/quality-assurance-event.model';
import { NotificationsBrokerTopicRestService } from '../../core/notifications/broker/topics/notifications-broker-topic-rest.service'; import { QualityAssuranceTopicRestService } from '../../core/notifications/qa/topics/quality-assurance-topic-rest.service';
import { NotificationsBrokerEventRestService } from '../../core/notifications/broker/events/notifications-broker-event-rest.service'; import { QualityAssuranceEventRestService } from '../../core/notifications/qa/events/quality-assurance-event-rest.service';
import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { NotificationsStateService } from '../../notifications/notifications-state.service'; import { NotificationsStateService } from '../../notifications/notifications-state.service';
import { Item } from '../../core/shared/item.model'; import { Item } from '../../core/shared/item.model';
@@ -13,7 +13,7 @@ import {
createSuccessfulRemoteDataObject$ createSuccessfulRemoteDataObject$
} from '../remote-data.utils'; } from '../remote-data.utils';
import { SearchResult } from '../search/models/search-result.model'; import { SearchResult } from '../search/models/search-result.model';
import { NotificationsBrokerSourceObject } from '../../core/notifications/broker/models/notifications-broker-source.model'; import { QualityAssuranceSourceObject } from '../../core/notifications/qa/models/quality-assurance-source.model';
// REST Mock --------------------------------------------------------------------- // REST Mock ---------------------------------------------------------------------
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@@ -1333,7 +1333,7 @@ export const NotificationsMockDspaceObject: SearchResult<DSpaceObject> = Object.
// Sources // Sources
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
export const notificationsBrokerSourceObjectMorePid: NotificationsBrokerSourceObject = { export const qualityAssuranceSourceObjectMorePid: QualityAssuranceSourceObject = {
type: new ResourceType('nbsource'), type: new ResourceType('nbsource'),
id: 'ENRICH!MORE!PID', id: 'ENRICH!MORE!PID',
lastEvent: '2020/10/09 10:11 UTC', lastEvent: '2020/10/09 10:11 UTC',
@@ -1345,7 +1345,7 @@ export const notificationsBrokerSourceObjectMorePid: NotificationsBrokerSourceOb
} }
}; };
export const notificationsBrokerSourceObjectMoreAbstract: NotificationsBrokerSourceObject = { export const qualityAssuranceSourceObjectMoreAbstract: QualityAssuranceSourceObject = {
type: new ResourceType('nbsource'), type: new ResourceType('nbsource'),
id: 'ENRICH!MORE!ABSTRACT', id: 'ENRICH!MORE!ABSTRACT',
lastEvent: '2020/09/08 21:14 UTC', lastEvent: '2020/09/08 21:14 UTC',
@@ -1357,7 +1357,7 @@ export const notificationsBrokerSourceObjectMoreAbstract: NotificationsBrokerSou
} }
}; };
export const notificationsBrokerSourceObjectMissingPid: NotificationsBrokerSourceObject = { export const qualityAssuranceSourceObjectMissingPid: QualityAssuranceSourceObject = {
type: new ResourceType('nbsource'), type: new ResourceType('nbsource'),
id: 'ENRICH!MISSING!PID', id: 'ENRICH!MISSING!PID',
lastEvent: '2020/10/01 07:36 UTC', lastEvent: '2020/10/01 07:36 UTC',
@@ -1372,7 +1372,7 @@ export const notificationsBrokerSourceObjectMissingPid: NotificationsBrokerSourc
// Topics // Topics
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
export const notificationsBrokerTopicObjectMorePid: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMorePid: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MORE!PID', id: 'ENRICH!MORE!PID',
name: 'ENRICH/MORE/PID', name: 'ENRICH/MORE/PID',
@@ -1385,7 +1385,7 @@ export const notificationsBrokerTopicObjectMorePid: NotificationsBrokerTopicObje
} }
}; };
export const notificationsBrokerTopicObjectMoreAbstract: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMoreAbstract: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MORE!ABSTRACT', id: 'ENRICH!MORE!ABSTRACT',
name: 'ENRICH/MORE/ABSTRACT', name: 'ENRICH/MORE/ABSTRACT',
@@ -1398,7 +1398,7 @@ export const notificationsBrokerTopicObjectMoreAbstract: NotificationsBrokerTopi
} }
}; };
export const notificationsBrokerTopicObjectMissingPid: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMissingPid: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MISSING!PID', id: 'ENRICH!MISSING!PID',
name: 'ENRICH/MISSING/PID', name: 'ENRICH/MISSING/PID',
@@ -1411,7 +1411,7 @@ export const notificationsBrokerTopicObjectMissingPid: NotificationsBrokerTopicO
} }
}; };
export const notificationsBrokerTopicObjectMissingAbstract: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMissingAbstract: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MISSING!ABSTRACT', id: 'ENRICH!MISSING!ABSTRACT',
name: 'ENRICH/MISSING/ABSTRACT', name: 'ENRICH/MISSING/ABSTRACT',
@@ -1424,7 +1424,7 @@ export const notificationsBrokerTopicObjectMissingAbstract: NotificationsBrokerT
} }
}; };
export const notificationsBrokerTopicObjectMissingAcm: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMissingAcm: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MISSING!SUBJECT!ACM', id: 'ENRICH!MISSING!SUBJECT!ACM',
name: 'ENRICH/MISSING/SUBJECT/ACM', name: 'ENRICH/MISSING/SUBJECT/ACM',
@@ -1437,7 +1437,7 @@ export const notificationsBrokerTopicObjectMissingAcm: NotificationsBrokerTopicO
} }
}; };
export const notificationsBrokerTopicObjectMissingProject: NotificationsBrokerTopicObject = { export const qualityAssuranceTopicObjectMissingProject: QualityAssuranceTopicObject = {
type: new ResourceType('nbtopic'), type: new ResourceType('nbtopic'),
id: 'ENRICH!MISSING!PROJECT', id: 'ENRICH!MISSING!PROJECT',
name: 'ENRICH/MISSING/PROJECT', name: 'ENRICH/MISSING/PROJECT',
@@ -1453,7 +1453,7 @@ export const notificationsBrokerTopicObjectMissingProject: NotificationsBrokerTo
// Events // Events
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
export const notificationsBrokerEventObjectMissingPid: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174001', id: '123e4567-e89b-12d3-a456-426614174001',
uuid: '123e4567-e89b-12d3-a456-426614174001', uuid: '123e4567-e89b-12d3-a456-426614174001',
type: new ResourceType('nbevent'), type: new ResourceType('nbevent'),
@@ -1489,10 +1489,10 @@ export const notificationsBrokerEventObjectMissingPid: NotificationsBrokerEventO
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingPid2: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid2: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174004', id: '123e4567-e89b-12d3-a456-426614174004',
uuid: '123e4567-e89b-12d3-a456-426614174004', uuid: '123e4567-e89b-12d3-a456-426614174004',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/21486', originalId: 'oai:www.openstarts.units.it:10077/21486',
title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI', title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI',
trust: 1.0, trust: 1.0,
@@ -1525,10 +1525,10 @@ export const notificationsBrokerEventObjectMissingPid2: NotificationsBrokerEvent
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingPid3: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid3: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174005', id: '123e4567-e89b-12d3-a456-426614174005',
uuid: '123e4567-e89b-12d3-a456-426614174005', uuid: '123e4567-e89b-12d3-a456-426614174005',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/554', originalId: 'oai:www.openstarts.units.it:10077/554',
title: 'Sustainable development', title: 'Sustainable development',
trust: 0.375, trust: 0.375,
@@ -1561,10 +1561,10 @@ export const notificationsBrokerEventObjectMissingPid3: NotificationsBrokerEvent
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingPid4: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid4: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174006', id: '123e4567-e89b-12d3-a456-426614174006',
uuid: '123e4567-e89b-12d3-a456-426614174006', uuid: '123e4567-e89b-12d3-a456-426614174006',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/10787', originalId: 'oai:www.openstarts.units.it:10077/10787',
title: 'Reply to Critics', title: 'Reply to Critics',
trust: 1.0, trust: 1.0,
@@ -1597,10 +1597,10 @@ export const notificationsBrokerEventObjectMissingPid4: NotificationsBrokerEvent
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingPid5: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid5: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174007', id: '123e4567-e89b-12d3-a456-426614174007',
uuid: '123e4567-e89b-12d3-a456-426614174007', uuid: '123e4567-e89b-12d3-a456-426614174007',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/11339', originalId: 'oai:www.openstarts.units.it:10077/11339',
title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI', title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI',
trust: 0.375, trust: 0.375,
@@ -1633,10 +1633,10 @@ export const notificationsBrokerEventObjectMissingPid5: NotificationsBrokerEvent
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingPid6: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingPid6: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174008', id: '123e4567-e89b-12d3-a456-426614174008',
uuid: '123e4567-e89b-12d3-a456-426614174008', uuid: '123e4567-e89b-12d3-a456-426614174008',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/29860', originalId: 'oai:www.openstarts.units.it:10077/29860',
title: 'Donald Davidson', title: 'Donald Davidson',
trust: 0.375, trust: 0.375,
@@ -1669,10 +1669,10 @@ export const notificationsBrokerEventObjectMissingPid6: NotificationsBrokerEvent
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingAbstract: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingAbstract: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174009', id: '123e4567-e89b-12d3-a456-426614174009',
uuid: '123e4567-e89b-12d3-a456-426614174009', uuid: '123e4567-e89b-12d3-a456-426614174009',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/21110', originalId: 'oai:www.openstarts.units.it:10077/21110',
title: 'Missing abstract article', title: 'Missing abstract article',
trust: 0.751, trust: 0.751,
@@ -1705,10 +1705,10 @@ export const notificationsBrokerEventObjectMissingAbstract: NotificationsBrokerE
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10)) related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
}; };
export const notificationsBrokerEventObjectMissingProjectFound: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingProjectFound: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174002', id: '123e4567-e89b-12d3-a456-426614174002',
uuid: '123e4567-e89b-12d3-a456-426614174002', uuid: '123e4567-e89b-12d3-a456-426614174002',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/21838', originalId: 'oai:www.openstarts.units.it:10077/21838',
title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature', title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
trust: 1.0, trust: 1.0,
@@ -1741,10 +1741,10 @@ export const notificationsBrokerEventObjectMissingProjectFound: NotificationsBro
related: createSuccessfulRemoteDataObject$(ItemMockPid10) related: createSuccessfulRemoteDataObject$(ItemMockPid10)
}; };
export const notificationsBrokerEventObjectMissingProjectNotFound: NotificationsBrokerEventObject = { export const qualityAssuranceEventObjectMissingProjectNotFound: QualityAssuranceEventObject = {
id: '123e4567-e89b-12d3-a456-426614174003', id: '123e4567-e89b-12d3-a456-426614174003',
uuid: '123e4567-e89b-12d3-a456-426614174003', uuid: '123e4567-e89b-12d3-a456-426614174003',
type: new ResourceType('notificationsBrokerEvent'), type: new ResourceType('qualityAssuranceEvent'),
originalId: 'oai:www.openstarts.units.it:10077/21838', originalId: 'oai:www.openstarts.units.it:10077/21838',
title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature', title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
trust: 1.0, trust: 1.0,
@@ -1785,51 +1785,51 @@ export const notificationsBrokerEventObjectMissingProjectNotFound: Notifications
*/ */
export function getMockNotificationsStateService(): any { export function getMockNotificationsStateService(): any {
return jasmine.createSpyObj('NotificationsStateService', { return jasmine.createSpyObj('NotificationsStateService', {
getNotificationsBrokerTopics: jasmine.createSpy('getNotificationsBrokerTopics'), getQualityAssuranceTopics: jasmine.createSpy('getQualityAssuranceTopics'),
isNotificationsBrokerTopicsLoading: jasmine.createSpy('isNotificationsBrokerTopicsLoading'), isQualityAssuranceTopicsLoading: jasmine.createSpy('isQualityAssuranceTopicsLoading'),
isNotificationsBrokerTopicsLoaded: jasmine.createSpy('isNotificationsBrokerTopicsLoaded'), isQualityAssuranceTopicsLoaded: jasmine.createSpy('isQualityAssuranceTopicsLoaded'),
isNotificationsBrokerTopicsProcessing: jasmine.createSpy('isNotificationsBrokerTopicsProcessing'), isQualityAssuranceTopicsProcessing: jasmine.createSpy('isQualityAssuranceTopicsProcessing'),
getNotificationsBrokerTopicsTotalPages: jasmine.createSpy('getNotificationsBrokerTopicsTotalPages'), getQualityAssuranceTopicsTotalPages: jasmine.createSpy('getQualityAssuranceTopicsTotalPages'),
getNotificationsBrokerTopicsCurrentPage: jasmine.createSpy('getNotificationsBrokerTopicsCurrentPage'), getQualityAssuranceTopicsCurrentPage: jasmine.createSpy('getQualityAssuranceTopicsCurrentPage'),
getNotificationsBrokerTopicsTotals: jasmine.createSpy('getNotificationsBrokerTopicsTotals'), getQualityAssuranceTopicsTotals: jasmine.createSpy('getQualityAssuranceTopicsTotals'),
dispatchRetrieveNotificationsBrokerTopics: jasmine.createSpy('dispatchRetrieveNotificationsBrokerTopics'), dispatchRetrieveQualityAssuranceTopics: jasmine.createSpy('dispatchRetrieveQualityAssuranceTopics'),
getNotificationsBrokerSource: jasmine.createSpy('getNotificationsBrokerSource'), getQualityAssuranceSource: jasmine.createSpy('getQualityAssuranceSource'),
isNotificationsBrokerSourceLoading: jasmine.createSpy('isNotificationsBrokerSourceLoading'), isQualityAssuranceSourceLoading: jasmine.createSpy('isQualityAssuranceSourceLoading'),
isNotificationsBrokerSourceLoaded: jasmine.createSpy('isNotificationsBrokerSourceLoaded'), isQualityAssuranceSourceLoaded: jasmine.createSpy('isQualityAssuranceSourceLoaded'),
isNotificationsBrokerSourceProcessing: jasmine.createSpy('isNotificationsBrokerSourceProcessing'), isQualityAssuranceSourceProcessing: jasmine.createSpy('isQualityAssuranceSourceProcessing'),
getNotificationsBrokerSourceTotalPages: jasmine.createSpy('getNotificationsBrokerSourceTotalPages'), getQualityAssuranceSourceTotalPages: jasmine.createSpy('getQualityAssuranceSourceTotalPages'),
getNotificationsBrokerSourceCurrentPage: jasmine.createSpy('getNotificationsBrokerSourceCurrentPage'), getQualityAssuranceSourceCurrentPage: jasmine.createSpy('getQualityAssuranceSourceCurrentPage'),
getNotificationsBrokerSourceTotals: jasmine.createSpy('getNotificationsBrokerSourceTotals'), getQualityAssuranceSourceTotals: jasmine.createSpy('getQualityAssuranceSourceTotals'),
dispatchRetrieveNotificationsBrokerSource: jasmine.createSpy('dispatchRetrieveNotificationsBrokerSource'), dispatchRetrieveQualityAssuranceSource: jasmine.createSpy('dispatchRetrieveQualityAssuranceSource'),
dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction') dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction')
}); });
} }
/** /**
* Mock for [[NotificationsBrokerSourceRestService]] * Mock for [[QualityAssuranceSourceRestService]]
*/ */
export function getMockNotificationsBrokerSourceRestService(): NotificationsBrokerTopicRestService { export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicRestService {
return jasmine.createSpyObj('NotificationsBrokerSourceRestService', { return jasmine.createSpyObj('QualityAssuranceSourceRestService', {
getSources: jasmine.createSpy('getSources'), getSources: jasmine.createSpy('getSources'),
getSource: jasmine.createSpy('getSource'), getSource: jasmine.createSpy('getSource'),
}); });
} }
/** /**
* Mock for [[NotificationsBrokerTopicRestService]] * Mock for [[QualityAssuranceTopicRestService]]
*/ */
export function getMockNotificationsBrokerTopicRestService(): NotificationsBrokerTopicRestService { export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicRestService {
return jasmine.createSpyObj('NotificationsBrokerTopicRestService', { return jasmine.createSpyObj('QualityAssuranceTopicRestService', {
getTopics: jasmine.createSpy('getTopics'), getTopics: jasmine.createSpy('getTopics'),
getTopic: jasmine.createSpy('getTopic'), getTopic: jasmine.createSpy('getTopic'),
}); });
} }
/** /**
* Mock for [[NotificationsBrokerEventRestService]] * Mock for [[QualityAssuranceEventRestService]]
*/ */
export function getMockNotificationsBrokerEventRestService(): NotificationsBrokerEventRestService { export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventRestService {
return jasmine.createSpyObj('NotificationsBrokerEventRestService', { return jasmine.createSpyObj('QualityAssuranceEventRestService', {
getEventsByTopic: jasmine.createSpy('getEventsByTopic'), getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
getEvent: jasmine.createSpy('getEvent'), getEvent: jasmine.createSpy('getEvent'),
patchEvent: jasmine.createSpy('patchEvent'), patchEvent: jasmine.createSpy('patchEvent'),
@@ -1840,7 +1840,7 @@ export function getMockNotificationsBrokerEventRestService(): NotificationsBroke
} }
/** /**
* Mock for [[NotificationsBrokerEventRestService]] * Mock for [[QualityAssuranceEventRestService]]
*/ */
export function getMockSuggestionsService(): any { export function getMockSuggestionsService(): any {
return jasmine.createSpyObj('SuggestionsService', { return jasmine.createSpyObj('SuggestionsService', {

View File

@@ -499,13 +499,13 @@
"admin.access-control.groups.form.return": "Back", "admin.access-control.groups.form.return": "Back",
"admin.notifications.broker.breadcrumbs": "Notifications Broker", "admin.notifications.broker.breadcrumbs": "Quality Assurance",
"admin.notifications.event.breadcrumbs": "Broker Suggestions", "admin.notifications.event.breadcrumbs": "Broker Suggestions",
"admin.notifications.event.page.title": "Broker Suggestions", "admin.notifications.event.page.title": "Broker Suggestions",
"admin.notifications.broker.page.title": "Notifications Broker", "admin.notifications.broker.page.title": "Quality Assurance",
"admin.notifications.source.breadcrumbs": "Notifications Source", "admin.notifications.source.breadcrumbs": "Notifications Source",
@@ -2687,7 +2687,7 @@
"menu.section.notifications": "Notifications", "menu.section.notifications": "Notifications",
"menu.section.notifications_broker": "Notifications Broker", "menu.section.notifications_broker": "Quality Assurance",
"menu.section.notifications_reciter": "Publication Claim", "menu.section.notifications_reciter": "Publication Claim",
@@ -2889,9 +2889,9 @@
"notifications.events.title": "Broker Suggestions", "notifications.events.title": "Broker Suggestions",
"notifications.broker.topic.error.service.retrieve": "An error occurred while loading the Notifications Broker topics", "notifications.broker.topic.error.service.retrieve": "An error occurred while loading the Quality Assurance topics",
"notifications.broker.source.error.service.retrieve": "An error occurred while loading the Notifications Broker source", "notifications.broker.source.error.service.retrieve": "An error occurred while loading the Quality Assurance source",
"notifications.broker.events.description": "Below the list of all the suggestions for the selected topic.", "notifications.broker.events.description": "Below the list of all the suggestions for the selected topic.",