mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[CST-5337] Replace Notifications broker with Quality assurance
This commit is contained in:
@@ -1 +0,0 @@
|
||||
<ds-notifications-broker-events></ds-notifications-broker-events>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
<ds-notifications-broker-source></ds-notifications-broker-source>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {}
|
@@ -1 +0,0 @@
|
||||
<ds-notifications-broker-topic></ds-notifications-broker-topic>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {
|
||||
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
||||
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) {
|
||||
return new URLCombiner(getNotificationsModuleRoute(), NOTIFICATIONS_EDIT_PATH, id).toString();
|
||||
export function getQualityAssuranceRoute(id: string) {
|
||||
return new URLCombiner(getNotificationsModuleRoute(), QUALITY_ASSURANCE_EDIT_PATH, id).toString();
|
||||
}
|
||||
|
@@ -4,26 +4,26 @@ import { RouterModule } from '@angular/router';
|
||||
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||
import { NOTIFICATIONS_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component';
|
||||
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component';
|
||||
import { AdminNotificationsBrokerTopicsPageResolver } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page-resolver.service';
|
||||
import { AdminNotificationsBrokerEventsPageResolver } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.resolver';
|
||||
import { AdminNotificationsBrokerSourcePageComponent } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-page.component';
|
||||
import { AdminNotificationsBrokerSourcePageResolver } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-page-resolver.service';
|
||||
import { SourceDataResolver } from './admin-notifications-broker-source-page-component/admin-notifications-broker-source-data.reslover';
|
||||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { SourceDataResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.reslover';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${NOTIFICATIONS_EDIT_PATH}/:sourceId`,
|
||||
component: AdminNotificationsBrokerTopicsPageComponent,
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId`,
|
||||
component: AdminQualityAssuranceTopicsPageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
openaireBrokerTopicsParams: AdminNotificationsBrokerTopicsPageResolver
|
||||
openaireBrokerTopicsParams: AdminQualityAssuranceTopicsPageResolver
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.broker.page.title',
|
||||
@@ -33,12 +33,12 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${NOTIFICATIONS_EDIT_PATH}`,
|
||||
component: AdminNotificationsBrokerSourcePageComponent,
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}`,
|
||||
component: AdminQualityAssuranceSourcePageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
openaireBrokerSourceParams: AdminNotificationsBrokerSourcePageResolver,
|
||||
openaireBrokerSourceParams: AdminQualityAssuranceSourcePageResolver,
|
||||
sourceData: SourceDataResolver
|
||||
},
|
||||
data: {
|
||||
@@ -49,12 +49,12 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
path: `${NOTIFICATIONS_EDIT_PATH}/:sourceId/:topicId`,
|
||||
component: AdminNotificationsBrokerEventsPageComponent,
|
||||
path: `${QUALITY_ASSURANCE_EDIT_PATH}/:sourceId/:topicId`,
|
||||
component: AdminQualityAssuranceEventsPageComponent,
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
openaireBrokerEventsParams: AdminNotificationsBrokerEventsPageResolver
|
||||
openaireBrokerEventsParams: AdminQualityAssuranceEventsPageResolver
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.event.page.title',
|
||||
@@ -68,9 +68,9 @@ import { SourceDataResolver } from './admin-notifications-broker-source-page-com
|
||||
I18nBreadcrumbResolver,
|
||||
I18nBreadcrumbsService,
|
||||
SourceDataResolver,
|
||||
AdminNotificationsBrokerTopicsPageResolver,
|
||||
AdminNotificationsBrokerEventsPageResolver,
|
||||
AdminNotificationsBrokerSourcePageResolver
|
||||
AdminQualityAssuranceTopicsPageResolver,
|
||||
AdminQualityAssuranceEventsPageResolver,
|
||||
AdminQualityAssuranceSourcePageResolver
|
||||
]
|
||||
})
|
||||
/**
|
||||
|
@@ -3,10 +3,10 @@ import { NgModule } from '@angular/core';
|
||||
import { CoreModule } from '../../core/core.module';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
||||
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component';
|
||||
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
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({
|
||||
imports: [
|
||||
@@ -17,9 +17,9 @@ import { AdminNotificationsBrokerSourcePageComponent } from './admin-notificatio
|
||||
NotificationsModule
|
||||
],
|
||||
declarations: [
|
||||
AdminNotificationsBrokerTopicsPageComponent,
|
||||
AdminNotificationsBrokerEventsPageComponent,
|
||||
AdminNotificationsBrokerSourcePageComponent
|
||||
AdminQualityAssuranceTopicsPageComponent,
|
||||
AdminQualityAssuranceEventsPageComponent,
|
||||
AdminQualityAssuranceSourcePageComponent
|
||||
],
|
||||
entryComponents: []
|
||||
})
|
||||
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-events></ds-quality-assurance-events>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {
|
||||
|
||||
}
|
@@ -4,7 +4,7 @@ import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/r
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminNotificationsBrokerEventsPageParams {
|
||||
export interface AdminQualityAssuranceEventsPageParams {
|
||||
pageId?: string;
|
||||
pageSize?: 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.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotificationsBrokerEventsPageResolver implements Resolve<AdminNotificationsBrokerEventsPageParams> {
|
||||
export class AdminQualityAssuranceEventsPageResolver implements Resolve<AdminQualityAssuranceEventsPageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @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 {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
@@ -3,30 +3,30 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Router } from '@a
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { NotificationsBrokerSourceObject } from '../../../core/notifications/broker/models/notifications-broker-source.model';
|
||||
import { NotificationsBrokerSourceService } from '../../../notifications/broker/source/notifications-broker-source.service';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
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.
|
||||
*/
|
||||
@Injectable()
|
||||
export class SourceDataResolver implements Resolve<Observable<NotificationsBrokerSourceObject[]>> {
|
||||
export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSourceObject[]>> {
|
||||
/**
|
||||
* Initialize the effect class variables.
|
||||
* @param {NotificationsBrokerSourceService} notificationsBrokerSourceService
|
||||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
|
||||
*/
|
||||
constructor(
|
||||
private notificationsBrokerSourceService: NotificationsBrokerSourceService,
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private router: Router
|
||||
) { }
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||
* @returns Observable<NotificationsBrokerSourceObject[]>
|
||||
* @returns Observable<QualityAssuranceSourceObject[]>
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<NotificationsBrokerSourceObject[]> {
|
||||
return this.notificationsBrokerSourceService.getSources(5,0).pipe(
|
||||
map((sources: PaginatedList<NotificationsBrokerSourceObject>) => {
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
|
||||
return this.qualityAssuranceSourceService.getSources(5,0).pipe(
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
|
||||
if (sources.page.length === 1) {
|
||||
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
|
||||
}
|
@@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminNotificationsBrokerTopicsPageParams {
|
||||
export interface AdminQualityAssuranceSourcePageParams {
|
||||
pageId?: string;
|
||||
pageSize?: 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.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotificationsBrokerTopicsPageResolver implements Resolve<AdminNotificationsBrokerTopicsPageParams> {
|
||||
export class AdminQualityAssuranceSourcePageResolver implements Resolve<AdminQualityAssuranceSourcePageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @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 {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-source></ds-quality-assurance-source>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {}
|
@@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
*/
|
||||
export interface AdminNotificationsBrokerSourcePageParams {
|
||||
export interface AdminQualityAssuranceTopicsPageParams {
|
||||
pageId?: string;
|
||||
pageSize?: 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.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotificationsBrokerSourcePageResolver implements Resolve<AdminNotificationsBrokerSourcePageParams> {
|
||||
export class AdminQualityAssuranceTopicsPageResolver implements Resolve<AdminQualityAssuranceTopicsPageParams> {
|
||||
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||
* @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 {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
@@ -0,0 +1 @@
|
||||
<ds-quality-assurance-topic></ds-quality-assurance-topic>
|
@@ -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();
|
||||
});
|
||||
});
|
@@ -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 {
|
||||
|
||||
}
|
@@ -167,9 +167,9 @@ import { SequenceService } from './shared/sequence.service';
|
||||
import { CoreState } from './core-state.model';
|
||||
import { GroupDataService } from './eperson/group-data.service';
|
||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||
import { NotificationsBrokerTopicObject } from './notifications/broker/models/notifications-broker-topic.model';
|
||||
import { NotificationsBrokerEventObject } from './notifications/broker/models/notifications-broker-event.model';
|
||||
import { NotificationsBrokerSourceObject } from './notifications/broker/models/notifications-broker-source.model';
|
||||
import { QualityAssuranceTopicObject } from './notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceEventObject } from './notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceSourceObject } from './notifications/qa/models/quality-assurance-source.model';
|
||||
import { AccessStatusObject } from '../shared/object-list/access-status-badge/access-status.model';
|
||||
import { AccessStatusDataService } from './data/access-status-data.service';
|
||||
import { LinkHeadService } from './services/link-head.service';
|
||||
@@ -369,12 +369,12 @@ export const models =
|
||||
ShortLivedToken,
|
||||
Registration,
|
||||
UsageReport,
|
||||
NotificationsBrokerTopicObject,
|
||||
NotificationsBrokerEventObject,
|
||||
QualityAssuranceTopicObject,
|
||||
QualityAssuranceEventObject,
|
||||
Root,
|
||||
SearchConfig,
|
||||
SubmissionAccessesModel,
|
||||
NotificationsBrokerSourceObject,
|
||||
QualityAssuranceSourceObject,
|
||||
AccessStatusObject,
|
||||
ResearcherProfile,
|
||||
OrcidQueue,
|
||||
|
@@ -6,8 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
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 { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
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 { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { NotificationsBrokerEventRestService } from './notifications-broker-event-rest.service';
|
||||
import { QualityAssuranceEventRestService } from './quality-assurance-event-rest.service';
|
||||
import {
|
||||
notificationsBrokerEventObjectMissingPid,
|
||||
notificationsBrokerEventObjectMissingPid2,
|
||||
notificationsBrokerEventObjectMissingProjectFound
|
||||
qualityAssuranceEventObjectMissingPid,
|
||||
qualityAssuranceEventObjectMissingPid2,
|
||||
qualityAssuranceEventObjectMissingProjectFound
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
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 service: NotificationsBrokerEventRestService;
|
||||
let service: QualityAssuranceEventRestService;
|
||||
let serviceASAny: any;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let responseCacheEntryB: RequestEntry;
|
||||
@@ -43,10 +43,10 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
const topic = 'ENRICH!MORE!PID';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [ notificationsBrokerEventObjectMissingPid, notificationsBrokerEventObjectMissingPid2 ];
|
||||
const array = [ qualityAssuranceEventObjectMissingPid, qualityAssuranceEventObjectMissingPid2 ];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const brokerEventObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid);
|
||||
const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound);
|
||||
const brokerEventObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid);
|
||||
const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
const status = 'ACCEPTED';
|
||||
@@ -99,7 +99,7 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new NotificationsBrokerEventRestService(
|
||||
service = new QualityAssuranceEventRestService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
@@ -138,7 +138,7 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
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 expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
@@ -155,15 +155,15 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
});
|
||||
|
||||
it('should proxy the call to dataservice.findById', () => {
|
||||
service.getEvent(notificationsBrokerEventObjectMissingPid.id).subscribe(
|
||||
service.getEvent(qualityAssuranceEventObjectMissingPid.id).subscribe(
|
||||
(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', () => {
|
||||
const result = service.getEvent(notificationsBrokerEventObjectMissingPid.id);
|
||||
it('should return a RemoteData<QualityAssuranceEventObject> for the object with the given URL', () => {
|
||||
const result = service.getEvent(qualityAssuranceEventObjectMissingPid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: brokerEventObjectRD
|
||||
});
|
||||
@@ -179,17 +179,17 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
});
|
||||
|
||||
it('should proxy the call to dataservice.patch', () => {
|
||||
service.patchEvent(status, notificationsBrokerEventObjectMissingPid).subscribe(
|
||||
service.patchEvent(status, qualityAssuranceEventObjectMissingPid).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingPid, operation);
|
||||
expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid, operation);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RemoteData with HTTP 200', () => {
|
||||
const result = service.patchEvent(status, notificationsBrokerEventObjectMissingPid);
|
||||
const result = service.patchEvent(status, qualityAssuranceEventObjectMissingPid);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid)
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid)
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -203,17 +203,17 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
});
|
||||
|
||||
it('should proxy the call to dataservice.postOnRelated', () => {
|
||||
service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
||||
service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
||||
(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', () => {
|
||||
const result = service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID);
|
||||
const result = service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound)
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound)
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -227,15 +227,15 @@ describe('NotificationsBrokerEventRestService', () => {
|
||||
});
|
||||
|
||||
it('should proxy the call to dataservice.deleteOnRelated', () => {
|
||||
service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id).subscribe(
|
||||
service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingProjectFound.id);
|
||||
expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RestResponse with HTTP 204', () => {
|
||||
const result = service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id);
|
||||
const result = service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject({})
|
||||
});
|
@@ -4,7 +4,6 @@ import { Store } from '@ngrx/store';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CoreState } from '../../../core.reducers';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.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 { dataService } from '../../../cache/builders/build-decorators';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { FindListOptions } from '../../../data/request.models';
|
||||
import { DataService } from '../../../data/data.service';
|
||||
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { NotificationsBrokerEventObject } from '../models/notifications-broker-event.model';
|
||||
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from '../models/notifications-broker-event-object.resource-type';
|
||||
import { QualityAssuranceEventObject } from '../models/quality-assurance-event.model';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from '../models/quality-assurance-event-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
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 */
|
||||
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
|
||||
class DataServiceImpl extends DataService<QualityAssuranceEventObject> {
|
||||
/**
|
||||
* The REST endpoint.
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {ChangeAnalyzer<NotificationsBrokerEventObject>} comparator
|
||||
* @param {ChangeAnalyzer<QualityAssuranceEventObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -54,17 +54,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: ChangeAnalyzer<NotificationsBrokerEventObject>) {
|
||||
protected comparator: ChangeAnalyzer<QualityAssuranceEventObject>) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The service handling all Notifications Broker topic REST requests.
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(NOTIFICATIONS_BROKER_EVENT_OBJECT)
|
||||
export class NotificationsBrokerEventRestService {
|
||||
@dataService(QUALITY_ASSURANCE_EVENT_OBJECT)
|
||||
export class QualityAssuranceEventRestService {
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
@@ -78,7 +78,7 @@ export class NotificationsBrokerEventRestService {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {DefaultChangeAnalyzer<NotificationsBrokerEventObject>} comparator
|
||||
* @param {DefaultChangeAnalyzer<QualityAssuranceEventObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -87,23 +87,23 @@ export class NotificationsBrokerEventRestService {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerEventObject>) {
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceEventObject>) {
|
||||
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
|
||||
* The Notifications Broker topic
|
||||
* The Quality Assurance topic
|
||||
* @param options
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerEventObject>>>
|
||||
* The list of Notifications Broker events.
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceEventObject>>>
|
||||
* 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 = [
|
||||
{
|
||||
fieldName: 'topic',
|
||||
@@ -121,32 +121,32 @@ export class NotificationsBrokerEventRestService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a single Notifications Broker event.
|
||||
* Return a single Quality Assurance event.
|
||||
*
|
||||
* @param id
|
||||
* The Notifications Broker event id
|
||||
* The Quality Assurance event id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||
* @return Observable<RemoteData<NotificationsBrokerEventObject>>
|
||||
* The Notifications Broker event.
|
||||
* @return Observable<RemoteData<QualityAssuranceEventObject>>
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the new status of a Notifications Broker event.
|
||||
* Save the new status of a Quality Assurance event.
|
||||
*
|
||||
* @param status
|
||||
* The new status
|
||||
* @param dso NotificationsBrokerEventObject
|
||||
* @param dso QualityAssuranceEventObject
|
||||
* The event item
|
||||
* @param reason
|
||||
* The optional reason (not used for now; for future implementation)
|
||||
* @return Observable<RestResponse>
|
||||
* 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>[] = [
|
||||
{
|
||||
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
|
||||
* The Id of the Notifications Broker event
|
||||
* The Id of the Quality Assurance event
|
||||
* @param projectId
|
||||
* The project Id to bound
|
||||
* @return Observable<RestResponse>
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a project from a Notifications Broker event publication.
|
||||
* Remove a project from a Quality Assurance event publication.
|
||||
*
|
||||
* @param itemId
|
||||
* The Id of the Notifications Broker event
|
||||
* The Id of the Quality Assurance event
|
||||
* @return Observable<RestResponse>
|
||||
* The REST response.
|
||||
*/
|
@@ -1,9 +1,9 @@
|
||||
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
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const NOTIFICATIONS_BROKER_TOPIC_OBJECT = new ResourceType('nbtopic');
|
||||
export const QUALITY_ASSURANCE_EVENT_OBJECT = new ResourceType('nbevent');
|
@@ -1,7 +1,6 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
||||
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from './notifications-broker-event-object.resource-type';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from './quality-assurance-event-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
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 { link, typedObject } from '../../../cache/builders/build-decorators';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@typedObject
|
||||
export class NotificationsBrokerEventObject implements CacheableObject {
|
||||
export class QualityAssuranceEventObject implements CacheableObject {
|
||||
/**
|
||||
* 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
|
@@ -1,9 +1,9 @@
|
||||
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
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const NOTIFICATIONS_BROKER_EVENT_OBJECT = new ResourceType('nbevent');
|
||||
export const QUALITY_ASSURANCE_SOURCE_OBJECT = new ResourceType('nbsource');
|
@@ -1,24 +1,24 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
|
||||
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
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
|
||||
export class NotificationsBrokerSourceObject implements CacheableObject {
|
||||
export class QualityAssuranceSourceObject implements CacheableObject {
|
||||
/**
|
||||
* 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
|
||||
id: string;
|
@@ -1,9 +1,9 @@
|
||||
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
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const NOTIFICATIONS_BROKER_SOURCE_OBJECT = new ResourceType('nbsource');
|
||||
export const QUALITY_ASSURANCE_TOPIC_OBJECT = new ResourceType('nbtopic');
|
@@ -1,30 +1,30 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
|
||||
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
||||
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from './notifications-broker-topic-object.resource-type';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from './quality-assurance-topic-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
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
|
||||
export class NotificationsBrokerTopicObject implements CacheableObject {
|
||||
export class QualityAssuranceTopicObject implements CacheableObject {
|
||||
/**
|
||||
* 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
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The Notifications Broker topic name to display
|
||||
* The Quality Assurance topic name to display
|
||||
*/
|
||||
@autoserialize
|
||||
name: string;
|
@@ -6,7 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RequestEntry } from '../../../data/request.reducer';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
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 { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { NotificationsBrokerSourceRestService } from './notifications-broker-source-rest.service';
|
||||
import {
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMorePid
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} 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 service: NotificationsBrokerSourceRestService;
|
||||
let service: QualityAssuranceSourceRestService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
@@ -36,9 +36,9 @@ describe('NotificationsBrokerSourceRestService', () => {
|
||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ];
|
||||
const array = [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const brokerSourceObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerSourceObjectMorePid);
|
||||
const brokerSourceObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceSourceObjectMorePid);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -72,7 +72,7 @@ describe('NotificationsBrokerSourceRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new NotificationsBrokerSourceRestService(
|
||||
service = new QualityAssuranceSourceRestService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
@@ -96,7 +96,7 @@ describe('NotificationsBrokerSourceRestService', () => {
|
||||
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 expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
@@ -107,16 +107,16 @@ describe('NotificationsBrokerSourceRestService', () => {
|
||||
|
||||
describe('getSource', () => {
|
||||
it('should proxy the call to dataservice.findByHref', (done) => {
|
||||
service.getSource(notificationsBrokerSourceObjectMorePid.id).subscribe(
|
||||
service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
|
||||
(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();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<NotificationsBrokerSourceObject> for the object with the given URL', () => {
|
||||
const result = service.getSource(notificationsBrokerSourceObjectMorePid.id);
|
||||
it('should return a RemoteData<QualityAssuranceSourceObject> for the object with the given URL', () => {
|
||||
const result = service.getSource(qualityAssuranceSourceObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: brokerSourceObjectRD
|
||||
});
|
@@ -5,29 +5,29 @@ import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { CoreState } from '../../../core.reducers';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { dataService } from '../../../cache/builders/build-decorators';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { FindListOptions } from '../../../data/request.models';
|
||||
import { DataService } from '../../../data/data.service';
|
||||
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { NotificationsBrokerSourceObject } from '../models/notifications-broker-source.model';
|
||||
import { NOTIFICATIONS_BROKER_SOURCE_OBJECT } from '../models/notifications-broker-source-object.resource-type';
|
||||
import { QualityAssuranceSourceObject } from '../models/quality-assurance-source.model';
|
||||
import { QUALITY_ASSURANCE_SOURCE_OBJECT } from '../models/quality-assurance-source-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.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 */
|
||||
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> {
|
||||
class DataServiceImpl extends DataService<QualityAssuranceSourceObject> {
|
||||
/**
|
||||
* The REST endpoint.
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {ChangeAnalyzer<NotificationsBrokerSourceObject>} comparator
|
||||
* @param {ChangeAnalyzer<QualityAssuranceSourceObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -52,17 +52,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerSourceObject> {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: ChangeAnalyzer<NotificationsBrokerSourceObject>) {
|
||||
protected comparator: ChangeAnalyzer<QualityAssuranceSourceObject>) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The service handling all Notifications Broker source REST requests.
|
||||
* The service handling all Quality Assurance source REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(NOTIFICATIONS_BROKER_SOURCE_OBJECT)
|
||||
export class NotificationsBrokerSourceRestService {
|
||||
@dataService(QUALITY_ASSURANCE_SOURCE_OBJECT)
|
||||
export class QualityAssuranceSourceRestService {
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ export class NotificationsBrokerSourceRestService {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {DefaultChangeAnalyzer<NotificationsBrokerSourceObject>} comparator
|
||||
* @param {DefaultChangeAnalyzer<QualityAssuranceSourceObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -85,21 +85,21 @@ export class NotificationsBrokerSourceRestService {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerSourceObject>) {
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceSourceObject>) {
|
||||
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
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerSourceObject>>>
|
||||
* The list of Notifications Broker source.
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceSourceObject>>>
|
||||
* 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(
|
||||
take(1),
|
||||
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
|
||||
* The Notifications Broker source id
|
||||
* The Quality Assurance source id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<NotificationsBrokerSourceObject>>
|
||||
* The Notifications Broker source.
|
||||
* @return Observable<RemoteData<QualityAssuranceSourceObject>>
|
||||
* 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 = {};
|
||||
return this.dataService.getBrowseEndpoint(options, 'nbsources').pipe(
|
||||
take(1),
|
@@ -6,7 +6,6 @@ import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RequestEntry } from '../../../data/request.reducer';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
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 { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { NotificationsBrokerTopicRestService } from './notifications-broker-topic-rest.service';
|
||||
import { QualityAssuranceTopicRestService } from './quality-assurance-topic-rest.service';
|
||||
import {
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import {RequestEntry} from '../../../data/request-entry.model';
|
||||
|
||||
describe('NotificationsBrokerTopicRestService', () => {
|
||||
describe('QualityAssuranceTopicRestService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
let service: NotificationsBrokerTopicRestService;
|
||||
let service: QualityAssuranceTopicRestService;
|
||||
let responseCacheEntry: RequestEntry;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
@@ -36,9 +36,9 @@ describe('NotificationsBrokerTopicRestService', () => {
|
||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ];
|
||||
const array = [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const brokerTopicObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerTopicObjectMorePid);
|
||||
const brokerTopicObjectRD = createSuccessfulRemoteDataObject(qualityAssuranceTopicObjectMorePid);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -72,7 +72,7 @@ describe('NotificationsBrokerTopicRestService', () => {
|
||||
http = {} as HttpClient;
|
||||
comparator = {} as any;
|
||||
|
||||
service = new NotificationsBrokerTopicRestService(
|
||||
service = new QualityAssuranceTopicRestService(
|
||||
requestService,
|
||||
rdbService,
|
||||
objectCache,
|
||||
@@ -96,7 +96,7 @@ describe('NotificationsBrokerTopicRestService', () => {
|
||||
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 expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
@@ -107,16 +107,16 @@ describe('NotificationsBrokerTopicRestService', () => {
|
||||
|
||||
describe('getTopic', () => {
|
||||
it('should proxy the call to dataservice.findByHref', (done) => {
|
||||
service.getTopic(notificationsBrokerTopicObjectMorePid.id).subscribe(
|
||||
service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
|
||||
(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();
|
||||
});
|
||||
|
||||
it('should return a RemoteData<NotificationsBrokerTopicObject> for the object with the given URL', () => {
|
||||
const result = service.getTopic(notificationsBrokerTopicObjectMorePid.id);
|
||||
it('should return a RemoteData<QualityAssuranceTopicObject> for the object with the given URL', () => {
|
||||
const result = service.getTopic(qualityAssuranceTopicObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: brokerTopicObjectRD
|
||||
});
|
@@ -5,29 +5,29 @@ import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { CoreState } from '../../../core.reducers';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { dataService } from '../../../cache/builders/build-decorators';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { FindListOptions } from '../../../data/request.models';
|
||||
import { DataService } from '../../../data/data.service';
|
||||
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { NotificationsBrokerTopicObject } from '../models/notifications-broker-topic.model';
|
||||
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from '../models/notifications-broker-topic-object.resource-type';
|
||||
import { QualityAssuranceTopicObject } from '../models/quality-assurance-topic.model';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.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 */
|
||||
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
|
||||
class DataServiceImpl extends DataService<QualityAssuranceTopicObject> {
|
||||
/**
|
||||
* The REST endpoint.
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {ChangeAnalyzer<NotificationsBrokerTopicObject>} comparator
|
||||
* @param {ChangeAnalyzer<QualityAssuranceTopicObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -52,17 +52,17 @@ class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: ChangeAnalyzer<NotificationsBrokerTopicObject>) {
|
||||
protected comparator: ChangeAnalyzer<QualityAssuranceTopicObject>) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The service handling all Notifications Broker topic REST requests.
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(NOTIFICATIONS_BROKER_TOPIC_OBJECT)
|
||||
export class NotificationsBrokerTopicRestService {
|
||||
@dataService(QUALITY_ASSURANCE_TOPIC_OBJECT)
|
||||
export class QualityAssuranceTopicRestService {
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ export class NotificationsBrokerTopicRestService {
|
||||
* @param {HALEndpointService} halService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {HttpClient} http
|
||||
* @param {DefaultChangeAnalyzer<NotificationsBrokerTopicObject>} comparator
|
||||
* @param {DefaultChangeAnalyzer<QualityAssuranceTopicObject>} comparator
|
||||
*/
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
@@ -85,21 +85,21 @@ export class NotificationsBrokerTopicRestService {
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerTopicObject>) {
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceTopicObject>) {
|
||||
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
|
||||
* Find list options object.
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerTopicObject>>>
|
||||
* The list of Notifications Broker topics.
|
||||
* @return Observable<RemoteData<PaginatedList<QualityAssuranceTopicObject>>>
|
||||
* 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(
|
||||
take(1),
|
||||
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
|
||||
* The Notifications Broker topic id
|
||||
* The Quality Assurance topic id
|
||||
* @param linksToFollow
|
||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||
* @return Observable<RemoteData<NotificationsBrokerTopicObject>>
|
||||
* The Notifications Broker topic.
|
||||
* @return Observable<RemoteData<QualityAssuranceTopicObject>>
|
||||
* 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 = {};
|
||||
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
|
||||
take(1),
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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');
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,15 +5,15 @@ import { cold } from 'jasmine-marbles';
|
||||
import { notificationsReducers } from './notifications.reducer';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
import {
|
||||
notificationsBrokerSourceObjectMissingPid,
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMorePid,
|
||||
notificationsBrokerTopicObjectMissingPid,
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMorePid
|
||||
qualityAssuranceSourceObjectMissingPid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceTopicObjectMissingPid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../shared/mocks/notifications.mock';
|
||||
import { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions';
|
||||
import { RetrieveAllSourceAction } from './broker/source/notifications-broker-source.actions';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
|
||||
|
||||
describe('NotificationsStateService', () => {
|
||||
let service: NotificationsStateService;
|
||||
@@ -42,9 +42,9 @@ describe('NotificationsStateService', () => {
|
||||
notifications: {
|
||||
brokerTopic: {
|
||||
topics: [
|
||||
notificationsBrokerTopicObjectMorePid,
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMissingPid
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMissingPid
|
||||
],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
@@ -79,9 +79,9 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopics', () => {
|
||||
describe('getQualityAssuranceTopics', () => {
|
||||
it('Should return an empty array', () => {
|
||||
const result = service.getNotificationsBrokerTopics();
|
||||
const result = service.getQualityAssuranceTopics();
|
||||
const expected = cold('(a)', {
|
||||
a: []
|
||||
});
|
||||
@@ -89,9 +89,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsTotalPages', () => {
|
||||
describe('getQualityAssuranceTopicsTotalPages', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsTotalPages();
|
||||
const result = service.getQualityAssuranceTopicsTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -99,9 +99,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsCurrentPage', () => {
|
||||
describe('getQualityAssuranceTopicsCurrentPage', () => {
|
||||
it('Should return minus one (0)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsCurrentPage();
|
||||
const result = service.getQualityAssuranceTopicsCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -109,9 +109,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsTotals', () => {
|
||||
describe('getQualityAssuranceTopicsTotals', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsTotals();
|
||||
const result = service.getQualityAssuranceTopicsTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -119,9 +119,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsLoading', () => {
|
||||
describe('isQualityAssuranceTopicsLoading', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsLoading();
|
||||
const result = service.isQualityAssuranceTopicsLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
});
|
||||
@@ -129,9 +129,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsLoaded', () => {
|
||||
describe('isQualityAssuranceTopicsLoaded', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsLoaded();
|
||||
const result = service.isQualityAssuranceTopicsLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -139,9 +139,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsProcessing', () => {
|
||||
describe('isQualityAssuranceTopicsProcessing', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsProcessing();
|
||||
const result = service.isQualityAssuranceTopicsProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -171,23 +171,23 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopics', () => {
|
||||
describe('getQualityAssuranceTopics', () => {
|
||||
it('Should return an array of topics', () => {
|
||||
const result = service.getNotificationsBrokerTopics();
|
||||
const result = service.getQualityAssuranceTopics();
|
||||
const expected = cold('(a)', {
|
||||
a: [
|
||||
notificationsBrokerTopicObjectMorePid,
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMissingPid
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMissingPid
|
||||
]
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsTotalPages', () => {
|
||||
describe('getQualityAssuranceTopicsTotalPages', () => {
|
||||
it('Should return one (1)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsTotalPages();
|
||||
const result = service.getQualityAssuranceTopicsTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
});
|
||||
@@ -195,9 +195,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsCurrentPage', () => {
|
||||
describe('getQualityAssuranceTopicsCurrentPage', () => {
|
||||
it('Should return minus zero (1)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsCurrentPage();
|
||||
const result = service.getQualityAssuranceTopicsCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
});
|
||||
@@ -205,9 +205,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerTopicsTotals', () => {
|
||||
describe('getQualityAssuranceTopicsTotals', () => {
|
||||
it('Should return three (3)', () => {
|
||||
const result = service.getNotificationsBrokerTopicsTotals();
|
||||
const result = service.getQualityAssuranceTopicsTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 3
|
||||
});
|
||||
@@ -215,9 +215,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsLoading', () => {
|
||||
describe('isQualityAssuranceTopicsLoading', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsLoading();
|
||||
const result = service.isQualityAssuranceTopicsLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -225,9 +225,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsLoaded', () => {
|
||||
describe('isQualityAssuranceTopicsLoaded', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsLoaded();
|
||||
const result = service.isQualityAssuranceTopicsLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
});
|
||||
@@ -235,9 +235,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerTopicsProcessing', () => {
|
||||
describe('isQualityAssuranceTopicsProcessing', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerTopicsProcessing();
|
||||
const result = service.isQualityAssuranceTopicsProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -267,12 +267,12 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('dispatchRetrieveNotificationsBrokerTopics', () => {
|
||||
describe('dispatchRetrieveQualityAssuranceTopics', () => {
|
||||
it('Should call store.dispatch', () => {
|
||||
const elementsPerPage = 3;
|
||||
const currentPage = 1;
|
||||
const action = new RetrieveAllTopicsAction(elementsPerPage, currentPage);
|
||||
service.dispatchRetrieveNotificationsBrokerTopics(elementsPerPage, currentPage);
|
||||
service.dispatchRetrieveQualityAssuranceTopics(elementsPerPage, currentPage);
|
||||
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
|
||||
});
|
||||
});
|
||||
@@ -300,9 +300,9 @@ describe('NotificationsStateService', () => {
|
||||
notifications: {
|
||||
brokerSource: {
|
||||
source: [
|
||||
notificationsBrokerSourceObjectMorePid,
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMissingPid
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMissingPid
|
||||
],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
@@ -337,9 +337,9 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSource', () => {
|
||||
describe('getQualityAssuranceSource', () => {
|
||||
it('Should return an empty array', () => {
|
||||
const result = service.getNotificationsBrokerSource();
|
||||
const result = service.getQualityAssuranceSource();
|
||||
const expected = cold('(a)', {
|
||||
a: []
|
||||
});
|
||||
@@ -347,9 +347,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourceTotalPages', () => {
|
||||
describe('getQualityAssuranceSourceTotalPages', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getNotificationsBrokerSourceTotalPages();
|
||||
const result = service.getQualityAssuranceSourceTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -357,9 +357,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourcesCurrentPage', () => {
|
||||
describe('getQualityAssuranceSourcesCurrentPage', () => {
|
||||
it('Should return minus one (0)', () => {
|
||||
const result = service.getNotificationsBrokerSourceCurrentPage();
|
||||
const result = service.getQualityAssuranceSourceCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -367,9 +367,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourceTotals', () => {
|
||||
describe('getQualityAssuranceSourceTotals', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getNotificationsBrokerSourceTotals();
|
||||
const result = service.getQualityAssuranceSourceTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
});
|
||||
@@ -377,9 +377,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceLoading', () => {
|
||||
describe('isQualityAssuranceSourceLoading', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isNotificationsBrokerSourceLoading();
|
||||
const result = service.isQualityAssuranceSourceLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
});
|
||||
@@ -387,9 +387,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceLoaded', () => {
|
||||
describe('isQualityAssuranceSourceLoaded', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerSourceLoaded();
|
||||
const result = service.isQualityAssuranceSourceLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -397,9 +397,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceProcessing', () => {
|
||||
describe('isQualityAssuranceSourceProcessing', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerSourceProcessing();
|
||||
const result = service.isQualityAssuranceSourceProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -429,23 +429,23 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSource', () => {
|
||||
describe('getQualityAssuranceSource', () => {
|
||||
it('Should return an array of Source', () => {
|
||||
const result = service.getNotificationsBrokerSource();
|
||||
const result = service.getQualityAssuranceSource();
|
||||
const expected = cold('(a)', {
|
||||
a: [
|
||||
notificationsBrokerSourceObjectMorePid,
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMissingPid
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMissingPid
|
||||
]
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourceTotalPages', () => {
|
||||
describe('getQualityAssuranceSourceTotalPages', () => {
|
||||
it('Should return one (1)', () => {
|
||||
const result = service.getNotificationsBrokerSourceTotalPages();
|
||||
const result = service.getQualityAssuranceSourceTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
});
|
||||
@@ -453,9 +453,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourceCurrentPage', () => {
|
||||
describe('getQualityAssuranceSourceCurrentPage', () => {
|
||||
it('Should return minus zero (1)', () => {
|
||||
const result = service.getNotificationsBrokerSourceCurrentPage();
|
||||
const result = service.getQualityAssuranceSourceCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
});
|
||||
@@ -463,9 +463,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerSourceTotals', () => {
|
||||
describe('getQualityAssuranceSourceTotals', () => {
|
||||
it('Should return three (3)', () => {
|
||||
const result = service.getNotificationsBrokerSourceTotals();
|
||||
const result = service.getQualityAssuranceSourceTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 3
|
||||
});
|
||||
@@ -473,9 +473,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceLoading', () => {
|
||||
describe('isQualityAssuranceSourceLoading', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerSourceLoading();
|
||||
const result = service.isQualityAssuranceSourceLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -483,9 +483,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceLoaded', () => {
|
||||
describe('isQualityAssuranceSourceLoaded', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isNotificationsBrokerSourceLoaded();
|
||||
const result = service.isQualityAssuranceSourceLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
});
|
||||
@@ -493,9 +493,9 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNotificationsBrokerSourceProcessing', () => {
|
||||
describe('isQualityAssuranceSourceProcessing', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isNotificationsBrokerSourceProcessing();
|
||||
const result = service.isQualityAssuranceSourceProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
});
|
||||
@@ -525,12 +525,12 @@ describe('NotificationsStateService', () => {
|
||||
spyOn(store, 'dispatch');
|
||||
});
|
||||
|
||||
describe('dispatchRetrieveNotificationsBrokerSource', () => {
|
||||
describe('dispatchRetrieveQualityAssuranceSource', () => {
|
||||
it('Should call store.dispatch', () => {
|
||||
const elementsPerPage = 3;
|
||||
const currentPage = 1;
|
||||
const action = new RetrieveAllSourceAction(elementsPerPage, currentPage);
|
||||
service.dispatchRetrieveNotificationsBrokerSource(elementsPerPage, currentPage);
|
||||
service.dispatchRetrieveQualityAssuranceSource(elementsPerPage, currentPage);
|
||||
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
|
||||
});
|
||||
});
|
||||
|
@@ -3,24 +3,24 @@ import { select, Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import {
|
||||
getNotificationsBrokerTopicsCurrentPageSelector,
|
||||
getNotificationsBrokerTopicsTotalPagesSelector,
|
||||
getNotificationsBrokerTopicsTotalsSelector,
|
||||
isNotificationsBrokerTopicsLoadedSelector,
|
||||
notificationsBrokerTopicsObjectSelector,
|
||||
isNotificationsBrokerTopicsProcessingSelector,
|
||||
notificationsBrokerSourceObjectSelector,
|
||||
isNotificationsBrokerSourceLoadedSelector,
|
||||
isNotificationsBrokerSourceProcessingSelector,
|
||||
getNotificationsBrokerSourceTotalPagesSelector,
|
||||
getNotificationsBrokerSourceCurrentPageSelector,
|
||||
getNotificationsBrokerSourceTotalsSelector
|
||||
getQualityAssuranceTopicsCurrentPageSelector,
|
||||
getQualityAssuranceTopicsTotalPagesSelector,
|
||||
getQualityAssuranceTopicsTotalsSelector,
|
||||
isQualityAssuranceTopicsLoadedSelector,
|
||||
qualityAssuranceTopicsObjectSelector,
|
||||
isQualityAssuranceTopicsProcessingSelector,
|
||||
qualityAssuranceSourceObjectSelector,
|
||||
isQualityAssuranceSourceLoadedSelector,
|
||||
isQualityAssuranceSourceProcessingSelector,
|
||||
getQualityAssuranceSourceTotalPagesSelector,
|
||||
getQualityAssuranceSourceCurrentPageSelector,
|
||||
getQualityAssuranceSourceTotalsSelector
|
||||
} 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 { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions';
|
||||
import { NotificationsBrokerSourceObject } from '../core/notifications/broker/models/notifications-broker-source.model';
|
||||
import { RetrieveAllSourceAction } from './broker/source/notifications-broker-source.actions';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
|
||||
|
||||
/**
|
||||
* The service handling the Notifications State.
|
||||
@@ -34,179 +34,179 @@ export class NotificationsStateService {
|
||||
*/
|
||||
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>
|
||||
* The list of Notifications Broker topics.
|
||||
* @return Observable<QualityAssuranceTopicObject>
|
||||
* The list of Quality Assurance topics.
|
||||
*/
|
||||
public getNotificationsBrokerTopics(): Observable<NotificationsBrokerTopicObject[]> {
|
||||
return this.store.pipe(select(notificationsBrokerTopicsObjectSelector()));
|
||||
public getQualityAssuranceTopics(): Observable<QualityAssuranceTopicObject[]> {
|
||||
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>
|
||||
* 'true' if the topics are loading, 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerTopicsLoading(): Observable<boolean> {
|
||||
public isQualityAssuranceTopicsLoading(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(isNotificationsBrokerTopicsLoadedSelector),
|
||||
select(isQualityAssuranceTopicsLoadedSelector),
|
||||
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>
|
||||
* 'true' if the topics are loaded, 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerTopicsLoaded(): Observable<boolean> {
|
||||
return this.store.pipe(select(isNotificationsBrokerTopicsLoadedSelector));
|
||||
public isQualityAssuranceTopicsLoaded(): Observable<boolean> {
|
||||
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>
|
||||
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerTopicsProcessing(): Observable<boolean> {
|
||||
return this.store.pipe(select(isNotificationsBrokerTopicsProcessingSelector));
|
||||
public isQualityAssuranceTopicsProcessing(): Observable<boolean> {
|
||||
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>
|
||||
* The number of the Notifications Broker topics pages.
|
||||
* The number of the Quality Assurance topics pages.
|
||||
*/
|
||||
public getNotificationsBrokerTopicsTotalPages(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerTopicsTotalPagesSelector));
|
||||
public getQualityAssuranceTopicsTotalPages(): Observable<number> {
|
||||
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>
|
||||
* The number of the current Notifications Broker topics page.
|
||||
* The number of the current Quality Assurance topics page.
|
||||
*/
|
||||
public getNotificationsBrokerTopicsCurrentPage(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerTopicsCurrentPageSelector));
|
||||
public getQualityAssuranceTopicsCurrentPage(): Observable<number> {
|
||||
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>
|
||||
* The number of the Notifications Broker topics.
|
||||
* The number of the Quality Assurance topics.
|
||||
*/
|
||||
public getNotificationsBrokerTopicsTotals(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerTopicsTotalsSelector));
|
||||
public getQualityAssuranceTopicsTotals(): Observable<number> {
|
||||
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
|
||||
* The number of the topics per page.
|
||||
* @param currentPage
|
||||
* 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));
|
||||
}
|
||||
|
||||
// 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>
|
||||
* The list of Notifications Broker source.
|
||||
* @return Observable<QualityAssuranceSourceObject>
|
||||
* The list of Quality Assurance source.
|
||||
*/
|
||||
public getNotificationsBrokerSource(): Observable<NotificationsBrokerSourceObject[]> {
|
||||
return this.store.pipe(select(notificationsBrokerSourceObjectSelector()));
|
||||
public getQualityAssuranceSource(): Observable<QualityAssuranceSourceObject[]> {
|
||||
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>
|
||||
* 'true' if the source are loading, 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerSourceLoading(): Observable<boolean> {
|
||||
public isQualityAssuranceSourceLoading(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(isNotificationsBrokerSourceLoadedSelector),
|
||||
select(isQualityAssuranceSourceLoadedSelector),
|
||||
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>
|
||||
* 'true' if the source are loaded, 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerSourceLoaded(): Observable<boolean> {
|
||||
return this.store.pipe(select(isNotificationsBrokerSourceLoadedSelector));
|
||||
public isQualityAssuranceSourceLoaded(): Observable<boolean> {
|
||||
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>
|
||||
* 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise.
|
||||
*/
|
||||
public isNotificationsBrokerSourceProcessing(): Observable<boolean> {
|
||||
return this.store.pipe(select(isNotificationsBrokerSourceProcessingSelector));
|
||||
public isQualityAssuranceSourceProcessing(): Observable<boolean> {
|
||||
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>
|
||||
* The number of the Notifications Broker source pages.
|
||||
* The number of the Quality Assurance source pages.
|
||||
*/
|
||||
public getNotificationsBrokerSourceTotalPages(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerSourceTotalPagesSelector));
|
||||
public getQualityAssuranceSourceTotalPages(): Observable<number> {
|
||||
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>
|
||||
* The number of the current Notifications Broker source page.
|
||||
* The number of the current Quality Assurance source page.
|
||||
*/
|
||||
public getNotificationsBrokerSourceCurrentPage(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerSourceCurrentPageSelector));
|
||||
public getQualityAssuranceSourceCurrentPage(): Observable<number> {
|
||||
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>
|
||||
* The number of the Notifications Broker source.
|
||||
* The number of the Quality Assurance source.
|
||||
*/
|
||||
public getNotificationsBrokerSourceTotals(): Observable<number> {
|
||||
return this.store.pipe(select(getNotificationsBrokerSourceTotalsSelector));
|
||||
public getQualityAssuranceSourceTotals(): Observable<number> {
|
||||
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
|
||||
* The number of the source per page.
|
||||
* @param currentPage
|
||||
* 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));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { NotificationsBrokerSourceEffects } from './broker/source/notifications-broker-source.effects';
|
||||
import { NotificationsBrokerTopicsEffects } from './broker/topics/notifications-broker-topics.effects';
|
||||
import { QualityAssuranceSourceEffects } from './qa/source/quality-assurance-source.effects';
|
||||
import { QualityAssuranceTopicsEffects } from './qa/topics/quality-assurance-topics.effects';
|
||||
|
||||
export const notificationsEffects = [
|
||||
NotificationsBrokerTopicsEffects,
|
||||
NotificationsBrokerSourceEffects
|
||||
QualityAssuranceTopicsEffects,
|
||||
QualityAssuranceSourceEffects
|
||||
];
|
||||
|
@@ -6,20 +6,20 @@ import { EffectsModule } from '@ngrx/effects';
|
||||
import { CoreModule } from '../core/core.module';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { storeModuleConfig } from '../app.reducer';
|
||||
import { NotificationsBrokerTopicsComponent } from './broker/topics/notifications-broker-topics.component';
|
||||
import { NotificationsBrokerEventsComponent } from './broker/events/notifications-broker-events.component';
|
||||
import { QualityAssuranceTopicsComponent } from './qa/topics/quality-assurance-topics.component';
|
||||
import { QualityAssuranceEventsComponent } from './qa/events/quality-assurance-events.component';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
import { notificationsReducers, NotificationsState } from './notifications.reducer';
|
||||
import { notificationsEffects } from './notifications.effects';
|
||||
import { NotificationsBrokerTopicsService } from './broker/topics/notifications-broker-topics.service';
|
||||
import { NotificationsBrokerTopicRestService } from '../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||
import { NotificationsBrokerEventRestService } from '../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||
import { ProjectEntryImportModalComponent } from './broker/project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
|
||||
import { QualityAssuranceTopicRestService } from '../core/notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
import { QualityAssuranceEventRestService } from '../core/notifications/qa/events/quality-assurance-event-rest.service';
|
||||
import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SearchModule } from '../shared/search/search.module';
|
||||
import { NotificationsBrokerSourceComponent } from './broker/source/notifications-broker-source.component';
|
||||
import { NotificationsBrokerSourceService } from './broker/source/notifications-broker-source.service';
|
||||
import { NotificationsBrokerSourceRestService } from '../core/notifications/broker/source/notifications-broker-source-rest.service';
|
||||
import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component';
|
||||
import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service';
|
||||
import { QualityAssuranceSourceRestService } from '../core/notifications/qa/source/quality-assurance-source-rest.service';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
@@ -31,9 +31,9 @@ const MODULES = [
|
||||
];
|
||||
|
||||
const COMPONENTS = [
|
||||
NotificationsBrokerTopicsComponent,
|
||||
NotificationsBrokerEventsComponent,
|
||||
NotificationsBrokerSourceComponent
|
||||
QualityAssuranceTopicsComponent,
|
||||
QualityAssuranceEventsComponent,
|
||||
QualityAssuranceSourceComponent
|
||||
];
|
||||
|
||||
const DIRECTIVES = [ ];
|
||||
@@ -44,11 +44,11 @@ const ENTRY_COMPONENTS = [
|
||||
|
||||
const PROVIDERS = [
|
||||
NotificationsStateService,
|
||||
NotificationsBrokerTopicsService,
|
||||
NotificationsBrokerSourceService,
|
||||
NotificationsBrokerTopicRestService,
|
||||
NotificationsBrokerSourceRestService,
|
||||
NotificationsBrokerEventRestService
|
||||
QualityAssuranceTopicsService,
|
||||
QualityAssuranceSourceService,
|
||||
QualityAssuranceTopicRestService,
|
||||
QualityAssuranceSourceRestService,
|
||||
QualityAssuranceEventRestService
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@@ -1,18 +1,18 @@
|
||||
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store';
|
||||
import { notificationsBrokerSourceReducer, NotificationsBrokerSourceState } from './broker/source/notifications-broker-source.reducer';
|
||||
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState, } from './broker/topics/notifications-broker-topics.reducer';
|
||||
import { qualityAssuranceSourceReducer, QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
|
||||
import { qualityAssuranceTopicsReducer, QualityAssuranceTopicState, } from './qa/topics/quality-assurance-topics.reducer';
|
||||
|
||||
/**
|
||||
* The OpenAIRE State
|
||||
*/
|
||||
export interface NotificationsState {
|
||||
'brokerTopic': NotificationsBrokerTopicState;
|
||||
'brokerSource': NotificationsBrokerSourceState;
|
||||
'brokerTopic': QualityAssuranceTopicState;
|
||||
'brokerSource': QualityAssuranceSourceState;
|
||||
}
|
||||
|
||||
export const notificationsReducers: ActionReducerMap<NotificationsState> = {
|
||||
brokerTopic: notificationsBrokerTopicsReducer,
|
||||
brokerSource: notificationsBrokerSourceReducer
|
||||
brokerTopic: qualityAssuranceTopicsReducer,
|
||||
brokerSource: qualityAssuranceSourceReducer
|
||||
};
|
||||
|
||||
export const notificationsSelector = createFeatureSelector<NotificationsState>('notifications');
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<h2 class="border-bottom pb-2">{{'notifications.events.title'| translate}}</h2>
|
||||
<p>{{'notifications.broker.events.description'| translate}}</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>
|
||||
{{'notifications.broker.events.back' | translate}}
|
||||
</a>
|
||||
@@ -23,7 +23,7 @@
|
||||
[paginationOptions]="paginationConfig"
|
||||
[collectionSize]="(totalElements$ | async)"
|
||||
[sortOptions]="paginationSortConfig"
|
||||
(paginationChange)="getNotificationsBrokerEvents()">
|
||||
(paginationChange)="getQualityAssuranceEvents()">
|
||||
|
||||
<ds-loading class="container" *ngIf="(isEventLoading | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
|
||||
<ng-container *ngIf="!(isEventLoading | async)">
|
||||
@@ -140,7 +140,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<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>
|
||||
{{'notifications.broker.events.back' | translate}}
|
||||
</a>
|
@@ -5,15 +5,15 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||
import { NotificationsBrokerEventsComponent } from './notifications-broker-events.component';
|
||||
import { QualityAssuranceEventRestService } from '../../../core/notifications/qa/events/quality-assurance-event-rest.service';
|
||||
import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
|
||||
import {
|
||||
getMockNotificationsBrokerEventRestService,
|
||||
getMockQualityAssuranceEventRestService,
|
||||
ItemMockPid10,
|
||||
ItemMockPid8,
|
||||
ItemMockPid9,
|
||||
notificationsBrokerEventObjectMissingProjectFound,
|
||||
notificationsBrokerEventObjectMissingProjectNotFound,
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectNotFound,
|
||||
NotificationsMockDspaceObject
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
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 { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { NotificationsBrokerEventObject } from '../../../core/notifications/broker/models/notifications-broker-event.model';
|
||||
import { NotificationsBrokerEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { QualityAssuranceEventObject } from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
@@ -34,14 +34,14 @@ import {
|
||||
createSuccessfulRemoteDataObject,
|
||||
createSuccessfulRemoteDataObject$
|
||||
} from '../../../shared/remote-data.utils';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
let fixture: ComponentFixture<NotificationsBrokerEventsComponent>;
|
||||
let comp: NotificationsBrokerEventsComponent;
|
||||
describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceEventsComponent>;
|
||||
let comp: QualityAssuranceEventsComponent;
|
||||
let compAsAny: any;
|
||||
let scheduler: TestScheduler;
|
||||
|
||||
@@ -50,9 +50,9 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
close: () => null,
|
||||
dismiss: () => null
|
||||
};
|
||||
const notificationsBrokerEventRestServiceStub: any = getMockNotificationsBrokerEventRestService();
|
||||
const qualityAssuranceEventRestServiceStub: any = getMockQualityAssuranceEventRestService();
|
||||
const activatedRouteParams = {
|
||||
notificationsBrokerEventsParams: {
|
||||
qualityAssuranceEventsParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 10
|
||||
}
|
||||
@@ -61,19 +61,19 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
id: 'ENRICH!MISSING!PROJECT'
|
||||
};
|
||||
|
||||
const events: NotificationsBrokerEventObject[] = [
|
||||
notificationsBrokerEventObjectMissingProjectFound,
|
||||
notificationsBrokerEventObjectMissingProjectNotFound
|
||||
const events: QualityAssuranceEventObject[] = [
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectNotFound
|
||||
];
|
||||
const paginationService = new PaginationServiceStub();
|
||||
|
||||
function getNotificationsBrokerEventData1(): NotificationsBrokerEventData {
|
||||
function getQualityAssuranceEventData1(): QualityAssuranceEventData {
|
||||
return {
|
||||
event: notificationsBrokerEventObjectMissingProjectFound,
|
||||
id: notificationsBrokerEventObjectMissingProjectFound.id,
|
||||
title: notificationsBrokerEventObjectMissingProjectFound.title,
|
||||
event: qualityAssuranceEventObjectMissingProjectFound,
|
||||
id: qualityAssuranceEventObjectMissingProjectFound.id,
|
||||
title: qualityAssuranceEventObjectMissingProjectFound.title,
|
||||
hasProject: true,
|
||||
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title,
|
||||
projectTitle: qualityAssuranceEventObjectMissingProjectFound.message.title,
|
||||
projectId: ItemMockPid10.id,
|
||||
handle: ItemMockPid10.handle,
|
||||
reason: null,
|
||||
@@ -82,11 +82,11 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
};
|
||||
}
|
||||
|
||||
function getNotificationsBrokerEventData2(): NotificationsBrokerEventData {
|
||||
function getQualityAssuranceEventData2(): QualityAssuranceEventData {
|
||||
return {
|
||||
event: notificationsBrokerEventObjectMissingProjectNotFound,
|
||||
id: notificationsBrokerEventObjectMissingProjectNotFound.id,
|
||||
title: notificationsBrokerEventObjectMissingProjectNotFound.title,
|
||||
event: qualityAssuranceEventObjectMissingProjectNotFound,
|
||||
id: qualityAssuranceEventObjectMissingProjectNotFound.id,
|
||||
title: qualityAssuranceEventObjectMissingProjectNotFound.title,
|
||||
hasProject: false,
|
||||
projectTitle: null,
|
||||
projectId: null,
|
||||
@@ -104,17 +104,17 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
declarations: [
|
||||
NotificationsBrokerEventsComponent,
|
||||
QualityAssuranceEventsComponent,
|
||||
TestComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
|
||||
{ provide: NotificationsBrokerEventRestService, useValue: notificationsBrokerEventRestServiceStub },
|
||||
{ provide: QualityAssuranceEventRestService, useValue: qualityAssuranceEventRestServiceStub },
|
||||
{ provide: NgbModal, useValue: modalStub },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
{ provide: TranslateService, useValue: getMockTranslateService() },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
NotificationsBrokerEventsComponent
|
||||
QualityAssuranceEventsComponent
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents().then();
|
||||
@@ -129,7 +129,7 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
// synchronous beforeEach
|
||||
beforeEach(() => {
|
||||
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>;
|
||||
testComp = testFixture.componentInstance;
|
||||
});
|
||||
@@ -138,14 +138,14 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
testFixture.destroy();
|
||||
});
|
||||
|
||||
it('should create NotificationsBrokerEventsComponent', inject([NotificationsBrokerEventsComponent], (app: NotificationsBrokerEventsComponent) => {
|
||||
it('should create QualityAssuranceEventsComponent', inject([QualityAssuranceEventsComponent], (app: QualityAssuranceEventsComponent) => {
|
||||
expect(app).toBeDefined();
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Main tests', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NotificationsBrokerEventsComponent);
|
||||
fixture = TestBed.createComponent(QualityAssuranceEventsComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
});
|
||||
@@ -159,8 +159,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
describe('setEventUpdated', () => {
|
||||
it('should update events', () => {
|
||||
const expected = [
|
||||
getNotificationsBrokerEventData1(),
|
||||
getNotificationsBrokerEventData2()
|
||||
getQualityAssuranceEventData1(),
|
||||
getQualityAssuranceEventData2()
|
||||
];
|
||||
scheduler.schedule(() => {
|
||||
compAsAny.setEventUpdated(events);
|
||||
@@ -179,14 +179,14 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
|
||||
it('should call executeAction if a project is present', () => {
|
||||
const action = 'ACCEPTED';
|
||||
comp.modalChoice(action, getNotificationsBrokerEventData1(), modalStub);
|
||||
expect(comp.executeAction).toHaveBeenCalledWith(action, getNotificationsBrokerEventData1());
|
||||
comp.modalChoice(action, getQualityAssuranceEventData1(), modalStub);
|
||||
expect(comp.executeAction).toHaveBeenCalledWith(action, getQualityAssuranceEventData1());
|
||||
});
|
||||
|
||||
it('should call openModal if a project is not present', () => {
|
||||
const action = 'ACCEPTED';
|
||||
comp.modalChoice(action, getNotificationsBrokerEventData2(), modalStub);
|
||||
expect(comp.openModal).toHaveBeenCalledWith(action, getNotificationsBrokerEventData2(), modalStub);
|
||||
comp.modalChoice(action, getQualityAssuranceEventData2(), 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(comp, 'executeAction');
|
||||
|
||||
comp.openModal(action, getNotificationsBrokerEventData1(), modalStub);
|
||||
comp.openModal(action, getQualityAssuranceEventData1(), modalStub);
|
||||
expect(compAsAny.modalService.open).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -217,7 +217,7 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
}
|
||||
);
|
||||
scheduler.schedule(() => {
|
||||
comp.openModalLookup(getNotificationsBrokerEventData1());
|
||||
comp.openModalLookup(getQualityAssuranceEventData1());
|
||||
});
|
||||
scheduler.flush();
|
||||
|
||||
@@ -227,27 +227,27 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
});
|
||||
|
||||
describe('executeAction', () => {
|
||||
it('should call getNotificationsBrokerEvents on 200 response from REST', () => {
|
||||
it('should call getQualityAssuranceEvents on 200 response from REST', () => {
|
||||
const action = 'ACCEPTED';
|
||||
spyOn(compAsAny, 'getNotificationsBrokerEvents');
|
||||
notificationsBrokerEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||
spyOn(compAsAny, 'getQualityAssuranceEvents');
|
||||
qualityAssuranceEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||
|
||||
scheduler.schedule(() => {
|
||||
comp.executeAction(action, getNotificationsBrokerEventData1());
|
||||
comp.executeAction(action, getQualityAssuranceEventData1());
|
||||
});
|
||||
scheduler.flush();
|
||||
|
||||
expect(compAsAny.getNotificationsBrokerEvents).toHaveBeenCalled();
|
||||
expect(compAsAny.getQualityAssuranceEvents).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('boundProject', () => {
|
||||
it('should populate the project data inside "eventData"', () => {
|
||||
const eventData = getNotificationsBrokerEventData2();
|
||||
const eventData = getQualityAssuranceEventData2();
|
||||
const projectId = 'UUID-23943-34u43-38344';
|
||||
const projectName = 'Test Project';
|
||||
const projectHandle = '1000/1000';
|
||||
notificationsBrokerEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||
qualityAssuranceEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||
|
||||
scheduler.schedule(() => {
|
||||
comp.boundProject(eventData, projectId, projectName, projectHandle);
|
||||
@@ -263,8 +263,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
|
||||
describe('removeProject', () => {
|
||||
it('should remove the project data inside "eventData"', () => {
|
||||
const eventData = getNotificationsBrokerEventData1();
|
||||
notificationsBrokerEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$());
|
||||
const eventData = getQualityAssuranceEventData1();
|
||||
qualityAssuranceEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$());
|
||||
|
||||
scheduler.schedule(() => {
|
||||
comp.removeProject(eventData);
|
||||
@@ -278,8 +278,8 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getNotificationsBrokerEvents', () => {
|
||||
it('should call the "notificationsBrokerEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => {
|
||||
describe('getQualityAssuranceEvents', () => {
|
||||
it('should call the "qualityAssuranceEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => {
|
||||
comp.paginationConfig = new PaginationComponentOptions();
|
||||
comp.paginationConfig.currentPage = 1;
|
||||
comp.paginationConfig.pageSize = 20;
|
||||
@@ -297,20 +297,20 @@ describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||
currentPage: comp.paginationConfig.currentPage
|
||||
});
|
||||
const array = [
|
||||
notificationsBrokerEventObjectMissingProjectFound,
|
||||
notificationsBrokerEventObjectMissingProjectNotFound,
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectNotFound,
|
||||
];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
notificationsBrokerEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
|
||||
qualityAssuranceEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
|
||||
spyOn(compAsAny, 'setEventUpdated');
|
||||
|
||||
scheduler.schedule(() => {
|
||||
compAsAny.getNotificationsBrokerEvents();
|
||||
compAsAny.getQualityAssuranceEvents();
|
||||
});
|
||||
scheduler.flush();
|
||||
|
||||
expect(compAsAny.notificationsBrokerEventRestService.getEventsByTopic).toHaveBeenCalledWith(
|
||||
expect(compAsAny.qualityAssuranceEventRestService.getEventsByTopic).toHaveBeenCalledWith(
|
||||
activatedRouteParamsMap.id,
|
||||
options,
|
||||
followLink('target'),followLink('related')
|
@@ -9,12 +9,11 @@ import { distinctUntilChanged, map, mergeMap, scan, switchMap, take } from 'rxjs
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import {
|
||||
NotificationsBrokerEventObject,
|
||||
QualityAssuranceEventObject,
|
||||
OpenaireBrokerEventMessageObject
|
||||
} from '../../../core/notifications/broker/models/notifications-broker-event.model';
|
||||
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceEventRestService } from '../../../core/notifications/qa/events/quality-assurance-event-rest.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
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 { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
NotificationsBrokerEventData,
|
||||
QualityAssuranceEventData,
|
||||
ProjectEntryImportModalComponent
|
||||
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { combineLatest } from 'rxjs/internal/observable/combineLatest';
|
||||
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({
|
||||
selector: 'ds-notifications-broker-events',
|
||||
templateUrl: './notifications-broker-events.component.html',
|
||||
styleUrls: ['./notifications-broker-events.scomponent.scss'],
|
||||
selector: 'ds-quality-assurance-events',
|
||||
templateUrl: './quality-assurance-events.component.html',
|
||||
styleUrls: ['./quality-assurance-events.scomponent.scss'],
|
||||
})
|
||||
export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
export class QualityAssuranceEventsComponent implements OnInit {
|
||||
/**
|
||||
* The pagination system configuration for HTML listing.
|
||||
* @type {PaginationComponentOptions}
|
||||
@@ -50,27 +50,27 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
});
|
||||
/**
|
||||
* The Notifications Broker event list sort options.
|
||||
* The Quality Assurance event list sort options.
|
||||
* @type {SortOptions}
|
||||
*/
|
||||
public paginationSortConfig: SortOptions = new SortOptions('trust', SortDirection.DESC);
|
||||
/**
|
||||
* Array to save the presence of a project inside an Notifications Broker event.
|
||||
* @type {NotificationsBrokerEventData[]>}
|
||||
* Array to save the presence of a project inside an Quality Assurance event.
|
||||
* @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>}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
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}
|
||||
*/
|
||||
public topic: string;
|
||||
@@ -114,7 +114,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
* @param {ActivatedRoute} activatedRoute
|
||||
* @param {NgbModal} modalService
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {NotificationsBrokerEventRestService} notificationsBrokerEventRestService
|
||||
* @param {QualityAssuranceEventRestService} qualityAssuranceEventRestService
|
||||
* @param {PaginationService} paginationService
|
||||
* @param {TranslateService} translateService
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private modalService: NgbModal,
|
||||
private notificationsService: NotificationsService,
|
||||
private notificationsBrokerEventRestService: NotificationsBrokerEventRestService,
|
||||
private qualityAssuranceEventRestService: QualityAssuranceEventRestService,
|
||||
private paginationService: PaginationService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
@@ -142,7 +142,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
this.showTopic = id.replace(regEx, '/');
|
||||
this.topic = id;
|
||||
this.isEventPageLoading.next(false);
|
||||
this.getNotificationsBrokerEvents();
|
||||
this.getQualityAssuranceEvents();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -162,12 +162,12 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
*
|
||||
* @param {string} action
|
||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||
* @param {NotificationsBrokerEventData} eventData
|
||||
* the Notifications Broker event data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event data
|
||||
* @param {any} content
|
||||
* 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) {
|
||||
this.executeAction(action, eventData);
|
||||
} else {
|
||||
@@ -180,12 +180,12 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
*
|
||||
* @param {string} action
|
||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||
* @param {NotificationsBrokerEventData} eventData
|
||||
* the Notifications Broker event data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event data
|
||||
* @param {any} content
|
||||
* 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(
|
||||
(result) => {
|
||||
if (result === 'do') {
|
||||
@@ -203,10 +203,10 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
/**
|
||||
* Open a modal where the user can select the project.
|
||||
*
|
||||
* @param {NotificationsBrokerEventData} eventData
|
||||
* the Notifications Broker event item data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event item data
|
||||
*/
|
||||
public openModalLookup(eventData: NotificationsBrokerEventData): void {
|
||||
public openModalLookup(eventData: QualityAssuranceEventData): void {
|
||||
this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, {
|
||||
size: 'lg'
|
||||
});
|
||||
@@ -232,19 +232,19 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
*
|
||||
* @param {string} action
|
||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||
* @param {NotificationsBrokerEventData} eventData
|
||||
* the Notifications Broker event data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event data
|
||||
*/
|
||||
public executeAction(action: string, eventData: NotificationsBrokerEventData): void {
|
||||
public executeAction(action: string, eventData: QualityAssuranceEventData): void {
|
||||
eventData.isRunning = true;
|
||||
this.subs.push(
|
||||
this.notificationsBrokerEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||
this.qualityAssuranceEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.isSuccess && rd.statusCode === 200) {
|
||||
this.notificationsService.success(
|
||||
this.translateService.instant('notifications.broker.event.action.saved')
|
||||
);
|
||||
this.getNotificationsBrokerEvents();
|
||||
this.getQualityAssuranceEvents();
|
||||
} else {
|
||||
this.notificationsService.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
|
||||
* the Notifications Broker event item data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event item data
|
||||
* @param {string} projectId
|
||||
* the project Id to bound
|
||||
* @param {string} projectTitle
|
||||
@@ -267,11 +267,11 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
* @param {string} projectHandle
|
||||
* 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;
|
||||
this.subs.push(
|
||||
this.notificationsBrokerEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||
this.qualityAssuranceEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.isSuccess) {
|
||||
this.notificationsService.success(
|
||||
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
|
||||
* the Notifications Broker event data
|
||||
* @param {QualityAssuranceEventData} eventData
|
||||
* the Quality Assurance event data
|
||||
*/
|
||||
public removeProject(eventData: NotificationsBrokerEventData): void {
|
||||
public removeProject(eventData: QualityAssuranceEventData): void {
|
||||
eventData.isRunning = true;
|
||||
this.subs.push(
|
||||
this.notificationsBrokerEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||
this.qualityAssuranceEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData())
|
||||
.subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.isSuccess) {
|
||||
this.notificationsService.success(
|
||||
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(
|
||||
distinctUntilChanged(),
|
||||
switchMap((options: FindListOptions) => this.notificationsBrokerEventRestService.getEventsByTopic(
|
||||
switchMap((options: FindListOptions) => this.qualityAssuranceEventRestService.getEventsByTopic(
|
||||
this.topic,
|
||||
options,
|
||||
followLink('target'), followLink('related')
|
||||
)),
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((rd: RemoteData<PaginatedList<NotificationsBrokerEventObject>>) => {
|
||||
).subscribe((rd: RemoteData<PaginatedList<QualityAssuranceEventObject>>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.isEventLoading.next(false);
|
||||
this.totalElements$ = observableOf(rd.payload.totalElements);
|
||||
this.setEventUpdated(rd.payload.page);
|
||||
} 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
|
||||
* the Notifications Broker event item
|
||||
* @param {QualityAssuranceEventObject[]} events
|
||||
* the Quality Assurance event item
|
||||
*/
|
||||
protected setEventUpdated(events: NotificationsBrokerEventObject[]): void {
|
||||
protected setEventUpdated(events: QualityAssuranceEventObject[]): void {
|
||||
this.subs.push(
|
||||
from(events).pipe(
|
||||
mergeMap((event: NotificationsBrokerEventObject) => {
|
||||
mergeMap((event: QualityAssuranceEventObject) => {
|
||||
const related$ = event.related.pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
);
|
||||
@@ -387,7 +387,7 @@ export class NotificationsBrokerEventsComponent implements OnInit {
|
||||
);
|
||||
return combineLatest([related$, target$]).pipe(
|
||||
map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => {
|
||||
const data: NotificationsBrokerEventData = {
|
||||
const data: QualityAssuranceEventData = {
|
||||
event: event,
|
||||
id: event.id,
|
||||
title: event.title,
|
@@ -17,16 +17,16 @@ import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import {
|
||||
ItemMockPid10,
|
||||
notificationsBrokerEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
NotificationsMockDspaceObject
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
|
||||
const eventData = {
|
||||
event: notificationsBrokerEventObjectMissingProjectFound,
|
||||
id: notificationsBrokerEventObjectMissingProjectFound.id,
|
||||
title: notificationsBrokerEventObjectMissingProjectFound.title,
|
||||
event: qualityAssuranceEventObjectMissingProjectFound,
|
||||
id: qualityAssuranceEventObjectMissingProjectFound.id,
|
||||
title: qualityAssuranceEventObjectMissingProjectFound.title,
|
||||
hasProject: true,
|
||||
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title,
|
||||
projectTitle: qualityAssuranceEventObjectMissingProjectFound.message.title,
|
||||
projectId: ItemMockPid10.id,
|
||||
handle: ItemMockPid10.handle,
|
||||
reason: null,
|
@@ -13,10 +13,10 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import {
|
||||
NotificationsBrokerEventObject,
|
||||
NotificationsBrokerEventMessageObject,
|
||||
QualityAssuranceEventObject,
|
||||
QualityAssuranceEventMessageObject,
|
||||
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 { Item } from '../../../core/shared/item.model';
|
||||
|
||||
@@ -34,13 +34,13 @@ export enum ImportType {
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
@@ -83,14 +83,14 @@ export interface NotificationsBrokerEventData {
|
||||
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.
|
||||
*/
|
||||
export class ProjectEntryImportModalComponent implements OnInit {
|
||||
/**
|
||||
* The external source entry
|
||||
*/
|
||||
@Input() externalSourceEntry: NotificationsBrokerEventData;
|
||||
@Input() externalSourceEntry: QualityAssuranceEventData;
|
||||
/**
|
||||
* The number of results per page
|
||||
*/
|
@@ -1,6 +1,6 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
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
|
||||
@@ -10,19 +10,19 @@ import { NotificationsBrokerSourceObject } from '../../../core/notifications/bro
|
||||
* literal types and runs a simple check to guarantee all
|
||||
* action types in the application are unique.
|
||||
*/
|
||||
export const NotificationsBrokerSourceActionTypes = {
|
||||
ADD_SOURCE: type('dspace/integration/notifications/broker/ADD_SOURCE'),
|
||||
RETRIEVE_ALL_SOURCE: type('dspace/integration/notifications/broker/RETRIEVE_ALL_SOURCE'),
|
||||
RETRIEVE_ALL_SOURCE_ERROR: type('dspace/integration/notifications/broker/RETRIEVE_ALL_SOURCE_ERROR'),
|
||||
export const QualityAssuranceSourceActionTypes = {
|
||||
ADD_SOURCE: type('dspace/integration/notifications/qa/ADD_SOURCE'),
|
||||
RETRIEVE_ALL_SOURCE: type('dspace/integration/notifications/qa/RETRIEVE_ALL_SOURCE'),
|
||||
RETRIEVE_ALL_SOURCE_ERROR: type('dspace/integration/notifications/qa/RETRIEVE_ALL_SOURCE_ERROR'),
|
||||
};
|
||||
|
||||
/* 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 {
|
||||
type = NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE;
|
||||
type = QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE;
|
||||
payload: {
|
||||
elementsPerPage: 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 {
|
||||
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.
|
||||
*/
|
||||
export class AddSourceAction implements Action {
|
||||
type = NotificationsBrokerSourceActionTypes.ADD_SOURCE;
|
||||
type = QualityAssuranceSourceActionTypes.ADD_SOURCE;
|
||||
payload: {
|
||||
source: NotificationsBrokerSourceObject[];
|
||||
source: QualityAssuranceSourceObject[];
|
||||
totalPages: number;
|
||||
currentPage: number;
|
||||
totalElements: number;
|
||||
@@ -74,9 +74,9 @@ export class AddSourceAction implements Action {
|
||||
* @param currentPage
|
||||
* the current page
|
||||
* @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 = {
|
||||
source,
|
||||
totalPages,
|
||||
@@ -93,7 +93,7 @@ export class AddSourceAction implements Action {
|
||||
* Export a type alias of all actions in this action group
|
||||
* so that reducers can easily compose action types.
|
||||
*/
|
||||
export type NotificationsBrokerSourceActions
|
||||
export type QualityAssuranceSourceActions
|
||||
= RetrieveAllSourceAction
|
||||
|RetrieveAllSourceErrorAction
|
||||
|AddSourceAction;
|
@@ -8,15 +8,15 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3 class="border-bottom pb-2">{{'notifications.broker.source'| translate}}</h3>
|
||||
|
||||
|
||||
<ds-loading class="container" *ngIf="(isSourceLoading() | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
|
||||
<ds-pagination *ngIf="!(isSourceLoading() | async)"
|
||||
[paginationOptions]="paginationConfig"
|
||||
[collectionSize]="(totalElements$ | async)"
|
||||
[hideGear]="false"
|
||||
[hideSortOptions]="true"
|
||||
(paginationChange)="getNotificationsBrokerSource()">
|
||||
|
||||
(paginationChange)="getQualityAssuranceSource()">
|
||||
|
||||
<ds-loading class="container" *ngIf="(isSourceProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading>
|
||||
<ng-container *ngIf="!(isSourceProcessing() | async)">
|
||||
<div *ngIf="(sources$|async)?.length == 0" class="alert alert-info w-100 mb-2 mt-2" role="alert">
|
||||
@@ -55,4 +55,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -7,22 +7,22 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMorePid
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} 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 { cold } from 'jasmine-marbles';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
|
||||
describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
let fixture: ComponentFixture<NotificationsBrokerSourceComponent>;
|
||||
let comp: NotificationsBrokerSourceComponent;
|
||||
describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceSourceComponent>;
|
||||
let comp: QualityAssuranceSourceComponent;
|
||||
let compAsAny: any;
|
||||
const mockNotificationsStateService = getMockNotificationsStateService();
|
||||
const activatedRouteParams = {
|
||||
notificationsBrokerSourceParams: {
|
||||
qualityAssuranceSourceParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 5
|
||||
}
|
||||
@@ -36,27 +36,27 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
declarations: [
|
||||
NotificationsBrokerSourceComponent,
|
||||
QualityAssuranceSourceComponent,
|
||||
TestComponent,
|
||||
],
|
||||
providers: [
|
||||
{ provide: NotificationsStateService, useValue: mockNotificationsStateService },
|
||||
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
NotificationsBrokerSourceComponent
|
||||
QualityAssuranceSourceComponent
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents().then(() => {
|
||||
mockNotificationsStateService.getNotificationsBrokerSource.and.returnValue(observableOf([
|
||||
notificationsBrokerSourceObjectMorePid,
|
||||
notificationsBrokerSourceObjectMoreAbstract
|
||||
mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract
|
||||
]));
|
||||
mockNotificationsStateService.getNotificationsBrokerSourceTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getNotificationsBrokerSourceCurrentPage.and.returnValue(observableOf(0));
|
||||
mockNotificationsStateService.getNotificationsBrokerSourceTotals.and.returnValue(observableOf(2));
|
||||
mockNotificationsStateService.isNotificationsBrokerSourceLoaded.and.returnValue(observableOf(true));
|
||||
mockNotificationsStateService.isNotificationsBrokerSourceLoading.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.isNotificationsBrokerSourceProcessing.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.getQualityAssuranceSourceTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getQualityAssuranceSourceCurrentPage.and.returnValue(observableOf(0));
|
||||
mockNotificationsStateService.getQualityAssuranceSourceTotals.and.returnValue(observableOf(2));
|
||||
mockNotificationsStateService.isQualityAssuranceSourceLoaded.and.returnValue(observableOf(true));
|
||||
mockNotificationsStateService.isQualityAssuranceSourceLoading.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.isQualityAssuranceSourceProcessing.and.returnValue(observableOf(false));
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
// synchronous beforeEach
|
||||
beforeEach(() => {
|
||||
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>;
|
||||
testComp = testFixture.componentInstance;
|
||||
});
|
||||
@@ -77,14 +77,14 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
testFixture.destroy();
|
||||
});
|
||||
|
||||
it('should create NotificationsBrokerSourceComponent', inject([NotificationsBrokerSourceComponent], (app: NotificationsBrokerSourceComponent) => {
|
||||
it('should create QualityAssuranceSourceComponent', inject([QualityAssuranceSourceComponent], (app: QualityAssuranceSourceComponent) => {
|
||||
expect(app).toBeDefined();
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Main tests running with two Source', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NotificationsBrokerSourceComponent);
|
||||
fixture = TestBed.createComponent(QualityAssuranceSourceComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
|
||||
@@ -102,8 +102,8 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
|
||||
expect(comp.sources$).toBeObservable(cold('(a|)', {
|
||||
a: [
|
||||
notificationsBrokerSourceObjectMorePid,
|
||||
notificationsBrokerSourceObjectMoreAbstract
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract
|
||||
]
|
||||
}));
|
||||
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
||||
@@ -112,12 +112,12 @@ describe('NotificationsBrokerSourceComponent test suite', () => {
|
||||
});
|
||||
|
||||
it(('Should set data properly after the view init'), () => {
|
||||
spyOn(compAsAny, 'getNotificationsBrokerSource');
|
||||
spyOn(compAsAny, 'getQualityAssuranceSource');
|
||||
|
||||
comp.ngAfterViewInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(compAsAny.getNotificationsBrokerSource).toHaveBeenCalled();
|
||||
expect(compAsAny.getQualityAssuranceSource).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
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();
|
||||
fixture.detectChanges();
|
||||
|
||||
compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerSource(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
||||
expect(compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerSource).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
||||
compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceSource(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
||||
expect(compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceSource).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
||||
});
|
||||
});
|
||||
});
|
@@ -3,18 +3,18 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, take } from 'rxjs/operators';
|
||||
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 { 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';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-notifications-broker-source',
|
||||
templateUrl: './notifications-broker-source.component.html',
|
||||
styleUrls: ['./notifications-broker-source.component.scss']
|
||||
selector: 'ds-quality-assurance-source',
|
||||
templateUrl: './quality-assurance-source.component.html',
|
||||
styleUrls: ['./quality-assurance-source.component.scss']
|
||||
})
|
||||
export class NotificationsBrokerSourceComponent implements OnInit {
|
||||
export class QualityAssuranceSourceComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* The pagination system configuration for HTML listing.
|
||||
@@ -26,16 +26,16 @@ export class NotificationsBrokerSourceComponent implements OnInit {
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
});
|
||||
/**
|
||||
* The Notifications Broker source list sort options.
|
||||
* The Quality Assurance source list sort options.
|
||||
* @type {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>;
|
||||
/**
|
||||
@@ -58,51 +58,51 @@ export class NotificationsBrokerSourceComponent implements OnInit {
|
||||
* Component initialization.
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.sources$ = this.notificationsStateService.getNotificationsBrokerSource();
|
||||
this.totalElements$ = this.notificationsStateService.getNotificationsBrokerSourceTotals();
|
||||
this.sources$ = this.notificationsStateService.getQualityAssuranceSource();
|
||||
this.totalElements$ = this.notificationsStateService.getQualityAssuranceSourceTotals();
|
||||
}
|
||||
|
||||
/**
|
||||
* First Notifications Broker source loading after view initialization.
|
||||
* First Quality Assurance source loading after view initialization.
|
||||
*/
|
||||
ngAfterViewInit(): void {
|
||||
this.subs.push(
|
||||
this.notificationsStateService.isNotificationsBrokerSourceLoaded().pipe(
|
||||
this.notificationsStateService.isQualityAssuranceSourceLoaded().pipe(
|
||||
take(1)
|
||||
).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>
|
||||
* 'true' if the source are loading, 'false' otherwise.
|
||||
*/
|
||||
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>
|
||||
* 'true' if there are operations running on the source (ex.: a REST call), 'false' otherwise.
|
||||
*/
|
||||
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(
|
||||
distinctUntilChanged(),
|
||||
).subscribe((options: PaginationComponentOptions) => {
|
||||
this.notificationsStateService.dispatchRetrieveNotificationsBrokerSource(
|
||||
this.notificationsStateService.dispatchRetrieveQualityAssuranceSource(
|
||||
options.pageSize,
|
||||
options.currentPage
|
||||
);
|
||||
@@ -114,7 +114,7 @@ export class NotificationsBrokerSourceComponent implements OnInit {
|
||||
*
|
||||
* @param eventsRouteParams
|
||||
*/
|
||||
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsBrokerSourcePageParams) {
|
||||
protected updatePaginationFromRouteParams(eventsRouteParams: AdminQualityAssuranceSourcePageParams) {
|
||||
if (eventsRouteParams.currentPage) {
|
||||
this.paginationConfig.currentPage = eventsRouteParams.currentPage;
|
||||
}
|
@@ -6,35 +6,35 @@ import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators'
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
AddSourceAction,
|
||||
NotificationsBrokerSourceActionTypes,
|
||||
QualityAssuranceSourceActionTypes,
|
||||
RetrieveAllSourceAction,
|
||||
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 { NotificationsBrokerSourceService } from './notifications-broker-source.service';
|
||||
import { QualityAssuranceSourceService } from './quality-assurance-source.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()
|
||||
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(
|
||||
ofType(NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE),
|
||||
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE),
|
||||
withLatestFrom(this.store$),
|
||||
switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => {
|
||||
return this.notificationsBrokerSourceService.getSources(
|
||||
return this.qualityAssuranceSourceService.getSources(
|
||||
action.payload.elementsPerPage,
|
||||
action.payload.currentPage
|
||||
).pipe(
|
||||
map((sources: PaginatedList<NotificationsBrokerSourceObject>) =>
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) =>
|
||||
new AddSourceAction(sources.page, sources.totalPages, sources.currentPage, sources.totalElements)
|
||||
),
|
||||
catchError((error: Error) => {
|
||||
@@ -51,7 +51,7 @@ export class NotificationsBrokerSourceEffects {
|
||||
* Show a notification on error.
|
||||
*/
|
||||
@Effect({ dispatch: false }) retrieveAllSourceErrorAction$ = this.actions$.pipe(
|
||||
ofType(NotificationsBrokerSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
|
||||
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
|
||||
tap(() => {
|
||||
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.
|
||||
*/
|
||||
@Effect({ dispatch: false }) addSourceAction$ = this.actions$.pipe(
|
||||
ofType(NotificationsBrokerSourceActionTypes.ADD_SOURCE),
|
||||
ofType(QualityAssuranceSourceActionTypes.ADD_SOURCE),
|
||||
tap(() => {
|
||||
this.notificationsBrokerSourceDataService.clearFindAllSourceRequests();
|
||||
this.qualityAssuranceSourceDataService.clearFindAllSourceRequests();
|
||||
})
|
||||
);
|
||||
|
||||
@@ -73,15 +73,15 @@ export class NotificationsBrokerSourceEffects {
|
||||
* @param {Store<any>} store$
|
||||
* @param {TranslateService} translate
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {NotificationsBrokerSourceService} notificationsBrokerSourceService
|
||||
* @param {NotificationsBrokerSourceRestService} notificationsBrokerSourceDataService
|
||||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
|
||||
* @param {QualityAssuranceSourceRestService} qualityAssuranceSourceDataService
|
||||
*/
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private store$: Store<any>,
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private notificationsBrokerSourceService: NotificationsBrokerSourceService,
|
||||
private notificationsBrokerSourceDataService: NotificationsBrokerSourceRestService
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceRestService
|
||||
) { }
|
||||
}
|
@@ -2,20 +2,20 @@ import {
|
||||
AddSourceAction,
|
||||
RetrieveAllSourceAction,
|
||||
RetrieveAllSourceErrorAction
|
||||
} from './notifications-broker-source.actions';
|
||||
import { notificationsBrokerSourceReducer, NotificationsBrokerSourceState } from './notifications-broker-source.reducer';
|
||||
} from './quality-assurance-source.actions';
|
||||
import { qualityAssuranceSourceReducer, QualityAssuranceSourceState } from './quality-assurance-source.reducer';
|
||||
import {
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMorePid
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
|
||||
describe('notificationsBrokerSourceReducer test suite', () => {
|
||||
let notificationsBrokerSourceInitialState: NotificationsBrokerSourceState;
|
||||
describe('qualityAssuranceSourceReducer test suite', () => {
|
||||
let qualityAssuranceSourceInitialState: QualityAssuranceSourceState;
|
||||
const elementPerPage = 3;
|
||||
const currentPage = 0;
|
||||
|
||||
beforeEach(() => {
|
||||
notificationsBrokerSourceInitialState = {
|
||||
qualityAssuranceSourceInitialState = {
|
||||
source: [],
|
||||
processing: false,
|
||||
loaded: false,
|
||||
@@ -26,30 +26,30 @@ import {
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_SOURCE should set the State property "processing" to TRUE', () => {
|
||||
const expectedState = notificationsBrokerSourceInitialState;
|
||||
const expectedState = qualityAssuranceSourceInitialState;
|
||||
expectedState.processing = true;
|
||||
|
||||
const action = new RetrieveAllSourceAction(elementPerPage, currentPage);
|
||||
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
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.loaded = true;
|
||||
expectedState.currentPage = 0;
|
||||
|
||||
const action = new RetrieveAllSourceErrorAction();
|
||||
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
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 = {
|
||||
source: [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ],
|
||||
source: [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
@@ -58,10 +58,10 @@ import {
|
||||
};
|
||||
|
||||
const action = new AddSourceAction(
|
||||
[ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ],
|
||||
[ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
1, 0, 2
|
||||
);
|
||||
const newState = notificationsBrokerSourceReducer(notificationsBrokerSourceInitialState, action);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,28 +1,28 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
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 { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { FindListOptions } from '../../../core/data/request.models';
|
||||
import {
|
||||
getMockNotificationsBrokerSourceRestService,
|
||||
notificationsBrokerSourceObjectMoreAbstract,
|
||||
notificationsBrokerSourceObjectMorePid
|
||||
getMockQualityAssuranceSourceRestService,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
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 {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('NotificationsBrokerSourceService', () => {
|
||||
let service: NotificationsBrokerSourceService;
|
||||
let restService: NotificationsBrokerSourceRestService;
|
||||
describe('QualityAssuranceSourceService', () => {
|
||||
let service: QualityAssuranceSourceService;
|
||||
let restService: QualityAssuranceSourceRestService;
|
||||
let serviceAsAny: any;
|
||||
let restServiceAsAny: any;
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [ notificationsBrokerSourceObjectMorePid, notificationsBrokerSourceObjectMoreAbstract ];
|
||||
const array = [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
const elementsPerPage = 3;
|
||||
@@ -31,22 +31,22 @@ describe('NotificationsBrokerSourceService', () => {
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: NotificationsBrokerSourceRestService, useClass: getMockNotificationsBrokerSourceRestService },
|
||||
{ provide: NotificationsBrokerSourceService, useValue: service }
|
||||
{ provide: QualityAssuranceSourceRestService, useClass: getMockQualityAssuranceSourceRestService },
|
||||
{ provide: QualityAssuranceSourceService, useValue: service }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
restService = TestBed.get(NotificationsBrokerSourceRestService);
|
||||
restService = TestBed.get(QualityAssuranceSourceRestService);
|
||||
restServiceAsAny = restService;
|
||||
restServiceAsAny.getSources.and.returnValue(observableOf(paginatedListRD));
|
||||
service = new NotificationsBrokerSourceService(restService);
|
||||
service = new QualityAssuranceSourceService(restService);
|
||||
serviceAsAny = service;
|
||||
});
|
||||
|
||||
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 findListOptions: FindListOptions = {
|
||||
elementsPerPage: elementsPerPage,
|
||||
@@ -54,10 +54,10 @@ describe('NotificationsBrokerSourceService', () => {
|
||||
sort: sortOptions
|
||||
};
|
||||
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|)', {
|
||||
a: paginatedList
|
||||
});
|
@@ -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');
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
import { Action } from '@ngrx/store';
|
||||
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
|
||||
@@ -10,19 +10,19 @@ import { NotificationsBrokerTopicObject } from '../../../core/notifications/brok
|
||||
* literal types and runs a simple check to guarantee all
|
||||
* action types in the application are unique.
|
||||
*/
|
||||
export const NotificationsBrokerTopicActionTypes = {
|
||||
ADD_TOPICS: type('dspace/integration/notifications/broker/topic/ADD_TOPICS'),
|
||||
RETRIEVE_ALL_TOPICS: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS'),
|
||||
RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS_ERROR'),
|
||||
export const QualityAssuranceTopicActionTypes = {
|
||||
ADD_TOPICS: type('dspace/integration/notifications/qa/topic/ADD_TOPICS'),
|
||||
RETRIEVE_ALL_TOPICS: type('dspace/integration/notifications/qa/topic/RETRIEVE_ALL_TOPICS'),
|
||||
RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/notifications/qa/topic/RETRIEVE_ALL_TOPICS_ERROR'),
|
||||
};
|
||||
|
||||
/* 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 {
|
||||
type = NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS;
|
||||
type = QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS;
|
||||
payload: {
|
||||
elementsPerPage: 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 {
|
||||
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.
|
||||
*/
|
||||
export class AddTopicsAction implements Action {
|
||||
type = NotificationsBrokerTopicActionTypes.ADD_TOPICS;
|
||||
type = QualityAssuranceTopicActionTypes.ADD_TOPICS;
|
||||
payload: {
|
||||
topics: NotificationsBrokerTopicObject[];
|
||||
topics: QualityAssuranceTopicObject[];
|
||||
totalPages: number;
|
||||
currentPage: number;
|
||||
totalElements: number;
|
||||
@@ -74,9 +74,9 @@ export class AddTopicsAction implements Action {
|
||||
* @param currentPage
|
||||
* the current page
|
||||
* @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 = {
|
||||
topics,
|
||||
totalPages,
|
||||
@@ -93,7 +93,7 @@ export class AddTopicsAction implements Action {
|
||||
* Export a type alias of all actions in this action group
|
||||
* so that reducers can easily compose action types.
|
||||
*/
|
||||
export type NotificationsBrokerTopicsActions
|
||||
export type QualityAssuranceTopicsActions
|
||||
= AddTopicsAction
|
||||
|RetrieveAllTopicsAction
|
||||
|RetrieveAllTopicsErrorAction;
|
@@ -15,7 +15,7 @@
|
||||
[collectionSize]="(totalElements$ | async)"
|
||||
[hideGear]="false"
|
||||
[hideSortOptions]="true"
|
||||
(paginationChange)="getNotificationsBrokerTopics()">
|
||||
(paginationChange)="getQualityAssuranceTopics()">
|
||||
|
||||
<ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading>
|
||||
<ng-container *ngIf="!(isTopicsProcessing() | async)">
|
@@ -7,23 +7,23 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} 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 { cold } from 'jasmine-marbles';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
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', () => {
|
||||
let fixture: ComponentFixture<NotificationsBrokerTopicsComponent>;
|
||||
let comp: NotificationsBrokerTopicsComponent;
|
||||
describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceTopicsComponent>;
|
||||
let comp: QualityAssuranceTopicsComponent;
|
||||
let compAsAny: any;
|
||||
const mockNotificationsStateService = getMockNotificationsStateService();
|
||||
const activatedRouteParams = {
|
||||
notificationsBrokerTopicsParams: {
|
||||
qualityAssuranceTopicsParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 5
|
||||
}
|
||||
@@ -37,7 +37,7 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
declarations: [
|
||||
NotificationsBrokerTopicsComponent,
|
||||
QualityAssuranceTopicsComponent,
|
||||
TestComponent,
|
||||
],
|
||||
providers: [
|
||||
@@ -48,22 +48,22 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
},
|
||||
}}},
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
NotificationsBrokerTopicsComponent,
|
||||
QualityAssuranceTopicsComponent,
|
||||
// tslint:disable-next-line: no-empty
|
||||
{ provide: NotificationsBrokerTopicsService, useValue: { setSourceId: (sourceId: string) => { } }}
|
||||
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } }}
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents().then(() => {
|
||||
mockNotificationsStateService.getNotificationsBrokerTopics.and.returnValue(observableOf([
|
||||
notificationsBrokerTopicObjectMorePid,
|
||||
notificationsBrokerTopicObjectMoreAbstract
|
||||
mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract
|
||||
]));
|
||||
mockNotificationsStateService.getNotificationsBrokerTopicsTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getNotificationsBrokerTopicsCurrentPage.and.returnValue(observableOf(0));
|
||||
mockNotificationsStateService.getNotificationsBrokerTopicsTotals.and.returnValue(observableOf(2));
|
||||
mockNotificationsStateService.isNotificationsBrokerTopicsLoaded.and.returnValue(observableOf(true));
|
||||
mockNotificationsStateService.isNotificationsBrokerTopicsLoading.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.isNotificationsBrokerTopicsProcessing.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.getQualityAssuranceTopicsTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getQualityAssuranceTopicsCurrentPage.and.returnValue(observableOf(0));
|
||||
mockNotificationsStateService.getQualityAssuranceTopicsTotals.and.returnValue(observableOf(2));
|
||||
mockNotificationsStateService.isQualityAssuranceTopicsLoaded.and.returnValue(observableOf(true));
|
||||
mockNotificationsStateService.isQualityAssuranceTopicsLoading.and.returnValue(observableOf(false));
|
||||
mockNotificationsStateService.isQualityAssuranceTopicsProcessing.and.returnValue(observableOf(false));
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
// synchronous beforeEach
|
||||
beforeEach(() => {
|
||||
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>;
|
||||
testComp = testFixture.componentInstance;
|
||||
});
|
||||
@@ -84,14 +84,14 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
testFixture.destroy();
|
||||
});
|
||||
|
||||
it('should create NotificationsBrokerTopicsComponent', inject([NotificationsBrokerTopicsComponent], (app: NotificationsBrokerTopicsComponent) => {
|
||||
it('should create QualityAssuranceTopicsComponent', inject([QualityAssuranceTopicsComponent], (app: QualityAssuranceTopicsComponent) => {
|
||||
expect(app).toBeDefined();
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Main tests running with two topics', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NotificationsBrokerTopicsComponent);
|
||||
fixture = TestBed.createComponent(QualityAssuranceTopicsComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
|
||||
@@ -109,8 +109,8 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
|
||||
expect(comp.topics$).toBeObservable(cold('(a|)', {
|
||||
a: [
|
||||
notificationsBrokerTopicObjectMorePid,
|
||||
notificationsBrokerTopicObjectMoreAbstract
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract
|
||||
]
|
||||
}));
|
||||
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
||||
@@ -119,12 +119,12 @@ describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||
});
|
||||
|
||||
it(('Should set data properly after the view init'), () => {
|
||||
spyOn(compAsAny, 'getNotificationsBrokerTopics');
|
||||
spyOn(compAsAny, 'getQualityAssuranceTopics');
|
||||
|
||||
comp.ngAfterViewInit();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(compAsAny.getNotificationsBrokerTopics).toHaveBeenCalled();
|
||||
expect(compAsAny.getQualityAssuranceTopics).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
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();
|
||||
fixture.detectChanges();
|
||||
|
||||
compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
||||
expect(compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
||||
compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
||||
expect(compAsAny.notificationsStateService.dispatchRetrieveQualityAssuranceTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
||||
});
|
||||
});
|
||||
});
|
@@ -4,24 +4,24 @@ import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, map, take } from 'rxjs/operators';
|
||||
|
||||
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 { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
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 { 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({
|
||||
selector: 'ds-notifications-broker-topic',
|
||||
templateUrl: './notifications-broker-topics.component.html',
|
||||
styleUrls: ['./notifications-broker-topics.component.scss'],
|
||||
selector: 'ds-quality-assurance-topic',
|
||||
templateUrl: './quality-assurance-topics.component.html',
|
||||
styleUrls: ['./quality-assurance-topics.component.scss'],
|
||||
})
|
||||
export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||
export class QualityAssuranceTopicsComponent implements OnInit {
|
||||
/**
|
||||
* The pagination system configuration for HTML listing.
|
||||
* @type {PaginationComponentOptions}
|
||||
@@ -32,16 +32,16 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
});
|
||||
/**
|
||||
* The Notifications Broker topic list sort options.
|
||||
* The Quality Assurance topic list sort options.
|
||||
* @type {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>;
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||
private paginationService: PaginationService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private notificationsStateService: NotificationsStateService,
|
||||
private notificationsBrokerTopicsService: NotificationsBrokerTopicsService
|
||||
private qualityAssuranceTopicsService: QualityAssuranceTopicsService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -74,52 +74,52 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.sourceId = this.activatedRoute.snapshot.paramMap.get('sourceId');
|
||||
this.notificationsBrokerTopicsService.setSourceId(this.sourceId);
|
||||
this.topics$ = this.notificationsStateService.getNotificationsBrokerTopics();
|
||||
this.totalElements$ = this.notificationsStateService.getNotificationsBrokerTopicsTotals();
|
||||
this.qualityAssuranceTopicsService.setSourceId(this.sourceId);
|
||||
this.topics$ = this.notificationsStateService.getQualityAssuranceTopics();
|
||||
this.totalElements$ = this.notificationsStateService.getQualityAssuranceTopicsTotals();
|
||||
}
|
||||
|
||||
/**
|
||||
* First Notifications Broker topics loading after view initialization.
|
||||
* First Quality Assurance topics loading after view initialization.
|
||||
*/
|
||||
ngAfterViewInit(): void {
|
||||
this.subs.push(
|
||||
this.notificationsStateService.isNotificationsBrokerTopicsLoaded().pipe(
|
||||
this.notificationsStateService.isQualityAssuranceTopicsLoaded().pipe(
|
||||
take(1)
|
||||
).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>
|
||||
* 'true' if the topics are loading, 'false' otherwise.
|
||||
*/
|
||||
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>
|
||||
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
|
||||
*/
|
||||
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(
|
||||
distinctUntilChanged(),
|
||||
).subscribe((options: PaginationComponentOptions) => {
|
||||
this.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics(
|
||||
this.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(
|
||||
options.pageSize,
|
||||
options.currentPage
|
||||
);
|
||||
@@ -131,7 +131,7 @@ export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||
*
|
||||
* @param eventsRouteParams
|
||||
*/
|
||||
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsBrokerTopicsPageParams) {
|
||||
protected updatePaginationFromRouteParams(eventsRouteParams: AdminQualityAssuranceTopicsPageParams) {
|
||||
if (eventsRouteParams.currentPage) {
|
||||
this.paginationConfig.currentPage = eventsRouteParams.currentPage;
|
||||
}
|
@@ -6,35 +6,35 @@ import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators'
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
AddTopicsAction,
|
||||
NotificationsBrokerTopicActionTypes,
|
||||
QualityAssuranceTopicActionTypes,
|
||||
RetrieveAllTopicsAction,
|
||||
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 { NotificationsBrokerTopicsService } from './notifications-broker-topics.service';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.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()
|
||||
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(
|
||||
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
||||
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
||||
withLatestFrom(this.store$),
|
||||
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
||||
return this.notificationsBrokerTopicService.getTopics(
|
||||
return this.qualityAssuranceTopicService.getTopics(
|
||||
action.payload.elementsPerPage,
|
||||
action.payload.currentPage
|
||||
).pipe(
|
||||
map((topics: PaginatedList<NotificationsBrokerTopicObject>) =>
|
||||
map((topics: PaginatedList<QualityAssuranceTopicObject>) =>
|
||||
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)
|
||||
),
|
||||
catchError((error: Error) => {
|
||||
@@ -51,7 +51,7 @@ export class NotificationsBrokerTopicsEffects {
|
||||
* Show a notification on error.
|
||||
*/
|
||||
@Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe(
|
||||
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
||||
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
||||
tap(() => {
|
||||
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.
|
||||
*/
|
||||
@Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe(
|
||||
ofType(NotificationsBrokerTopicActionTypes.ADD_TOPICS),
|
||||
ofType(QualityAssuranceTopicActionTypes.ADD_TOPICS),
|
||||
tap(() => {
|
||||
this.notificationsBrokerTopicDataService.clearFindAllTopicsRequests();
|
||||
this.qualityAssuranceTopicDataService.clearFindAllTopicsRequests();
|
||||
})
|
||||
);
|
||||
|
||||
@@ -73,15 +73,15 @@ export class NotificationsBrokerTopicsEffects {
|
||||
* @param {Store<any>} store$
|
||||
* @param {TranslateService} translate
|
||||
* @param {NotificationsService} notificationsService
|
||||
* @param {NotificationsBrokerTopicsService} notificationsBrokerTopicService
|
||||
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicDataService
|
||||
* @param {QualityAssuranceTopicsService} qualityAssuranceTopicService
|
||||
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicDataService
|
||||
*/
|
||||
constructor(
|
||||
private actions$: Actions,
|
||||
private store$: Store<any>,
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private notificationsBrokerTopicService: NotificationsBrokerTopicsService,
|
||||
private notificationsBrokerTopicDataService: NotificationsBrokerTopicRestService
|
||||
private qualityAssuranceTopicService: QualityAssuranceTopicsService,
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicRestService
|
||||
) { }
|
||||
}
|
@@ -2,20 +2,20 @@ import {
|
||||
AddTopicsAction,
|
||||
RetrieveAllTopicsAction,
|
||||
RetrieveAllTopicsErrorAction
|
||||
} from './notifications-broker-topics.actions';
|
||||
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState } from './notifications-broker-topics.reducer';
|
||||
} from './quality-assurance-topics.actions';
|
||||
import { qualityAssuranceTopicsReducer, QualityAssuranceTopicState } from './quality-assurance-topics.reducer';
|
||||
import {
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
|
||||
describe('notificationsBrokerTopicsReducer test suite', () => {
|
||||
let notificationsBrokerTopicInitialState: NotificationsBrokerTopicState;
|
||||
describe('qualityAssuranceTopicsReducer test suite', () => {
|
||||
let qualityAssuranceTopicInitialState: QualityAssuranceTopicState;
|
||||
const elementPerPage = 3;
|
||||
const currentPage = 0;
|
||||
|
||||
beforeEach(() => {
|
||||
notificationsBrokerTopicInitialState = {
|
||||
qualityAssuranceTopicInitialState = {
|
||||
topics: [],
|
||||
processing: false,
|
||||
loaded: false,
|
||||
@@ -26,30 +26,30 @@ describe('notificationsBrokerTopicsReducer test suite', () => {
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_TOPICS should set the State property "processing" to TRUE', () => {
|
||||
const expectedState = notificationsBrokerTopicInitialState;
|
||||
const expectedState = qualityAssuranceTopicInitialState;
|
||||
expectedState.processing = true;
|
||||
|
||||
const action = new RetrieveAllTopicsAction(elementPerPage, currentPage);
|
||||
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action);
|
||||
const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
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.loaded = true;
|
||||
expectedState.currentPage = 0;
|
||||
|
||||
const action = new RetrieveAllTopicsErrorAction();
|
||||
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action);
|
||||
const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
|
||||
|
||||
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 = {
|
||||
topics: [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ],
|
||||
topics: [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
@@ -58,10 +58,10 @@ describe('notificationsBrokerTopicsReducer test suite', () => {
|
||||
};
|
||||
|
||||
const action = new AddTopicsAction(
|
||||
[ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ],
|
||||
[ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ],
|
||||
1, 0, 2
|
||||
);
|
||||
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action);
|
||||
const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,28 +1,28 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
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 { 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 { FindListOptions } from '../../../core/data/request.models';
|
||||
import {
|
||||
getMockNotificationsBrokerTopicRestService,
|
||||
notificationsBrokerTopicObjectMoreAbstract,
|
||||
notificationsBrokerTopicObjectMorePid
|
||||
getMockQualityAssuranceTopicRestService,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
|
||||
describe('NotificationsBrokerTopicsService', () => {
|
||||
let service: NotificationsBrokerTopicsService;
|
||||
let restService: NotificationsBrokerTopicRestService;
|
||||
describe('QualityAssuranceTopicsService', () => {
|
||||
let service: QualityAssuranceTopicsService;
|
||||
let restService: QualityAssuranceTopicRestService;
|
||||
let serviceAsAny: any;
|
||||
let restServiceAsAny: any;
|
||||
|
||||
const pageInfo = new PageInfo();
|
||||
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ];
|
||||
const array = [ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ];
|
||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||
const elementsPerPage = 3;
|
||||
@@ -31,22 +31,22 @@ describe('NotificationsBrokerTopicsService', () => {
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: NotificationsBrokerTopicRestService, useClass: getMockNotificationsBrokerTopicRestService },
|
||||
{ provide: NotificationsBrokerTopicsService, useValue: service }
|
||||
{ provide: QualityAssuranceTopicRestService, useClass: getMockQualityAssuranceTopicRestService },
|
||||
{ provide: QualityAssuranceTopicsService, useValue: service }
|
||||
]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
restService = TestBed.get(NotificationsBrokerTopicRestService);
|
||||
restService = TestBed.get(QualityAssuranceTopicRestService);
|
||||
restServiceAsAny = restService;
|
||||
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
|
||||
service = new NotificationsBrokerTopicsService(restService);
|
||||
service = new QualityAssuranceTopicsService(restService);
|
||||
serviceAsAny = service;
|
||||
});
|
||||
|
||||
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 findListOptions: FindListOptions = {
|
||||
elementsPerPage: elementsPerPage,
|
||||
@@ -56,10 +56,10 @@ describe('NotificationsBrokerTopicsService', () => {
|
||||
};
|
||||
service.setSourceId('ENRICH!MORE!ABSTRACT');
|
||||
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|)', {
|
||||
a: paginatedList
|
||||
});
|
@@ -1,26 +1,26 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
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 { FindListOptions } from '../../../core/data/request.models';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
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 {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()
|
||||
export class NotificationsBrokerTopicsService {
|
||||
export class QualityAssuranceTopicsService {
|
||||
|
||||
/**
|
||||
* Initialize the service variables.
|
||||
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicRestService
|
||||
* @param {QualityAssuranceTopicRestService} qualityAssuranceTopicRestService
|
||||
*/
|
||||
constructor(
|
||||
private notificationsBrokerTopicRestService: NotificationsBrokerTopicRestService
|
||||
private qualityAssuranceTopicRestService: QualityAssuranceTopicRestService
|
||||
) { }
|
||||
|
||||
/**
|
||||
@@ -29,16 +29,16 @@ export class NotificationsBrokerTopicsService {
|
||||
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
|
||||
* The number of the topics per page
|
||||
* @param currentPage
|
||||
* The page number to retrieve
|
||||
* @return Observable<PaginatedList<NotificationsBrokerTopicObject>>
|
||||
* The list of Notifications Broker topics.
|
||||
* @return Observable<PaginatedList<QualityAssuranceTopicObject>>
|
||||
* 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 findListOptions: FindListOptions = {
|
||||
@@ -48,13 +48,13 @@ export class NotificationsBrokerTopicsService {
|
||||
searchParams: [new RequestParam('source', this.sourceId)]
|
||||
};
|
||||
|
||||
return this.notificationsBrokerTopicRestService.getTopics(findListOptions).pipe(
|
||||
find((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => !rd.isResponsePending),
|
||||
map((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => {
|
||||
return this.qualityAssuranceTopicRestService.getTopics(findListOptions).pipe(
|
||||
find((rd: RemoteData<PaginatedList<QualityAssuranceTopicObject>>) => !rd.isResponsePending),
|
||||
map((rd: RemoteData<PaginatedList<QualityAssuranceTopicObject>>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
return rd.payload;
|
||||
} 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');
|
||||
}
|
||||
})
|
||||
);
|
@@ -1,10 +1,10 @@
|
||||
import { createSelector, MemoizedSelector } from '@ngrx/store';
|
||||
import { subStateSelector } from '../shared/selector.util';
|
||||
import { notificationsSelector, NotificationsState } from './notifications.reducer';
|
||||
import { NotificationsBrokerTopicObject } from '../core/notifications/broker/models/notifications-broker-topic.model';
|
||||
import { NotificationsBrokerTopicState } from './broker/topics/notifications-broker-topics.reducer';
|
||||
import { NotificationsBrokerSourceState } from './broker/source/notifications-broker-source.reducer';
|
||||
import { NotificationsBrokerSourceObject } from '../core/notifications/broker/models/notifications-broker-source.model';
|
||||
import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceTopicState } from './qa/topics/quality-assurance-topics.reducer';
|
||||
import { QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
|
||||
import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
|
||||
/**
|
||||
* Returns the Notifications state.
|
||||
@@ -14,33 +14,33 @@ import { NotificationsBrokerSourceObject } from '../core/notifications/broker/mo
|
||||
*/
|
||||
const _getNotificationsState = (state: any) => state.notifications;
|
||||
|
||||
// Notifications Broker topics
|
||||
// Quality Assurance topics
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns the Notifications Broker topics State.
|
||||
* @function notificationsBrokerTopicsStateSelector
|
||||
* @return {NotificationsBrokerTopicState}
|
||||
* Returns the Quality Assurance topics State.
|
||||
* @function qualityAssuranceTopicsStateSelector
|
||||
* @return {QualityAssuranceTopicState}
|
||||
*/
|
||||
export function notificationsBrokerTopicsStateSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicState> {
|
||||
return subStateSelector<NotificationsState,NotificationsBrokerTopicState>(notificationsSelector, 'brokerTopic');
|
||||
export function qualityAssuranceTopicsStateSelector(): MemoizedSelector<NotificationsState, QualityAssuranceTopicState> {
|
||||
return subStateSelector<NotificationsState,QualityAssuranceTopicState>(notificationsSelector, 'brokerTopic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Notifications Broker topics list.
|
||||
* @function notificationsBrokerTopicsObjectSelector
|
||||
* @return {NotificationsBrokerTopicObject[]}
|
||||
* Returns the Quality Assurance topics list.
|
||||
* @function qualityAssuranceTopicsObjectSelector
|
||||
* @return {QualityAssuranceTopicObject[]}
|
||||
*/
|
||||
export function notificationsBrokerTopicsObjectSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicObject[]> {
|
||||
return subStateSelector<NotificationsState, NotificationsBrokerTopicObject[]>(notificationsBrokerTopicsStateSelector(), 'topics');
|
||||
export function qualityAssuranceTopicsObjectSelector(): MemoizedSelector<NotificationsState, QualityAssuranceTopicObject[]> {
|
||||
return subStateSelector<NotificationsState, QualityAssuranceTopicObject[]>(qualityAssuranceTopicsStateSelector(), 'topics');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Notifications Broker topics are loaded.
|
||||
* @function isNotificationsBrokerTopicsLoadedSelector
|
||||
* Returns true if the Quality Assurance topics are loaded.
|
||||
* @function isQualityAssuranceTopicsLoadedSelector
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isNotificationsBrokerTopicsLoadedSelector = createSelector(_getNotificationsState,
|
||||
export const isQualityAssuranceTopicsLoadedSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerTopic.loaded
|
||||
);
|
||||
|
||||
@@ -49,64 +49,64 @@ export const isNotificationsBrokerTopicsLoadedSelector = createSelector(_getNoti
|
||||
* @function isDeduplicationSetsProcessingSelector
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isNotificationsBrokerTopicsProcessingSelector = createSelector(_getNotificationsState,
|
||||
export const isQualityAssuranceTopicsProcessingSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerTopic.processing
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the total available pages of Notifications Broker topics.
|
||||
* @function getNotificationsBrokerTopicsTotalPagesSelector
|
||||
* Returns the total available pages of Quality Assurance topics.
|
||||
* @function getQualityAssuranceTopicsTotalPagesSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerTopicsTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceTopicsTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerTopic.totalPages
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the current page of Notifications Broker topics.
|
||||
* @function getNotificationsBrokerTopicsCurrentPageSelector
|
||||
* Returns the current page of Quality Assurance topics.
|
||||
* @function getQualityAssuranceTopicsCurrentPageSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerTopicsCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceTopicsCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerTopic.currentPage
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the total number of Notifications Broker topics.
|
||||
* @function getNotificationsBrokerTopicsTotalsSelector
|
||||
* Returns the total number of Quality Assurance topics.
|
||||
* @function getQualityAssuranceTopicsTotalsSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerTopicsTotalsSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceTopicsTotalsSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerTopic.totalElements
|
||||
);
|
||||
|
||||
// Notifications Broker source
|
||||
// Quality Assurance source
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Returns the Notifications Broker source State.
|
||||
* @function notificationsBrokerSourceStateSelector
|
||||
* @return {NotificationsBrokerSourceState}
|
||||
* Returns the Quality Assurance source State.
|
||||
* @function qualityAssuranceSourceStateSelector
|
||||
* @return {QualityAssuranceSourceState}
|
||||
*/
|
||||
export function notificationsBrokerSourceStateSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerSourceState> {
|
||||
return subStateSelector<NotificationsState,NotificationsBrokerSourceState>(notificationsSelector, 'brokerSource');
|
||||
export function qualityAssuranceSourceStateSelector(): MemoizedSelector<NotificationsState, QualityAssuranceSourceState> {
|
||||
return subStateSelector<NotificationsState,QualityAssuranceSourceState>(notificationsSelector, 'brokerSource');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Notifications Broker source list.
|
||||
* @function notificationsBrokerSourceObjectSelector
|
||||
* @return {NotificationsBrokerSourceObject[]}
|
||||
* Returns the Quality Assurance source list.
|
||||
* @function qualityAssuranceSourceObjectSelector
|
||||
* @return {QualityAssuranceSourceObject[]}
|
||||
*/
|
||||
export function notificationsBrokerSourceObjectSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerSourceObject[]> {
|
||||
return subStateSelector<NotificationsState, NotificationsBrokerSourceObject[]>(notificationsBrokerSourceStateSelector(), 'source');
|
||||
export function qualityAssuranceSourceObjectSelector(): MemoizedSelector<NotificationsState, QualityAssuranceSourceObject[]> {
|
||||
return subStateSelector<NotificationsState, QualityAssuranceSourceObject[]>(qualityAssuranceSourceStateSelector(), 'source');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the Notifications Broker source are loaded.
|
||||
* @function isNotificationsBrokerSourceLoadedSelector
|
||||
* Returns true if the Quality Assurance source are loaded.
|
||||
* @function isQualityAssuranceSourceLoadedSelector
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isNotificationsBrokerSourceLoadedSelector = createSelector(_getNotificationsState,
|
||||
export const isQualityAssuranceSourceLoadedSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerSource.loaded
|
||||
);
|
||||
|
||||
@@ -115,33 +115,33 @@ export const isNotificationsBrokerSourceLoadedSelector = createSelector(_getNoti
|
||||
* @function isDeduplicationSetsProcessingSelector
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isNotificationsBrokerSourceProcessingSelector = createSelector(_getNotificationsState,
|
||||
export const isQualityAssuranceSourceProcessingSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerSource.processing
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the total available pages of Notifications Broker source.
|
||||
* @function getNotificationsBrokerSourceTotalPagesSelector
|
||||
* Returns the total available pages of Quality Assurance source.
|
||||
* @function getQualityAssuranceSourceTotalPagesSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerSourceTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceSourceTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerSource.totalPages
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the current page of Notifications Broker source.
|
||||
* @function getNotificationsBrokerSourceCurrentPageSelector
|
||||
* Returns the current page of Quality Assurance source.
|
||||
* @function getQualityAssuranceSourceCurrentPageSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerSourceCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceSourceCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerSource.currentPage
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns the total number of Notifications Broker source.
|
||||
* @function getNotificationsBrokerSourceTotalsSelector
|
||||
* Returns the total number of Quality Assurance source.
|
||||
* @function getQualityAssuranceSourceTotalsSelector
|
||||
* @return {number}
|
||||
*/
|
||||
export const getNotificationsBrokerSourceTotalsSelector = createSelector(_getNotificationsState,
|
||||
export const getQualityAssuranceSourceTotalsSelector = createSelector(_getNotificationsState,
|
||||
(state: NotificationsState) => state.brokerSource.totalElements
|
||||
);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { ResourceType } from '../../core/shared/resource-type';
|
||||
import { NotificationsBrokerTopicObject } from '../../core/notifications/broker/models/notifications-broker-topic.model';
|
||||
import { NotificationsBrokerEventObject } from '../../core/notifications/broker/models/notifications-broker-event.model';
|
||||
import { NotificationsBrokerTopicRestService } from '../../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||
import { NotificationsBrokerEventRestService } from '../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||
import { QualityAssuranceTopicObject } from '../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceEventObject } from '../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceTopicRestService } from '../../core/notifications/qa/topics/quality-assurance-topic-rest.service';
|
||||
import { QualityAssuranceEventRestService } from '../../core/notifications/qa/events/quality-assurance-event-rest.service';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { NotificationsStateService } from '../../notifications/notifications-state.service';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
createSuccessfulRemoteDataObject$
|
||||
} from '../remote-data.utils';
|
||||
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 ---------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -1333,7 +1333,7 @@ export const NotificationsMockDspaceObject: SearchResult<DSpaceObject> = Object.
|
||||
// Sources
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
export const notificationsBrokerSourceObjectMorePid: NotificationsBrokerSourceObject = {
|
||||
export const qualityAssuranceSourceObjectMorePid: QualityAssuranceSourceObject = {
|
||||
type: new ResourceType('nbsource'),
|
||||
id: 'ENRICH!MORE!PID',
|
||||
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'),
|
||||
id: 'ENRICH!MORE!ABSTRACT',
|
||||
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'),
|
||||
id: 'ENRICH!MISSING!PID',
|
||||
lastEvent: '2020/10/01 07:36 UTC',
|
||||
@@ -1372,7 +1372,7 @@ export const notificationsBrokerSourceObjectMissingPid: NotificationsBrokerSourc
|
||||
// Topics
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
export const notificationsBrokerTopicObjectMorePid: NotificationsBrokerTopicObject = {
|
||||
export const qualityAssuranceTopicObjectMorePid: QualityAssuranceTopicObject = {
|
||||
type: new ResourceType('nbtopic'),
|
||||
id: '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'),
|
||||
id: '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'),
|
||||
id: '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'),
|
||||
id: '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'),
|
||||
id: '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'),
|
||||
id: 'ENRICH!MISSING!PROJECT',
|
||||
name: 'ENRICH/MISSING/PROJECT',
|
||||
@@ -1453,7 +1453,7 @@ export const notificationsBrokerTopicObjectMissingProject: NotificationsBrokerTo
|
||||
// Events
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid: QualityAssuranceEventObject = {
|
||||
id: '123e4567-e89b-12d3-a456-426614174001',
|
||||
uuid: '123e4567-e89b-12d3-a456-426614174001',
|
||||
type: new ResourceType('nbevent'),
|
||||
@@ -1489,10 +1489,10 @@ export const notificationsBrokerEventObjectMissingPid: NotificationsBrokerEventO
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid2: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid2: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI',
|
||||
trust: 1.0,
|
||||
@@ -1525,10 +1525,10 @@ export const notificationsBrokerEventObjectMissingPid2: NotificationsBrokerEvent
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid3: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid3: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Sustainable development',
|
||||
trust: 0.375,
|
||||
@@ -1561,10 +1561,10 @@ export const notificationsBrokerEventObjectMissingPid3: NotificationsBrokerEvent
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid4: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid4: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Reply to Critics',
|
||||
trust: 1.0,
|
||||
@@ -1597,10 +1597,10 @@ export const notificationsBrokerEventObjectMissingPid4: NotificationsBrokerEvent
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid5: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid5: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI',
|
||||
trust: 0.375,
|
||||
@@ -1633,10 +1633,10 @@ export const notificationsBrokerEventObjectMissingPid5: NotificationsBrokerEvent
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingPid6: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingPid6: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Donald Davidson',
|
||||
trust: 0.375,
|
||||
@@ -1669,10 +1669,10 @@ export const notificationsBrokerEventObjectMissingPid6: NotificationsBrokerEvent
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingAbstract: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingAbstract: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Missing abstract article',
|
||||
trust: 0.751,
|
||||
@@ -1705,10 +1705,10 @@ export const notificationsBrokerEventObjectMissingAbstract: NotificationsBrokerE
|
||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingProjectFound: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingProjectFound: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
||||
trust: 1.0,
|
||||
@@ -1741,10 +1741,10 @@ export const notificationsBrokerEventObjectMissingProjectFound: NotificationsBro
|
||||
related: createSuccessfulRemoteDataObject$(ItemMockPid10)
|
||||
};
|
||||
|
||||
export const notificationsBrokerEventObjectMissingProjectNotFound: NotificationsBrokerEventObject = {
|
||||
export const qualityAssuranceEventObjectMissingProjectNotFound: QualityAssuranceEventObject = {
|
||||
id: '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',
|
||||
title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
||||
trust: 1.0,
|
||||
@@ -1785,51 +1785,51 @@ export const notificationsBrokerEventObjectMissingProjectNotFound: Notifications
|
||||
*/
|
||||
export function getMockNotificationsStateService(): any {
|
||||
return jasmine.createSpyObj('NotificationsStateService', {
|
||||
getNotificationsBrokerTopics: jasmine.createSpy('getNotificationsBrokerTopics'),
|
||||
isNotificationsBrokerTopicsLoading: jasmine.createSpy('isNotificationsBrokerTopicsLoading'),
|
||||
isNotificationsBrokerTopicsLoaded: jasmine.createSpy('isNotificationsBrokerTopicsLoaded'),
|
||||
isNotificationsBrokerTopicsProcessing: jasmine.createSpy('isNotificationsBrokerTopicsProcessing'),
|
||||
getNotificationsBrokerTopicsTotalPages: jasmine.createSpy('getNotificationsBrokerTopicsTotalPages'),
|
||||
getNotificationsBrokerTopicsCurrentPage: jasmine.createSpy('getNotificationsBrokerTopicsCurrentPage'),
|
||||
getNotificationsBrokerTopicsTotals: jasmine.createSpy('getNotificationsBrokerTopicsTotals'),
|
||||
dispatchRetrieveNotificationsBrokerTopics: jasmine.createSpy('dispatchRetrieveNotificationsBrokerTopics'),
|
||||
getNotificationsBrokerSource: jasmine.createSpy('getNotificationsBrokerSource'),
|
||||
isNotificationsBrokerSourceLoading: jasmine.createSpy('isNotificationsBrokerSourceLoading'),
|
||||
isNotificationsBrokerSourceLoaded: jasmine.createSpy('isNotificationsBrokerSourceLoaded'),
|
||||
isNotificationsBrokerSourceProcessing: jasmine.createSpy('isNotificationsBrokerSourceProcessing'),
|
||||
getNotificationsBrokerSourceTotalPages: jasmine.createSpy('getNotificationsBrokerSourceTotalPages'),
|
||||
getNotificationsBrokerSourceCurrentPage: jasmine.createSpy('getNotificationsBrokerSourceCurrentPage'),
|
||||
getNotificationsBrokerSourceTotals: jasmine.createSpy('getNotificationsBrokerSourceTotals'),
|
||||
dispatchRetrieveNotificationsBrokerSource: jasmine.createSpy('dispatchRetrieveNotificationsBrokerSource'),
|
||||
getQualityAssuranceTopics: jasmine.createSpy('getQualityAssuranceTopics'),
|
||||
isQualityAssuranceTopicsLoading: jasmine.createSpy('isQualityAssuranceTopicsLoading'),
|
||||
isQualityAssuranceTopicsLoaded: jasmine.createSpy('isQualityAssuranceTopicsLoaded'),
|
||||
isQualityAssuranceTopicsProcessing: jasmine.createSpy('isQualityAssuranceTopicsProcessing'),
|
||||
getQualityAssuranceTopicsTotalPages: jasmine.createSpy('getQualityAssuranceTopicsTotalPages'),
|
||||
getQualityAssuranceTopicsCurrentPage: jasmine.createSpy('getQualityAssuranceTopicsCurrentPage'),
|
||||
getQualityAssuranceTopicsTotals: jasmine.createSpy('getQualityAssuranceTopicsTotals'),
|
||||
dispatchRetrieveQualityAssuranceTopics: jasmine.createSpy('dispatchRetrieveQualityAssuranceTopics'),
|
||||
getQualityAssuranceSource: jasmine.createSpy('getQualityAssuranceSource'),
|
||||
isQualityAssuranceSourceLoading: jasmine.createSpy('isQualityAssuranceSourceLoading'),
|
||||
isQualityAssuranceSourceLoaded: jasmine.createSpy('isQualityAssuranceSourceLoaded'),
|
||||
isQualityAssuranceSourceProcessing: jasmine.createSpy('isQualityAssuranceSourceProcessing'),
|
||||
getQualityAssuranceSourceTotalPages: jasmine.createSpy('getQualityAssuranceSourceTotalPages'),
|
||||
getQualityAssuranceSourceCurrentPage: jasmine.createSpy('getQualityAssuranceSourceCurrentPage'),
|
||||
getQualityAssuranceSourceTotals: jasmine.createSpy('getQualityAssuranceSourceTotals'),
|
||||
dispatchRetrieveQualityAssuranceSource: jasmine.createSpy('dispatchRetrieveQualityAssuranceSource'),
|
||||
dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction')
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[NotificationsBrokerSourceRestService]]
|
||||
* Mock for [[QualityAssuranceSourceRestService]]
|
||||
*/
|
||||
export function getMockNotificationsBrokerSourceRestService(): NotificationsBrokerTopicRestService {
|
||||
return jasmine.createSpyObj('NotificationsBrokerSourceRestService', {
|
||||
export function getMockQualityAssuranceSourceRestService(): QualityAssuranceTopicRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceSourceRestService', {
|
||||
getSources: jasmine.createSpy('getSources'),
|
||||
getSource: jasmine.createSpy('getSource'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[NotificationsBrokerTopicRestService]]
|
||||
* Mock for [[QualityAssuranceTopicRestService]]
|
||||
*/
|
||||
export function getMockNotificationsBrokerTopicRestService(): NotificationsBrokerTopicRestService {
|
||||
return jasmine.createSpyObj('NotificationsBrokerTopicRestService', {
|
||||
export function getMockQualityAssuranceTopicRestService(): QualityAssuranceTopicRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceTopicRestService', {
|
||||
getTopics: jasmine.createSpy('getTopics'),
|
||||
getTopic: jasmine.createSpy('getTopic'),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[NotificationsBrokerEventRestService]]
|
||||
* Mock for [[QualityAssuranceEventRestService]]
|
||||
*/
|
||||
export function getMockNotificationsBrokerEventRestService(): NotificationsBrokerEventRestService {
|
||||
return jasmine.createSpyObj('NotificationsBrokerEventRestService', {
|
||||
export function getMockQualityAssuranceEventRestService(): QualityAssuranceEventRestService {
|
||||
return jasmine.createSpyObj('QualityAssuranceEventRestService', {
|
||||
getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
|
||||
getEvent: jasmine.createSpy('getEvent'),
|
||||
patchEvent: jasmine.createSpy('patchEvent'),
|
||||
@@ -1840,7 +1840,7 @@ export function getMockNotificationsBrokerEventRestService(): NotificationsBroke
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock for [[NotificationsBrokerEventRestService]]
|
||||
* Mock for [[QualityAssuranceEventRestService]]
|
||||
*/
|
||||
export function getMockSuggestionsService(): any {
|
||||
return jasmine.createSpyObj('SuggestionsService', {
|
||||
|
@@ -499,13 +499,13 @@
|
||||
|
||||
"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.page.title": "Broker Suggestions",
|
||||
|
||||
"admin.notifications.broker.page.title": "Notifications Broker",
|
||||
"admin.notifications.broker.page.title": "Quality Assurance",
|
||||
|
||||
"admin.notifications.source.breadcrumbs": "Notifications Source",
|
||||
|
||||
@@ -2687,7 +2687,7 @@
|
||||
|
||||
"menu.section.notifications": "Notifications",
|
||||
|
||||
"menu.section.notifications_broker": "Notifications Broker",
|
||||
"menu.section.notifications_broker": "Quality Assurance",
|
||||
|
||||
"menu.section.notifications_reciter": "Publication Claim",
|
||||
|
||||
@@ -2889,9 +2889,9 @@
|
||||
|
||||
"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.",
|
||||
|
||||
|
Reference in New Issue
Block a user