mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
[CST-5246] Correction service should support multiple providers
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
<ds-notifications-broker-events></ds-notifications-broker-events>
|
@@ -0,0 +1,26 @@
|
|||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-notifications-broker-events-page',
|
||||||
|
templateUrl: './admin-notifications-broker-events-page.component.html'
|
||||||
|
})
|
||||||
|
export class AdminNotificationsBrokerEventsPageComponent {
|
||||||
|
|
||||||
|
}
|
@@ -4,7 +4,7 @@ import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/r
|
|||||||
/**
|
/**
|
||||||
* Interface for the route parameters.
|
* Interface for the route parameters.
|
||||||
*/
|
*/
|
||||||
export interface AdminNotificationsOpenaireEventsPageParams {
|
export interface AdminNotificationsBrokerEventsPageParams {
|
||||||
pageId?: string;
|
pageId?: string;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
currentPage?: number;
|
currentPage?: number;
|
||||||
@@ -14,15 +14,15 @@ export interface AdminNotificationsOpenaireEventsPageParams {
|
|||||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminNotificationsOpenaireEventsPageResolver implements Resolve<AdminNotificationsOpenaireEventsPageParams> {
|
export class AdminNotificationsBrokerEventsPageResolver implements Resolve<AdminNotificationsBrokerEventsPageParams> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for resolving the parameters in the current route.
|
* Method for resolving the parameters in the current route.
|
||||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||||
* @returns AdminNotificationsOpenaireEventsPageParams Emits the route parameters
|
* @returns AdminNotificationsBrokerEventsPageParams Emits the route parameters
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsOpenaireEventsPageParams {
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsBrokerEventsPageParams {
|
||||||
return {
|
return {
|
||||||
pageId: route.queryParams.pageId,
|
pageId: route.queryParams.pageId,
|
||||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
pageSize: parseInt(route.queryParams.pageSize, 10),
|
@@ -4,7 +4,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
|
|||||||
/**
|
/**
|
||||||
* Interface for the route parameters.
|
* Interface for the route parameters.
|
||||||
*/
|
*/
|
||||||
export interface AdminNotificationsOpenaireTopicsPageParams {
|
export interface AdminNotificationsBrokerTopicsPageParams {
|
||||||
pageId?: string;
|
pageId?: string;
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
currentPage?: number;
|
currentPage?: number;
|
||||||
@@ -14,15 +14,15 @@ export interface AdminNotificationsOpenaireTopicsPageParams {
|
|||||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminNotificationsOpenaireTopicsPageResolver implements Resolve<AdminNotificationsOpenaireTopicsPageParams> {
|
export class AdminNotificationsBrokerTopicsPageResolver implements Resolve<AdminNotificationsBrokerTopicsPageParams> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method for resolving the parameters in the current route.
|
* Method for resolving the parameters in the current route.
|
||||||
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
* @param {ActivatedRouteSnapshot} route The current ActivatedRouteSnapshot
|
||||||
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
* @param {RouterStateSnapshot} state The current RouterStateSnapshot
|
||||||
* @returns AdminNotificationsOpenaireTopicsPageParams Emits the route parameters
|
* @returns AdminNotificationsBrokerTopicsPageParams Emits the route parameters
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsOpenaireTopicsPageParams {
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): AdminNotificationsBrokerTopicsPageParams {
|
||||||
return {
|
return {
|
||||||
pageId: route.queryParams.pageId,
|
pageId: route.queryParams.pageId,
|
||||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
pageSize: parseInt(route.queryParams.pageSize, 10),
|
@@ -0,0 +1 @@
|
|||||||
|
<ds-notifications-broker-topic></ds-notifications-broker-topic>
|
@@ -0,0 +1,26 @@
|
|||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-notification-broker-page',
|
||||||
|
templateUrl: './admin-notifications-broker-topics-page.component.html'
|
||||||
|
})
|
||||||
|
export class AdminNotificationsBrokerTopicsPageComponent {
|
||||||
|
|
||||||
|
}
|
@@ -1 +0,0 @@
|
|||||||
<ds-openaire-broker-events></ds-openaire-broker-events>
|
|
@@ -1,26 +0,0 @@
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { AdminNotificationsOpenaireEventsPageComponent } from './admin-notifications-openaire-events-page.component';
|
|
||||||
|
|
||||||
describe('AdminNotificationsOpenaireEventsPageComponent', () => {
|
|
||||||
let component: AdminNotificationsOpenaireEventsPageComponent;
|
|
||||||
let fixture: ComponentFixture<AdminNotificationsOpenaireEventsPageComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ AdminNotificationsOpenaireEventsPageComponent ],
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(AdminNotificationsOpenaireEventsPageComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create AdminNotificationsOpenaireEventsPageComponent', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,9 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-notification-openaire-events-page',
|
|
||||||
templateUrl: './admin-notifications-openaire-events-page.component.html'
|
|
||||||
})
|
|
||||||
export class AdminNotificationsOpenaireEventsPageComponent {
|
|
||||||
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
<ds-openaire-broker-topic></ds-openaire-broker-topic>
|
|
@@ -1,26 +0,0 @@
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { AdminNotificationsOpenaireTopicsPageComponent } from './admin-notifications-openaire-topics-page.component';
|
|
||||||
|
|
||||||
describe('AdminNotificationsOpenaireTopicsPageComponent', () => {
|
|
||||||
let component: AdminNotificationsOpenaireTopicsPageComponent;
|
|
||||||
let fixture: ComponentFixture<AdminNotificationsOpenaireTopicsPageComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ AdminNotificationsOpenaireTopicsPageComponent ],
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(AdminNotificationsOpenaireTopicsPageComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create AdminNotificationsOpenaireTopicsPageComponent', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,9 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'ds-notification-openairebroker-page',
|
|
||||||
templateUrl: './admin-notifications-openaire-topics-page.component.html'
|
|
||||||
})
|
|
||||||
export class AdminNotificationsOpenaireTopicsPageComponent {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,8 +1,8 @@
|
|||||||
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
||||||
import { getNotificationsModuleRoute } from '../admin-routing-paths';
|
import { getNotificationsModuleRoute } from '../admin-routing-paths';
|
||||||
|
|
||||||
export const NOTIFICATIONS_EDIT_PATH = 'openaire-broker';
|
export const NOTIFICATIONS_EDIT_PATH = 'notifications-broker';
|
||||||
|
|
||||||
export function getNotificationsOpenairebrokerRoute(id: string) {
|
export function getNotificationsBrokerbrokerRoute(id: string) {
|
||||||
return new URLCombiner(getNotificationsModuleRoute(), NOTIFICATIONS_EDIT_PATH, id).toString();
|
return new URLCombiner(getNotificationsModuleRoute(), NOTIFICATIONS_EDIT_PATH, id).toString();
|
||||||
}
|
}
|
||||||
|
@@ -5,10 +5,10 @@ import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
|||||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||||
import { NOTIFICATIONS_EDIT_PATH } from './admin-notifications-routing-paths';
|
import { NOTIFICATIONS_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||||
import { AdminNotificationsOpenaireTopicsPageComponent } from './admin-notifications-openaire-topics-page/admin-notifications-openaire-topics-page.component';
|
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component';
|
||||||
import { AdminNotificationsOpenaireEventsPageComponent } from './admin-notifications-openaire-events-page/admin-notifications-openaire-events-page.component';
|
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component';
|
||||||
import { AdminNotificationsOpenaireTopicsPageResolver } from './admin-notifications-openaire-topics-page/admin-notifications-openaire-topics-page-resolver.service';
|
import { AdminNotificationsBrokerTopicsPageResolver } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page-resolver.service';
|
||||||
import { AdminNotificationsOpenaireEventsPageResolver } from './admin-notifications-openaire-events-page/admin-notifications-openaire-events-page.resolver';
|
import { AdminNotificationsBrokerEventsPageResolver } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.resolver';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -16,30 +16,30 @@ import { AdminNotificationsOpenaireEventsPageResolver } from './admin-notificati
|
|||||||
{
|
{
|
||||||
canActivate: [ AuthenticatedGuard ],
|
canActivate: [ AuthenticatedGuard ],
|
||||||
path: `${NOTIFICATIONS_EDIT_PATH}`,
|
path: `${NOTIFICATIONS_EDIT_PATH}`,
|
||||||
component: AdminNotificationsOpenaireTopicsPageComponent,
|
component: AdminNotificationsBrokerTopicsPageComponent,
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
openaireBrokerTopicsParams: AdminNotificationsOpenaireTopicsPageResolver
|
openaireBrokerTopicsParams: AdminNotificationsBrokerTopicsPageResolver
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.notifications.openairebroker.page.title',
|
title: 'admin.notifications.broker.page.title',
|
||||||
breadcrumbKey: 'admin.notifications.openairebroker',
|
breadcrumbKey: 'admin.notifications.broker',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
canActivate: [ AuthenticatedGuard ],
|
canActivate: [ AuthenticatedGuard ],
|
||||||
path: `${NOTIFICATIONS_EDIT_PATH}/:id`,
|
path: `${NOTIFICATIONS_EDIT_PATH}/:id`,
|
||||||
component: AdminNotificationsOpenaireEventsPageComponent,
|
component: AdminNotificationsBrokerEventsPageComponent,
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
resolve: {
|
resolve: {
|
||||||
breadcrumb: I18nBreadcrumbResolver,
|
breadcrumb: I18nBreadcrumbResolver,
|
||||||
openaireBrokerEventsParams: AdminNotificationsOpenaireEventsPageResolver
|
openaireBrokerEventsParams: AdminNotificationsBrokerEventsPageResolver
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: 'admin.notifications.openaireevent.page.title',
|
title: 'admin.notifications.event.page.title',
|
||||||
breadcrumbKey: 'admin.notifications.openaireevent',
|
breadcrumbKey: 'admin.notifications.event',
|
||||||
showBreadcrumbsFluid: false
|
showBreadcrumbsFluid: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,8 +48,8 @@ import { AdminNotificationsOpenaireEventsPageResolver } from './admin-notificati
|
|||||||
providers: [
|
providers: [
|
||||||
I18nBreadcrumbResolver,
|
I18nBreadcrumbResolver,
|
||||||
I18nBreadcrumbsService,
|
I18nBreadcrumbsService,
|
||||||
AdminNotificationsOpenaireTopicsPageResolver,
|
AdminNotificationsBrokerTopicsPageResolver,
|
||||||
AdminNotificationsOpenaireEventsPageResolver
|
AdminNotificationsBrokerEventsPageResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
|
@@ -3,9 +3,9 @@ import { NgModule } from '@angular/core';
|
|||||||
import { CoreModule } from '../../core/core.module';
|
import { CoreModule } from '../../core/core.module';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
||||||
import { AdminNotificationsOpenaireTopicsPageComponent } from './admin-notifications-openaire-topics-page/admin-notifications-openaire-topics-page.component';
|
import { AdminNotificationsBrokerTopicsPageComponent } from './admin-notifications-broker-topics-page/admin-notifications-broker-topics-page.component';
|
||||||
import { AdminNotificationsOpenaireEventsPageComponent } from './admin-notifications-openaire-events-page/admin-notifications-openaire-events-page.component';
|
import { AdminNotificationsBrokerEventsPageComponent } from './admin-notifications-broker-events-page/admin-notifications-broker-events-page.component';
|
||||||
import { OpenaireModule } from '../../openaire/openaire.module';
|
import { NotificationsModule } from '../../notifications/notifications.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -13,11 +13,11 @@ import { OpenaireModule } from '../../openaire/openaire.module';
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
CoreModule.forRoot(),
|
CoreModule.forRoot(),
|
||||||
AdminNotificationsRoutingModule,
|
AdminNotificationsRoutingModule,
|
||||||
OpenaireModule
|
NotificationsModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AdminNotificationsOpenaireTopicsPageComponent,
|
AdminNotificationsBrokerTopicsPageComponent,
|
||||||
AdminNotificationsOpenaireEventsPageComponent
|
AdminNotificationsBrokerEventsPageComponent
|
||||||
],
|
],
|
||||||
entryComponents: []
|
entryComponents: []
|
||||||
})
|
})
|
||||||
|
@@ -483,8 +483,8 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
|||||||
visible: authorized,
|
visible: authorized,
|
||||||
model: {
|
model: {
|
||||||
type: MenuItemType.LINK,
|
type: MenuItemType.LINK,
|
||||||
text: 'menu.section.notifications_openaire_broker',
|
text: 'menu.section.notifications_broker',
|
||||||
link: '/admin/notifications/openaire-broker'
|
link: '/admin/notifications/notifications-broker'
|
||||||
} as LinkMenuItemModel,
|
} as LinkMenuItemModel,
|
||||||
},
|
},
|
||||||
/* Admin Search */
|
/* Admin Search */
|
||||||
|
@@ -162,8 +162,8 @@ import { SearchConfig } from './shared/search/search-filters/search-config.model
|
|||||||
import { SequenceService } from './shared/sequence.service';
|
import { SequenceService } from './shared/sequence.service';
|
||||||
import { GroupDataService } from './eperson/group-data.service';
|
import { GroupDataService } from './eperson/group-data.service';
|
||||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||||
import { OpenaireBrokerTopicObject } from './openaire/broker/models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from './notifications/broker/models/notifications-broker-topic.model';
|
||||||
import { OpenaireBrokerEventObject } from './openaire/broker/models/openaire-broker-event.model';
|
import { NotificationsBrokerEventObject } from './notifications/broker/models/notifications-broker-event.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When not in production, endpoint responses can be mocked for testing purposes
|
* When not in production, endpoint responses can be mocked for testing purposes
|
||||||
@@ -345,8 +345,8 @@ export const models =
|
|||||||
ShortLivedToken,
|
ShortLivedToken,
|
||||||
Registration,
|
Registration,
|
||||||
UsageReport,
|
UsageReport,
|
||||||
OpenaireBrokerTopicObject,
|
NotificationsBrokerTopicObject,
|
||||||
OpenaireBrokerEventObject,
|
NotificationsBrokerEventObject,
|
||||||
Root,
|
Root,
|
||||||
SearchConfig,
|
SearchConfig,
|
||||||
SubmissionAccessesModel
|
SubmissionAccessesModel
|
||||||
|
@@ -15,17 +15,17 @@ import { PageInfo } from '../../../shared/page-info.model';
|
|||||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||||
import { OpenaireBrokerEventRestService } from './openaire-broker-event-rest.service';
|
import { NotificationsBrokerEventRestService } from './notifications-broker-event-rest.service';
|
||||||
import {
|
import {
|
||||||
openaireBrokerEventObjectMissingPid,
|
notificationsBrokerEventObjectMissingPid,
|
||||||
openaireBrokerEventObjectMissingPid2,
|
notificationsBrokerEventObjectMissingPid2,
|
||||||
openaireBrokerEventObjectMissingProjectFound
|
notificationsBrokerEventObjectMissingProjectFound
|
||||||
} from '../../../../shared/mocks/openaire.mock';
|
} from '../../../../shared/mocks/notifications.mock';
|
||||||
import { ReplaceOperation } from 'fast-json-patch';
|
import { ReplaceOperation } from 'fast-json-patch';
|
||||||
|
|
||||||
describe('OpenaireBrokerEventRestService', () => {
|
describe('NotificationsBrokerEventRestService', () => {
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
let service: OpenaireBrokerEventRestService;
|
let service: NotificationsBrokerEventRestService;
|
||||||
let serviceASAny: any;
|
let serviceASAny: any;
|
||||||
let responseCacheEntry: RequestEntry;
|
let responseCacheEntry: RequestEntry;
|
||||||
let responseCacheEntryB: RequestEntry;
|
let responseCacheEntryB: RequestEntry;
|
||||||
@@ -43,10 +43,10 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
const topic = 'ENRICH!MORE!PID';
|
const topic = 'ENRICH!MORE!PID';
|
||||||
|
|
||||||
const pageInfo = new PageInfo();
|
const pageInfo = new PageInfo();
|
||||||
const array = [ openaireBrokerEventObjectMissingPid, openaireBrokerEventObjectMissingPid2 ];
|
const array = [ notificationsBrokerEventObjectMissingPid, notificationsBrokerEventObjectMissingPid2 ];
|
||||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||||
const brokerEventObjectRD = createSuccessfulRemoteDataObject(openaireBrokerEventObjectMissingPid);
|
const brokerEventObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid);
|
||||||
const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(openaireBrokerEventObjectMissingProjectFound);
|
const brokerEventObjectMissingProjectRD = createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound);
|
||||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||||
|
|
||||||
const status = 'ACCEPTED';
|
const status = 'ACCEPTED';
|
||||||
@@ -99,7 +99,7 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
http = {} as HttpClient;
|
http = {} as HttpClient;
|
||||||
comparator = {} as any;
|
comparator = {} as any;
|
||||||
|
|
||||||
service = new OpenaireBrokerEventRestService(
|
service = new NotificationsBrokerEventRestService(
|
||||||
requestService,
|
requestService,
|
||||||
rdbService,
|
rdbService,
|
||||||
objectCache,
|
objectCache,
|
||||||
@@ -138,7 +138,7 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
expect(serviceASAny.dataService.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true);
|
expect(serviceASAny.dataService.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData<PaginatedList<OpenaireBrokerEventObject>> for the object with the given Topic', () => {
|
it('should return a RemoteData<PaginatedList<NotificationsBrokerEventObject>> for the object with the given Topic', () => {
|
||||||
const result = service.getEventsByTopic(topic);
|
const result = service.getEventsByTopic(topic);
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: paginatedListRD
|
a: paginatedListRD
|
||||||
@@ -155,15 +155,15 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should proxy the call to dataservice.findById', () => {
|
it('should proxy the call to dataservice.findById', () => {
|
||||||
service.getEvent(openaireBrokerEventObjectMissingPid.id).subscribe(
|
service.getEvent(notificationsBrokerEventObjectMissingPid.id).subscribe(
|
||||||
(res) => {
|
(res) => {
|
||||||
expect(serviceASAny.dataService.findById).toHaveBeenCalledWith(openaireBrokerEventObjectMissingPid.id, true, true);
|
expect(serviceASAny.dataService.findById).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingPid.id, true, true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData<OpenaireBrokerEventObject> for the object with the given URL', () => {
|
it('should return a RemoteData<NotificationsBrokerEventObject> for the object with the given URL', () => {
|
||||||
const result = service.getEvent(openaireBrokerEventObjectMissingPid.id);
|
const result = service.getEvent(notificationsBrokerEventObjectMissingPid.id);
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: brokerEventObjectRD
|
a: brokerEventObjectRD
|
||||||
});
|
});
|
||||||
@@ -179,17 +179,17 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should proxy the call to dataservice.patch', () => {
|
it('should proxy the call to dataservice.patch', () => {
|
||||||
service.patchEvent(status, openaireBrokerEventObjectMissingPid).subscribe(
|
service.patchEvent(status, notificationsBrokerEventObjectMissingPid).subscribe(
|
||||||
(res) => {
|
(res) => {
|
||||||
expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(openaireBrokerEventObjectMissingPid, operation);
|
expect(serviceASAny.dataService.patch).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingPid, operation);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData with HTTP 200', () => {
|
it('should return a RemoteData with HTTP 200', () => {
|
||||||
const result = service.patchEvent(status, openaireBrokerEventObjectMissingPid);
|
const result = service.patchEvent(status, notificationsBrokerEventObjectMissingPid);
|
||||||
const expected = cold('(a|)', {
|
const expected = cold('(a|)', {
|
||||||
a: createSuccessfulRemoteDataObject(openaireBrokerEventObjectMissingPid)
|
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingPid)
|
||||||
});
|
});
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
@@ -203,17 +203,17 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should proxy the call to dataservice.postOnRelated', () => {
|
it('should proxy the call to dataservice.postOnRelated', () => {
|
||||||
service.boundProject(openaireBrokerEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
||||||
(res) => {
|
(res) => {
|
||||||
expect(serviceASAny.dataService.postOnRelated).toHaveBeenCalledWith(openaireBrokerEventObjectMissingProjectFound.id, requestUUID);
|
expect(serviceASAny.dataService.postOnRelated).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RestResponse with HTTP 201', () => {
|
it('should return a RestResponse with HTTP 201', () => {
|
||||||
const result = service.boundProject(openaireBrokerEventObjectMissingProjectFound.id, requestUUID);
|
const result = service.boundProject(notificationsBrokerEventObjectMissingProjectFound.id, requestUUID);
|
||||||
const expected = cold('(a|)', {
|
const expected = cold('(a|)', {
|
||||||
a: createSuccessfulRemoteDataObject(openaireBrokerEventObjectMissingProjectFound)
|
a: createSuccessfulRemoteDataObject(notificationsBrokerEventObjectMissingProjectFound)
|
||||||
});
|
});
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
@@ -227,15 +227,15 @@ describe('OpenaireBrokerEventRestService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should proxy the call to dataservice.deleteOnRelated', () => {
|
it('should proxy the call to dataservice.deleteOnRelated', () => {
|
||||||
service.removeProject(openaireBrokerEventObjectMissingProjectFound.id).subscribe(
|
service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id).subscribe(
|
||||||
(res) => {
|
(res) => {
|
||||||
expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(openaireBrokerEventObjectMissingProjectFound.id);
|
expect(serviceASAny.dataService.deleteOnRelated).toHaveBeenCalledWith(notificationsBrokerEventObjectMissingProjectFound.id);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RestResponse with HTTP 204', () => {
|
it('should return a RestResponse with HTTP 204', () => {
|
||||||
const result = service.removeProject(openaireBrokerEventObjectMissingProjectFound.id);
|
const result = service.removeProject(notificationsBrokerEventObjectMissingProjectFound.id);
|
||||||
const expected = cold('(a|)', {
|
const expected = cold('(a|)', {
|
||||||
a: createSuccessfulRemoteDataObject({})
|
a: createSuccessfulRemoteDataObject({})
|
||||||
});
|
});
|
@@ -17,8 +17,8 @@ import { DataService } from '../../../data/data.service';
|
|||||||
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
||||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||||
import { RemoteData } from '../../../data/remote-data';
|
import { RemoteData } from '../../../data/remote-data';
|
||||||
import { OpenaireBrokerEventObject } from '../models/openaire-broker-event.model';
|
import { NotificationsBrokerEventObject } from '../models/notifications-broker-event.model';
|
||||||
import { OPENAIRE_BROKER_EVENT_OBJECT } from '../models/openaire-broker-event-object.resource-type';
|
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from '../models/notifications-broker-event-object.resource-type';
|
||||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||||
import { ReplaceOperation } from 'fast-json-patch';
|
import { ReplaceOperation } from 'fast-json-patch';
|
||||||
@@ -29,7 +29,7 @@ import { NoContent } from '../../../shared/NoContent.model';
|
|||||||
/**
|
/**
|
||||||
* A private DataService implementation to delegate specific methods to.
|
* A private DataService implementation to delegate specific methods to.
|
||||||
*/
|
*/
|
||||||
class DataServiceImpl extends DataService<OpenaireBrokerEventObject> {
|
class DataServiceImpl extends DataService<NotificationsBrokerEventObject> {
|
||||||
/**
|
/**
|
||||||
* The REST endpoint.
|
* The REST endpoint.
|
||||||
*/
|
*/
|
||||||
@@ -44,7 +44,7 @@ class DataServiceImpl extends DataService<OpenaireBrokerEventObject> {
|
|||||||
* @param {HALEndpointService} halService
|
* @param {HALEndpointService} halService
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {HttpClient} http
|
* @param {HttpClient} http
|
||||||
* @param {ChangeAnalyzer<OpenaireBrokerEventObject>} comparator
|
* @param {ChangeAnalyzer<NotificationsBrokerEventObject>} comparator
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
@@ -54,17 +54,17 @@ class DataServiceImpl extends DataService<OpenaireBrokerEventObject> {
|
|||||||
protected halService: HALEndpointService,
|
protected halService: HALEndpointService,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected http: HttpClient,
|
protected http: HttpClient,
|
||||||
protected comparator: ChangeAnalyzer<OpenaireBrokerEventObject>) {
|
protected comparator: ChangeAnalyzer<NotificationsBrokerEventObject>) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The service handling all OpenAIRE Broker topic REST requests.
|
* The service handling all Notifications Broker topic REST requests.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@dataService(OPENAIRE_BROKER_EVENT_OBJECT)
|
@dataService(NOTIFICATIONS_BROKER_EVENT_OBJECT)
|
||||||
export class OpenaireBrokerEventRestService {
|
export class NotificationsBrokerEventRestService {
|
||||||
/**
|
/**
|
||||||
* A private DataService implementation to delegate specific methods to.
|
* A private DataService implementation to delegate specific methods to.
|
||||||
*/
|
*/
|
||||||
@@ -78,7 +78,7 @@ export class OpenaireBrokerEventRestService {
|
|||||||
* @param {HALEndpointService} halService
|
* @param {HALEndpointService} halService
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {HttpClient} http
|
* @param {HttpClient} http
|
||||||
* @param {DefaultChangeAnalyzer<OpenaireBrokerEventObject>} comparator
|
* @param {DefaultChangeAnalyzer<NotificationsBrokerEventObject>} comparator
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
@@ -87,23 +87,23 @@ export class OpenaireBrokerEventRestService {
|
|||||||
protected halService: HALEndpointService,
|
protected halService: HALEndpointService,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected http: HttpClient,
|
protected http: HttpClient,
|
||||||
protected comparator: DefaultChangeAnalyzer<OpenaireBrokerEventObject>) {
|
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerEventObject>) {
|
||||||
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
|
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of OpenAIRE Broker events by topic.
|
* Return the list of Notifications Broker events by topic.
|
||||||
*
|
*
|
||||||
* @param topic
|
* @param topic
|
||||||
* The OpenAIRE Broker topic
|
* The Notifications Broker topic
|
||||||
* @param options
|
* @param options
|
||||||
* Find list options object.
|
* Find list options object.
|
||||||
* @param linksToFollow
|
* @param linksToFollow
|
||||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||||
* @return Observable<RemoteData<PaginatedList<OpenaireBrokerEventObject>>>
|
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerEventObject>>>
|
||||||
* The list of OpenAIRE Broker events.
|
* The list of Notifications Broker events.
|
||||||
*/
|
*/
|
||||||
public getEventsByTopic(topic: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<OpenaireBrokerEventObject>[]): Observable<RemoteData<PaginatedList<OpenaireBrokerEventObject>>> {
|
public getEventsByTopic(topic: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<NotificationsBrokerEventObject>[]): Observable<RemoteData<PaginatedList<NotificationsBrokerEventObject>>> {
|
||||||
options.searchParams = [
|
options.searchParams = [
|
||||||
{
|
{
|
||||||
fieldName: 'topic',
|
fieldName: 'topic',
|
||||||
@@ -121,32 +121,32 @@ export class OpenaireBrokerEventRestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a single OpenAIRE Broker event.
|
* Return a single Notifications Broker event.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* The OpenAIRE Broker event id
|
* The Notifications Broker event id
|
||||||
* @param linksToFollow
|
* @param linksToFollow
|
||||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
|
||||||
* @return Observable<RemoteData<OpenaireBrokerEventObject>>
|
* @return Observable<RemoteData<NotificationsBrokerEventObject>>
|
||||||
* The OpenAIRE Broker event.
|
* The Notifications Broker event.
|
||||||
*/
|
*/
|
||||||
public getEvent(id: string, ...linksToFollow: FollowLinkConfig<OpenaireBrokerEventObject>[]): Observable<RemoteData<OpenaireBrokerEventObject>> {
|
public getEvent(id: string, ...linksToFollow: FollowLinkConfig<NotificationsBrokerEventObject>[]): Observable<RemoteData<NotificationsBrokerEventObject>> {
|
||||||
return this.dataService.findById(id, true, true, ...linksToFollow);
|
return this.dataService.findById(id, true, true, ...linksToFollow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the new status of an OpenAIRE Broker event.
|
* Save the new status of a Notifications Broker event.
|
||||||
*
|
*
|
||||||
* @param status
|
* @param status
|
||||||
* The new status
|
* The new status
|
||||||
* @param dso OpenaireBrokerEventObject
|
* @param dso NotificationsBrokerEventObject
|
||||||
* The event item
|
* The event item
|
||||||
* @param reason
|
* @param reason
|
||||||
* The optional reason (not used for now; for future implementation)
|
* The optional reason (not used for now; for future implementation)
|
||||||
* @return Observable<RestResponse>
|
* @return Observable<RestResponse>
|
||||||
* The REST response.
|
* The REST response.
|
||||||
*/
|
*/
|
||||||
public patchEvent(status, dso, reason?: string): Observable<RemoteData<OpenaireBrokerEventObject>> {
|
public patchEvent(status, dso, reason?: string): Observable<RemoteData<NotificationsBrokerEventObject>> {
|
||||||
const operation: ReplaceOperation<string>[] = [
|
const operation: ReplaceOperation<string>[] = [
|
||||||
{
|
{
|
||||||
path: '/status',
|
path: '/status',
|
||||||
@@ -158,24 +158,24 @@ export class OpenaireBrokerEventRestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bound a project to an OpenAIRE Broker event publication.
|
* Bound a project to a Notifications Broker event publication.
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param itemId
|
||||||
* The Id of the OpenAIRE Broker event
|
* The Id of the Notifications Broker event
|
||||||
* @param projectId
|
* @param projectId
|
||||||
* The project Id to bound
|
* The project Id to bound
|
||||||
* @return Observable<RestResponse>
|
* @return Observable<RestResponse>
|
||||||
* The REST response.
|
* The REST response.
|
||||||
*/
|
*/
|
||||||
public boundProject(itemId: string, projectId: string): Observable<RemoteData<OpenaireBrokerEventObject>> {
|
public boundProject(itemId: string, projectId: string): Observable<RemoteData<NotificationsBrokerEventObject>> {
|
||||||
return this.dataService.postOnRelated(itemId, projectId);
|
return this.dataService.postOnRelated(itemId, projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a project from an OpenAIRE Broker event publication.
|
* Remove a project from a Notifications Broker event publication.
|
||||||
*
|
*
|
||||||
* @param itemId
|
* @param itemId
|
||||||
* The Id of the OpenAIRE Broker event
|
* The Id of the Notifications Broker event
|
||||||
* @return Observable<RestResponse>
|
* @return Observable<RestResponse>
|
||||||
* The REST response.
|
* The REST response.
|
||||||
*/
|
*/
|
@@ -1,9 +1,9 @@
|
|||||||
import { ResourceType } from '../../../shared/resource-type';
|
import { ResourceType } from '../../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resource type for the OpenAIRE Broker event
|
* The resource type for the Notifications Broker event
|
||||||
*
|
*
|
||||||
* Needs to be in a separate file to prevent circular
|
* Needs to be in a separate file to prevent circular
|
||||||
* dependencies in webpack.
|
* dependencies in webpack.
|
||||||
*/
|
*/
|
||||||
export const OPENAIRE_BROKER_EVENT_OBJECT = new ResourceType('nbevent');
|
export const NOTIFICATIONS_BROKER_EVENT_OBJECT = new ResourceType('nbevent');
|
@@ -1,7 +1,7 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||||
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
||||||
import { OPENAIRE_BROKER_EVENT_OBJECT } from './openaire-broker-event-object.resource-type';
|
import { NOTIFICATIONS_BROKER_EVENT_OBJECT } from './notifications-broker-event-object.resource-type';
|
||||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||||
import { ResourceType } from '../../../shared/resource-type';
|
import { ResourceType } from '../../../shared/resource-type';
|
||||||
import { HALLink } from '../../../shared/hal-link.model';
|
import { HALLink } from '../../../shared/hal-link.model';
|
||||||
@@ -11,85 +11,92 @@ import { link, typedObject } from '../../../cache/builders/build-decorators';
|
|||||||
import { RemoteData } from '../../../data/remote-data';
|
import { RemoteData } from '../../../data/remote-data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface representing the OpenAIRE Broker event message
|
* The interface representing the Notifications Broker event message
|
||||||
*/
|
*/
|
||||||
export interface OpenaireBrokerEventMessageObject {
|
export interface NotificationsBrokerEventMessageObject {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The interface representing the Notifications Broker event message
|
||||||
|
*/
|
||||||
|
export interface OpenaireBrokerEventMessageObject{
|
||||||
/**
|
/**
|
||||||
* The type of 'value'
|
* The type of 'value'
|
||||||
*/
|
*/
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value suggested by OpenAIRE
|
* The value suggested by Notifications
|
||||||
*/
|
*/
|
||||||
value: string;
|
value: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The abstract suggested by OpenAIRE
|
* The abstract suggested by Notifications
|
||||||
*/
|
*/
|
||||||
abstract: string;
|
abstract: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project acronym suggested by OpenAIRE
|
* The project acronym suggested by Notifications
|
||||||
*/
|
*/
|
||||||
acronym: string;
|
acronym: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project code suggested by OpenAIRE
|
* The project code suggested by Notifications
|
||||||
*/
|
*/
|
||||||
code: string;
|
code: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project funder suggested by OpenAIRE
|
* The project funder suggested by Notifications
|
||||||
*/
|
*/
|
||||||
funder: string;
|
funder: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project program suggested by OpenAIRE
|
* The project program suggested by Notifications
|
||||||
*/
|
*/
|
||||||
fundingProgram?: string;
|
fundingProgram?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project jurisdiction suggested by OpenAIRE
|
* The project jurisdiction suggested by Notifications
|
||||||
*/
|
*/
|
||||||
jurisdiction: string;
|
jurisdiction: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project title suggested by OpenAIRE
|
* The project title suggested by Notifications
|
||||||
*/
|
*/
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE ID.
|
* The OPENAIRE ID.
|
||||||
*/
|
*/
|
||||||
openaireId: string;
|
openaireId: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface representing the OpenAIRE Broker event model
|
* The interface representing the Notifications Broker event model
|
||||||
*/
|
*/
|
||||||
@typedObject
|
@typedObject
|
||||||
export class OpenaireBrokerEventObject implements CacheableObject {
|
export class NotificationsBrokerEventObject implements CacheableObject {
|
||||||
/**
|
/**
|
||||||
* A string representing the kind of object, e.g. community, item, …
|
* A string representing the kind of object, e.g. community, item, …
|
||||||
*/
|
*/
|
||||||
static type = OPENAIRE_BROKER_EVENT_OBJECT;
|
static type = NOTIFICATIONS_BROKER_EVENT_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event uuid inside DSpace
|
* The Notifications Broker event uuid inside DSpace
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The universally unique identifier of this OpenAIRE Broker event
|
* The universally unique identifier of this Notifications Broker event
|
||||||
*/
|
*/
|
||||||
@autoserializeAs(String, 'id')
|
@autoserializeAs(String, 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event original id (ex.: the source archive OAI-PMH identifier)
|
* The Notifications Broker event original id (ex.: the source archive OAI-PMH identifier)
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
originalId: string;
|
originalId: string;
|
||||||
@@ -107,19 +114,19 @@ export class OpenaireBrokerEventObject implements CacheableObject {
|
|||||||
trust: number;
|
trust: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The timestamp OpenAIRE Broker event was saved in DSpace
|
* The timestamp Notifications Broker event was saved in DSpace
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
eventDate: string;
|
eventDate: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event status (ACCEPTED, REJECTED, DISCARDED, PENDING)
|
* The Notifications Broker event status (ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
status: string;
|
status: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The suggestion data. Data may vary depending on the topic
|
* The suggestion data. Data may vary depending on the source
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
message: OpenaireBrokerEventMessageObject;
|
message: OpenaireBrokerEventMessageObject;
|
@@ -1,9 +1,9 @@
|
|||||||
import { ResourceType } from '../../../shared/resource-type';
|
import { ResourceType } from '../../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resource type for the OpenAIRE Broker topic
|
* The resource type for the Notifications Broker topic
|
||||||
*
|
*
|
||||||
* Needs to be in a separate file to prevent circular
|
* Needs to be in a separate file to prevent circular
|
||||||
* dependencies in webpack.
|
* dependencies in webpack.
|
||||||
*/
|
*/
|
||||||
export const OPENAIRE_BROKER_TOPIC_OBJECT = new ResourceType('nbtopic');
|
export const NOTIFICATIONS_BROKER_TOPIC_OBJECT = new ResourceType('nbtopic');
|
@@ -1,42 +1,42 @@
|
|||||||
import { autoserialize, deserialize } from 'cerialize';
|
import { autoserialize, deserialize } from 'cerialize';
|
||||||
|
|
||||||
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
import { CacheableObject } from '../../../cache/object-cache.reducer';
|
||||||
import { OPENAIRE_BROKER_TOPIC_OBJECT } from './openaire-broker-topic-object.resource-type';
|
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from './notifications-broker-topic-object.resource-type';
|
||||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||||
import { ResourceType } from '../../../shared/resource-type';
|
import { ResourceType } from '../../../shared/resource-type';
|
||||||
import { HALLink } from '../../../shared/hal-link.model';
|
import { HALLink } from '../../../shared/hal-link.model';
|
||||||
import { typedObject } from '../../../cache/builders/build-decorators';
|
import { typedObject } from '../../../cache/builders/build-decorators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The interface representing the OpenAIRE Broker topic model
|
* The interface representing the Notifications Broker topic model
|
||||||
*/
|
*/
|
||||||
@typedObject
|
@typedObject
|
||||||
export class OpenaireBrokerTopicObject implements CacheableObject {
|
export class NotificationsBrokerTopicObject implements CacheableObject {
|
||||||
/**
|
/**
|
||||||
* A string representing the kind of object, e.g. community, item, …
|
* A string representing the kind of object, e.g. community, item, …
|
||||||
*/
|
*/
|
||||||
static type = OPENAIRE_BROKER_TOPIC_OBJECT;
|
static type = NOTIFICATIONS_BROKER_TOPIC_OBJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker topic id
|
* The Notifications Broker topic id
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker topic name to display
|
* The Notifications Broker topic name to display
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date of the last udate from OpenAIRE
|
* The date of the last udate from Notifications
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
lastEvent: string;
|
lastEvent: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The total number of suggestions provided by OpenAIRE for this topic
|
* The total number of suggestions provided by Notifications for this topic
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
totalEvents: number;
|
totalEvents: number;
|
@@ -14,15 +14,15 @@ import { PageInfo } from '../../../shared/page-info.model';
|
|||||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||||
import { OpenaireBrokerTopicRestService } from './openaire-broker-topic-rest.service';
|
import { NotificationsBrokerTopicRestService } from './notifications-broker-topic-rest.service';
|
||||||
import {
|
import {
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMorePid
|
notificationsBrokerTopicObjectMorePid
|
||||||
} from '../../../../shared/mocks/openaire.mock';
|
} from '../../../../shared/mocks/notifications.mock';
|
||||||
|
|
||||||
describe('OpenaireBrokerTopicRestService', () => {
|
describe('NotificationsBrokerTopicRestService', () => {
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
let service: OpenaireBrokerTopicRestService;
|
let service: NotificationsBrokerTopicRestService;
|
||||||
let responseCacheEntry: RequestEntry;
|
let responseCacheEntry: RequestEntry;
|
||||||
let requestService: RequestService;
|
let requestService: RequestService;
|
||||||
let rdbService: RemoteDataBuildService;
|
let rdbService: RemoteDataBuildService;
|
||||||
@@ -36,9 +36,9 @@ describe('OpenaireBrokerTopicRestService', () => {
|
|||||||
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
const requestUUID = '8b3c913a-5a4b-438b-9181-be1a5b4a1c8a';
|
||||||
|
|
||||||
const pageInfo = new PageInfo();
|
const pageInfo = new PageInfo();
|
||||||
const array = [ openaireBrokerTopicObjectMorePid, openaireBrokerTopicObjectMoreAbstract ];
|
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ];
|
||||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||||
const brokerTopicObjectRD = createSuccessfulRemoteDataObject(openaireBrokerTopicObjectMorePid);
|
const brokerTopicObjectRD = createSuccessfulRemoteDataObject(notificationsBrokerTopicObjectMorePid);
|
||||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -72,7 +72,7 @@ describe('OpenaireBrokerTopicRestService', () => {
|
|||||||
http = {} as HttpClient;
|
http = {} as HttpClient;
|
||||||
comparator = {} as any;
|
comparator = {} as any;
|
||||||
|
|
||||||
service = new OpenaireBrokerTopicRestService(
|
service = new NotificationsBrokerTopicRestService(
|
||||||
requestService,
|
requestService,
|
||||||
rdbService,
|
rdbService,
|
||||||
objectCache,
|
objectCache,
|
||||||
@@ -96,7 +96,7 @@ describe('OpenaireBrokerTopicRestService', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData<PaginatedList<OpenaireBrokerTopicObject>> for the object with the given URL', () => {
|
it('should return a RemoteData<PaginatedList<NotificationsBrokerTopicObject>> for the object with the given URL', () => {
|
||||||
const result = service.getTopics();
|
const result = service.getTopics();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: paginatedListRD
|
a: paginatedListRD
|
||||||
@@ -107,16 +107,16 @@ describe('OpenaireBrokerTopicRestService', () => {
|
|||||||
|
|
||||||
describe('getTopic', () => {
|
describe('getTopic', () => {
|
||||||
it('should proxy the call to dataservice.findByHref', (done) => {
|
it('should proxy the call to dataservice.findByHref', (done) => {
|
||||||
service.getTopic(openaireBrokerTopicObjectMorePid.id).subscribe(
|
service.getTopic(notificationsBrokerTopicObjectMorePid.id).subscribe(
|
||||||
(res) => {
|
(res) => {
|
||||||
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + openaireBrokerTopicObjectMorePid.id, true, true);
|
expect((service as any).dataService.findByHref).toHaveBeenCalledWith(endpointURL + '/' + notificationsBrokerTopicObjectMorePid.id, true, true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a RemoteData<OpenaireBrokerTopicObject> for the object with the given URL', () => {
|
it('should return a RemoteData<NotificationsBrokerTopicObject> for the object with the given URL', () => {
|
||||||
const result = service.getTopic(openaireBrokerTopicObjectMorePid.id);
|
const result = service.getTopic(notificationsBrokerTopicObjectMorePid.id);
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: brokerTopicObjectRD
|
a: brokerTopicObjectRD
|
||||||
});
|
});
|
@@ -17,8 +17,8 @@ import { DataService } from '../../../data/data.service';
|
|||||||
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
import { ChangeAnalyzer } from '../../../data/change-analyzer';
|
||||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||||
import { RemoteData } from '../../../data/remote-data';
|
import { RemoteData } from '../../../data/remote-data';
|
||||||
import { OpenaireBrokerTopicObject } from '../models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from '../models/notifications-broker-topic.model';
|
||||||
import { OPENAIRE_BROKER_TOPIC_OBJECT } from '../models/openaire-broker-topic-object.resource-type';
|
import { NOTIFICATIONS_BROKER_TOPIC_OBJECT } from '../models/notifications-broker-topic-object.resource-type';
|
||||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ import { PaginatedList } from '../../../data/paginated-list.model';
|
|||||||
/**
|
/**
|
||||||
* A private DataService implementation to delegate specific methods to.
|
* A private DataService implementation to delegate specific methods to.
|
||||||
*/
|
*/
|
||||||
class DataServiceImpl extends DataService<OpenaireBrokerTopicObject> {
|
class DataServiceImpl extends DataService<NotificationsBrokerTopicObject> {
|
||||||
/**
|
/**
|
||||||
* The REST endpoint.
|
* The REST endpoint.
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +42,7 @@ class DataServiceImpl extends DataService<OpenaireBrokerTopicObject> {
|
|||||||
* @param {HALEndpointService} halService
|
* @param {HALEndpointService} halService
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {HttpClient} http
|
* @param {HttpClient} http
|
||||||
* @param {ChangeAnalyzer<OpenaireBrokerTopicObject>} comparator
|
* @param {ChangeAnalyzer<NotificationsBrokerTopicObject>} comparator
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
@@ -52,17 +52,17 @@ class DataServiceImpl extends DataService<OpenaireBrokerTopicObject> {
|
|||||||
protected halService: HALEndpointService,
|
protected halService: HALEndpointService,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected http: HttpClient,
|
protected http: HttpClient,
|
||||||
protected comparator: ChangeAnalyzer<OpenaireBrokerTopicObject>) {
|
protected comparator: ChangeAnalyzer<NotificationsBrokerTopicObject>) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The service handling all OpenAIRE Broker topic REST requests.
|
* The service handling all Notifications Broker topic REST requests.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@dataService(OPENAIRE_BROKER_TOPIC_OBJECT)
|
@dataService(NOTIFICATIONS_BROKER_TOPIC_OBJECT)
|
||||||
export class OpenaireBrokerTopicRestService {
|
export class NotificationsBrokerTopicRestService {
|
||||||
/**
|
/**
|
||||||
* A private DataService implementation to delegate specific methods to.
|
* A private DataService implementation to delegate specific methods to.
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +76,7 @@ export class OpenaireBrokerTopicRestService {
|
|||||||
* @param {HALEndpointService} halService
|
* @param {HALEndpointService} halService
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {HttpClient} http
|
* @param {HttpClient} http
|
||||||
* @param {DefaultChangeAnalyzer<OpenaireBrokerTopicObject>} comparator
|
* @param {DefaultChangeAnalyzer<NotificationsBrokerTopicObject>} comparator
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
protected requestService: RequestService,
|
protected requestService: RequestService,
|
||||||
@@ -85,21 +85,21 @@ export class OpenaireBrokerTopicRestService {
|
|||||||
protected halService: HALEndpointService,
|
protected halService: HALEndpointService,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected http: HttpClient,
|
protected http: HttpClient,
|
||||||
protected comparator: DefaultChangeAnalyzer<OpenaireBrokerTopicObject>) {
|
protected comparator: DefaultChangeAnalyzer<NotificationsBrokerTopicObject>) {
|
||||||
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
|
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of OpenAIRE Broker topics.
|
* Return the list of Notifications Broker topics.
|
||||||
*
|
*
|
||||||
* @param options
|
* @param options
|
||||||
* Find list options object.
|
* Find list options object.
|
||||||
* @param linksToFollow
|
* @param linksToFollow
|
||||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||||
* @return Observable<RemoteData<PaginatedList<OpenaireBrokerTopicObject>>>
|
* @return Observable<RemoteData<PaginatedList<NotificationsBrokerTopicObject>>>
|
||||||
* The list of OpenAIRE Broker topics.
|
* The list of Notifications Broker topics.
|
||||||
*/
|
*/
|
||||||
public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<OpenaireBrokerTopicObject>[]): Observable<RemoteData<PaginatedList<OpenaireBrokerTopicObject>>> {
|
public getTopics(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<NotificationsBrokerTopicObject>[]): Observable<RemoteData<PaginatedList<NotificationsBrokerTopicObject>>> {
|
||||||
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
|
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
|
||||||
take(1),
|
take(1),
|
||||||
mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)),
|
mergeMap((href: string) => this.dataService.findAllByHref(href, options, true, true, ...linksToFollow)),
|
||||||
@@ -114,16 +114,16 @@ export class OpenaireBrokerTopicRestService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a single OpenAIRE Broker topic.
|
* Return a single Notifications Broker topic.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* The OpenAIRE Broker topic id
|
* The Notifications Broker topic id
|
||||||
* @param linksToFollow
|
* @param linksToFollow
|
||||||
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
* List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved.
|
||||||
* @return Observable<RemoteData<OpenaireBrokerTopicObject>>
|
* @return Observable<RemoteData<NotificationsBrokerTopicObject>>
|
||||||
* The OpenAIRE Broker topic.
|
* The Notifications Broker topic.
|
||||||
*/
|
*/
|
||||||
public getTopic(id: string, ...linksToFollow: FollowLinkConfig<OpenaireBrokerTopicObject>[]): Observable<RemoteData<OpenaireBrokerTopicObject>> {
|
public getTopic(id: string, ...linksToFollow: FollowLinkConfig<NotificationsBrokerTopicObject>[]): Observable<RemoteData<NotificationsBrokerTopicObject>> {
|
||||||
const options = {};
|
const options = {};
|
||||||
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
|
return this.dataService.getBrowseEndpoint(options, 'nbtopics').pipe(
|
||||||
take(1),
|
take(1),
|
@@ -1,12 +1,12 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h2 class="border-bottom pb-2">{{'openaire.events.title'| translate}}</h2>
|
<h2 class="border-bottom pb-2">{{'notifications.events.title'| translate}}</h2>
|
||||||
<p>{{'openaire.broker.events.description'| translate}}</p>
|
<p>{{'notifications.broker.events.description'| translate}}</p>
|
||||||
<p>
|
<p>
|
||||||
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/openaire-broker']">
|
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/notifications-broker']">
|
||||||
<i class="fas fa-angle-double-left"></i>
|
<i class="fas fa-angle-double-left"></i>
|
||||||
{{'openaire.broker.events.back' | translate}}
|
{{'notifications.broker.events.back' | translate}}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -14,31 +14,31 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h3 class="border-bottom pb-2">
|
<h3 class="border-bottom pb-2">
|
||||||
{{'openaire.broker.events.topic' | translate}} {{this.showTopic}}
|
{{'notifications.broker.events.topic' | translate}} {{this.showTopic}}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<ds-loading class="container" *ngIf="(isEventPageLoading | async)" message="{{'openaire.broker.loading' | translate}}"></ds-loading>
|
<ds-loading class="container" *ngIf="(isEventPageLoading | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
|
||||||
|
|
||||||
<ds-pagination *ngIf="!(isEventPageLoading | async)"
|
<ds-pagination *ngIf="!(isEventPageLoading | async)"
|
||||||
[paginationOptions]="paginationConfig"
|
[paginationOptions]="paginationConfig"
|
||||||
[collectionSize]="(totalElements$ | async)"
|
[collectionSize]="(totalElements$ | async)"
|
||||||
[sortOptions]="paginationSortConfig"
|
[sortOptions]="paginationSortConfig"
|
||||||
(paginationChange)="getOpenaireBrokerEvents()">
|
(paginationChange)="getNotificationsBrokerEvents()">
|
||||||
|
|
||||||
<ds-loading class="container" *ngIf="(isEventLoading | async)" message="{{'openaire.broker.loading' | translate}}"></ds-loading>
|
<ds-loading class="container" *ngIf="(isEventLoading | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
|
||||||
<ng-container *ngIf="!(isEventLoading | async)">
|
<ng-container *ngIf="!(isEventLoading | async)">
|
||||||
<div *ngIf="(eventsUpdated$|async)?.length == 0" class="alert alert-info w-100 mb-2 mt-2" role="alert">
|
<div *ngIf="(eventsUpdated$|async)?.length == 0" class="alert alert-info w-100 mb-2 mt-2" role="alert">
|
||||||
{{'openaire.broker.noEvents' | translate}}
|
{{'notifications.broker.noEvents' | translate}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="(eventsUpdated$|async)?.length != 0" class="table-responsive mt-2">
|
<div *ngIf="(eventsUpdated$|async)?.length != 0" class="table-responsive mt-2">
|
||||||
<table id="events" class="table table-striped table-hover table-bordered">
|
<table id="events" class="table table-striped table-hover table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{{'openaire.broker.event.table.trust' | translate}}</th>
|
<th scope="col">{{'notifications.broker.event.table.trust' | translate}}</th>
|
||||||
<th scope="col">{{'openaire.broker.event.table.publication' | translate}}</th>
|
<th scope="col">{{'notifications.broker.event.table.publication' | translate}}</th>
|
||||||
<th *ngIf="hasDetailColumn() && showTopic.indexOf('/PROJECT') == -1" scope="col">{{'openaire.broker.event.table.details' | translate}}</th>
|
<th *ngIf="hasDetailColumn() && showTopic.indexOf('/PROJECT') == -1" scope="col">{{'notifications.broker.event.table.details' | translate}}</th>
|
||||||
<th *ngIf="hasDetailColumn() && showTopic.indexOf('/PROJECT') !== -1" scope="col">{{'openaire.broker.event.table.project-details' | translate}}</th>
|
<th *ngIf="hasDetailColumn() && showTopic.indexOf('/PROJECT') !== -1" scope="col">{{'notifications.broker.event.table.project-details' | translate}}</th>
|
||||||
<th scope="col" class="button-rows">{{'openaire.broker.event.table.actions' | translate}}</th>
|
<th scope="col" class="button-rows">{{'notifications.broker.event.table.actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -51,8 +51,8 @@
|
|||||||
<span *ngIf="!eventElement?.target">{{eventElement.title}}</span>
|
<span *ngIf="!eventElement?.target">{{eventElement.title}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="showTopic.indexOf('/PID') !== -1">
|
<td *ngIf="showTopic.indexOf('/PID') !== -1">
|
||||||
<p><span class="small">{{'openaire.broker.event.table.pidtype' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.type}}</span></p>
|
<p><span class="small">{{'notifications.broker.event.table.pidtype' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.type}}</span></p>
|
||||||
<p><span class="small">{{'openaire.broker.event.table.pidvalue' | translate}}</span><br>
|
<p><span class="small">{{'notifications.broker.event.table.pidvalue' | translate}}</span><br>
|
||||||
<a *ngIf="hasPIDHref(eventElement.event.message); else noPID" href="{{getPIDHref(eventElement.event.message)}}" target="_blank">
|
<a *ngIf="hasPIDHref(eventElement.event.message); else noPID" href="{{getPIDHref(eventElement.event.message)}}" target="_blank">
|
||||||
{{eventElement.event.message.value}}
|
{{eventElement.event.message.value}}
|
||||||
</a>
|
</a>
|
||||||
@@ -60,37 +60,37 @@
|
|||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="showTopic.indexOf('/SUBJECT') !== -1">
|
<td *ngIf="showTopic.indexOf('/SUBJECT') !== -1">
|
||||||
<p><span class="small">{{'openaire.broker.event.table.subjectValue' | translate}}</span><br><span class="badge badge-info">{{eventElement.event.message.value}}</span></p>
|
<p><span class="small">{{'notifications.broker.event.table.subjectValue' | translate}}</span><br><span class="badge badge-info">{{eventElement.event.message.value}}</span></p>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="showTopic.indexOf('/ABSTRACT') !== -1">
|
<td *ngIf="showTopic.indexOf('/ABSTRACT') !== -1">
|
||||||
<p class="abstract-container" [class.show]="showMore">
|
<p class="abstract-container" [class.show]="showMore">
|
||||||
<span class="small">{{'openaire.broker.event.table.abstract' | translate}}</span><br>
|
<span class="small">{{'notifications.broker.event.table.abstract' | translate}}</span><br>
|
||||||
<span class="text-ellipsis">{{eventElement.event.message.abstract}}</span>
|
<span class="text-ellipsis">{{eventElement.event.message.abstract}}</span>
|
||||||
</p>
|
</p>
|
||||||
<button class="btn btn-outline-primary btn-sm" (click)="showMore = !showMore">
|
<button class="btn btn-outline-primary btn-sm" (click)="showMore = !showMore">
|
||||||
<i *ngIf="!showMore" class="fas fa-angle-down"></i>
|
<i *ngIf="!showMore" class="fas fa-angle-down"></i>
|
||||||
<i *ngIf="showMore" class="fas fa-angle-up"></i>
|
<i *ngIf="showMore" class="fas fa-angle-up"></i>
|
||||||
{{ (showMore ? 'openaire.broker.event.table.less': 'openaire.broker.event.table.more') | translate }}
|
{{ (showMore ? 'notifications.broker.event.table.less': 'notifications.broker.event.table.more') | translate }}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td *ngIf="showTopic.indexOf('/PROJECT') !== -1">
|
<td *ngIf="showTopic.indexOf('/PROJECT') !== -1">
|
||||||
<p>
|
<p>
|
||||||
{{'openaire.broker.event.table.suggestedProject' | translate}}
|
{{'notifications.broker.event.table.suggestedProject' | translate}}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="small">{{'openaire.broker.event.table.project' | translate}}</span><br>
|
<span class="small">{{'notifications.broker.event.table.project' | translate}}</span><br>
|
||||||
<a href="https://explore.openaire.eu/search/project?projectId={{ eventElement.event.message.openaireId}}" target="_blank">{{eventElement.event.message.title}}</a>
|
<a href="https://explore.openaire.eu/search/project?projectId={{ eventElement.event.message.openaireId}}" target="_blank">{{eventElement.event.message.title}}</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span *ngIf="eventElement.event.message.acronym"><span class="small">{{'openaire.broker.event.table.acronym' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.acronym}}</span><br></span>
|
<span *ngIf="eventElement.event.message.acronym"><span class="small">{{'notifications.broker.event.table.acronym' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.acronym}}</span><br></span>
|
||||||
<span *ngIf="eventElement.event.message.code"><span class="small">{{'openaire.broker.event.table.code' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.code}}</span><br></span>
|
<span *ngIf="eventElement.event.message.code"><span class="small">{{'notifications.broker.event.table.code' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.code}}</span><br></span>
|
||||||
<span *ngIf="eventElement.event.message.funder"><span class="small">{{'openaire.broker.event.table.funder' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.funder}}</span><br></span>
|
<span *ngIf="eventElement.event.message.funder"><span class="small">{{'notifications.broker.event.table.funder' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.funder}}</span><br></span>
|
||||||
<span *ngIf="eventElement.event.message.fundingProgram"><span class="small">{{'openaire.broker.event.table.fundingProgram' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.fundingProgram}}</span><br></span>
|
<span *ngIf="eventElement.event.message.fundingProgram"><span class="small">{{'notifications.broker.event.table.fundingProgram' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.fundingProgram}}</span><br></span>
|
||||||
<span *ngIf="eventElement.event.message.jurisdiction"><span class="small">{{'openaire.broker.event.table.jurisdiction' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.jurisdiction}}</span></span>
|
<span *ngIf="eventElement.event.message.jurisdiction"><span class="small">{{'notifications.broker.event.table.jurisdiction' | translate}}</span> <span class="badge badge-info">{{eventElement.event.message.jurisdiction}}</span></span>
|
||||||
</p>
|
</p>
|
||||||
<hr>
|
<hr>
|
||||||
<div>
|
<div>
|
||||||
{{(eventElement.hasProject ? 'openaire.broker.event.project.found' : 'openaire.broker.event.project.notFound') | translate}}
|
{{(eventElement.hasProject ? 'notifications.broker.event.project.found' : 'notifications.broker.event.project.notFound') | translate}}
|
||||||
<a target="_blank" *ngIf="eventElement.hasProject" title="{{eventElement.projectTitle}}" [routerLink]="['/items', eventElement.projectId]">{{eventElement.handle}}</a>
|
<a target="_blank" *ngIf="eventElement.hasProject" title="{{eventElement.projectTitle}}" [routerLink]="['/items', eventElement.projectId]">{{eventElement.handle}}</a>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-outline-primary btn-sm"
|
<button class="btn btn-outline-primary btn-sm"
|
||||||
@@ -114,19 +114,19 @@
|
|||||||
[disabled]="eventElement.isRunning"
|
[disabled]="eventElement.isRunning"
|
||||||
(click)="modalChoice('ACCEPTED', eventElement, acceptModal)">
|
(click)="modalChoice('ACCEPTED', eventElement, acceptModal)">
|
||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.import' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.import' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="showTopic.indexOf('/PROJECT') == -1" class="btn btn-outline-success btn-sm button-width" [disabled]="eventElement.isRunning" (click)="executeAction('ACCEPTED', eventElement)">
|
<button *ngIf="showTopic.indexOf('/PROJECT') == -1" class="btn btn-outline-success btn-sm button-width" [disabled]="eventElement.isRunning" (click)="executeAction('ACCEPTED', eventElement)">
|
||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.accept' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.accept' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-dark btn-sm button-width" [disabled]="eventElement.isRunning" (click)="openModal('DISCARDED', eventElement, ignoreModal)">
|
<button class="btn btn-outline-dark btn-sm button-width" [disabled]="eventElement.isRunning" (click)="openModal('DISCARDED', eventElement, ignoreModal)">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-trash-alt"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.ignore' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.ignore' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-danger btn-sm button-width" [disabled]="eventElement.isRunning" (click)="openModal('REJECTED', eventElement, rejectModal)">
|
<button class="btn btn-outline-danger btn-sm button-width" [disabled]="eventElement.isRunning" (click)="openModal('REJECTED', eventElement, rejectModal)">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-trash-alt"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.reject' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.reject' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -140,9 +140,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/openaire-broker']">
|
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/notifications-broker']">
|
||||||
<i class="fas fa-angle-double-left"></i>
|
<i class="fas fa-angle-double-left"></i>
|
||||||
{{'openaire.broker.events.back' | translate}}
|
{{'notifications.broker.events.back' | translate}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -150,58 +150,58 @@
|
|||||||
|
|
||||||
<ng-template #acceptModal let-modal>
|
<ng-template #acceptModal let-modal>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="acceptModal">{{'openaire.broker.event.sure' | translate}}</h4>
|
<h4 class="modal-title" id="acceptModal">{{'notifications.broker.event.sure' | translate}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>{{'openaire.broker.event.accept.description' | translate}}</p>
|
<p>{{'notifications.broker.event.accept.description' | translate}}</p>
|
||||||
|
|
||||||
<button class="btn btn-outline-success float-left" (click)="modal.close('do')">
|
<button class="btn btn-outline-success float-left" (click)="modal.close('do')">
|
||||||
<i class="fas fa-check"></i>
|
<i class="fas fa-check"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.import' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.import' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
||||||
<i class="fas fa-close"></i>
|
<i class="fas fa-close"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.cancel' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.cancel' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #ignoreModal let-modal>
|
<ng-template #ignoreModal let-modal>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="ignoreModal">{{'openaire.broker.event.sure' | translate}}</h4>
|
<h4 class="modal-title" id="ignoreModal">{{'notifications.broker.event.sure' | translate}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>{{'openaire.broker.event.ignore.description' | translate}}</p>
|
<p>{{'notifications.broker.event.ignore.description' | translate}}</p>
|
||||||
|
|
||||||
<!-- textarea class="form-control mb-2" [(ngModel)]="selectedReason" placeholder="{{'openaire.broker.event.reason' |translate}}"></textarea -->
|
<!-- textarea class="form-control mb-2" [(ngModel)]="selectedReason" placeholder="{{'notifications.broker.event.reason' |translate}}"></textarea -->
|
||||||
|
|
||||||
<button class="btn btn-outline-danger float-left" (click)="modal.close('do')">
|
<button class="btn btn-outline-danger float-left" (click)="modal.close('do')">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-trash-alt"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.ignore' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.ignore' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
||||||
<i class="fas fa-close"></i>
|
<i class="fas fa-close"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.cancel' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.cancel' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #rejectModal let-modal>
|
<ng-template #rejectModal let-modal>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="rejectModal">{{'openaire.broker.event.sure' | translate}}</h4>
|
<h4 class="modal-title" id="rejectModal">{{'notifications.broker.event.sure' | translate}}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>{{'openaire.broker.event.reject.description' | translate}}</p>
|
<p>{{'notifications.broker.event.reject.description' | translate}}</p>
|
||||||
|
|
||||||
<!-- textarea class="form-control mb-2" [(ngModel)]="selectedReason" placeholder="{{'openaire.broker.event.reason' |translate}}"></textarea -->
|
<!-- textarea class="form-control mb-2" [(ngModel)]="selectedReason" placeholder="{{'notifications.broker.event.reason' |translate}}"></textarea -->
|
||||||
|
|
||||||
<button class="btn btn-outline-danger float-left" (click)="modal.close('do')">
|
<button class="btn btn-outline-danger float-left" (click)="modal.close('do')">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-trash-alt"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.reject' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.reject' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
<button class="btn btn-outline-secondary float-right" (click)="modal.close('cancel')">
|
||||||
<i class="fas fa-close"></i>
|
<i class="fas fa-close"></i>
|
||||||
<span class="d-none d-sm-inline">{{'openaire.broker.event.action.cancel' | translate}}</span>
|
<span class="d-none d-sm-inline">{{'notifications.broker.event.action.cancel' | translate}}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
@@ -5,25 +5,25 @@ import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/t
|
|||||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { OpenaireBrokerEventRestService } from '../../../core/openaire/broker/events/openaire-broker-event-rest.service';
|
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||||
import { OpenaireBrokerEventsComponent } from './openaire-broker-events.component';
|
import { NotificationsBrokerEventsComponent } from './notifications-broker-events.component';
|
||||||
import {
|
import {
|
||||||
getMockOpenaireBrokerEventRestService,
|
getMockNotificationsBrokerEventRestService,
|
||||||
ItemMockPid10,
|
ItemMockPid10,
|
||||||
ItemMockPid8,
|
ItemMockPid8,
|
||||||
ItemMockPid9,
|
ItemMockPid9,
|
||||||
openaireBrokerEventObjectMissingProjectFound,
|
notificationsBrokerEventObjectMissingProjectFound,
|
||||||
openaireBrokerEventObjectMissingProjectNotFound,
|
notificationsBrokerEventObjectMissingProjectNotFound,
|
||||||
OpenaireMockDspaceObject
|
NotificationsMockDspaceObject
|
||||||
} from '../../../shared/mocks/openaire.mock';
|
} from '../../../shared/mocks/notifications.mock';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
||||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { OpenaireBrokerEventObject } from '../../../core/openaire/broker/models/openaire-broker-event.model';
|
import { NotificationsBrokerEventObject } from '../../../core/notifications/broker/models/notifications-broker-event.model';
|
||||||
import { OpenaireBrokerEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
import { NotificationsBrokerEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { getTestScheduler } from 'jasmine-marbles';
|
import { getTestScheduler } from 'jasmine-marbles';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
@@ -39,9 +39,9 @@ import { SortDirection, SortOptions } from '../../../core/cache/models/sort-opti
|
|||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
|
|
||||||
describe('OpenaireBrokerEventsComponent test suite', () => {
|
describe('NotificationsBrokerEventsComponent test suite', () => {
|
||||||
let fixture: ComponentFixture<OpenaireBrokerEventsComponent>;
|
let fixture: ComponentFixture<NotificationsBrokerEventsComponent>;
|
||||||
let comp: OpenaireBrokerEventsComponent;
|
let comp: NotificationsBrokerEventsComponent;
|
||||||
let compAsAny: any;
|
let compAsAny: any;
|
||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
close: () => null,
|
close: () => null,
|
||||||
dismiss: () => null
|
dismiss: () => null
|
||||||
};
|
};
|
||||||
const openaireBrokerEventRestServiceStub: any = getMockOpenaireBrokerEventRestService();
|
const notificationsBrokerEventRestServiceStub: any = getMockNotificationsBrokerEventRestService();
|
||||||
const activatedRouteParams = {
|
const activatedRouteParams = {
|
||||||
openaireBrokerEventsParams: {
|
notificationsBrokerEventsParams: {
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
pageSize: 10
|
pageSize: 10
|
||||||
}
|
}
|
||||||
@@ -61,19 +61,19 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
id: 'ENRICH!MISSING!PROJECT'
|
id: 'ENRICH!MISSING!PROJECT'
|
||||||
};
|
};
|
||||||
|
|
||||||
const events: OpenaireBrokerEventObject[] = [
|
const events: NotificationsBrokerEventObject[] = [
|
||||||
openaireBrokerEventObjectMissingProjectFound,
|
notificationsBrokerEventObjectMissingProjectFound,
|
||||||
openaireBrokerEventObjectMissingProjectNotFound
|
notificationsBrokerEventObjectMissingProjectNotFound
|
||||||
];
|
];
|
||||||
const paginationService = new PaginationServiceStub();
|
const paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
function getOpenAireBrokerEventData1(): OpenaireBrokerEventData {
|
function getNotificationsBrokerEventData1(): NotificationsBrokerEventData {
|
||||||
return {
|
return {
|
||||||
event: openaireBrokerEventObjectMissingProjectFound,
|
event: notificationsBrokerEventObjectMissingProjectFound,
|
||||||
id: openaireBrokerEventObjectMissingProjectFound.id,
|
id: notificationsBrokerEventObjectMissingProjectFound.id,
|
||||||
title: openaireBrokerEventObjectMissingProjectFound.title,
|
title: notificationsBrokerEventObjectMissingProjectFound.title,
|
||||||
hasProject: true,
|
hasProject: true,
|
||||||
projectTitle: openaireBrokerEventObjectMissingProjectFound.message.title,
|
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title,
|
||||||
projectId: ItemMockPid10.id,
|
projectId: ItemMockPid10.id,
|
||||||
handle: ItemMockPid10.handle,
|
handle: ItemMockPid10.handle,
|
||||||
reason: null,
|
reason: null,
|
||||||
@@ -82,11 +82,11 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOpenAireBrokerEventData2(): OpenaireBrokerEventData {
|
function getNotificationsBrokerEventData2(): NotificationsBrokerEventData {
|
||||||
return {
|
return {
|
||||||
event: openaireBrokerEventObjectMissingProjectNotFound,
|
event: notificationsBrokerEventObjectMissingProjectNotFound,
|
||||||
id: openaireBrokerEventObjectMissingProjectNotFound.id,
|
id: notificationsBrokerEventObjectMissingProjectNotFound.id,
|
||||||
title: openaireBrokerEventObjectMissingProjectNotFound.title,
|
title: notificationsBrokerEventObjectMissingProjectNotFound.title,
|
||||||
hasProject: false,
|
hasProject: false,
|
||||||
projectTitle: null,
|
projectTitle: null,
|
||||||
projectId: null,
|
projectId: null,
|
||||||
@@ -104,17 +104,17 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OpenaireBrokerEventsComponent,
|
NotificationsBrokerEventsComponent,
|
||||||
TestComponent,
|
TestComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
|
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
|
||||||
{ provide: OpenaireBrokerEventRestService, useValue: openaireBrokerEventRestServiceStub },
|
{ provide: NotificationsBrokerEventRestService, useValue: notificationsBrokerEventRestServiceStub },
|
||||||
{ provide: NgbModal, useValue: modalStub },
|
{ provide: NgbModal, useValue: modalStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: TranslateService, useValue: getMockTranslateService() },
|
{ provide: TranslateService, useValue: getMockTranslateService() },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
OpenaireBrokerEventsComponent
|
NotificationsBrokerEventsComponent
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents().then();
|
}).compileComponents().then();
|
||||||
@@ -129,7 +129,7 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
// synchronous beforeEach
|
// synchronous beforeEach
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const html = `
|
const html = `
|
||||||
<ds-openaire-broker-event></ds-openaire-broker-event>`;
|
<ds-notifications-broker-event></ds-notifications-broker-event>`;
|
||||||
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
||||||
testComp = testFixture.componentInstance;
|
testComp = testFixture.componentInstance;
|
||||||
});
|
});
|
||||||
@@ -138,14 +138,14 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
testFixture.destroy();
|
testFixture.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create OpenaireBrokerEventsComponent', inject([OpenaireBrokerEventsComponent], (app: OpenaireBrokerEventsComponent) => {
|
it('should create NotificationsBrokerEventsComponent', inject([NotificationsBrokerEventsComponent], (app: NotificationsBrokerEventsComponent) => {
|
||||||
expect(app).toBeDefined();
|
expect(app).toBeDefined();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Main tests', () => {
|
describe('Main tests', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(OpenaireBrokerEventsComponent);
|
fixture = TestBed.createComponent(NotificationsBrokerEventsComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
compAsAny = comp;
|
compAsAny = comp;
|
||||||
});
|
});
|
||||||
@@ -159,8 +159,8 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
describe('setEventUpdated', () => {
|
describe('setEventUpdated', () => {
|
||||||
it('should update events', () => {
|
it('should update events', () => {
|
||||||
const expected = [
|
const expected = [
|
||||||
getOpenAireBrokerEventData1(),
|
getNotificationsBrokerEventData1(),
|
||||||
getOpenAireBrokerEventData2()
|
getNotificationsBrokerEventData2()
|
||||||
];
|
];
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
compAsAny.setEventUpdated(events);
|
compAsAny.setEventUpdated(events);
|
||||||
@@ -179,14 +179,14 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
|
|
||||||
it('should call executeAction if a project is present', () => {
|
it('should call executeAction if a project is present', () => {
|
||||||
const action = 'ACCEPTED';
|
const action = 'ACCEPTED';
|
||||||
comp.modalChoice(action, getOpenAireBrokerEventData1(), modalStub);
|
comp.modalChoice(action, getNotificationsBrokerEventData1(), modalStub);
|
||||||
expect(comp.executeAction).toHaveBeenCalledWith(action, getOpenAireBrokerEventData1());
|
expect(comp.executeAction).toHaveBeenCalledWith(action, getNotificationsBrokerEventData1());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call openModal if a project is not present', () => {
|
it('should call openModal if a project is not present', () => {
|
||||||
const action = 'ACCEPTED';
|
const action = 'ACCEPTED';
|
||||||
comp.modalChoice(action, getOpenAireBrokerEventData2(), modalStub);
|
comp.modalChoice(action, getNotificationsBrokerEventData2(), modalStub);
|
||||||
expect(comp.openModal).toHaveBeenCalledWith(action, getOpenAireBrokerEventData2(), modalStub);
|
expect(comp.openModal).toHaveBeenCalledWith(action, getNotificationsBrokerEventData2(), modalStub);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
spyOn(compAsAny.modalService, 'open').and.returnValue({ result: new Promise((res, rej) => 'do' ) });
|
spyOn(compAsAny.modalService, 'open').and.returnValue({ result: new Promise((res, rej) => 'do' ) });
|
||||||
spyOn(comp, 'executeAction');
|
spyOn(comp, 'executeAction');
|
||||||
|
|
||||||
comp.openModal(action, getOpenAireBrokerEventData1(), modalStub);
|
comp.openModal(action, getNotificationsBrokerEventData1(), modalStub);
|
||||||
expect(compAsAny.modalService.open).toHaveBeenCalled();
|
expect(compAsAny.modalService.open).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -211,13 +211,13 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
externalSourceEntry: null,
|
externalSourceEntry: null,
|
||||||
label: null,
|
label: null,
|
||||||
importedObject: observableOf({
|
importedObject: observableOf({
|
||||||
indexableObject: OpenaireMockDspaceObject
|
indexableObject: NotificationsMockDspaceObject
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
comp.openModalLookup(getOpenAireBrokerEventData1());
|
comp.openModalLookup(getNotificationsBrokerEventData1());
|
||||||
});
|
});
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
|
|
||||||
@@ -227,27 +227,27 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('executeAction', () => {
|
describe('executeAction', () => {
|
||||||
it('should call getOpenaireBrokerEvents on 200 response from REST', () => {
|
it('should call getNotificationsBrokerEvents on 200 response from REST', () => {
|
||||||
const action = 'ACCEPTED';
|
const action = 'ACCEPTED';
|
||||||
spyOn(compAsAny, 'getOpenaireBrokerEvents');
|
spyOn(compAsAny, 'getNotificationsBrokerEvents');
|
||||||
openaireBrokerEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
notificationsBrokerEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||||
|
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
comp.executeAction(action, getOpenAireBrokerEventData1());
|
comp.executeAction(action, getNotificationsBrokerEventData1());
|
||||||
});
|
});
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
|
|
||||||
expect(compAsAny.getOpenaireBrokerEvents).toHaveBeenCalled();
|
expect(compAsAny.getNotificationsBrokerEvents).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('boundProject', () => {
|
describe('boundProject', () => {
|
||||||
it('should populate the project data inside "eventData"', () => {
|
it('should populate the project data inside "eventData"', () => {
|
||||||
const eventData = getOpenAireBrokerEventData2();
|
const eventData = getNotificationsBrokerEventData2();
|
||||||
const projectId = 'UUID-23943-34u43-38344';
|
const projectId = 'UUID-23943-34u43-38344';
|
||||||
const projectName = 'Test Project';
|
const projectName = 'Test Project';
|
||||||
const projectHandle = '1000/1000';
|
const projectHandle = '1000/1000';
|
||||||
openaireBrokerEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
notificationsBrokerEventRestServiceStub.boundProject.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||||
|
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
comp.boundProject(eventData, projectId, projectName, projectHandle);
|
comp.boundProject(eventData, projectId, projectName, projectHandle);
|
||||||
@@ -263,8 +263,8 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
|
|
||||||
describe('removeProject', () => {
|
describe('removeProject', () => {
|
||||||
it('should remove the project data inside "eventData"', () => {
|
it('should remove the project data inside "eventData"', () => {
|
||||||
const eventData = getOpenAireBrokerEventData1();
|
const eventData = getNotificationsBrokerEventData1();
|
||||||
openaireBrokerEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$());
|
notificationsBrokerEventRestServiceStub.removeProject.and.returnValue(createNoContentRemoteDataObject$());
|
||||||
|
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
comp.removeProject(eventData);
|
comp.removeProject(eventData);
|
||||||
@@ -278,8 +278,8 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerEvents', () => {
|
describe('getNotificationsBrokerEvents', () => {
|
||||||
it('should call the "openaireBrokerEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => {
|
it('should call the "notificationsBrokerEventRestService.getEventsByTopic" to take data and "setEventUpdated" to populate eventData', () => {
|
||||||
comp.paginationConfig = new PaginationComponentOptions();
|
comp.paginationConfig = new PaginationComponentOptions();
|
||||||
comp.paginationConfig.currentPage = 1;
|
comp.paginationConfig.currentPage = 1;
|
||||||
comp.paginationConfig.pageSize = 20;
|
comp.paginationConfig.pageSize = 20;
|
||||||
@@ -297,20 +297,20 @@ describe('OpenaireBrokerEventsComponent test suite', () => {
|
|||||||
currentPage: comp.paginationConfig.currentPage
|
currentPage: comp.paginationConfig.currentPage
|
||||||
});
|
});
|
||||||
const array = [
|
const array = [
|
||||||
openaireBrokerEventObjectMissingProjectFound,
|
notificationsBrokerEventObjectMissingProjectFound,
|
||||||
openaireBrokerEventObjectMissingProjectNotFound,
|
notificationsBrokerEventObjectMissingProjectNotFound,
|
||||||
];
|
];
|
||||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||||
openaireBrokerEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
|
notificationsBrokerEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
|
||||||
spyOn(compAsAny, 'setEventUpdated');
|
spyOn(compAsAny, 'setEventUpdated');
|
||||||
|
|
||||||
scheduler.schedule(() => {
|
scheduler.schedule(() => {
|
||||||
compAsAny.getOpenaireBrokerEvents();
|
compAsAny.getNotificationsBrokerEvents();
|
||||||
});
|
});
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
|
|
||||||
expect(compAsAny.openaireBrokerEventRestService.getEventsByTopic).toHaveBeenCalledWith(
|
expect(compAsAny.notificationsBrokerEventRestService.getEventsByTopic).toHaveBeenCalledWith(
|
||||||
activatedRouteParamsMap.id,
|
activatedRouteParamsMap.id,
|
||||||
options,
|
options,
|
||||||
followLink('target'),followLink('related')
|
followLink('target'),followLink('related')
|
@@ -11,10 +11,10 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
|||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { FindListOptions } from '../../../core/data/request.models';
|
import { FindListOptions } from '../../../core/data/request.models';
|
||||||
import {
|
import {
|
||||||
OpenaireBrokerEventMessageObject,
|
NotificationsBrokerEventObject,
|
||||||
OpenaireBrokerEventObject
|
OpenaireBrokerEventMessageObject
|
||||||
} from '../../../core/openaire/broker/models/openaire-broker-event.model';
|
} from '../../../core/notifications/broker/models/notifications-broker-event.model';
|
||||||
import { OpenaireBrokerEventRestService } from '../../../core/openaire/broker/events/openaire-broker-event-rest.service';
|
import { NotificationsBrokerEventRestService } from '../../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
@@ -22,7 +22,7 @@ import { hasValue } from '../../../shared/empty.util';
|
|||||||
import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import {
|
import {
|
||||||
OpenaireBrokerEventData,
|
NotificationsBrokerEventData,
|
||||||
ProjectEntryImportModalComponent
|
ProjectEntryImportModalComponent
|
||||||
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||||
@@ -31,14 +31,14 @@ import { combineLatest } from 'rxjs/internal/observable/combineLatest';
|
|||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component to display the OpenAIRE Broker event list.
|
* Component to display the Notifications Broker event list.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-openaire-broker-events',
|
selector: 'ds-notifications-broker-events',
|
||||||
templateUrl: './openaire-broker-events.component.html',
|
templateUrl: './notifications-broker-events.component.html',
|
||||||
styleUrls: ['./openaire-broker-events.scomponent.scss'],
|
styleUrls: ['./notifications-broker-events.scomponent.scss'],
|
||||||
})
|
})
|
||||||
export class OpenaireBrokerEventsComponent implements OnInit {
|
export class NotificationsBrokerEventsComponent implements OnInit {
|
||||||
/**
|
/**
|
||||||
* The pagination system configuration for HTML listing.
|
* The pagination system configuration for HTML listing.
|
||||||
* @type {PaginationComponentOptions}
|
* @type {PaginationComponentOptions}
|
||||||
@@ -50,27 +50,27 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event list sort options.
|
* The Notifications Broker event list sort options.
|
||||||
* @type {SortOptions}
|
* @type {SortOptions}
|
||||||
*/
|
*/
|
||||||
public paginationSortConfig: SortOptions = new SortOptions('trust', SortDirection.DESC);
|
public paginationSortConfig: SortOptions = new SortOptions('trust', SortDirection.DESC);
|
||||||
/**
|
/**
|
||||||
* Array to save the presence of a project inside an OpenAIRE Broker event.
|
* Array to save the presence of a project inside an Notifications Broker event.
|
||||||
* @type {OpenaireBrokerEventData[]>}
|
* @type {NotificationsBrokerEventData[]>}
|
||||||
*/
|
*/
|
||||||
public eventsUpdated$: BehaviorSubject<OpenaireBrokerEventData[]> = new BehaviorSubject([]);
|
public eventsUpdated$: BehaviorSubject<NotificationsBrokerEventData[]> = new BehaviorSubject([]);
|
||||||
/**
|
/**
|
||||||
* The total number of OpenAIRE Broker events.
|
* The total number of Notifications Broker events.
|
||||||
* @type {Observable<number>}
|
* @type {Observable<number>}
|
||||||
*/
|
*/
|
||||||
public totalElements$: Observable<number>;
|
public totalElements$: Observable<number>;
|
||||||
/**
|
/**
|
||||||
* The topic of the OpenAIRE Broker events; suitable for displaying.
|
* The topic of the Notifications Broker events; suitable for displaying.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
public showTopic: string;
|
public showTopic: string;
|
||||||
/**
|
/**
|
||||||
* The topic of the OpenAIRE Broker events; suitable for HTTP calls.
|
* The topic of the Notifications Broker events; suitable for HTTP calls.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
public topic: string;
|
public topic: string;
|
||||||
@@ -114,7 +114,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
* @param {ActivatedRoute} activatedRoute
|
* @param {ActivatedRoute} activatedRoute
|
||||||
* @param {NgbModal} modalService
|
* @param {NgbModal} modalService
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {OpenaireBrokerEventRestService} openaireBrokerEventRestService
|
* @param {NotificationsBrokerEventRestService} notificationsBrokerEventRestService
|
||||||
* @param {PaginationService} paginationService
|
* @param {PaginationService} paginationService
|
||||||
* @param {TranslateService} translateService
|
* @param {TranslateService} translateService
|
||||||
*/
|
*/
|
||||||
@@ -122,7 +122,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private modalService: NgbModal,
|
private modalService: NgbModal,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private openaireBrokerEventRestService: OpenaireBrokerEventRestService,
|
private notificationsBrokerEventRestService: NotificationsBrokerEventRestService,
|
||||||
private paginationService: PaginationService,
|
private paginationService: PaginationService,
|
||||||
private translateService: TranslateService
|
private translateService: TranslateService
|
||||||
) {
|
) {
|
||||||
@@ -142,7 +142,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
this.showTopic = id.replace(regEx, '/');
|
this.showTopic = id.replace(regEx, '/');
|
||||||
this.topic = id;
|
this.topic = id;
|
||||||
this.isEventPageLoading.next(false);
|
this.isEventPageLoading.next(false);
|
||||||
this.getOpenaireBrokerEvents();
|
this.getNotificationsBrokerEvents();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,12 +162,12 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event data
|
* the Notifications Broker event data
|
||||||
* @param {any} content
|
* @param {any} content
|
||||||
* Reference to the modal
|
* Reference to the modal
|
||||||
*/
|
*/
|
||||||
public modalChoice(action: string, eventData: OpenaireBrokerEventData, content: any): void {
|
public modalChoice(action: string, eventData: NotificationsBrokerEventData, content: any): void {
|
||||||
if (eventData.hasProject) {
|
if (eventData.hasProject) {
|
||||||
this.executeAction(action, eventData);
|
this.executeAction(action, eventData);
|
||||||
} else {
|
} else {
|
||||||
@@ -180,12 +180,12 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event data
|
* the Notifications Broker event data
|
||||||
* @param {any} content
|
* @param {any} content
|
||||||
* Reference to the modal
|
* Reference to the modal
|
||||||
*/
|
*/
|
||||||
public openModal(action: string, eventData: OpenaireBrokerEventData, content: any): void {
|
public openModal(action: string, eventData: NotificationsBrokerEventData, content: any): void {
|
||||||
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then(
|
this.modalService.open(content, { ariaLabelledBy: 'modal-basic-title' }).result.then(
|
||||||
(result) => {
|
(result) => {
|
||||||
if (result === 'do') {
|
if (result === 'do') {
|
||||||
@@ -203,10 +203,10 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Open a modal where the user can select the project.
|
* Open a modal where the user can select the project.
|
||||||
*
|
*
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event item data
|
* the Notifications Broker event item data
|
||||||
*/
|
*/
|
||||||
public openModalLookup(eventData: OpenaireBrokerEventData): void {
|
public openModalLookup(eventData: NotificationsBrokerEventData): void {
|
||||||
this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, {
|
this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, {
|
||||||
size: 'lg'
|
size: 'lg'
|
||||||
});
|
});
|
||||||
@@ -232,22 +232,22 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param {string} action
|
* @param {string} action
|
||||||
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
* the action (can be: ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event data
|
* the Notifications Broker event data
|
||||||
*/
|
*/
|
||||||
public executeAction(action: string, eventData: OpenaireBrokerEventData): void {
|
public executeAction(action: string, eventData: NotificationsBrokerEventData): void {
|
||||||
eventData.isRunning = true;
|
eventData.isRunning = true;
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.openaireBrokerEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData())
|
this.notificationsBrokerEventRestService.patchEvent(action, eventData.event, eventData.reason).pipe(getFirstCompletedRemoteData())
|
||||||
.subscribe((rd: RemoteData<OpenaireBrokerEventObject>) => {
|
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||||
if (rd.isSuccess && rd.statusCode === 200) {
|
if (rd.isSuccess && rd.statusCode === 200) {
|
||||||
this.notificationsService.success(
|
this.notificationsService.success(
|
||||||
this.translateService.instant('openaire.broker.event.action.saved')
|
this.translateService.instant('notifications.broker.event.action.saved')
|
||||||
);
|
);
|
||||||
this.getOpenaireBrokerEvents();
|
this.getNotificationsBrokerEvents();
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(
|
this.notificationsService.error(
|
||||||
this.translateService.instant('openaire.broker.event.action.error')
|
this.translateService.instant('notifications.broker.event.action.error')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
eventData.isRunning = false;
|
eventData.isRunning = false;
|
||||||
@@ -256,10 +256,10 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bound a project to the publication described in the OpenAIRE Broker event calling the REST service.
|
* Bound a project to the publication described in the Notifications Broker event calling the REST service.
|
||||||
*
|
*
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event item data
|
* the Notifications Broker event item data
|
||||||
* @param {string} projectId
|
* @param {string} projectId
|
||||||
* the project Id to bound
|
* the project Id to bound
|
||||||
* @param {string} projectTitle
|
* @param {string} projectTitle
|
||||||
@@ -267,14 +267,14 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
* @param {string} projectHandle
|
* @param {string} projectHandle
|
||||||
* the project handle
|
* the project handle
|
||||||
*/
|
*/
|
||||||
public boundProject(eventData: OpenaireBrokerEventData, projectId: string, projectTitle: string, projectHandle: string): void {
|
public boundProject(eventData: NotificationsBrokerEventData, projectId: string, projectTitle: string, projectHandle: string): void {
|
||||||
eventData.isRunning = true;
|
eventData.isRunning = true;
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.openaireBrokerEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData())
|
this.notificationsBrokerEventRestService.boundProject(eventData.id, projectId).pipe(getFirstCompletedRemoteData())
|
||||||
.subscribe((rd: RemoteData<OpenaireBrokerEventObject>) => {
|
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||||
if (rd.isSuccess) {
|
if (rd.isSuccess) {
|
||||||
this.notificationsService.success(
|
this.notificationsService.success(
|
||||||
this.translateService.instant('openaire.broker.event.project.bounded')
|
this.translateService.instant('notifications.broker.event.project.bounded')
|
||||||
);
|
);
|
||||||
eventData.hasProject = true;
|
eventData.hasProject = true;
|
||||||
eventData.projectTitle = projectTitle;
|
eventData.projectTitle = projectTitle;
|
||||||
@@ -282,7 +282,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
eventData.projectId = projectId;
|
eventData.projectId = projectId;
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(
|
this.notificationsService.error(
|
||||||
this.translateService.instant('openaire.broker.event.project.error')
|
this.translateService.instant('notifications.broker.event.project.error')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
eventData.isRunning = false;
|
eventData.isRunning = false;
|
||||||
@@ -291,19 +291,19 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the bounded project from the publication described in the OpenAIRE Broker event calling the REST service.
|
* Remove the bounded project from the publication described in the Notifications Broker event calling the REST service.
|
||||||
*
|
*
|
||||||
* @param {OpenaireBrokerEventData} eventData
|
* @param {NotificationsBrokerEventData} eventData
|
||||||
* the OpenAIRE Broker event data
|
* the Notifications Broker event data
|
||||||
*/
|
*/
|
||||||
public removeProject(eventData: OpenaireBrokerEventData): void {
|
public removeProject(eventData: NotificationsBrokerEventData): void {
|
||||||
eventData.isRunning = true;
|
eventData.isRunning = true;
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.openaireBrokerEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData())
|
this.notificationsBrokerEventRestService.removeProject(eventData.id).pipe(getFirstCompletedRemoteData())
|
||||||
.subscribe((rd: RemoteData<OpenaireBrokerEventObject>) => {
|
.subscribe((rd: RemoteData<NotificationsBrokerEventObject>) => {
|
||||||
if (rd.isSuccess) {
|
if (rd.isSuccess) {
|
||||||
this.notificationsService.success(
|
this.notificationsService.success(
|
||||||
this.translateService.instant('openaire.broker.event.project.removed')
|
this.translateService.instant('notifications.broker.event.project.removed')
|
||||||
);
|
);
|
||||||
eventData.hasProject = false;
|
eventData.hasProject = false;
|
||||||
eventData.projectTitle = null;
|
eventData.projectTitle = null;
|
||||||
@@ -311,7 +311,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
eventData.projectId = null;
|
eventData.projectId = null;
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(
|
this.notificationsService.error(
|
||||||
this.translateService.instant('openaire.broker.event.project.error')
|
this.translateService.instant('notifications.broker.event.project.error')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
eventData.isRunning = false;
|
eventData.isRunning = false;
|
||||||
@@ -337,26 +337,26 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch the OpenAIRE Broker events retrival.
|
* Dispatch the Notifications Broker events retrival.
|
||||||
*/
|
*/
|
||||||
public getOpenaireBrokerEvents(): void {
|
public getNotificationsBrokerEvents(): void {
|
||||||
this.paginationService.getFindListOptions(this.paginationConfig.id, this.defaultConfig).pipe(
|
this.paginationService.getFindListOptions(this.paginationConfig.id, this.defaultConfig).pipe(
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
switchMap((options: FindListOptions) => this.openaireBrokerEventRestService.getEventsByTopic(
|
switchMap((options: FindListOptions) => this.notificationsBrokerEventRestService.getEventsByTopic(
|
||||||
this.topic,
|
this.topic,
|
||||||
options,
|
options,
|
||||||
followLink('target'), followLink('related')
|
followLink('target'), followLink('related')
|
||||||
)),
|
)),
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
).subscribe((rd: RemoteData<PaginatedList<OpenaireBrokerEventObject>>) => {
|
).subscribe((rd: RemoteData<PaginatedList<NotificationsBrokerEventObject>>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.isEventLoading.next(false);
|
this.isEventLoading.next(false);
|
||||||
this.totalElements$ = observableOf(rd.payload.totalElements);
|
this.totalElements$ = observableOf(rd.payload.totalElements);
|
||||||
this.setEventUpdated(rd.payload.page);
|
this.setEventUpdated(rd.payload.page);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Can\'t retrieve OpenAIRE Broker events from the Broker events REST service');
|
throw new Error('Can\'t retrieve Notifications Broker events from the Broker events REST service');
|
||||||
}
|
}
|
||||||
this.openaireBrokerEventRestService.clearFindByTopicRequests();
|
this.notificationsBrokerEventRestService.clearFindByTopicRequests();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,15 +370,15 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the project status for the OpenAIRE Broker events.
|
* Set the project status for the Notifications Broker events.
|
||||||
*
|
*
|
||||||
* @param {OpenaireBrokerEventObject[]} events
|
* @param {NotificationsBrokerEventObject[]} events
|
||||||
* the OpenAIRE Broker event item
|
* the Notifications Broker event item
|
||||||
*/
|
*/
|
||||||
protected setEventUpdated(events: OpenaireBrokerEventObject[]): void {
|
protected setEventUpdated(events: NotificationsBrokerEventObject[]): void {
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
from(events).pipe(
|
from(events).pipe(
|
||||||
mergeMap((event: OpenaireBrokerEventObject) => {
|
mergeMap((event: NotificationsBrokerEventObject) => {
|
||||||
const related$ = event.related.pipe(
|
const related$ = event.related.pipe(
|
||||||
getFirstCompletedRemoteData(),
|
getFirstCompletedRemoteData(),
|
||||||
);
|
);
|
||||||
@@ -387,7 +387,7 @@ export class OpenaireBrokerEventsComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
return combineLatest([related$, target$]).pipe(
|
return combineLatest([related$, target$]).pipe(
|
||||||
map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => {
|
map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => {
|
||||||
const data: OpenaireBrokerEventData = {
|
const data: NotificationsBrokerEventData = {
|
||||||
event: event,
|
event: event,
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: event.title,
|
title: event.title,
|
@@ -17,16 +17,16 @@ import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
|||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import {
|
import {
|
||||||
ItemMockPid10,
|
ItemMockPid10,
|
||||||
openaireBrokerEventObjectMissingProjectFound,
|
notificationsBrokerEventObjectMissingProjectFound,
|
||||||
OpenaireMockDspaceObject
|
NotificationsMockDspaceObject
|
||||||
} from '../../../shared/mocks/openaire.mock';
|
} from '../../../shared/mocks/notifications.mock';
|
||||||
|
|
||||||
const eventData = {
|
const eventData = {
|
||||||
event: openaireBrokerEventObjectMissingProjectFound,
|
event: notificationsBrokerEventObjectMissingProjectFound,
|
||||||
id: openaireBrokerEventObjectMissingProjectFound.id,
|
id: notificationsBrokerEventObjectMissingProjectFound.id,
|
||||||
title: openaireBrokerEventObjectMissingProjectFound.title,
|
title: notificationsBrokerEventObjectMissingProjectFound.title,
|
||||||
hasProject: true,
|
hasProject: true,
|
||||||
projectTitle: openaireBrokerEventObjectMissingProjectFound.message.title,
|
projectTitle: notificationsBrokerEventObjectMissingProjectFound.message.title,
|
||||||
projectId: ItemMockPid10.id,
|
projectId: ItemMockPid10.id,
|
||||||
handle: ItemMockPid10.handle,
|
handle: ItemMockPid10.handle,
|
||||||
reason: null,
|
reason: null,
|
||||||
@@ -36,7 +36,7 @@ const eventData = {
|
|||||||
const searchString = 'Test project to search';
|
const searchString = 'Test project to search';
|
||||||
const pagination = Object.assign(
|
const pagination = Object.assign(
|
||||||
new PaginationComponentOptions(), {
|
new PaginationComponentOptions(), {
|
||||||
id: 'openaire-project-bound',
|
id: 'notifications-project-bound',
|
||||||
pageSize: 3
|
pageSize: 3
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -54,7 +54,7 @@ const pageInfo = new PageInfo({
|
|||||||
currentPage: 1
|
currentPage: 1
|
||||||
});
|
});
|
||||||
const array = [
|
const array = [
|
||||||
OpenaireMockDspaceObject,
|
NotificationsMockDspaceObject,
|
||||||
];
|
];
|
||||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||||
@@ -143,7 +143,7 @@ describe('ProjectEntryImportModalComponent test suite', () => {
|
|||||||
spyOn(comp, 'deselectAllLists');
|
spyOn(comp, 'deselectAllLists');
|
||||||
spyOn(comp, 'close');
|
spyOn(comp, 'close');
|
||||||
spyOn(comp.importedObject, 'emit');
|
spyOn(comp.importedObject, 'emit');
|
||||||
comp.selectedEntity = OpenaireMockDspaceObject;
|
comp.selectedEntity = NotificationsMockDspaceObject;
|
||||||
comp.bound();
|
comp.bound();
|
||||||
|
|
||||||
expect(comp.importedObject.emit).toHaveBeenCalled();
|
expect(comp.importedObject.emit).toHaveBeenCalled();
|
@@ -12,7 +12,11 @@ import { ListableObject } from '../../../shared/object-collection/shared/listabl
|
|||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { SearchService } from '../../../core/shared/search/search.service';
|
import { SearchService } from '../../../core/shared/search/search.service';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { OpenaireBrokerEventObject } from '../../../core/openaire/broker/models/openaire-broker-event.model';
|
import {
|
||||||
|
NotificationsBrokerEventObject,
|
||||||
|
NotificationsBrokerEventMessageObject,
|
||||||
|
OpenaireBrokerEventMessageObject,
|
||||||
|
} from '../../../core/notifications/broker/models/notifications-broker-event.model';
|
||||||
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
|
|
||||||
@@ -30,13 +34,13 @@ export enum ImportType {
|
|||||||
/**
|
/**
|
||||||
* The data type passed from the parent page
|
* The data type passed from the parent page
|
||||||
*/
|
*/
|
||||||
export interface OpenaireBrokerEventData {
|
export interface NotificationsBrokerEventData {
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event
|
* The Notifications Broker event
|
||||||
*/
|
*/
|
||||||
event: OpenaireBrokerEventObject;
|
event: NotificationsBrokerEventObject;
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker event Id (uuid)
|
* The Notifications Broker event Id (uuid)
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
/**
|
/**
|
||||||
@@ -79,14 +83,14 @@ export interface OpenaireBrokerEventData {
|
|||||||
templateUrl: './project-entry-import-modal.component.html'
|
templateUrl: './project-entry-import-modal.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Component to display a modal window for linking a project to an OpenAIRE Broker event
|
* Component to display a modal window for linking a project to an Notifications Broker event
|
||||||
* Shows information about the selected project and a selectable list.
|
* Shows information about the selected project and a selectable list.
|
||||||
*/
|
*/
|
||||||
export class ProjectEntryImportModalComponent implements OnInit {
|
export class ProjectEntryImportModalComponent implements OnInit {
|
||||||
/**
|
/**
|
||||||
* The external source entry
|
* The external source entry
|
||||||
*/
|
*/
|
||||||
@Input() externalSourceEntry: OpenaireBrokerEventData;
|
@Input() externalSourceEntry: NotificationsBrokerEventData;
|
||||||
/**
|
/**
|
||||||
* The number of results per page
|
* The number of results per page
|
||||||
*/
|
*/
|
||||||
@@ -94,7 +98,7 @@ export class ProjectEntryImportModalComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* The prefix for every i18n key within this modal
|
* The prefix for every i18n key within this modal
|
||||||
*/
|
*/
|
||||||
labelPrefix = 'openaire.broker.event.modal.';
|
labelPrefix = 'notifications.broker.event.modal.';
|
||||||
/**
|
/**
|
||||||
* The search configuration to retrieve project
|
* The search configuration to retrieve project
|
||||||
*/
|
*/
|
||||||
@@ -126,11 +130,11 @@ export class ProjectEntryImportModalComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* List ID for selecting local entities
|
* List ID for selecting local entities
|
||||||
*/
|
*/
|
||||||
entityListId = 'openaire-project-bound';
|
entityListId = 'notifications-project-bound';
|
||||||
/**
|
/**
|
||||||
* List ID for selecting local authorities
|
* List ID for selecting local authorities
|
||||||
*/
|
*/
|
||||||
authorityListId = 'openaire-project-bound-authority';
|
authorityListId = 'notifications-project-bound-authority';
|
||||||
/**
|
/**
|
||||||
* ImportType enum
|
* ImportType enum
|
||||||
*/
|
*/
|
||||||
@@ -175,8 +179,9 @@ export class ProjectEntryImportModalComponent implements OnInit {
|
|||||||
* Component intitialization.
|
* Component intitialization.
|
||||||
*/
|
*/
|
||||||
public ngOnInit(): void {
|
public ngOnInit(): void {
|
||||||
this.pagination = Object.assign(new PaginationComponentOptions(), { id: 'openaire-project-bound', pageSize: this.pageSize });
|
this.pagination = Object.assign(new PaginationComponentOptions(), { id: 'notifications-project-bound', pageSize: this.pageSize });
|
||||||
this.projectTitle = (this.externalSourceEntry.projectTitle !== null) ? this.externalSourceEntry.projectTitle : this.externalSourceEntry.event.message.title;
|
this.projectTitle = (this.externalSourceEntry.projectTitle !== null) ? this.externalSourceEntry.projectTitle
|
||||||
|
: (this.externalSourceEntry.event.message as OpenaireBrokerEventMessageObject).title;
|
||||||
this.searchOptions = Object.assign(new PaginatedSearchOptions(
|
this.searchOptions = Object.assign(new PaginatedSearchOptions(
|
||||||
{
|
{
|
||||||
configuration: this.configuration,
|
configuration: this.configuration,
|
@@ -1,6 +1,6 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
import { type } from '../../../shared/ngrx/type';
|
import { type } from '../../../shared/ngrx/type';
|
||||||
import { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For each action type in an action group, make a simple
|
* For each action type in an action group, make a simple
|
||||||
@@ -10,19 +10,19 @@ import { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/
|
|||||||
* literal types and runs a simple check to guarantee all
|
* literal types and runs a simple check to guarantee all
|
||||||
* action types in the application are unique.
|
* action types in the application are unique.
|
||||||
*/
|
*/
|
||||||
export const OpenaireBrokerTopicActionTypes = {
|
export const NotificationsBrokerTopicActionTypes = {
|
||||||
ADD_TOPICS: type('dspace/integration/openaire/broker/topic/ADD_TOPICS'),
|
ADD_TOPICS: type('dspace/integration/notifications/broker/topic/ADD_TOPICS'),
|
||||||
RETRIEVE_ALL_TOPICS: type('dspace/integration/openaire/broker/topic/RETRIEVE_ALL_TOPICS'),
|
RETRIEVE_ALL_TOPICS: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS'),
|
||||||
RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/openaire/broker/topic/RETRIEVE_ALL_TOPICS_ERROR'),
|
RETRIEVE_ALL_TOPICS_ERROR: type('dspace/integration/notifications/broker/topic/RETRIEVE_ALL_TOPICS_ERROR'),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tslint:disable:max-classes-per-file */
|
/* tslint:disable:max-classes-per-file */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ngrx action to retrieve all the OpenAIRE Broker topics.
|
* An ngrx action to retrieve all the Notifications Broker topics.
|
||||||
*/
|
*/
|
||||||
export class RetrieveAllTopicsAction implements Action {
|
export class RetrieveAllTopicsAction implements Action {
|
||||||
type = OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS;
|
type = NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS;
|
||||||
payload: {
|
payload: {
|
||||||
elementsPerPage: number;
|
elementsPerPage: number;
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
@@ -45,20 +45,20 @@ export class RetrieveAllTopicsAction implements Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ngrx action for retrieving 'all OpenAIRE Broker topics' error.
|
* An ngrx action for retrieving 'all Notifications Broker topics' error.
|
||||||
*/
|
*/
|
||||||
export class RetrieveAllTopicsErrorAction implements Action {
|
export class RetrieveAllTopicsErrorAction implements Action {
|
||||||
type = OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR;
|
type = NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ngrx action to load the OpenAIRE Broker topic objects.
|
* An ngrx action to load the Notifications Broker topic objects.
|
||||||
* Called by the ??? effect.
|
* Called by the ??? effect.
|
||||||
*/
|
*/
|
||||||
export class AddTopicsAction implements Action {
|
export class AddTopicsAction implements Action {
|
||||||
type = OpenaireBrokerTopicActionTypes.ADD_TOPICS;
|
type = NotificationsBrokerTopicActionTypes.ADD_TOPICS;
|
||||||
payload: {
|
payload: {
|
||||||
topics: OpenaireBrokerTopicObject[];
|
topics: NotificationsBrokerTopicObject[];
|
||||||
totalPages: number;
|
totalPages: number;
|
||||||
currentPage: number;
|
currentPage: number;
|
||||||
totalElements: number;
|
totalElements: number;
|
||||||
@@ -74,9 +74,9 @@ export class AddTopicsAction implements Action {
|
|||||||
* @param currentPage
|
* @param currentPage
|
||||||
* the current page
|
* the current page
|
||||||
* @param totalElements
|
* @param totalElements
|
||||||
* the total available OpenAIRE Broker topics
|
* the total available Notifications Broker topics
|
||||||
*/
|
*/
|
||||||
constructor(topics: OpenaireBrokerTopicObject[], totalPages: number, currentPage: number, totalElements: number) {
|
constructor(topics: NotificationsBrokerTopicObject[], totalPages: number, currentPage: number, totalElements: number) {
|
||||||
this.payload = {
|
this.payload = {
|
||||||
topics,
|
topics,
|
||||||
totalPages,
|
totalPages,
|
||||||
@@ -93,7 +93,7 @@ export class AddTopicsAction implements Action {
|
|||||||
* Export a type alias of all actions in this action group
|
* Export a type alias of all actions in this action group
|
||||||
* so that reducers can easily compose action types.
|
* so that reducers can easily compose action types.
|
||||||
*/
|
*/
|
||||||
export type OpenaireBrokerTopicsActions
|
export type NotificationsBrokerTopicsActions
|
||||||
= AddTopicsAction
|
= AddTopicsAction
|
||||||
|RetrieveAllTopicsAction
|
|RetrieveAllTopicsAction
|
||||||
|RetrieveAllTopicsErrorAction;
|
|RetrieveAllTopicsErrorAction;
|
@@ -1,34 +1,34 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h2 class="border-bottom pb-2">{{'openaire.broker.title'| translate}}</h2>
|
<h2 class="border-bottom pb-2">{{'notifications.broker.title'| translate}}</h2>
|
||||||
<p>{{'openaire.broker.topics.description'| translate}}</p>
|
<p>{{'notifications.broker.topics.description'| translate}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<h3 class="border-bottom pb-2">{{'openaire.broker.topics'| translate}}</h3>
|
<h3 class="border-bottom pb-2">{{'notifications.broker.topics'| translate}}</h3>
|
||||||
|
|
||||||
<ds-loading class="container" *ngIf="(isTopicsLoading() | async)" message="{{'openaire.broker.loading' | translate}}"></ds-loading>
|
<ds-loading class="container" *ngIf="(isTopicsLoading() | async)" message="{{'notifications.broker.loading' | translate}}"></ds-loading>
|
||||||
<ds-pagination *ngIf="!(isTopicsLoading() | async)"
|
<ds-pagination *ngIf="!(isTopicsLoading() | async)"
|
||||||
[paginationOptions]="paginationConfig"
|
[paginationOptions]="paginationConfig"
|
||||||
[collectionSize]="(totalElements$ | async)"
|
[collectionSize]="(totalElements$ | async)"
|
||||||
[hideGear]="false"
|
[hideGear]="false"
|
||||||
[hideSortOptions]="true"
|
[hideSortOptions]="true"
|
||||||
(paginationChange)="getOpenaireBrokerTopics()">
|
(paginationChange)="getNotificationsBrokerTopics()">
|
||||||
|
|
||||||
<ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'openaire.broker.loading' | translate"></ds-loading>
|
<ds-loading class="container" *ngIf="(isTopicsProcessing() | async)" message="'notifications.broker.loading' | translate"></ds-loading>
|
||||||
<ng-container *ngIf="!(isTopicsProcessing() | async)">
|
<ng-container *ngIf="!(isTopicsProcessing() | async)">
|
||||||
<div *ngIf="(topics$|async)?.length == 0" class="alert alert-info w-100 mb-2 mt-2" role="alert">
|
<div *ngIf="(topics$|async)?.length == 0" class="alert alert-info w-100 mb-2 mt-2" role="alert">
|
||||||
{{'openaire.broker.noTopics' | translate}}
|
{{'notifications.broker.noTopics' | translate}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="(topics$|async)?.length != 0" class="table-responsive mt-2">
|
<div *ngIf="(topics$|async)?.length != 0" class="table-responsive mt-2">
|
||||||
<table id="epeople" class="table table-striped table-hover table-bordered">
|
<table id="epeople" class="table table-striped table-hover table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{{'openaire.broker.table.topic' | translate}}</th>
|
<th scope="col">{{'notifications.broker.table.topic' | translate}}</th>
|
||||||
<th scope="col">{{'openaire.broker.table.last-event' | translate}}</th>
|
<th scope="col">{{'notifications.broker.table.last-event' | translate}}</th>
|
||||||
<th scope="col">{{'openaire.broker.table.actions' | translate}}</th>
|
<th scope="col">{{'notifications.broker.table.actions' | translate}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<div class="btn-group edit-field">
|
<div class="btn-group edit-field">
|
||||||
<button
|
<button
|
||||||
class="btn btn-outline-primary btn-sm"
|
class="btn btn-outline-primary btn-sm"
|
||||||
title="{{'openaire.broker.button.detail' | translate }}"
|
title="{{'notifications.broker.button.detail' | translate }}"
|
||||||
[routerLink]="[topicElement.id]">
|
[routerLink]="[topicElement.id]">
|
||||||
<span class="badge badge-info">{{topicElement.totalEvents}}</span>
|
<span class="badge badge-info">{{topicElement.totalEvents}}</span>
|
||||||
<i class="fas fa-info fa-fw"></i>
|
<i class="fas fa-info fa-fw"></i>
|
@@ -6,23 +6,23 @@ import { of as observableOf } from 'rxjs';
|
|||||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||||
import {
|
import {
|
||||||
getMockOpenaireStateService,
|
getMockNotificationsStateService,
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMorePid
|
notificationsBrokerTopicObjectMorePid
|
||||||
} from '../../../shared/mocks/openaire.mock';
|
} from '../../../shared/mocks/notifications.mock';
|
||||||
import { OpenaireBrokerTopicsComponent } from './openaire-broker-topics.component';
|
import { NotificationsBrokerTopicsComponent } from './notifications-broker-topics.component';
|
||||||
import { OpenaireStateService } from '../../openaire-state.service';
|
import { NotificationsStateService } from '../../notifications-state.service';
|
||||||
import { cold } from 'jasmine-marbles';
|
import { cold } from 'jasmine-marbles';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
|
||||||
describe('OpenaireBrokerTopicsComponent test suite', () => {
|
describe('NotificationsBrokerTopicsComponent test suite', () => {
|
||||||
let fixture: ComponentFixture<OpenaireBrokerTopicsComponent>;
|
let fixture: ComponentFixture<NotificationsBrokerTopicsComponent>;
|
||||||
let comp: OpenaireBrokerTopicsComponent;
|
let comp: NotificationsBrokerTopicsComponent;
|
||||||
let compAsAny: any;
|
let compAsAny: any;
|
||||||
const mockOpenaireStateService = getMockOpenaireStateService();
|
const mockNotificationsStateService = getMockNotificationsStateService();
|
||||||
const activatedRouteParams = {
|
const activatedRouteParams = {
|
||||||
openaireBrokerTopicsParams: {
|
notificationsBrokerTopicsParams: {
|
||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
pageSize: 5
|
pageSize: 5
|
||||||
}
|
}
|
||||||
@@ -36,27 +36,27 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OpenaireBrokerTopicsComponent,
|
NotificationsBrokerTopicsComponent,
|
||||||
TestComponent,
|
TestComponent,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: OpenaireStateService, useValue: mockOpenaireStateService },
|
{ provide: NotificationsStateService, useValue: mockNotificationsStateService },
|
||||||
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
|
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
|
||||||
{ provide: PaginationService, useValue: paginationService },
|
{ provide: PaginationService, useValue: paginationService },
|
||||||
OpenaireBrokerTopicsComponent
|
NotificationsBrokerTopicsComponent
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents().then(() => {
|
}).compileComponents().then(() => {
|
||||||
mockOpenaireStateService.getOpenaireBrokerTopics.and.returnValue(observableOf([
|
mockNotificationsStateService.getNotificationsBrokerTopics.and.returnValue(observableOf([
|
||||||
openaireBrokerTopicObjectMorePid,
|
notificationsBrokerTopicObjectMorePid,
|
||||||
openaireBrokerTopicObjectMoreAbstract
|
notificationsBrokerTopicObjectMoreAbstract
|
||||||
]));
|
]));
|
||||||
mockOpenaireStateService.getOpenaireBrokerTopicsTotalPages.and.returnValue(observableOf(1));
|
mockNotificationsStateService.getNotificationsBrokerTopicsTotalPages.and.returnValue(observableOf(1));
|
||||||
mockOpenaireStateService.getOpenaireBrokerTopicsCurrentPage.and.returnValue(observableOf(0));
|
mockNotificationsStateService.getNotificationsBrokerTopicsCurrentPage.and.returnValue(observableOf(0));
|
||||||
mockOpenaireStateService.getOpenaireBrokerTopicsTotals.and.returnValue(observableOf(2));
|
mockNotificationsStateService.getNotificationsBrokerTopicsTotals.and.returnValue(observableOf(2));
|
||||||
mockOpenaireStateService.isOpenaireBrokerTopicsLoaded.and.returnValue(observableOf(true));
|
mockNotificationsStateService.isNotificationsBrokerTopicsLoaded.and.returnValue(observableOf(true));
|
||||||
mockOpenaireStateService.isOpenaireBrokerTopicsLoading.and.returnValue(observableOf(false));
|
mockNotificationsStateService.isNotificationsBrokerTopicsLoading.and.returnValue(observableOf(false));
|
||||||
mockOpenaireStateService.isOpenaireBrokerTopicsProcessing.and.returnValue(observableOf(false));
|
mockNotificationsStateService.isNotificationsBrokerTopicsProcessing.and.returnValue(observableOf(false));
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
// synchronous beforeEach
|
// synchronous beforeEach
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const html = `
|
const html = `
|
||||||
<ds-openaire-broker-topic></ds-openaire-broker-topic>`;
|
<ds-notifications-broker-topic></ds-notifications-broker-topic>`;
|
||||||
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
||||||
testComp = testFixture.componentInstance;
|
testComp = testFixture.componentInstance;
|
||||||
});
|
});
|
||||||
@@ -77,14 +77,14 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
testFixture.destroy();
|
testFixture.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create OpenaireBrokerTopicsComponent', inject([OpenaireBrokerTopicsComponent], (app: OpenaireBrokerTopicsComponent) => {
|
it('should create NotificationsBrokerTopicsComponent', inject([NotificationsBrokerTopicsComponent], (app: NotificationsBrokerTopicsComponent) => {
|
||||||
expect(app).toBeDefined();
|
expect(app).toBeDefined();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Main tests running with two topics', () => {
|
describe('Main tests running with two topics', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(OpenaireBrokerTopicsComponent);
|
fixture = TestBed.createComponent(NotificationsBrokerTopicsComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
compAsAny = comp;
|
compAsAny = comp;
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
|
|
||||||
expect(comp.topics$).toBeObservable(cold('(a|)', {
|
expect(comp.topics$).toBeObservable(cold('(a|)', {
|
||||||
a: [
|
a: [
|
||||||
openaireBrokerTopicObjectMorePid,
|
notificationsBrokerTopicObjectMorePid,
|
||||||
openaireBrokerTopicObjectMoreAbstract
|
notificationsBrokerTopicObjectMoreAbstract
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
||||||
@@ -112,12 +112,12 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it(('Should set data properly after the view init'), () => {
|
it(('Should set data properly after the view init'), () => {
|
||||||
spyOn(compAsAny, 'getOpenaireBrokerTopics');
|
spyOn(compAsAny, 'getNotificationsBrokerTopics');
|
||||||
|
|
||||||
comp.ngAfterViewInit();
|
comp.ngAfterViewInit();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(compAsAny.getOpenaireBrokerTopics).toHaveBeenCalled();
|
expect(compAsAny.getNotificationsBrokerTopics).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(('isTopicsLoading should return FALSE'), () => {
|
it(('isTopicsLoading should return FALSE'), () => {
|
||||||
@@ -132,12 +132,12 @@ describe('OpenaireBrokerTopicsComponent test suite', () => {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
it(('getOpenaireBrokerTopics should call the service to dispatch a STATE change'), () => {
|
it(('getNotificationsBrokerTopics should call the service to dispatch a STATE change'), () => {
|
||||||
comp.ngOnInit();
|
comp.ngOnInit();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
compAsAny.openaireStateService.dispatchRetrieveOpenaireBrokerTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage).and.callThrough();
|
||||||
expect(compAsAny.openaireStateService.dispatchRetrieveOpenaireBrokerTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
expect(compAsAny.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics).toHaveBeenCalledWith(comp.paginationConfig.pageSize, comp.paginationConfig.currentPage);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -4,22 +4,22 @@ import { Observable, Subscription } from 'rxjs';
|
|||||||
import { distinctUntilChanged, take } from 'rxjs/operators';
|
import { distinctUntilChanged, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { SortOptions } from '../../../core/cache/models/sort-options.model';
|
import { SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||||
import { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { OpenaireStateService } from '../../openaire-state.service';
|
import { NotificationsStateService } from '../../notifications-state.service';
|
||||||
import { AdminNotificationsOpenaireTopicsPageParams } from '../../../admin/admin-notifications/admin-notifications-openaire-topics-page/admin-notifications-openaire-topics-page-resolver.service';
|
import { AdminNotificationsBrokerTopicsPageParams } from '../../../admin/admin-notifications/admin-notifications-broker-topics-page/admin-notifications-broker-topics-page-resolver.service';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component to display the OpenAIRE Broker topic list.
|
* Component to display the Notifications Broker topic list.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-openaire-broker-topic',
|
selector: 'ds-notifications-broker-topic',
|
||||||
templateUrl: './openaire-broker-topics.component.html',
|
templateUrl: './notifications-broker-topics.component.html',
|
||||||
styleUrls: ['./openaire-broker-topics.component.scss'],
|
styleUrls: ['./notifications-broker-topics.component.scss'],
|
||||||
})
|
})
|
||||||
export class OpenaireBrokerTopicsComponent implements OnInit {
|
export class NotificationsBrokerTopicsComponent implements OnInit {
|
||||||
/**
|
/**
|
||||||
* The pagination system configuration for HTML listing.
|
* The pagination system configuration for HTML listing.
|
||||||
* @type {PaginationComponentOptions}
|
* @type {PaginationComponentOptions}
|
||||||
@@ -30,16 +30,16 @@ export class OpenaireBrokerTopicsComponent implements OnInit {
|
|||||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker topic list sort options.
|
* The Notifications Broker topic list sort options.
|
||||||
* @type {SortOptions}
|
* @type {SortOptions}
|
||||||
*/
|
*/
|
||||||
public paginationSortConfig: SortOptions;
|
public paginationSortConfig: SortOptions;
|
||||||
/**
|
/**
|
||||||
* The OpenAIRE Broker topic list.
|
* The Notifications Broker topic list.
|
||||||
*/
|
*/
|
||||||
public topics$: Observable<OpenaireBrokerTopicObject[]>;
|
public topics$: Observable<NotificationsBrokerTopicObject[]>;
|
||||||
/**
|
/**
|
||||||
* The total number of OpenAIRE Broker topics.
|
* The total number of Notifications Broker topics.
|
||||||
*/
|
*/
|
||||||
public totalElements$: Observable<number>;
|
public totalElements$: Observable<number>;
|
||||||
/**
|
/**
|
||||||
@@ -51,62 +51,62 @@ export class OpenaireBrokerTopicsComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* Initialize the component variables.
|
* Initialize the component variables.
|
||||||
* @param {PaginationService} paginationService
|
* @param {PaginationService} paginationService
|
||||||
* @param {OpenaireStateService} openaireStateService
|
* @param {NotificationsStateService} notificationsStateService
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private paginationService: PaginationService,
|
private paginationService: PaginationService,
|
||||||
private openaireStateService: OpenaireStateService,
|
private notificationsStateService: NotificationsStateService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component initialization.
|
* Component initialization.
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.topics$ = this.openaireStateService.getOpenaireBrokerTopics();
|
this.topics$ = this.notificationsStateService.getNotificationsBrokerTopics();
|
||||||
this.totalElements$ = this.openaireStateService.getOpenaireBrokerTopicsTotals();
|
this.totalElements$ = this.notificationsStateService.getNotificationsBrokerTopicsTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First OpenAIRE Broker topics loading after view initialization.
|
* First Notifications Broker topics loading after view initialization.
|
||||||
*/
|
*/
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.openaireStateService.isOpenaireBrokerTopicsLoaded().pipe(
|
this.notificationsStateService.isNotificationsBrokerTopicsLoaded().pipe(
|
||||||
take(1)
|
take(1)
|
||||||
).subscribe(() => {
|
).subscribe(() => {
|
||||||
this.getOpenaireBrokerTopics();
|
this.getNotificationsBrokerTopics();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the information about the loading status of the OpenAIRE Broker topics (if it's running or not).
|
* Returns the information about the loading status of the Notifications Broker topics (if it's running or not).
|
||||||
*
|
*
|
||||||
* @return Observable<boolean>
|
* @return Observable<boolean>
|
||||||
* 'true' if the topics are loading, 'false' otherwise.
|
* 'true' if the topics are loading, 'false' otherwise.
|
||||||
*/
|
*/
|
||||||
public isTopicsLoading(): Observable<boolean> {
|
public isTopicsLoading(): Observable<boolean> {
|
||||||
return this.openaireStateService.isOpenaireBrokerTopicsLoading();
|
return this.notificationsStateService.isNotificationsBrokerTopicsLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the information about the processing status of the OpenAIRE Broker topics (if it's running or not).
|
* Returns the information about the processing status of the Notifications Broker topics (if it's running or not).
|
||||||
*
|
*
|
||||||
* @return Observable<boolean>
|
* @return Observable<boolean>
|
||||||
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
|
* 'true' if there are operations running on the topics (ex.: a REST call), 'false' otherwise.
|
||||||
*/
|
*/
|
||||||
public isTopicsProcessing(): Observable<boolean> {
|
public isTopicsProcessing(): Observable<boolean> {
|
||||||
return this.openaireStateService.isOpenaireBrokerTopicsProcessing();
|
return this.notificationsStateService.isNotificationsBrokerTopicsProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch the OpenAIRE Broker topics retrival.
|
* Dispatch the Notifications Broker topics retrival.
|
||||||
*/
|
*/
|
||||||
public getOpenaireBrokerTopics(): void {
|
public getNotificationsBrokerTopics(): void {
|
||||||
this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe(
|
this.paginationService.getCurrentPagination(this.paginationConfig.id, this.paginationConfig).pipe(
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
).subscribe((options: PaginationComponentOptions) => {
|
).subscribe((options: PaginationComponentOptions) => {
|
||||||
this.openaireStateService.dispatchRetrieveOpenaireBrokerTopics(
|
this.notificationsStateService.dispatchRetrieveNotificationsBrokerTopics(
|
||||||
options.pageSize,
|
options.pageSize,
|
||||||
options.currentPage
|
options.currentPage
|
||||||
);
|
);
|
||||||
@@ -118,7 +118,7 @@ export class OpenaireBrokerTopicsComponent implements OnInit {
|
|||||||
*
|
*
|
||||||
* @param eventsRouteParams
|
* @param eventsRouteParams
|
||||||
*/
|
*/
|
||||||
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsOpenaireTopicsPageParams) {
|
protected updatePaginationFromRouteParams(eventsRouteParams: AdminNotificationsBrokerTopicsPageParams) {
|
||||||
if (eventsRouteParams.currentPage) {
|
if (eventsRouteParams.currentPage) {
|
||||||
this.paginationConfig.currentPage = 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 { of as observableOf } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
AddTopicsAction,
|
AddTopicsAction,
|
||||||
OpenaireBrokerTopicActionTypes,
|
NotificationsBrokerTopicActionTypes,
|
||||||
RetrieveAllTopicsAction,
|
RetrieveAllTopicsAction,
|
||||||
RetrieveAllTopicsErrorAction,
|
RetrieveAllTopicsErrorAction,
|
||||||
} from './openaire-broker-topics.actions';
|
} from './notifications-broker-topics.actions';
|
||||||
|
|
||||||
import { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from '../../../core/notifications/broker/models/notifications-broker-topic.model';
|
||||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
import { OpenaireBrokerTopicsService } from './openaire-broker-topics.service';
|
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { OpenaireBrokerTopicRestService } from '../../../core/openaire/broker/topics/openaire-broker-topic-rest.service';
|
import { NotificationsBrokerTopicRestService } from '../../../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides effect methods for the OpenAIRE Broker topics actions.
|
* Provides effect methods for the Notifications Broker topics actions.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OpenaireBrokerTopicsEffects {
|
export class NotificationsBrokerTopicsEffects {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve all OpenAIRE Broker topics managing pagination and errors.
|
* Retrieve all Notifications Broker topics managing pagination and errors.
|
||||||
*/
|
*/
|
||||||
@Effect() retrieveAllTopics$ = this.actions$.pipe(
|
@Effect() retrieveAllTopics$ = this.actions$.pipe(
|
||||||
ofType(OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS),
|
||||||
withLatestFrom(this.store$),
|
withLatestFrom(this.store$),
|
||||||
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
||||||
return this.openaireBrokerTopicService.getTopics(
|
return this.notificationsBrokerTopicService.getTopics(
|
||||||
action.payload.elementsPerPage,
|
action.payload.elementsPerPage,
|
||||||
action.payload.currentPage
|
action.payload.currentPage
|
||||||
).pipe(
|
).pipe(
|
||||||
map((topics: PaginatedList<OpenaireBrokerTopicObject>) =>
|
map((topics: PaginatedList<NotificationsBrokerTopicObject>) =>
|
||||||
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)
|
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)
|
||||||
),
|
),
|
||||||
catchError((error: Error) => {
|
catchError((error: Error) => {
|
||||||
@@ -51,9 +51,9 @@ export class OpenaireBrokerTopicsEffects {
|
|||||||
* Show a notification on error.
|
* Show a notification on error.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe(
|
@Effect({ dispatch: false }) retrieveAllTopicsErrorAction$ = this.actions$.pipe(
|
||||||
ofType(OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
ofType(NotificationsBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.notificationsService.error(null, this.translate.get('openaire.broker.topic.error.service.retrieve'));
|
this.notificationsService.error(null, this.translate.get('notifications.broker.topic.error.service.retrieve'));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -61,9 +61,9 @@ export class OpenaireBrokerTopicsEffects {
|
|||||||
* Clear find all topics requests from cache.
|
* Clear find all topics requests from cache.
|
||||||
*/
|
*/
|
||||||
@Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe(
|
@Effect({ dispatch: false }) addTopicsAction$ = this.actions$.pipe(
|
||||||
ofType(OpenaireBrokerTopicActionTypes.ADD_TOPICS),
|
ofType(NotificationsBrokerTopicActionTypes.ADD_TOPICS),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
this.openaireBrokerTopicDataService.clearFindAllTopicsRequests();
|
this.notificationsBrokerTopicDataService.clearFindAllTopicsRequests();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -73,15 +73,15 @@ export class OpenaireBrokerTopicsEffects {
|
|||||||
* @param {Store<any>} store$
|
* @param {Store<any>} store$
|
||||||
* @param {TranslateService} translate
|
* @param {TranslateService} translate
|
||||||
* @param {NotificationsService} notificationsService
|
* @param {NotificationsService} notificationsService
|
||||||
* @param {OpenaireBrokerTopicsService} openaireBrokerTopicService
|
* @param {NotificationsBrokerTopicsService} notificationsBrokerTopicService
|
||||||
* @param {OpenaireBrokerTopicRestService} openaireBrokerTopicDataService
|
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicDataService
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private actions$: Actions,
|
private actions$: Actions,
|
||||||
private store$: Store<any>,
|
private store$: Store<any>,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private openaireBrokerTopicService: OpenaireBrokerTopicsService,
|
private notificationsBrokerTopicService: NotificationsBrokerTopicsService,
|
||||||
private openaireBrokerTopicDataService: OpenaireBrokerTopicRestService
|
private notificationsBrokerTopicDataService: NotificationsBrokerTopicRestService
|
||||||
) { }
|
) { }
|
||||||
}
|
}
|
@@ -0,0 +1,68 @@
|
|||||||
|
import {
|
||||||
|
AddTopicsAction,
|
||||||
|
RetrieveAllTopicsAction,
|
||||||
|
RetrieveAllTopicsErrorAction
|
||||||
|
} from './notifications-broker-topics.actions';
|
||||||
|
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState } from './notifications-broker-topics.reducer';
|
||||||
|
import {
|
||||||
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
|
notificationsBrokerTopicObjectMorePid
|
||||||
|
} from '../../../shared/mocks/notifications.mock';
|
||||||
|
|
||||||
|
describe('notificationsBrokerTopicsReducer test suite', () => {
|
||||||
|
let notificationsBrokerTopicInitialState: NotificationsBrokerTopicState;
|
||||||
|
const elementPerPage = 3;
|
||||||
|
const currentPage = 0;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
notificationsBrokerTopicInitialState = {
|
||||||
|
topics: [],
|
||||||
|
processing: false,
|
||||||
|
loaded: false,
|
||||||
|
totalPages: 0,
|
||||||
|
currentPage: 0,
|
||||||
|
totalElements: 0
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Action RETRIEVE_ALL_TOPICS should set the State property "processing" to TRUE', () => {
|
||||||
|
const expectedState = notificationsBrokerTopicInitialState;
|
||||||
|
expectedState.processing = true;
|
||||||
|
|
||||||
|
const action = new RetrieveAllTopicsAction(elementPerPage, currentPage);
|
||||||
|
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, 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;
|
||||||
|
expectedState.processing = false;
|
||||||
|
expectedState.loaded = true;
|
||||||
|
expectedState.currentPage = 0;
|
||||||
|
|
||||||
|
const action = new RetrieveAllTopicsErrorAction();
|
||||||
|
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action);
|
||||||
|
|
||||||
|
expect(newState).toEqual(expectedState);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Action ADD_TOPICS should populate the State with Notifications Broker topics', () => {
|
||||||
|
const expectedState = {
|
||||||
|
topics: [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ],
|
||||||
|
processing: false,
|
||||||
|
loaded: true,
|
||||||
|
totalPages: 1,
|
||||||
|
currentPage: 0,
|
||||||
|
totalElements: 2
|
||||||
|
};
|
||||||
|
|
||||||
|
const action = new AddTopicsAction(
|
||||||
|
[ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ],
|
||||||
|
1, 0, 2
|
||||||
|
);
|
||||||
|
const newState = notificationsBrokerTopicsReducer(notificationsBrokerTopicInitialState, action);
|
||||||
|
|
||||||
|
expect(newState).toEqual(expectedState);
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,72 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,27 +1,27 @@
|
|||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { OpenaireBrokerTopicsService } from './openaire-broker-topics.service';
|
import { NotificationsBrokerTopicsService } from './notifications-broker-topics.service';
|
||||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||||
import { OpenaireBrokerTopicRestService } from '../../../core/openaire/broker/topics/openaire-broker-topic-rest.service';
|
import { NotificationsBrokerTopicRestService } from '../../../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { FindListOptions } from '../../../core/data/request.models';
|
import { FindListOptions } from '../../../core/data/request.models';
|
||||||
import {
|
import {
|
||||||
getMockOpenaireBrokerTopicRestService,
|
getMockNotificationsBrokerTopicRestService,
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMorePid
|
notificationsBrokerTopicObjectMorePid
|
||||||
} from '../../../shared/mocks/openaire.mock';
|
} from '../../../shared/mocks/notifications.mock';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
import { cold } from 'jasmine-marbles';
|
import { cold } from 'jasmine-marbles';
|
||||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||||
|
|
||||||
describe('OpenaireBrokerTopicsService', () => {
|
describe('NotificationsBrokerTopicsService', () => {
|
||||||
let service: OpenaireBrokerTopicsService;
|
let service: NotificationsBrokerTopicsService;
|
||||||
let restService: OpenaireBrokerTopicRestService;
|
let restService: NotificationsBrokerTopicRestService;
|
||||||
let serviceAsAny: any;
|
let serviceAsAny: any;
|
||||||
let restServiceAsAny: any;
|
let restServiceAsAny: any;
|
||||||
|
|
||||||
const pageInfo = new PageInfo();
|
const pageInfo = new PageInfo();
|
||||||
const array = [ openaireBrokerTopicObjectMorePid, openaireBrokerTopicObjectMoreAbstract ];
|
const array = [ notificationsBrokerTopicObjectMorePid, notificationsBrokerTopicObjectMoreAbstract ];
|
||||||
const paginatedList = buildPaginatedList(pageInfo, array);
|
const paginatedList = buildPaginatedList(pageInfo, array);
|
||||||
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
const paginatedListRD = createSuccessfulRemoteDataObject(paginatedList);
|
||||||
const elementsPerPage = 3;
|
const elementsPerPage = 3;
|
||||||
@@ -30,22 +30,22 @@ describe('OpenaireBrokerTopicsService', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: OpenaireBrokerTopicRestService, useClass: getMockOpenaireBrokerTopicRestService },
|
{ provide: NotificationsBrokerTopicRestService, useClass: getMockNotificationsBrokerTopicRestService },
|
||||||
{ provide: OpenaireBrokerTopicsService, useValue: service }
|
{ provide: NotificationsBrokerTopicsService, useValue: service }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
restService = TestBed.get(OpenaireBrokerTopicRestService);
|
restService = TestBed.get(NotificationsBrokerTopicRestService);
|
||||||
restServiceAsAny = restService;
|
restServiceAsAny = restService;
|
||||||
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
|
restServiceAsAny.getTopics.and.returnValue(observableOf(paginatedListRD));
|
||||||
service = new OpenaireBrokerTopicsService(restService);
|
service = new NotificationsBrokerTopicsService(restService);
|
||||||
serviceAsAny = service;
|
serviceAsAny = service;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getTopics', () => {
|
describe('getTopics', () => {
|
||||||
it('Should proxy the call to openaireBrokerTopicRestService.getTopics', () => {
|
it('Should proxy the call to notificationsBrokerTopicRestService.getTopics', () => {
|
||||||
const sortOptions = new SortOptions('name', SortDirection.ASC);
|
const sortOptions = new SortOptions('name', SortDirection.ASC);
|
||||||
const findListOptions: FindListOptions = {
|
const findListOptions: FindListOptions = {
|
||||||
elementsPerPage: elementsPerPage,
|
elementsPerPage: elementsPerPage,
|
||||||
@@ -53,10 +53,10 @@ describe('OpenaireBrokerTopicsService', () => {
|
|||||||
sort: sortOptions
|
sort: sortOptions
|
||||||
};
|
};
|
||||||
const result = service.getTopics(elementsPerPage, currentPage);
|
const result = service.getTopics(elementsPerPage, currentPage);
|
||||||
expect((service as any).openaireBrokerTopicRestService.getTopics).toHaveBeenCalledWith(findListOptions);
|
expect((service as any).notificationsBrokerTopicRestService.getTopics).toHaveBeenCalledWith(findListOptions);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should return a paginated list of OpenAIRE Broker topics', () => {
|
it('Should return a paginated list of Notifications Broker topics', () => {
|
||||||
const expected = cold('(a|)', {
|
const expected = cold('(a|)', {
|
||||||
a: paginatedList
|
a: paginatedList
|
||||||
});
|
});
|
@@ -0,0 +1,55 @@
|
|||||||
|
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 { 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The service handling all Notifications Broker topic requests to the REST service.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class NotificationsBrokerTopicsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the service variables.
|
||||||
|
* @param {NotificationsBrokerTopicRestService} notificationsBrokerTopicRestService
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private notificationsBrokerTopicRestService: NotificationsBrokerTopicRestService
|
||||||
|
) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of Notifications Broker 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.
|
||||||
|
*/
|
||||||
|
public getTopics(elementsPerPage, currentPage): Observable<PaginatedList<NotificationsBrokerTopicObject>> {
|
||||||
|
const sortOptions = new SortOptions('name', SortDirection.ASC);
|
||||||
|
|
||||||
|
const findListOptions: FindListOptions = {
|
||||||
|
elementsPerPage: elementsPerPage,
|
||||||
|
currentPage: currentPage,
|
||||||
|
sort: sortOptions
|
||||||
|
};
|
||||||
|
|
||||||
|
return this.notificationsBrokerTopicRestService.getTopics(findListOptions).pipe(
|
||||||
|
find((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => !rd.isResponsePending),
|
||||||
|
map((rd: RemoteData<PaginatedList<NotificationsBrokerTopicObject>>) => {
|
||||||
|
if (rd.hasSucceeded) {
|
||||||
|
return rd.payload;
|
||||||
|
} else {
|
||||||
|
throw new Error('Can\'t retrieve Notifications Broker topics from the Broker topics REST service');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -2,17 +2,17 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { Store, StoreModule } from '@ngrx/store';
|
import { Store, StoreModule } from '@ngrx/store';
|
||||||
import { provideMockStore } from '@ngrx/store/testing';
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
import { cold } from 'jasmine-marbles';
|
import { cold } from 'jasmine-marbles';
|
||||||
import { openaireReducers } from './openaire.reducer';
|
import { notificationsReducers } from './notifications.reducer';
|
||||||
import { OpenaireStateService } from './openaire-state.service';
|
import { NotificationsStateService } from './notifications-state.service';
|
||||||
import {
|
import {
|
||||||
openaireBrokerTopicObjectMissingPid,
|
notificationsBrokerTopicObjectMissingPid,
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMorePid
|
notificationsBrokerTopicObjectMorePid
|
||||||
} from '../shared/mocks/openaire.mock';
|
} from '../shared/mocks/notifications.mock';
|
||||||
import { RetrieveAllTopicsAction } from './broker/topics/openaire-broker-topics.actions';
|
import { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions';
|
||||||
|
|
||||||
describe('OpenaireStateService', () => {
|
describe('NotificationsStateService', () => {
|
||||||
let service: OpenaireStateService;
|
let service: NotificationsStateService;
|
||||||
let serviceAsAny: any;
|
let serviceAsAny: any;
|
||||||
let store: any;
|
let store: any;
|
||||||
let initialState: any;
|
let initialState: any;
|
||||||
@@ -20,7 +20,7 @@ describe('OpenaireStateService', () => {
|
|||||||
function init(mode: string) {
|
function init(mode: string) {
|
||||||
if (mode === 'empty') {
|
if (mode === 'empty') {
|
||||||
initialState = {
|
initialState = {
|
||||||
openaire: {
|
notifications: {
|
||||||
brokerTopic: {
|
brokerTopic: {
|
||||||
topics: [],
|
topics: [],
|
||||||
processing: false,
|
processing: false,
|
||||||
@@ -34,12 +34,12 @@ describe('OpenaireStateService', () => {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
initialState = {
|
initialState = {
|
||||||
openaire: {
|
notifications: {
|
||||||
brokerTopic: {
|
brokerTopic: {
|
||||||
topics: [
|
topics: [
|
||||||
openaireBrokerTopicObjectMorePid,
|
notificationsBrokerTopicObjectMorePid,
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMissingPid
|
notificationsBrokerTopicObjectMissingPid
|
||||||
],
|
],
|
||||||
processing: false,
|
processing: false,
|
||||||
loaded: true,
|
loaded: true,
|
||||||
@@ -58,25 +58,25 @@ describe('OpenaireStateService', () => {
|
|||||||
init('empty');
|
init('empty');
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
StoreModule.forRoot({ openaire: openaireReducers } as any),
|
StoreModule.forRoot({ notifications: notificationsReducers } as any),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
provideMockStore({ initialState }),
|
provideMockStore({ initialState }),
|
||||||
{ provide: OpenaireStateService, useValue: service }
|
{ provide: NotificationsStateService, useValue: service }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
store = TestBed.get(Store);
|
store = TestBed.get(Store);
|
||||||
service = new OpenaireStateService(store);
|
service = new NotificationsStateService(store);
|
||||||
serviceAsAny = service;
|
serviceAsAny = service;
|
||||||
spyOn(store, 'dispatch');
|
spyOn(store, 'dispatch');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopics', () => {
|
describe('getNotificationsBrokerTopics', () => {
|
||||||
it('Should return an empty array', () => {
|
it('Should return an empty array', () => {
|
||||||
const result = service.getOpenaireBrokerTopics();
|
const result = service.getNotificationsBrokerTopics();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: []
|
a: []
|
||||||
});
|
});
|
||||||
@@ -84,9 +84,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsTotalPages', () => {
|
describe('getNotificationsBrokerTopicsTotalPages', () => {
|
||||||
it('Should return zero (0)', () => {
|
it('Should return zero (0)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsTotalPages();
|
const result = service.getNotificationsBrokerTopicsTotalPages();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 0
|
a: 0
|
||||||
});
|
});
|
||||||
@@ -94,9 +94,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsCurrentPage', () => {
|
describe('getNotificationsBrokerTopicsCurrentPage', () => {
|
||||||
it('Should return minus one (0)', () => {
|
it('Should return minus one (0)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsCurrentPage();
|
const result = service.getNotificationsBrokerTopicsCurrentPage();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 0
|
a: 0
|
||||||
});
|
});
|
||||||
@@ -104,9 +104,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsTotals', () => {
|
describe('getNotificationsBrokerTopicsTotals', () => {
|
||||||
it('Should return zero (0)', () => {
|
it('Should return zero (0)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsTotals();
|
const result = service.getNotificationsBrokerTopicsTotals();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 0
|
a: 0
|
||||||
});
|
});
|
||||||
@@ -114,9 +114,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsLoading', () => {
|
describe('isNotificationsBrokerTopicsLoading', () => {
|
||||||
it('Should return TRUE', () => {
|
it('Should return TRUE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsLoading();
|
const result = service.isNotificationsBrokerTopicsLoading();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: true
|
a: true
|
||||||
});
|
});
|
||||||
@@ -124,9 +124,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsLoaded', () => {
|
describe('isNotificationsBrokerTopicsLoaded', () => {
|
||||||
it('Should return FALSE', () => {
|
it('Should return FALSE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsLoaded();
|
const result = service.isNotificationsBrokerTopicsLoaded();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: false
|
a: false
|
||||||
});
|
});
|
||||||
@@ -134,9 +134,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsProcessing', () => {
|
describe('isNotificationsBrokerTopicsProcessing', () => {
|
||||||
it('Should return FALSE', () => {
|
it('Should return FALSE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsProcessing();
|
const result = service.isNotificationsBrokerTopicsProcessing();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: false
|
a: false
|
||||||
});
|
});
|
||||||
@@ -150,39 +150,39 @@ describe('OpenaireStateService', () => {
|
|||||||
init('full');
|
init('full');
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
StoreModule.forRoot({ openaire: openaireReducers } as any),
|
StoreModule.forRoot({ notifications: notificationsReducers } as any),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
provideMockStore({ initialState }),
|
provideMockStore({ initialState }),
|
||||||
{ provide: OpenaireStateService, useValue: service }
|
{ provide: NotificationsStateService, useValue: service }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
store = TestBed.get(Store);
|
store = TestBed.get(Store);
|
||||||
service = new OpenaireStateService(store);
|
service = new NotificationsStateService(store);
|
||||||
serviceAsAny = service;
|
serviceAsAny = service;
|
||||||
spyOn(store, 'dispatch');
|
spyOn(store, 'dispatch');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopics', () => {
|
describe('getNotificationsBrokerTopics', () => {
|
||||||
it('Should return an array of topics', () => {
|
it('Should return an array of topics', () => {
|
||||||
const result = service.getOpenaireBrokerTopics();
|
const result = service.getNotificationsBrokerTopics();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: [
|
a: [
|
||||||
openaireBrokerTopicObjectMorePid,
|
notificationsBrokerTopicObjectMorePid,
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
notificationsBrokerTopicObjectMoreAbstract,
|
||||||
openaireBrokerTopicObjectMissingPid
|
notificationsBrokerTopicObjectMissingPid
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
expect(result).toBeObservable(expected);
|
expect(result).toBeObservable(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsTotalPages', () => {
|
describe('getNotificationsBrokerTopicsTotalPages', () => {
|
||||||
it('Should return one (1)', () => {
|
it('Should return one (1)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsTotalPages();
|
const result = service.getNotificationsBrokerTopicsTotalPages();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 1
|
a: 1
|
||||||
});
|
});
|
||||||
@@ -190,9 +190,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsCurrentPage', () => {
|
describe('getNotificationsBrokerTopicsCurrentPage', () => {
|
||||||
it('Should return minus zero (1)', () => {
|
it('Should return minus zero (1)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsCurrentPage();
|
const result = service.getNotificationsBrokerTopicsCurrentPage();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 1
|
a: 1
|
||||||
});
|
});
|
||||||
@@ -200,9 +200,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getOpenaireBrokerTopicsTotals', () => {
|
describe('getNotificationsBrokerTopicsTotals', () => {
|
||||||
it('Should return three (3)', () => {
|
it('Should return three (3)', () => {
|
||||||
const result = service.getOpenaireBrokerTopicsTotals();
|
const result = service.getNotificationsBrokerTopicsTotals();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: 3
|
a: 3
|
||||||
});
|
});
|
||||||
@@ -210,9 +210,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsLoading', () => {
|
describe('isNotificationsBrokerTopicsLoading', () => {
|
||||||
it('Should return FALSE', () => {
|
it('Should return FALSE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsLoading();
|
const result = service.isNotificationsBrokerTopicsLoading();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: false
|
a: false
|
||||||
});
|
});
|
||||||
@@ -220,9 +220,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsLoaded', () => {
|
describe('isNotificationsBrokerTopicsLoaded', () => {
|
||||||
it('Should return TRUE', () => {
|
it('Should return TRUE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsLoaded();
|
const result = service.isNotificationsBrokerTopicsLoaded();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: true
|
a: true
|
||||||
});
|
});
|
||||||
@@ -230,9 +230,9 @@ describe('OpenaireStateService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isOpenaireBrokerTopicsProcessing', () => {
|
describe('isNotificationsBrokerTopicsProcessing', () => {
|
||||||
it('Should return FALSE', () => {
|
it('Should return FALSE', () => {
|
||||||
const result = service.isOpenaireBrokerTopicsProcessing();
|
const result = service.isNotificationsBrokerTopicsProcessing();
|
||||||
const expected = cold('(a)', {
|
const expected = cold('(a)', {
|
||||||
a: false
|
a: false
|
||||||
});
|
});
|
||||||
@@ -246,28 +246,28 @@ describe('OpenaireStateService', () => {
|
|||||||
init('full');
|
init('full');
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
StoreModule.forRoot({ openaire: openaireReducers } as any),
|
StoreModule.forRoot({ notifications: notificationsReducers } as any),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
provideMockStore({ initialState }),
|
provideMockStore({ initialState }),
|
||||||
{ provide: OpenaireStateService, useValue: service }
|
{ provide: NotificationsStateService, useValue: service }
|
||||||
]
|
]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
store = TestBed.get(Store);
|
store = TestBed.get(Store);
|
||||||
service = new OpenaireStateService(store);
|
service = new NotificationsStateService(store);
|
||||||
serviceAsAny = service;
|
serviceAsAny = service;
|
||||||
spyOn(store, 'dispatch');
|
spyOn(store, 'dispatch');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('dispatchRetrieveOpenaireBrokerTopics', () => {
|
describe('dispatchRetrieveNotificationsBrokerTopics', () => {
|
||||||
it('Should call store.dispatch', () => {
|
it('Should call store.dispatch', () => {
|
||||||
const elementsPerPage = 3;
|
const elementsPerPage = 3;
|
||||||
const currentPage = 1;
|
const currentPage = 1;
|
||||||
const action = new RetrieveAllTopicsAction(elementsPerPage, currentPage);
|
const action = new RetrieveAllTopicsAction(elementsPerPage, currentPage);
|
||||||
service.dispatchRetrieveOpenaireBrokerTopics(elementsPerPage, currentPage);
|
service.dispatchRetrieveNotificationsBrokerTopics(elementsPerPage, currentPage);
|
||||||
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
|
expect(serviceAsAny.store.dispatch).toHaveBeenCalledWith(action);
|
||||||
});
|
});
|
||||||
});
|
});
|
116
src/app/notifications/notifications-state.service.ts
Normal file
116
src/app/notifications/notifications-state.service.ts
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { select, Store } from '@ngrx/store';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
import {
|
||||||
|
getNotificationsBrokerTopicsCurrentPageSelector,
|
||||||
|
getNotificationsBrokerTopicsTotalPagesSelector,
|
||||||
|
getNotificationsBrokerTopicsTotalsSelector,
|
||||||
|
isNotificationsBrokerTopicsLoadedSelector,
|
||||||
|
notificationsBrokerTopicsObjectSelector,
|
||||||
|
isNotificationsBrokerTopicsProcessingSelector
|
||||||
|
} from './selectors';
|
||||||
|
import { NotificationsBrokerTopicObject } from '../core/notifications/broker/models/notifications-broker-topic.model';
|
||||||
|
import { NotificationsState } from './notifications.reducer';
|
||||||
|
import { RetrieveAllTopicsAction } from './broker/topics/notifications-broker-topics.actions';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The service handling the Notifications State.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class NotificationsStateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the service variables.
|
||||||
|
* @param {Store<NotificationsState>} store
|
||||||
|
*/
|
||||||
|
constructor(private store: Store<NotificationsState>) { }
|
||||||
|
|
||||||
|
// Notifications Broker topics
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of Notifications Broker topics from the state.
|
||||||
|
*
|
||||||
|
* @return Observable<NotificationsBrokerTopicObject>
|
||||||
|
* The list of Notifications Broker topics.
|
||||||
|
*/
|
||||||
|
public getNotificationsBrokerTopics(): Observable<NotificationsBrokerTopicObject[]> {
|
||||||
|
return this.store.pipe(select(notificationsBrokerTopicsObjectSelector()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the information about the loading status of the Notifications Broker topics (if it's running or not).
|
||||||
|
*
|
||||||
|
* @return Observable<boolean>
|
||||||
|
* 'true' if the topics are loading, 'false' otherwise.
|
||||||
|
*/
|
||||||
|
public isNotificationsBrokerTopicsLoading(): Observable<boolean> {
|
||||||
|
return this.store.pipe(
|
||||||
|
select(isNotificationsBrokerTopicsLoadedSelector),
|
||||||
|
map((loaded: boolean) => !loaded)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the information about the loading status of the Notifications Broker 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the information about the processing status of the Notifications Broker 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns, from the state, the total available pages of the Notifications Broker topics.
|
||||||
|
*
|
||||||
|
* @return Observable<number>
|
||||||
|
* The number of the Notifications Broker topics pages.
|
||||||
|
*/
|
||||||
|
public getNotificationsBrokerTopicsTotalPages(): Observable<number> {
|
||||||
|
return this.store.pipe(select(getNotificationsBrokerTopicsTotalPagesSelector));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current page of the Notifications Broker topics, from the state.
|
||||||
|
*
|
||||||
|
* @return Observable<number>
|
||||||
|
* The number of the current Notifications Broker topics page.
|
||||||
|
*/
|
||||||
|
public getNotificationsBrokerTopicsCurrentPage(): Observable<number> {
|
||||||
|
return this.store.pipe(select(getNotificationsBrokerTopicsCurrentPageSelector));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total number of the Notifications Broker topics.
|
||||||
|
*
|
||||||
|
* @return Observable<number>
|
||||||
|
* The number of the Notifications Broker topics.
|
||||||
|
*/
|
||||||
|
public getNotificationsBrokerTopicsTotals(): Observable<number> {
|
||||||
|
return this.store.pipe(select(getNotificationsBrokerTopicsTotalsSelector));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch a request to change the Notifications Broker 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 {
|
||||||
|
this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage));
|
||||||
|
}
|
||||||
|
}
|
5
src/app/notifications/notifications.effects.ts
Normal file
5
src/app/notifications/notifications.effects.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { NotificationsBrokerTopicsEffects } from './broker/topics/notifications-broker-topics.effects';
|
||||||
|
|
||||||
|
export const notificationsEffects = [
|
||||||
|
NotificationsBrokerTopicsEffects
|
||||||
|
];
|
@@ -6,14 +6,14 @@ import { EffectsModule } from '@ngrx/effects';
|
|||||||
import { CoreModule } from '../core/core.module';
|
import { CoreModule } from '../core/core.module';
|
||||||
import { SharedModule } from '../shared/shared.module';
|
import { SharedModule } from '../shared/shared.module';
|
||||||
import { storeModuleConfig } from '../app.reducer';
|
import { storeModuleConfig } from '../app.reducer';
|
||||||
import { OpenaireBrokerTopicsComponent } from './broker/topics/openaire-broker-topics.component';
|
import { NotificationsBrokerTopicsComponent } from './broker/topics/notifications-broker-topics.component';
|
||||||
import { OpenaireBrokerEventsComponent } from './broker/events/openaire-broker-events.component';
|
import { NotificationsBrokerEventsComponent } from './broker/events/notifications-broker-events.component';
|
||||||
import { OpenaireStateService } from './openaire-state.service';
|
import { NotificationsStateService } from './notifications-state.service';
|
||||||
import { openaireReducers, OpenaireState } from './openaire.reducer';
|
import { notificationsReducers, NotificationsState } from './notifications.reducer';
|
||||||
import { openaireEffects } from './openaire.effects';
|
import { notificationsEffects } from './notifications.effects';
|
||||||
import { OpenaireBrokerTopicsService } from './broker/topics/openaire-broker-topics.service';
|
import { NotificationsBrokerTopicsService } from './broker/topics/notifications-broker-topics.service';
|
||||||
import { OpenaireBrokerTopicRestService } from '../core/openaire/broker/topics/openaire-broker-topic-rest.service';
|
import { NotificationsBrokerTopicRestService } from '../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||||
import { OpenaireBrokerEventRestService } from '../core/openaire/broker/events/openaire-broker-event-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 { ProjectEntryImportModalComponent } from './broker/project-entry-import-modal/project-entry-import-modal.component';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { SearchModule } from '../shared/search/search.module';
|
import { SearchModule } from '../shared/search/search.module';
|
||||||
@@ -22,14 +22,14 @@ const MODULES = [
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
CoreModule.forRoot(),
|
CoreModule.forRoot(),
|
||||||
StoreModule.forFeature('openaire', openaireReducers, storeModuleConfig as StoreConfig<OpenaireState, Action>),
|
StoreModule.forFeature('notifications', notificationsReducers, storeModuleConfig as StoreConfig<NotificationsState, Action>),
|
||||||
EffectsModule.forFeature(openaireEffects),
|
EffectsModule.forFeature(notificationsEffects),
|
||||||
TranslateModule
|
TranslateModule
|
||||||
];
|
];
|
||||||
|
|
||||||
const COMPONENTS = [
|
const COMPONENTS = [
|
||||||
OpenaireBrokerTopicsComponent,
|
NotificationsBrokerTopicsComponent,
|
||||||
OpenaireBrokerEventsComponent
|
NotificationsBrokerEventsComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
const DIRECTIVES = [ ];
|
const DIRECTIVES = [ ];
|
||||||
@@ -39,10 +39,10 @@ const ENTRY_COMPONENTS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const PROVIDERS = [
|
const PROVIDERS = [
|
||||||
OpenaireStateService,
|
NotificationsStateService,
|
||||||
OpenaireBrokerTopicsService,
|
NotificationsBrokerTopicsService,
|
||||||
OpenaireBrokerTopicRestService,
|
NotificationsBrokerTopicRestService,
|
||||||
OpenaireBrokerEventRestService
|
NotificationsBrokerEventRestService
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -70,5 +70,5 @@ const PROVIDERS = [
|
|||||||
/**
|
/**
|
||||||
* This module handles all components that are necessary for the OpenAIRE components
|
* This module handles all components that are necessary for the OpenAIRE components
|
||||||
*/
|
*/
|
||||||
export class OpenaireModule {
|
export class NotificationsModule {
|
||||||
}
|
}
|
16
src/app/notifications/notifications.reducer.ts
Normal file
16
src/app/notifications/notifications.reducer.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store';
|
||||||
|
|
||||||
|
import { notificationsBrokerTopicsReducer, NotificationsBrokerTopicState, } from './broker/topics/notifications-broker-topics.reducer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OpenAIRE State
|
||||||
|
*/
|
||||||
|
export interface NotificationsState {
|
||||||
|
'brokerTopic': NotificationsBrokerTopicState;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const notificationsReducers: ActionReducerMap<NotificationsState> = {
|
||||||
|
brokerTopic: notificationsBrokerTopicsReducer,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const notificationsSelector = createFeatureSelector<NotificationsState>('notifications');
|
79
src/app/notifications/selectors.ts
Normal file
79
src/app/notifications/selectors.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Notifications state.
|
||||||
|
* @function _getNotificationsState
|
||||||
|
* @param {AppState} state Top level state.
|
||||||
|
* @return {NotificationsState}
|
||||||
|
*/
|
||||||
|
const _getNotificationsState = (state: any) => state.notifications;
|
||||||
|
|
||||||
|
// Notifications Broker topics
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Notifications Broker topics State.
|
||||||
|
* @function notificationsBrokerTopicsStateSelector
|
||||||
|
* @return {NotificationsBrokerTopicState}
|
||||||
|
*/
|
||||||
|
export function notificationsBrokerTopicsStateSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicState> {
|
||||||
|
return subStateSelector<NotificationsState,NotificationsBrokerTopicState>(notificationsSelector, 'brokerTopic');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Notifications Broker topics list.
|
||||||
|
* @function notificationsBrokerTopicsObjectSelector
|
||||||
|
* @return {NotificationsBrokerTopicObject[]}
|
||||||
|
*/
|
||||||
|
export function notificationsBrokerTopicsObjectSelector(): MemoizedSelector<NotificationsState, NotificationsBrokerTopicObject[]> {
|
||||||
|
return subStateSelector<NotificationsState, NotificationsBrokerTopicObject[]>(notificationsBrokerTopicsStateSelector(), 'topics');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the Notifications Broker topics are loaded.
|
||||||
|
* @function isNotificationsBrokerTopicsLoadedSelector
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
export const isNotificationsBrokerTopicsLoadedSelector = createSelector(_getNotificationsState,
|
||||||
|
(state: NotificationsState) => state.brokerTopic.loaded
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the deduplication sets are processing.
|
||||||
|
* @function isDeduplicationSetsProcessingSelector
|
||||||
|
* @return {boolean}
|
||||||
|
*/
|
||||||
|
export const isNotificationsBrokerTopicsProcessingSelector = createSelector(_getNotificationsState,
|
||||||
|
(state: NotificationsState) => state.brokerTopic.processing
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total available pages of Notifications Broker topics.
|
||||||
|
* @function getNotificationsBrokerTopicsTotalPagesSelector
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
export const getNotificationsBrokerTopicsTotalPagesSelector = createSelector(_getNotificationsState,
|
||||||
|
(state: NotificationsState) => state.brokerTopic.totalPages
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current page of Notifications Broker topics.
|
||||||
|
* @function getNotificationsBrokerTopicsCurrentPageSelector
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
export const getNotificationsBrokerTopicsCurrentPageSelector = createSelector(_getNotificationsState,
|
||||||
|
(state: NotificationsState) => state.brokerTopic.currentPage
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total number of Notifications Broker topics.
|
||||||
|
* @function getNotificationsBrokerTopicsTotalsSelector
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
export const getNotificationsBrokerTopicsTotalsSelector = createSelector(_getNotificationsState,
|
||||||
|
(state: NotificationsState) => state.brokerTopic.totalElements
|
||||||
|
);
|
@@ -1,68 +0,0 @@
|
|||||||
import {
|
|
||||||
AddTopicsAction,
|
|
||||||
RetrieveAllTopicsAction,
|
|
||||||
RetrieveAllTopicsErrorAction
|
|
||||||
} from './openaire-broker-topics.actions';
|
|
||||||
import { openaireBrokerTopicsReducer, OpenaireBrokerTopicState } from './openaire-broker-topics.reducer';
|
|
||||||
import {
|
|
||||||
openaireBrokerTopicObjectMoreAbstract,
|
|
||||||
openaireBrokerTopicObjectMorePid
|
|
||||||
} from '../../../shared/mocks/openaire.mock';
|
|
||||||
|
|
||||||
describe('openaireBrokerTopicsReducer test suite', () => {
|
|
||||||
let openaireBrokerTopicInitialState: OpenaireBrokerTopicState;
|
|
||||||
const elementPerPage = 3;
|
|
||||||
const currentPage = 0;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
openaireBrokerTopicInitialState = {
|
|
||||||
topics: [],
|
|
||||||
processing: false,
|
|
||||||
loaded: false,
|
|
||||||
totalPages: 0,
|
|
||||||
currentPage: 0,
|
|
||||||
totalElements: 0
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Action RETRIEVE_ALL_TOPICS should set the State property "processing" to TRUE', () => {
|
|
||||||
const expectedState = openaireBrokerTopicInitialState;
|
|
||||||
expectedState.processing = true;
|
|
||||||
|
|
||||||
const action = new RetrieveAllTopicsAction(elementPerPage, currentPage);
|
|
||||||
const newState = openaireBrokerTopicsReducer(openaireBrokerTopicInitialState, 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 = openaireBrokerTopicInitialState;
|
|
||||||
expectedState.processing = false;
|
|
||||||
expectedState.loaded = true;
|
|
||||||
expectedState.currentPage = 0;
|
|
||||||
|
|
||||||
const action = new RetrieveAllTopicsErrorAction();
|
|
||||||
const newState = openaireBrokerTopicsReducer(openaireBrokerTopicInitialState, action);
|
|
||||||
|
|
||||||
expect(newState).toEqual(expectedState);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Action ADD_TOPICS should populate the State with OpenAIRE Broker topics', () => {
|
|
||||||
const expectedState = {
|
|
||||||
topics: [ openaireBrokerTopicObjectMorePid, openaireBrokerTopicObjectMoreAbstract ],
|
|
||||||
processing: false,
|
|
||||||
loaded: true,
|
|
||||||
totalPages: 1,
|
|
||||||
currentPage: 0,
|
|
||||||
totalElements: 2
|
|
||||||
};
|
|
||||||
|
|
||||||
const action = new AddTopicsAction(
|
|
||||||
[ openaireBrokerTopicObjectMorePid, openaireBrokerTopicObjectMoreAbstract ],
|
|
||||||
1, 0, 2
|
|
||||||
);
|
|
||||||
const newState = openaireBrokerTopicsReducer(openaireBrokerTopicInitialState, action);
|
|
||||||
|
|
||||||
expect(newState).toEqual(expectedState);
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,72 +0,0 @@
|
|||||||
import { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/openaire-broker-topic.model';
|
|
||||||
import { OpenaireBrokerTopicActionTypes, OpenaireBrokerTopicsActions } from './openaire-broker-topics.actions';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The interface representing the OpenAIRE Broker topic state.
|
|
||||||
*/
|
|
||||||
export interface OpenaireBrokerTopicState {
|
|
||||||
topics: OpenaireBrokerTopicObject[];
|
|
||||||
processing: boolean;
|
|
||||||
loaded: boolean;
|
|
||||||
totalPages: number;
|
|
||||||
currentPage: number;
|
|
||||||
totalElements: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for the OpenAIRE Broker topic state initialization.
|
|
||||||
*/
|
|
||||||
const openaireBrokerTopicInitialState: OpenaireBrokerTopicState = {
|
|
||||||
topics: [],
|
|
||||||
processing: false,
|
|
||||||
loaded: false,
|
|
||||||
totalPages: 0,
|
|
||||||
currentPage: 0,
|
|
||||||
totalElements: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The OpenAIRE Broker Topic Reducer
|
|
||||||
*
|
|
||||||
* @param state
|
|
||||||
* the current state initialized with openaireBrokerTopicInitialState
|
|
||||||
* @param action
|
|
||||||
* the action to perform on the state
|
|
||||||
* @return OpenaireBrokerTopicState
|
|
||||||
* the new state
|
|
||||||
*/
|
|
||||||
export function openaireBrokerTopicsReducer(state = openaireBrokerTopicInitialState, action: OpenaireBrokerTopicsActions): OpenaireBrokerTopicState {
|
|
||||||
switch (action.type) {
|
|
||||||
case OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS: {
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
topics: [],
|
|
||||||
processing: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
case OpenaireBrokerTopicActionTypes.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 OpenaireBrokerTopicActionTypes.RETRIEVE_ALL_TOPICS_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 { OpenaireBrokerTopicRestService } from '../../../core/openaire/broker/topics/openaire-broker-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 { OpenaireBrokerTopicObject } from '../../../core/openaire/broker/models/openaire-broker-topic.model';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The service handling all OpenAIRE Broker topic requests to the REST service.
|
|
||||||
*/
|
|
||||||
@Injectable()
|
|
||||||
export class OpenaireBrokerTopicsService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the service variables.
|
|
||||||
* @param {OpenaireBrokerTopicRestService} openaireBrokerTopicRestService
|
|
||||||
*/
|
|
||||||
constructor(
|
|
||||||
private openaireBrokerTopicRestService: OpenaireBrokerTopicRestService
|
|
||||||
) { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the list of OpenAIRE Broker topics managing pagination and errors.
|
|
||||||
*
|
|
||||||
* @param elementsPerPage
|
|
||||||
* The number of the topics per page
|
|
||||||
* @param currentPage
|
|
||||||
* The page number to retrieve
|
|
||||||
* @return Observable<PaginatedList<OpenaireBrokerTopicObject>>
|
|
||||||
* The list of OpenAIRE Broker topics.
|
|
||||||
*/
|
|
||||||
public getTopics(elementsPerPage, currentPage): Observable<PaginatedList<OpenaireBrokerTopicObject>> {
|
|
||||||
const sortOptions = new SortOptions('name', SortDirection.ASC);
|
|
||||||
|
|
||||||
const findListOptions: FindListOptions = {
|
|
||||||
elementsPerPage: elementsPerPage,
|
|
||||||
currentPage: currentPage,
|
|
||||||
sort: sortOptions
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.openaireBrokerTopicRestService.getTopics(findListOptions).pipe(
|
|
||||||
find((rd: RemoteData<PaginatedList<OpenaireBrokerTopicObject>>) => !rd.isResponsePending),
|
|
||||||
map((rd: RemoteData<PaginatedList<OpenaireBrokerTopicObject>>) => {
|
|
||||||
if (rd.hasSucceeded) {
|
|
||||||
return rd.payload;
|
|
||||||
} else {
|
|
||||||
throw new Error('Can\'t retrieve OpenAIRE Broker topics from the Broker topics REST service');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,116 +0,0 @@
|
|||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { select, Store } from '@ngrx/store';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { map } from 'rxjs/operators';
|
|
||||||
import {
|
|
||||||
getOpenaireBrokerTopicsCurrentPageSelector,
|
|
||||||
getOpenaireBrokerTopicsTotalPagesSelector,
|
|
||||||
getOpenaireBrokerTopicsTotalsSelector,
|
|
||||||
isOpenaireBrokerTopicsLoadedSelector,
|
|
||||||
openaireBrokerTopicsObjectSelector,
|
|
||||||
sOpenaireBrokerTopicsProcessingSelector
|
|
||||||
} from './selectors';
|
|
||||||
import { OpenaireBrokerTopicObject } from '../core/openaire/broker/models/openaire-broker-topic.model';
|
|
||||||
import { OpenaireState } from './openaire.reducer';
|
|
||||||
import { RetrieveAllTopicsAction } from './broker/topics/openaire-broker-topics.actions';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The service handling the OpenAIRE State.
|
|
||||||
*/
|
|
||||||
@Injectable()
|
|
||||||
export class OpenaireStateService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the service variables.
|
|
||||||
* @param {Store<OpenaireState>} store
|
|
||||||
*/
|
|
||||||
constructor(private store: Store<OpenaireState>) { }
|
|
||||||
|
|
||||||
// OpenAIRE Broker topics
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of OpenAIRE Broker topics from the state.
|
|
||||||
*
|
|
||||||
* @return Observable<OpenaireBrokerTopicObject>
|
|
||||||
* The list of OpenAIRE Broker topics.
|
|
||||||
*/
|
|
||||||
public getOpenaireBrokerTopics(): Observable<OpenaireBrokerTopicObject[]> {
|
|
||||||
return this.store.pipe(select(openaireBrokerTopicsObjectSelector()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the information about the loading status of the OpenAIRE Broker topics (if it's running or not).
|
|
||||||
*
|
|
||||||
* @return Observable<boolean>
|
|
||||||
* 'true' if the topics are loading, 'false' otherwise.
|
|
||||||
*/
|
|
||||||
public isOpenaireBrokerTopicsLoading(): Observable<boolean> {
|
|
||||||
return this.store.pipe(
|
|
||||||
select(isOpenaireBrokerTopicsLoadedSelector),
|
|
||||||
map((loaded: boolean) => !loaded)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the information about the loading status of the OpenAIRE Broker topics (whether or not they were loaded).
|
|
||||||
*
|
|
||||||
* @return Observable<boolean>
|
|
||||||
* 'true' if the topics are loaded, 'false' otherwise.
|
|
||||||
*/
|
|
||||||
public isOpenaireBrokerTopicsLoaded(): Observable<boolean> {
|
|
||||||
return this.store.pipe(select(isOpenaireBrokerTopicsLoadedSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the information about the processing status of the OpenAIRE Broker 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 isOpenaireBrokerTopicsProcessing(): Observable<boolean> {
|
|
||||||
return this.store.pipe(select(sOpenaireBrokerTopicsProcessingSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns, from the state, the total available pages of the OpenAIRE Broker topics.
|
|
||||||
*
|
|
||||||
* @return Observable<number>
|
|
||||||
* The number of the OpenAIRE Broker topics pages.
|
|
||||||
*/
|
|
||||||
public getOpenaireBrokerTopicsTotalPages(): Observable<number> {
|
|
||||||
return this.store.pipe(select(getOpenaireBrokerTopicsTotalPagesSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current page of the OpenAIRE Broker topics, from the state.
|
|
||||||
*
|
|
||||||
* @return Observable<number>
|
|
||||||
* The number of the current OpenAIRE Broker topics page.
|
|
||||||
*/
|
|
||||||
public getOpenaireBrokerTopicsCurrentPage(): Observable<number> {
|
|
||||||
return this.store.pipe(select(getOpenaireBrokerTopicsCurrentPageSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the total number of the OpenAIRE Broker topics.
|
|
||||||
*
|
|
||||||
* @return Observable<number>
|
|
||||||
* The number of the OpenAIRE Broker topics.
|
|
||||||
*/
|
|
||||||
public getOpenaireBrokerTopicsTotals(): Observable<number> {
|
|
||||||
return this.store.pipe(select(getOpenaireBrokerTopicsTotalsSelector));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch a request to change the OpenAIRE Broker 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 dispatchRetrieveOpenaireBrokerTopics(elementsPerPage: number, currentPage: number): void {
|
|
||||||
this.store.dispatch(new RetrieveAllTopicsAction(elementsPerPage, currentPage));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
import { OpenaireBrokerTopicsEffects } from './broker/topics/openaire-broker-topics.effects';
|
|
||||||
|
|
||||||
export const openaireEffects = [
|
|
||||||
OpenaireBrokerTopicsEffects
|
|
||||||
];
|
|
@@ -1,16 +0,0 @@
|
|||||||
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store';
|
|
||||||
|
|
||||||
import { openaireBrokerTopicsReducer, OpenaireBrokerTopicState, } from './broker/topics/openaire-broker-topics.reducer';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The OpenAIRE State
|
|
||||||
*/
|
|
||||||
export interface OpenaireState {
|
|
||||||
'brokerTopic': OpenaireBrokerTopicState;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const openaireReducers: ActionReducerMap<OpenaireState> = {
|
|
||||||
brokerTopic: openaireBrokerTopicsReducer,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const openaireSelector = createFeatureSelector<OpenaireState>('openaire');
|
|
@@ -1,79 +0,0 @@
|
|||||||
import { createSelector, MemoizedSelector } from '@ngrx/store';
|
|
||||||
import { subStateSelector } from '../shared/selector.util';
|
|
||||||
import { openaireSelector, OpenaireState } from './openaire.reducer';
|
|
||||||
import { OpenaireBrokerTopicObject } from '../core/openaire/broker/models/openaire-broker-topic.model';
|
|
||||||
import { OpenaireBrokerTopicState } from './broker/topics/openaire-broker-topics.reducer';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the OpenAIRE state.
|
|
||||||
* @function _getOpenaireState
|
|
||||||
* @param {AppState} state Top level state.
|
|
||||||
* @return {OpenaireState}
|
|
||||||
*/
|
|
||||||
const _getOpenaireState = (state: any) => state.openaire;
|
|
||||||
|
|
||||||
// OpenAIRE Broker topics
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the OpenAIRE Broker topics State.
|
|
||||||
* @function openaireBrokerTopicsStateSelector
|
|
||||||
* @return {OpenaireBrokerTopicState}
|
|
||||||
*/
|
|
||||||
export function openaireBrokerTopicsStateSelector(): MemoizedSelector<OpenaireState, OpenaireBrokerTopicState> {
|
|
||||||
return subStateSelector<OpenaireState,OpenaireBrokerTopicState>(openaireSelector, 'brokerTopic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the OpenAIRE Broker topics list.
|
|
||||||
* @function openaireBrokerTopicsObjectSelector
|
|
||||||
* @return {OpenaireBrokerTopicObject[]}
|
|
||||||
*/
|
|
||||||
export function openaireBrokerTopicsObjectSelector(): MemoizedSelector<OpenaireState, OpenaireBrokerTopicObject[]> {
|
|
||||||
return subStateSelector<OpenaireState, OpenaireBrokerTopicObject[]>(openaireBrokerTopicsStateSelector(), 'topics');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the OpenAIRE Broker topics are loaded.
|
|
||||||
* @function isOpenaireBrokerTopicsLoadedSelector
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
export const isOpenaireBrokerTopicsLoadedSelector = createSelector(_getOpenaireState,
|
|
||||||
(state: OpenaireState) => state.brokerTopic.loaded
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the deduplication sets are processing.
|
|
||||||
* @function isDeduplicationSetsProcessingSelector
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
export const sOpenaireBrokerTopicsProcessingSelector = createSelector(_getOpenaireState,
|
|
||||||
(state: OpenaireState) => state.brokerTopic.processing
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the total available pages of OpenAIRE Broker topics.
|
|
||||||
* @function getOpenaireBrokerTopicsTotalPagesSelector
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
export const getOpenaireBrokerTopicsTotalPagesSelector = createSelector(_getOpenaireState,
|
|
||||||
(state: OpenaireState) => state.brokerTopic.totalPages
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current page of OpenAIRE Broker topics.
|
|
||||||
* @function getOpenaireBrokerTopicsCurrentPageSelector
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
export const getOpenaireBrokerTopicsCurrentPageSelector = createSelector(_getOpenaireState,
|
|
||||||
(state: OpenaireState) => state.brokerTopic.currentPage
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the total number of OpenAIRE Broker topics.
|
|
||||||
* @function getOpenaireBrokerTopicsTotalsSelector
|
|
||||||
* @return {number}
|
|
||||||
*/
|
|
||||||
export const getOpenaireBrokerTopicsTotalsSelector = createSelector(_getOpenaireState,
|
|
||||||
(state: OpenaireState) => state.brokerTopic.totalElements
|
|
||||||
);
|
|
@@ -1,11 +1,11 @@
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { ResourceType } from '../../core/shared/resource-type';
|
import { ResourceType } from '../../core/shared/resource-type';
|
||||||
import { OpenaireBrokerTopicObject } from '../../core/openaire/broker/models/openaire-broker-topic.model';
|
import { NotificationsBrokerTopicObject } from '../../core/notifications/broker/models/notifications-broker-topic.model';
|
||||||
import { OpenaireBrokerEventObject } from '../../core/openaire/broker/models/openaire-broker-event.model';
|
import { NotificationsBrokerEventObject } from '../../core/notifications/broker/models/notifications-broker-event.model';
|
||||||
import { OpenaireBrokerTopicRestService } from '../../core/openaire/broker/topics/openaire-broker-topic-rest.service';
|
import { NotificationsBrokerTopicRestService } from '../../core/notifications/broker/topics/notifications-broker-topic-rest.service';
|
||||||
import { OpenaireBrokerEventRestService } from '../../core/openaire/broker/events/openaire-broker-event-rest.service';
|
import { NotificationsBrokerEventRestService } from '../../core/notifications/broker/events/notifications-broker-event-rest.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
import { OpenaireStateService } from '../../openaire/openaire-state.service';
|
import { NotificationsStateService } from '../../notifications/notifications-state.service';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import {
|
import {
|
||||||
createNoContentRemoteDataObject$,
|
createNoContentRemoteDataObject$,
|
||||||
@@ -1210,7 +1210,7 @@ export const ItemMockPid10: Item = Object.assign(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const OpenaireMockDspaceObject: SearchResult<DSpaceObject> = Object.assign(
|
export const NotificationsMockDspaceObject: SearchResult<DSpaceObject> = Object.assign(
|
||||||
new SearchResult<DSpaceObject>(),
|
new SearchResult<DSpaceObject>(),
|
||||||
{
|
{
|
||||||
handle: '10713/29832',
|
handle: '10713/29832',
|
||||||
@@ -1332,7 +1332,7 @@ export const OpenaireMockDspaceObject: SearchResult<DSpaceObject> = Object.assig
|
|||||||
// Topics
|
// Topics
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMorePid: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMorePid: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MORE!PID',
|
id: 'ENRICH!MORE!PID',
|
||||||
name: 'ENRICH/MORE/PID',
|
name: 'ENRICH/MORE/PID',
|
||||||
@@ -1345,7 +1345,7 @@ export const openaireBrokerTopicObjectMorePid: OpenaireBrokerTopicObject = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMoreAbstract: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMoreAbstract: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MORE!ABSTRACT',
|
id: 'ENRICH!MORE!ABSTRACT',
|
||||||
name: 'ENRICH/MORE/ABSTRACT',
|
name: 'ENRICH/MORE/ABSTRACT',
|
||||||
@@ -1358,7 +1358,7 @@ export const openaireBrokerTopicObjectMoreAbstract: OpenaireBrokerTopicObject =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMissingPid: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMissingPid: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MISSING!PID',
|
id: 'ENRICH!MISSING!PID',
|
||||||
name: 'ENRICH/MISSING/PID',
|
name: 'ENRICH/MISSING/PID',
|
||||||
@@ -1371,7 +1371,7 @@ export const openaireBrokerTopicObjectMissingPid: OpenaireBrokerTopicObject = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMissingAbstract: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMissingAbstract: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MISSING!ABSTRACT',
|
id: 'ENRICH!MISSING!ABSTRACT',
|
||||||
name: 'ENRICH/MISSING/ABSTRACT',
|
name: 'ENRICH/MISSING/ABSTRACT',
|
||||||
@@ -1384,7 +1384,7 @@ export const openaireBrokerTopicObjectMissingAbstract: OpenaireBrokerTopicObject
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMissingAcm: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMissingAcm: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MISSING!SUBJECT!ACM',
|
id: 'ENRICH!MISSING!SUBJECT!ACM',
|
||||||
name: 'ENRICH/MISSING/SUBJECT/ACM',
|
name: 'ENRICH/MISSING/SUBJECT/ACM',
|
||||||
@@ -1397,7 +1397,7 @@ export const openaireBrokerTopicObjectMissingAcm: OpenaireBrokerTopicObject = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerTopicObjectMissingProject: OpenaireBrokerTopicObject = {
|
export const notificationsBrokerTopicObjectMissingProject: NotificationsBrokerTopicObject = {
|
||||||
type: new ResourceType('nbtopic'),
|
type: new ResourceType('nbtopic'),
|
||||||
id: 'ENRICH!MISSING!PROJECT',
|
id: 'ENRICH!MISSING!PROJECT',
|
||||||
name: 'ENRICH/MISSING/PROJECT',
|
name: 'ENRICH/MISSING/PROJECT',
|
||||||
@@ -1413,7 +1413,7 @@ export const openaireBrokerTopicObjectMissingProject: OpenaireBrokerTopicObject
|
|||||||
// Events
|
// Events
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174001',
|
id: '123e4567-e89b-12d3-a456-426614174001',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174001',
|
uuid: '123e4567-e89b-12d3-a456-426614174001',
|
||||||
type: new ResourceType('nbevent'),
|
type: new ResourceType('nbevent'),
|
||||||
@@ -1449,10 +1449,10 @@ export const openaireBrokerEventObjectMissingPid: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid2: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid2: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174004',
|
id: '123e4567-e89b-12d3-a456-426614174004',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174004',
|
uuid: '123e4567-e89b-12d3-a456-426614174004',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/21486',
|
originalId: 'oai:www.openstarts.units.it:10077/21486',
|
||||||
title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI',
|
title: 'UNA NUOVA RILETTURA DELL\u0027 ARISTOTELE DI FRANZ BRENTANO ALLA LUCE DI ALCUNI INEDITI',
|
||||||
trust: 1.0,
|
trust: 1.0,
|
||||||
@@ -1485,10 +1485,10 @@ export const openaireBrokerEventObjectMissingPid2: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid3: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid3: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174005',
|
id: '123e4567-e89b-12d3-a456-426614174005',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174005',
|
uuid: '123e4567-e89b-12d3-a456-426614174005',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/554',
|
originalId: 'oai:www.openstarts.units.it:10077/554',
|
||||||
title: 'Sustainable development',
|
title: 'Sustainable development',
|
||||||
trust: 0.375,
|
trust: 0.375,
|
||||||
@@ -1521,10 +1521,10 @@ export const openaireBrokerEventObjectMissingPid3: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid4: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid4: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174006',
|
id: '123e4567-e89b-12d3-a456-426614174006',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174006',
|
uuid: '123e4567-e89b-12d3-a456-426614174006',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/10787',
|
originalId: 'oai:www.openstarts.units.it:10077/10787',
|
||||||
title: 'Reply to Critics',
|
title: 'Reply to Critics',
|
||||||
trust: 1.0,
|
trust: 1.0,
|
||||||
@@ -1557,10 +1557,10 @@ export const openaireBrokerEventObjectMissingPid4: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid5: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid5: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174007',
|
id: '123e4567-e89b-12d3-a456-426614174007',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174007',
|
uuid: '123e4567-e89b-12d3-a456-426614174007',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/11339',
|
originalId: 'oai:www.openstarts.units.it:10077/11339',
|
||||||
title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI',
|
title: 'PROGETTAZIONE, SINTESI E VALUTAZIONE DELL\u0027ATTIVITA\u0027 ANTIMICOBATTERICA ED ANTIFUNGINA DI NUOVI DERIVATI ETEROCICLICI',
|
||||||
trust: 0.375,
|
trust: 0.375,
|
||||||
@@ -1593,10 +1593,10 @@ export const openaireBrokerEventObjectMissingPid5: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingPid6: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingPid6: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174008',
|
id: '123e4567-e89b-12d3-a456-426614174008',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174008',
|
uuid: '123e4567-e89b-12d3-a456-426614174008',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/29860',
|
originalId: 'oai:www.openstarts.units.it:10077/29860',
|
||||||
title: 'Donald Davidson',
|
title: 'Donald Davidson',
|
||||||
trust: 0.375,
|
trust: 0.375,
|
||||||
@@ -1629,10 +1629,10 @@ export const openaireBrokerEventObjectMissingPid6: OpenaireBrokerEventObject = {
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingAbstract: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingAbstract: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174009',
|
id: '123e4567-e89b-12d3-a456-426614174009',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174009',
|
uuid: '123e4567-e89b-12d3-a456-426614174009',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/21110',
|
originalId: 'oai:www.openstarts.units.it:10077/21110',
|
||||||
title: 'Missing abstract article',
|
title: 'Missing abstract article',
|
||||||
trust: 0.751,
|
trust: 0.751,
|
||||||
@@ -1665,10 +1665,10 @@ export const openaireBrokerEventObjectMissingAbstract: OpenaireBrokerEventObject
|
|||||||
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
related: observableOf(createSuccessfulRemoteDataObject(ItemMockPid10))
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingProjectFound: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingProjectFound: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174002',
|
id: '123e4567-e89b-12d3-a456-426614174002',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174002',
|
uuid: '123e4567-e89b-12d3-a456-426614174002',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/21838',
|
originalId: 'oai:www.openstarts.units.it:10077/21838',
|
||||||
title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
title: 'Egypt, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
||||||
trust: 1.0,
|
trust: 1.0,
|
||||||
@@ -1701,10 +1701,10 @@ export const openaireBrokerEventObjectMissingProjectFound: OpenaireBrokerEventOb
|
|||||||
related: createSuccessfulRemoteDataObject$(ItemMockPid10)
|
related: createSuccessfulRemoteDataObject$(ItemMockPid10)
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openaireBrokerEventObjectMissingProjectNotFound: OpenaireBrokerEventObject = {
|
export const notificationsBrokerEventObjectMissingProjectNotFound: NotificationsBrokerEventObject = {
|
||||||
id: '123e4567-e89b-12d3-a456-426614174003',
|
id: '123e4567-e89b-12d3-a456-426614174003',
|
||||||
uuid: '123e4567-e89b-12d3-a456-426614174003',
|
uuid: '123e4567-e89b-12d3-a456-426614174003',
|
||||||
type: new ResourceType('openaireBrokerEvent'),
|
type: new ResourceType('notificationsBrokerEvent'),
|
||||||
originalId: 'oai:www.openstarts.units.it:10077/21838',
|
originalId: 'oai:www.openstarts.units.it:10077/21838',
|
||||||
title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
title: 'Morocco, crossroad of translations and literary interweavings (3rd-6th centuries). A reconsideration of earlier Coptic literature',
|
||||||
trust: 1.0,
|
trust: 1.0,
|
||||||
@@ -1741,37 +1741,37 @@ export const openaireBrokerEventObjectMissingProjectNotFound: OpenaireBrokerEven
|
|||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock for [[OpenaireStateService]]
|
* Mock for [[NotificationsStateService]]
|
||||||
*/
|
*/
|
||||||
export function getMockOpenaireStateService(): any {
|
export function getMockNotificationsStateService(): any {
|
||||||
return jasmine.createSpyObj('OpenaireStateService', {
|
return jasmine.createSpyObj('NotificationsStateService', {
|
||||||
getOpenaireBrokerTopics: jasmine.createSpy('getOpenaireBrokerTopics'),
|
getNotificationsBrokerTopics: jasmine.createSpy('getNotificationsBrokerTopics'),
|
||||||
isOpenaireBrokerTopicsLoading: jasmine.createSpy('isOpenaireBrokerTopicsLoading'),
|
isNotificationsBrokerTopicsLoading: jasmine.createSpy('isNotificationsBrokerTopicsLoading'),
|
||||||
isOpenaireBrokerTopicsLoaded: jasmine.createSpy('isOpenaireBrokerTopicsLoaded'),
|
isNotificationsBrokerTopicsLoaded: jasmine.createSpy('isNotificationsBrokerTopicsLoaded'),
|
||||||
isOpenaireBrokerTopicsProcessing: jasmine.createSpy('isOpenaireBrokerTopicsProcessing'),
|
isNotificationsBrokerTopicsProcessing: jasmine.createSpy('isNotificationsBrokerTopicsProcessing'),
|
||||||
getOpenaireBrokerTopicsTotalPages: jasmine.createSpy('getOpenaireBrokerTopicsTotalPages'),
|
getNotificationsBrokerTopicsTotalPages: jasmine.createSpy('getNotificationsBrokerTopicsTotalPages'),
|
||||||
getOpenaireBrokerTopicsCurrentPage: jasmine.createSpy('getOpenaireBrokerTopicsCurrentPage'),
|
getNotificationsBrokerTopicsCurrentPage: jasmine.createSpy('getNotificationsBrokerTopicsCurrentPage'),
|
||||||
getOpenaireBrokerTopicsTotals: jasmine.createSpy('getOpenaireBrokerTopicsTotals'),
|
getNotificationsBrokerTopicsTotals: jasmine.createSpy('getNotificationsBrokerTopicsTotals'),
|
||||||
dispatchRetrieveOpenaireBrokerTopics: jasmine.createSpy('dispatchRetrieveOpenaireBrokerTopics'),
|
dispatchRetrieveNotificationsBrokerTopics: jasmine.createSpy('dispatchRetrieveNotificationsBrokerTopics'),
|
||||||
dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction')
|
dispatchMarkUserSuggestionsAsVisitedAction: jasmine.createSpy('dispatchMarkUserSuggestionsAsVisitedAction')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock for [[OpenaireBrokerTopicRestService]]
|
* Mock for [[NotificationsBrokerTopicRestService]]
|
||||||
*/
|
*/
|
||||||
export function getMockOpenaireBrokerTopicRestService(): OpenaireBrokerTopicRestService {
|
export function getMockNotificationsBrokerTopicRestService(): NotificationsBrokerTopicRestService {
|
||||||
return jasmine.createSpyObj('OpenaireBrokerTopicRestService', {
|
return jasmine.createSpyObj('NotificationsBrokerTopicRestService', {
|
||||||
getTopics: jasmine.createSpy('getTopics'),
|
getTopics: jasmine.createSpy('getTopics'),
|
||||||
getTopic: jasmine.createSpy('getTopic'),
|
getTopic: jasmine.createSpy('getTopic'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock for [[OpenaireBrokerEventRestService]]
|
* Mock for [[NotificationsBrokerEventRestService]]
|
||||||
*/
|
*/
|
||||||
export function getMockOpenaireBrokerEventRestService(): OpenaireBrokerEventRestService {
|
export function getMockNotificationsBrokerEventRestService(): NotificationsBrokerEventRestService {
|
||||||
return jasmine.createSpyObj('OpenaireBrokerEventRestService', {
|
return jasmine.createSpyObj('NotificationsBrokerEventRestService', {
|
||||||
getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
|
getEventsByTopic: jasmine.createSpy('getEventsByTopic'),
|
||||||
getEvent: jasmine.createSpy('getEvent'),
|
getEvent: jasmine.createSpy('getEvent'),
|
||||||
patchEvent: jasmine.createSpy('patchEvent'),
|
patchEvent: jasmine.createSpy('patchEvent'),
|
||||||
@@ -1782,7 +1782,7 @@ export function getMockOpenaireBrokerEventRestService(): OpenaireBrokerEventRest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mock for [[OpenaireBrokerEventRestService]]
|
* Mock for [[NotificationsBrokerEventRestService]]
|
||||||
*/
|
*/
|
||||||
export function getMockSuggestionsService(): any {
|
export function getMockSuggestionsService(): any {
|
||||||
return jasmine.createSpyObj('SuggestionsService', {
|
return jasmine.createSpyObj('SuggestionsService', {
|
@@ -479,13 +479,13 @@
|
|||||||
|
|
||||||
"admin.access-control.groups.form.return": "Back",
|
"admin.access-control.groups.form.return": "Back",
|
||||||
|
|
||||||
"admin.notifications.openairebroker.breadcrumbs": "OpenAIRE Broker",
|
"admin.notifications.broker.breadcrumbs": "Notifications Broker",
|
||||||
|
|
||||||
"admin.notifications.openairebroker.page.title": "OpenAIRE Broker",
|
"admin.notifications.event.breadcrumbs": "Broker Suggestions",
|
||||||
|
|
||||||
"admin.notifications.openaireevent.breadcrumbs": "OpenAIRE Broker Suggestions",
|
"admin.notifications.event.page.title": "Broker Suggestions",
|
||||||
|
|
||||||
"admin.notifications.openaireevent.page.title": "OpenAIRE Broker Suggestions",
|
"admin.notifications.broker.page.title": "Notifications Broker",
|
||||||
|
|
||||||
"admin.search.breadcrumbs": "Administrative Search",
|
"admin.search.breadcrumbs": "Administrative Search",
|
||||||
|
|
||||||
@@ -2544,7 +2544,7 @@
|
|||||||
|
|
||||||
"menu.section.notifications": "Notifications",
|
"menu.section.notifications": "Notifications",
|
||||||
|
|
||||||
"menu.section.notifications_openaire_broker": "OpenAIRE Broker",
|
"menu.section.notifications_broker": "Notifications Broker",
|
||||||
|
|
||||||
"menu.section.notifications_reciter": "Publication Claim",
|
"menu.section.notifications_reciter": "Publication Claim",
|
||||||
|
|
||||||
@@ -2713,125 +2713,125 @@
|
|||||||
|
|
||||||
"none.listelement.badge": "Item",
|
"none.listelement.badge": "Item",
|
||||||
|
|
||||||
"openaire.broker.title": "OpenAIRE Broker",
|
"notifications.broker.title": "{{source}} Broker",
|
||||||
|
|
||||||
"openaire.broker.topics.description": "Below you can see all the topics received from the subscriptions to OpenAIRE.",
|
"notifications.broker.topics.description": "Below you can see all the topics received from the subscriptions to {{source}}.",
|
||||||
|
|
||||||
"openaire.broker.topics": "Current Topics",
|
"notifications.broker.topics": "Current Topics",
|
||||||
|
|
||||||
"openaire.broker.table.topic": "Topic",
|
"notifications.broker.table.topic": "Topic",
|
||||||
|
|
||||||
"openaire.broker.table.last-event": "Last Event",
|
"notifications.broker.table.last-event": "Last Event",
|
||||||
|
|
||||||
"openaire.broker.table.actions": "Actions",
|
"notifications.broker.table.actions": "Actions",
|
||||||
|
|
||||||
"openaire.broker.button.detail": "Show details",
|
"notifications.broker.button.detail": "Show details",
|
||||||
|
|
||||||
"openaire.broker.noTopics": "No topics found.",
|
"notifications.broker.noTopics": "No topics found.",
|
||||||
|
|
||||||
"openaire.broker.topic.error.service.retrieve": "An error occurred while loading the OpenAIRE Broker topics",
|
"notifications.events.title": "{{source}} Broker Suggestions",
|
||||||
|
|
||||||
"openaire.broker.loading": "Loading ...",
|
"notifications.broker.topic.error.service.retrieve": "An error occurred while loading the Notifications Broker topics",
|
||||||
|
|
||||||
"openaire.events.title": "OpenAIRE Broker Suggestions",
|
"notifications.broker.events.description": "Below the list of all the suggestions, received from {{source}}, for the selected topic.",
|
||||||
|
|
||||||
"openaire.broker.events.description": "Below the list of all the suggestions, received from OpenAIRE, for the selected topic.",
|
"notifications.broker.loading": "Loading ...",
|
||||||
|
|
||||||
"openaire.broker.events.topic": "Topic:",
|
"notifications.broker.events.topic": "Topic:",
|
||||||
|
|
||||||
"openaire.broker.noEvents": "No suggestions found.",
|
"notifications.broker.noEvents": "No suggestions found.",
|
||||||
|
|
||||||
"openaire.broker.event.table.trust": "Trust",
|
"notifications.broker.event.table.trust": "Trust",
|
||||||
|
|
||||||
"openaire.broker.event.table.publication": "Publication",
|
"notifications.broker.event.table.publication": "Publication",
|
||||||
|
|
||||||
"openaire.broker.event.table.details": "Details",
|
"notifications.broker.event.table.details": "Details",
|
||||||
|
|
||||||
"openaire.broker.event.table.project-details": "Project details",
|
"notifications.broker.event.table.project-details": "Project details",
|
||||||
|
|
||||||
"openaire.broker.event.table.actions": "Actions",
|
"notifications.broker.event.table.actions": "Actions",
|
||||||
|
|
||||||
"openaire.broker.event.action.accept": "Accept suggestion",
|
"notifications.broker.event.action.accept": "Accept suggestion",
|
||||||
|
|
||||||
"openaire.broker.event.action.ignore": "Ignore suggestion",
|
"notifications.broker.event.action.ignore": "Ignore suggestion",
|
||||||
|
|
||||||
"openaire.broker.event.action.reject": "Reject suggestion",
|
"notifications.broker.event.action.reject": "Reject suggestion",
|
||||||
|
|
||||||
"openaire.broker.event.action.import": "Import project and accept suggestion",
|
"notifications.broker.event.action.import": "Import project and accept suggestion",
|
||||||
|
|
||||||
"openaire.broker.event.table.pidtype": "PID Type:",
|
"notifications.broker.event.table.pidtype": "PID Type:",
|
||||||
|
|
||||||
"openaire.broker.event.table.pidvalue": "PID Value:",
|
"notifications.broker.event.table.pidvalue": "PID Value:",
|
||||||
|
|
||||||
"openaire.broker.event.table.subjectValue": "Subject Value:",
|
"notifications.broker.event.table.subjectValue": "Subject Value:",
|
||||||
|
|
||||||
"openaire.broker.event.table.abstract": "Abstract:",
|
"notifications.broker.event.table.abstract": "Abstract:",
|
||||||
|
|
||||||
"openaire.broker.event.table.suggestedProject": "OpenAIRE Suggested Project data",
|
"notifications.broker.event.table.suggestedProject": "OpenAIRE Suggested Project data",
|
||||||
|
|
||||||
"openaire.broker.event.table.project": "Project title:",
|
"notifications.broker.event.table.project": "Project title:",
|
||||||
|
|
||||||
"openaire.broker.event.table.acronym": "Acronym:",
|
"notifications.broker.event.table.acronym": "Acronym:",
|
||||||
|
|
||||||
"openaire.broker.event.table.code": "Code:",
|
"notifications.broker.event.table.code": "Code:",
|
||||||
|
|
||||||
"openaire.broker.event.table.funder": "Funder:",
|
"notifications.broker.event.table.funder": "Funder:",
|
||||||
|
|
||||||
"openaire.broker.event.table.fundingProgram": "Funding program:",
|
"notifications.broker.event.table.fundingProgram": "Funding program:",
|
||||||
|
|
||||||
"openaire.broker.event.table.jurisdiction": "Jurisdiction:",
|
"notifications.broker.event.table.jurisdiction": "Jurisdiction:",
|
||||||
|
|
||||||
"openaire.broker.events.back": "Back to topics",
|
"notifications.broker.events.back": "Back to topics",
|
||||||
|
|
||||||
"openaire.broker.event.table.less": "Show less",
|
"notifications.broker.event.table.less": "Show less",
|
||||||
|
|
||||||
"openaire.broker.event.table.more": "Show more",
|
"notifications.broker.event.table.more": "Show more",
|
||||||
|
|
||||||
"openaire.broker.event.project.found": "Bound to the local record:",
|
"notifications.broker.event.project.found": "Bound to the local record:",
|
||||||
|
|
||||||
"openaire.broker.event.project.notFound": "No local record found",
|
"notifications.broker.event.project.notFound": "No local record found",
|
||||||
|
|
||||||
"openaire.broker.event.sure": "Are you sure?",
|
"notifications.broker.event.sure": "Are you sure?",
|
||||||
|
|
||||||
"openaire.broker.event.ignore.description": "This operation can't be undone. Ignore this suggestion?",
|
"notifications.broker.event.ignore.description": "This operation can't be undone. Ignore this suggestion?",
|
||||||
|
|
||||||
"openaire.broker.event.reject.description": "This operation can't be undone. Reject this suggestion?",
|
"notifications.broker.event.reject.description": "This operation can't be undone. Reject this suggestion?",
|
||||||
|
|
||||||
"openaire.broker.event.accept.description": "No DSpace project selected. A new project will be created based on the suggestion data.",
|
"notifications.broker.event.accept.description": "No DSpace project selected. A new project will be created based on the suggestion data.",
|
||||||
|
|
||||||
"openaire.broker.event.action.cancel": "Cancel",
|
"notifications.broker.event.action.cancel": "Cancel",
|
||||||
|
|
||||||
"openaire.broker.event.action.saved": "Your decision has been saved successfully.",
|
"notifications.broker.event.action.saved": "Your decision has been saved successfully.",
|
||||||
|
|
||||||
"openaire.broker.event.action.error": "An error has occurred. Your decision has not been saved.",
|
"notifications.broker.event.action.error": "An error has occurred. Your decision has not been saved.",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.title": "Choose a project to bound",
|
"notifications.broker.event.modal.project.title": "Choose a project to bound",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.publication": "Publication:",
|
"notifications.broker.event.modal.project.publication": "Publication:",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.bountToLocal": "Bound to the local record:",
|
"notifications.broker.event.modal.project.bountToLocal": "Bound to the local record:",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.select": "Project search",
|
"notifications.broker.event.modal.project.select": "Project search",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.search": "Search",
|
"notifications.broker.event.modal.project.search": "Search",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.clear": "Clear",
|
"notifications.broker.event.modal.project.clear": "Clear",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.cancel": "Cancel",
|
"notifications.broker.event.modal.project.cancel": "Cancel",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.bound": "Bound project",
|
"notifications.broker.event.modal.project.bound": "Bound project",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.placeholder": "Enter a project name",
|
"notifications.broker.event.modal.project.placeholder": "Enter a project name",
|
||||||
|
|
||||||
"openaire.broker.event.modal.project.notFound": "No project found.",
|
"notifications.broker.event.modal.project.notFound": "No project found.",
|
||||||
|
|
||||||
"openaire.broker.event.project.bounded": "The project has been linked successfully.",
|
"notifications.broker.event.project.bounded": "The project has been linked successfully.",
|
||||||
|
|
||||||
"openaire.broker.event.project.removed": "The project has been successfully unlinked.",
|
"notifications.broker.event.project.removed": "The project has been successfully unlinked.",
|
||||||
|
|
||||||
"openaire.broker.event.project.error": "An error has occurred. No operation performed.",
|
"notifications.broker.event.project.error": "An error has occurred. No operation performed.",
|
||||||
|
|
||||||
"openaire.broker.event.reason": "Reason",
|
"notifications.broker.event.reason": "Reason",
|
||||||
|
|
||||||
|
|
||||||
"orgunit.listelement.badge": "Organizational Unit",
|
"orgunit.listelement.badge": "Organizational Unit",
|
||||||
|
Reference in New Issue
Block a user