mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
Autofix lint issues
This commit is contained in:
@@ -4,18 +4,16 @@ import { RouterModule } from '@angular/router';
|
||||
import { AuthenticatedGuard } from '../../core/auth/authenticated.guard';
|
||||
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
|
||||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { QualityAssuranceBreadcrumbResolver } from '../../core/breadcrumbs/quality-assurance-breadcrumb.resolver';
|
||||
import { QualityAssuranceBreadcrumbService } from '../../core/breadcrumbs/quality-assurance-breadcrumb.service';
|
||||
import {
|
||||
SourceDataResolver
|
||||
} from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver';
|
||||
import { QUALITY_ASSURANCE_EDIT_PATH } from './admin-notifications-routing-paths';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceEventsPageResolver } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.resolver';
|
||||
import { SourceDataResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-data.resolver';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import { AdminQualityAssuranceSourcePageResolver } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceTopicsPageResolver } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -27,13 +25,13 @@ import {
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||
openaireQualityAssuranceTopicsParams: AdminQualityAssuranceTopicsPageResolver
|
||||
openaireQualityAssuranceTopicsParams: AdminQualityAssuranceTopicsPageResolver,
|
||||
},
|
||||
data: {
|
||||
title: 'admin.quality-assurance.page.title',
|
||||
breadcrumbKey: 'admin.quality-assurance',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
showBreadcrumbsFluid: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
@@ -43,13 +41,13 @@ import {
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
openaireQualityAssuranceSourceParams: AdminQualityAssuranceSourcePageResolver,
|
||||
sourceData: SourceDataResolver
|
||||
sourceData: SourceDataResolver,
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.source.breadcrumbs',
|
||||
breadcrumbKey: 'admin.notifications.source',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
showBreadcrumbsFluid: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
canActivate: [ AuthenticatedGuard ],
|
||||
@@ -58,15 +56,15 @@ import {
|
||||
pathMatch: 'full',
|
||||
resolve: {
|
||||
breadcrumb: QualityAssuranceBreadcrumbResolver,
|
||||
openaireQualityAssuranceEventsParams: AdminQualityAssuranceEventsPageResolver
|
||||
openaireQualityAssuranceEventsParams: AdminQualityAssuranceEventsPageResolver,
|
||||
},
|
||||
data: {
|
||||
title: 'admin.notifications.event.page.title',
|
||||
breadcrumbKey: 'admin.notifications.event',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
}
|
||||
])
|
||||
showBreadcrumbsFluid: false,
|
||||
},
|
||||
},
|
||||
]),
|
||||
],
|
||||
providers: [
|
||||
I18nBreadcrumbResolver,
|
||||
@@ -76,8 +74,8 @@ import {
|
||||
AdminQualityAssuranceEventsPageResolver,
|
||||
AdminQualityAssuranceSourcePageResolver,
|
||||
QualityAssuranceBreadcrumbResolver,
|
||||
QualityAssuranceBreadcrumbService
|
||||
]
|
||||
QualityAssuranceBreadcrumbService,
|
||||
],
|
||||
})
|
||||
/**
|
||||
* Routing module for the Notifications section of the admin sidebar
|
||||
|
@@ -1,12 +1,13 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { CoreModule } from '../../core/core.module';
|
||||
import { NotificationsModule } from '../../notifications/notifications.module';
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { AdminNotificationsRoutingModule } from './admin-notifications-routing.module';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page/admin-quality-assurance-events-page.component';
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page-component/admin-quality-assurance-source-page.component';
|
||||
import {NotificationsModule} from '../../notifications/notifications.module';
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page/admin-quality-assurance-topics-page.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -14,14 +15,14 @@ import {NotificationsModule} from '../../notifications/notifications.module';
|
||||
SharedModule,
|
||||
CoreModule.forRoot(),
|
||||
AdminNotificationsRoutingModule,
|
||||
NotificationsModule
|
||||
NotificationsModule,
|
||||
],
|
||||
declarations: [
|
||||
AdminQualityAssuranceTopicsPageComponent,
|
||||
AdminQualityAssuranceEventsPageComponent,
|
||||
AdminQualityAssuranceSourcePageComponent
|
||||
AdminQualityAssuranceSourcePageComponent,
|
||||
],
|
||||
entryComponents: []
|
||||
entryComponents: [],
|
||||
})
|
||||
/**
|
||||
* This module handles all components related to the notifications pages
|
||||
|
@@ -1,5 +1,10 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
async,
|
||||
ComponentFixture,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { AdminQualityAssuranceEventsPageComponent } from './admin-quality-assurance-events-page.component';
|
||||
|
||||
describe('AdminQualityAssuranceEventsPageComponent', () => {
|
||||
@@ -9,9 +14,9 @@ describe('AdminQualityAssuranceEventsPageComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceEventsPageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -5,7 +5,7 @@ import { Component } from '@angular/core';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-quality-assurance-events-page',
|
||||
templateUrl: './admin-quality-assurance-events-page.component.html'
|
||||
templateUrl: './admin-quality-assurance-events-page.component.html',
|
||||
})
|
||||
export class AdminQualityAssuranceEventsPageComponent {
|
||||
|
||||
|
@@ -1,5 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
@@ -26,7 +30,7 @@ export class AdminQualityAssuranceEventsPageResolver implements Resolve<AdminQua
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
currentPage: parseInt(route.queryParams.page, 10),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot, Router } from '@angular/router';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
Router,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceSourceService } from '../../../notifications/qa/source/quality-assurance-source.service';
|
||||
import {environment} from '../../../../environments/environment';
|
||||
/**
|
||||
* This class represents a resolver that retrieve the route data before the route is activated.
|
||||
*/
|
||||
@@ -16,9 +22,9 @@ export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSo
|
||||
* Initialize the effect class variables.
|
||||
* @param {QualityAssuranceSourceService} qualityAssuranceSourceService
|
||||
*/
|
||||
constructor(
|
||||
constructor(
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
) { }
|
||||
/**
|
||||
* Method for resolving the parameters in the current route.
|
||||
@@ -28,12 +34,12 @@ export class SourceDataResolver implements Resolve<Observable<QualityAssuranceSo
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<QualityAssuranceSourceObject[]> {
|
||||
return this.qualityAssuranceSourceService.getSources(this.pageSize, 0).pipe(
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
|
||||
if (sources.page.length === 1) {
|
||||
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
|
||||
}
|
||||
return sources.page;
|
||||
}));
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) => {
|
||||
if (sources.page.length === 1) {
|
||||
this.router.navigate([this.getResolvedUrl(route) + '/' + sources.page[0].id]);
|
||||
}
|
||||
return sources.page;
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
@@ -26,7 +30,7 @@ export class AdminQualityAssuranceSourcePageResolver implements Resolve<AdminQua
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
currentPage: parseInt(route.queryParams.page, 10),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
ComponentFixture,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assurance-source-page.component';
|
||||
|
||||
@@ -10,9 +13,9 @@ describe('AdminQualityAssuranceSourcePageComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceSourcePageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -1,5 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
|
||||
/**
|
||||
* Interface for the route parameters.
|
||||
@@ -26,7 +30,7 @@ export class AdminQualityAssuranceTopicsPageResolver implements Resolve<AdminQua
|
||||
return {
|
||||
pageId: route.queryParams.pageId,
|
||||
pageSize: parseInt(route.queryParams.pageSize, 10),
|
||||
currentPage: parseInt(route.queryParams.page, 10)
|
||||
currentPage: parseInt(route.queryParams.page, 10),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,10 @@
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
async,
|
||||
ComponentFixture,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { AdminQualityAssuranceTopicsPageComponent } from './admin-quality-assurance-topics-page.component';
|
||||
|
||||
describe('AdminQualityAssuranceTopicsPageComponent', () => {
|
||||
@@ -9,9 +14,9 @@ describe('AdminQualityAssuranceTopicsPageComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AdminQualityAssuranceTopicsPageComponent ],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -5,7 +5,7 @@ import { Component } from '@angular/core';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-notification-qa-page',
|
||||
templateUrl: './admin-quality-assurance-topics-page.component.html'
|
||||
templateUrl: './admin-quality-assurance-topics-page.component.html',
|
||||
})
|
||||
export class AdminQualityAssuranceTopicsPageComponent {
|
||||
|
||||
|
@@ -7,8 +7,8 @@ import { AdminCurationTasksComponent } from './admin-curation-tasks/admin-curati
|
||||
import { BatchImportPageComponent } from './admin-import-batch-page/batch-import-page.component';
|
||||
import { MetadataImportPageComponent } from './admin-import-metadata-page/metadata-import-page.component';
|
||||
import {
|
||||
NOTIFICATIONS_MODULE_PATH,
|
||||
REGISTRIES_MODULE_PATH,
|
||||
NOTIFICATIONS_MODULE_PATH
|
||||
} from './admin-routing-paths';
|
||||
import { AdminSearchPageComponent } from './admin-search-page/admin-search-page.component';
|
||||
import { AdminWorkflowPageComponent } from './admin-workflow-page/admin-workflow-page.component';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import {QualityAssuranceBreadcrumbResolver} from './quality-assurance-breadcrumb.resolver';
|
||||
import { QualityAssuranceBreadcrumbResolver } from './quality-assurance-breadcrumb.resolver';
|
||||
|
||||
describe('QualityAssuranceBreadcrumbResolver', () => {
|
||||
describe('resolve', () => {
|
||||
@@ -15,15 +15,15 @@ describe('QualityAssuranceBreadcrumbResolver', () => {
|
||||
return this[param];
|
||||
},
|
||||
sourceId: 'testSourceId',
|
||||
topicId: 'testTopicId'
|
||||
}
|
||||
topicId: 'testTopicId',
|
||||
},
|
||||
};
|
||||
qualityAssuranceBreadcrumbService = {};
|
||||
resolver = new QualityAssuranceBreadcrumbResolver(qualityAssuranceBreadcrumbService);
|
||||
});
|
||||
|
||||
it('should resolve the breadcrumb config', () => {
|
||||
const resolvedConfig = resolver.resolve(route as any, {url: fullPath + 'testSourceId'} as any);
|
||||
const resolvedConfig = resolver.resolve(route as any, { url: fullPath + 'testSourceId' } as any);
|
||||
const expectedConfig = { provider: qualityAssuranceBreadcrumbService, key: expectedKey, url: fullPath };
|
||||
expect(resolvedConfig).toEqual(expectedConfig);
|
||||
});
|
||||
|
@@ -1,10 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {QualityAssuranceBreadcrumbService} from './quality-assurance-breadcrumb.service';
|
||||
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
|
||||
import {BreadcrumbConfig} from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
Resolve,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
|
||||
import { BreadcrumbConfig } from '../../breadcrumbs/breadcrumb/breadcrumb-config.model';
|
||||
import { QualityAssuranceBreadcrumbService } from './quality-assurance-breadcrumb.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class QualityAssuranceBreadcrumbResolver implements Resolve<BreadcrumbConfig<string>> {
|
||||
constructor(protected breadcrumbService: QualityAssuranceBreadcrumbService) {}
|
||||
|
@@ -1,7 +1,11 @@
|
||||
import { TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import {
|
||||
TestBed,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import {QualityAssuranceBreadcrumbService} from './quality-assurance-breadcrumb.service';
|
||||
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { QualityAssuranceBreadcrumbService } from './quality-assurance-breadcrumb.service';
|
||||
|
||||
describe('QualityAssuranceBreadcrumbService', () => {
|
||||
let service: QualityAssuranceBreadcrumbService;
|
||||
@@ -33,7 +37,7 @@ describe('QualityAssuranceBreadcrumbService', () => {
|
||||
it('should return a breadcrumb based on a string', () => {
|
||||
const breadcrumbs = service.getBreadcrumbs(exampleString, exampleURL);
|
||||
getTestScheduler().expectObservable(breadcrumbs).toBe('(a|)', { a: [new Breadcrumb(exampleQaKey, exampleURL),
|
||||
new Breadcrumb(exampleString, exampleURL + exampleString)]
|
||||
new Breadcrumb(exampleString, exampleURL + exampleString)],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,11 +1,15 @@
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { BreadcrumbsProviderService } from './breadcrumbsProviderService';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
Observable,
|
||||
of as observableOf,
|
||||
} from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { Breadcrumb } from '../../breadcrumbs/breadcrumb/breadcrumb.model';
|
||||
import { QualityAssuranceTopicDataService } from '../notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { getFirstCompletedRemoteData } from '../shared/operators';
|
||||
import { BreadcrumbsProviderService } from './breadcrumbsProviderService';
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +17,7 @@ import { QualityAssuranceTopicDataService } from '../notifications/qa/topics/qua
|
||||
* Service to calculate QA breadcrumbs for a single part of the route
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class QualityAssuranceBreadcrumbService implements BreadcrumbsProviderService<string> {
|
||||
|
||||
@@ -39,10 +43,10 @@ export class QualityAssuranceBreadcrumbService implements BreadcrumbsProviderSer
|
||||
return this.qualityAssuranceService.getTopic(topicId).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((topic) => {
|
||||
return [new Breadcrumb(this.translationService.instant(this.QUALITY_ASSURANCE_BREADCRUMB_KEY), url),
|
||||
new Breadcrumb(sourceId, `${url}${sourceId}`),
|
||||
new Breadcrumb(topicId, undefined)];
|
||||
})
|
||||
return [new Breadcrumb(this.translationService.instant(this.QUALITY_ASSURANCE_BREADCRUMB_KEY), url),
|
||||
new Breadcrumb(sourceId, `${url}${sourceId}`),
|
||||
new Breadcrumb(topicId, undefined)];
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
return observableOf([new Breadcrumb(this.translationService.instant(this.QUALITY_ASSURANCE_BREADCRUMB_KEY), url),
|
||||
|
@@ -1,8 +1,17 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import {
|
||||
ModuleWithProviders,
|
||||
NgModule,
|
||||
Optional,
|
||||
SkipSelf,
|
||||
} from '@angular/core';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
import { Action, StoreConfig, StoreModule } from '@ngrx/store';
|
||||
import {
|
||||
Action,
|
||||
StoreConfig,
|
||||
StoreModule,
|
||||
} from '@ngrx/store';
|
||||
|
||||
import { environment } from '../../environments/environment';
|
||||
import { storeModuleConfig } from '../app.reducer';
|
||||
@@ -14,7 +23,11 @@ import { isNotEmpty } from '../shared/empty.util';
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
import { EndpointMockingRestService } from '../shared/mocks/dspace-rest/endpoint-mocking-rest.service';
|
||||
import { MOCK_RESPONSE_MAP, mockResponseMap, ResponseMapMock } from '../shared/mocks/dspace-rest/mocks/response-map.mock';
|
||||
import {
|
||||
MOCK_RESPONSE_MAP,
|
||||
mockResponseMap,
|
||||
ResponseMapMock,
|
||||
} from '../shared/mocks/dspace-rest/mocks/response-map.mock';
|
||||
import { NotificationsService } from '../shared/notifications/notifications.service';
|
||||
import { AccessStatusObject } from '../shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { IdentifierData } from '../shared/object-list/identifier-data/identifier-data.model';
|
||||
@@ -94,6 +107,9 @@ import { JsonPatchOperationsBuilder } from './json-patch/builder/json-patch-oper
|
||||
import { MetadataService } from './metadata/metadata.service';
|
||||
import { MetadataField } from './metadata/metadata-field.model';
|
||||
import { MetadataSchema } from './metadata/metadata-schema.model';
|
||||
import { QualityAssuranceEventObject } from './notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceSourceObject } from './notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceTopicObject } from './notifications/qa/models/quality-assurance-topic.model';
|
||||
import { OrcidHistory } from './orcid/model/orcid-history.model';
|
||||
import { OrcidQueue } from './orcid/model/orcid-queue.model';
|
||||
import { OrcidAuthService } from './orcid/orcid-auth.service';
|
||||
@@ -108,7 +124,10 @@ import { ResourcePolicyDataService } from './resource-policy/resource-policy-dat
|
||||
import { RoleService } from './roles/role.service';
|
||||
import { LinkHeadService } from './services/link-head.service';
|
||||
import { ServerResponseService } from './services/server-response.service';
|
||||
import { NativeWindowFactory, NativeWindowService } from './services/window.service';
|
||||
import {
|
||||
NativeWindowFactory,
|
||||
NativeWindowService,
|
||||
} from './services/window.service';
|
||||
import { Authorization } from './shared/authorization.model';
|
||||
import { Bitstream } from './shared/bitstream.model';
|
||||
import { BitstreamFormat } from './shared/bitstream-format.model';
|
||||
@@ -173,9 +192,6 @@ import { TaskObject } from './tasks/models/task-object.model';
|
||||
import { WorkflowAction } from './tasks/models/workflow-action-object.model';
|
||||
import { PoolTaskDataService } from './tasks/pool-task-data.service';
|
||||
import { TaskResponseParsingService } from './tasks/task-response-parsing.service';
|
||||
import { QualityAssuranceTopicObject } from './notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceEventObject } from './notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceSourceObject } from './notifications/qa/models/quality-assurance-source.model';
|
||||
|
||||
/**
|
||||
* When not in production, endpoint responses can be mocked for testing purposes
|
||||
|
@@ -1,27 +1,29 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
import {
|
||||
cold,
|
||||
getTestScheduler,
|
||||
} from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceEventDataService } from './quality-assurance-event-data.service';
|
||||
import {
|
||||
qualityAssuranceEventObjectMissingPid,
|
||||
qualityAssuranceEventObjectMissingPid2,
|
||||
qualityAssuranceEventObjectMissingProjectFound
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { QualityAssuranceEventDataService } from './quality-assurance-event-data.service';
|
||||
|
||||
describe('QualityAssuranceEventDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
@@ -54,8 +56,8 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
{
|
||||
path: '/status',
|
||||
op: 'replace',
|
||||
value: status
|
||||
}
|
||||
value: status,
|
||||
},
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -69,7 +71,7 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
send: true,
|
||||
removeByHrefSubstring: {},
|
||||
getByHref: jasmine.createSpy('getByHref'),
|
||||
getByUUID: jasmine.createSpy('getByUUID')
|
||||
getByUUID: jasmine.createSpy('getByUUID'),
|
||||
});
|
||||
|
||||
responseCacheEntryB = new RequestEntry();
|
||||
@@ -82,18 +84,18 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaEventObjectRD
|
||||
a: qaEventObjectRD,
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
}),
|
||||
buildFromRequestUUID: jasmine.createSpy('buildFromRequestUUID'),
|
||||
buildFromRequestUUIDAndAwait: jasmine.createSpy('buildFromRequestUUIDAndAwait')
|
||||
buildFromRequestUUIDAndAwait: jasmine.createSpy('buildFromRequestUUIDAndAwait'),
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
getEndpoint: cold('a|', { a: endpointURL }),
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
@@ -106,7 +108,7 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService,
|
||||
comparator
|
||||
comparator,
|
||||
);
|
||||
|
||||
serviceASAny = service;
|
||||
@@ -130,9 +132,9 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
searchParams: [
|
||||
{
|
||||
fieldName: 'topic',
|
||||
fieldValue: topic
|
||||
}
|
||||
]
|
||||
fieldValue: topic,
|
||||
},
|
||||
],
|
||||
};
|
||||
service.getEventsByTopic(topic);
|
||||
expect(serviceASAny.searchData.searchBy).toHaveBeenCalledWith('findByTopic', options, true, true);
|
||||
@@ -141,7 +143,7 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceEventObject>> for the object with the given Topic', () => {
|
||||
const result = service.getEventsByTopic(topic);
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -158,14 +160,14 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
service.getEvent(qualityAssuranceEventObjectMissingPid.id).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.findById).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid.id, true, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RemoteData for the object with the given URL', () => {
|
||||
const result = service.getEvent(qualityAssuranceEventObjectMissingPid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaEventObjectRD
|
||||
a: qaEventObjectRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -183,14 +185,14 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
service.patchEvent(status, qualityAssuranceEventObjectMissingPid).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.patchData.patch).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingPid, operation);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RemoteData with HTTP 200', () => {
|
||||
const result = service.patchEvent(status, qualityAssuranceEventObjectMissingPid);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid)
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingPid),
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -207,14 +209,14 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.postOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RestResponse with HTTP 201', () => {
|
||||
const result = service.boundProject(qualityAssuranceEventObjectMissingProjectFound.id, requestUUID);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound)
|
||||
a: createSuccessfulRemoteDataObject(qualityAssuranceEventObjectMissingProjectFound),
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -231,14 +233,14 @@ describe('QualityAssuranceEventDataService', () => {
|
||||
service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id).subscribe(
|
||||
(res) => {
|
||||
expect(serviceASAny.deleteOnRelated).toHaveBeenCalledWith(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should return a RestResponse with HTTP 204', () => {
|
||||
const result = service.removeProject(qualityAssuranceEventObjectMissingProjectFound.id);
|
||||
const expected = cold('(a|)', {
|
||||
a: createSuccessfulRemoteDataObject({})
|
||||
a: createSuccessfulRemoteDataObject({}),
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
|
@@ -1,30 +1,47 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { find, take } from 'rxjs/operators';
|
||||
import { ReplaceOperation } from 'fast-json-patch';
|
||||
import { Observable } from 'rxjs';
|
||||
import {
|
||||
find,
|
||||
take,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { hasValue } from '../../../../shared/empty.util';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import {
|
||||
CreateData,
|
||||
CreateDataImpl,
|
||||
} from '../../../data/base/create-data';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import {
|
||||
DeleteData,
|
||||
DeleteDataImpl,
|
||||
} from '../../../data/base/delete-data';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import {
|
||||
PatchData,
|
||||
PatchDataImpl,
|
||||
} from '../../../data/base/patch-data';
|
||||
import {
|
||||
SearchData,
|
||||
SearchDataImpl,
|
||||
} from '../../../data/base/search-data';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import {
|
||||
DeleteByIDRequest,
|
||||
PostRequest,
|
||||
} from '../../../data/request.models';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NoContent } from '../../../shared/NoContent.model';
|
||||
import { QualityAssuranceEventObject } from '../models/quality-assurance-event.model';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from '../models/quality-assurance-event-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { NoContent } from '../../../shared/NoContent.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { CreateData, CreateDataImpl } from '../../../data/base/create-data';
|
||||
import { PatchData, PatchDataImpl } from '../../../data/base/patch-data';
|
||||
import { DeleteData, DeleteDataImpl } from '../../../data/base/delete-data';
|
||||
import { SearchData, SearchDataImpl } from '../../../data/base/search-data';
|
||||
import { DefaultChangeAnalyzer } from '../../../data/default-change-analyzer.service';
|
||||
import { hasValue } from '../../../../shared/empty.util';
|
||||
import { DeleteByIDRequest, PostRequest } from '../../../data/request.models';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
@@ -53,7 +70,7 @@ export class QualityAssuranceEventDataService extends IdentifiableDataService<Qu
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceEventObject>
|
||||
protected comparator: DefaultChangeAnalyzer<QualityAssuranceEventObject>,
|
||||
) {
|
||||
super('qualityassuranceevents', requestService, rdbService, objectCache, halService);
|
||||
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
|
||||
@@ -78,8 +95,8 @@ export class QualityAssuranceEventDataService extends IdentifiableDataService<Qu
|
||||
options.searchParams = [
|
||||
{
|
||||
fieldName: 'topic',
|
||||
fieldValue: topic
|
||||
}
|
||||
fieldValue: topic,
|
||||
},
|
||||
];
|
||||
return this.searchData.searchBy('findByTopic', options, true, true, ...linksToFollow);
|
||||
}
|
||||
@@ -122,8 +139,8 @@ export class QualityAssuranceEventDataService extends IdentifiableDataService<Qu
|
||||
{
|
||||
path: '/status',
|
||||
op: 'replace',
|
||||
value: status
|
||||
}
|
||||
value: status,
|
||||
},
|
||||
];
|
||||
return this.patchData.patch(dso, operation);
|
||||
}
|
||||
@@ -189,7 +206,7 @@ export class QualityAssuranceEventDataService extends IdentifiableDataService<Qu
|
||||
const hrefObs = this.getIDHrefObs(objectId);
|
||||
|
||||
hrefObs.pipe(
|
||||
take(1)
|
||||
take(1),
|
||||
).subscribe((href: string) => {
|
||||
const request = new PostRequest(requestId, href + '/related?item=' + relatedItemId, body);
|
||||
if (hasValue(this.responseMsToLive)) {
|
||||
|
@@ -1,15 +1,23 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import {
|
||||
autoserialize,
|
||||
autoserializeAs,
|
||||
deserialize,
|
||||
} from 'cerialize';
|
||||
import { Observable } from 'rxjs';
|
||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from './quality-assurance-event-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
|
||||
import {
|
||||
link,
|
||||
typedObject,
|
||||
} from '../../../cache/builders/build-decorators';
|
||||
import { CacheableObject } from '../../../cache/cacheable-object.model';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { Item } from '../../../shared/item.model';
|
||||
import { ITEM } from '../../../shared/item.resource-type';
|
||||
import { link, typedObject } from '../../../cache/builders/build-decorators';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { QUALITY_ASSURANCE_EVENT_OBJECT } from './quality-assurance-event-object.resource-type';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance event message
|
||||
@@ -94,62 +102,62 @@ export class QualityAssuranceEventObject implements CacheableObject {
|
||||
* The Quality Assurance event uuid inside DSpace
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The universally unique identifier of this Quality Assurance event
|
||||
*/
|
||||
@autoserializeAs(String, 'id')
|
||||
uuid: string;
|
||||
uuid: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance event original id (ex.: the source archive OAI-PMH identifier)
|
||||
*/
|
||||
@autoserialize
|
||||
originalId: string;
|
||||
originalId: string;
|
||||
|
||||
/**
|
||||
* The title of the article to which the suggestion refers
|
||||
*/
|
||||
@autoserialize
|
||||
title: string;
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Reliability of the suggestion (of the data inside 'message')
|
||||
*/
|
||||
@autoserialize
|
||||
trust: number;
|
||||
trust: number;
|
||||
|
||||
/**
|
||||
* The timestamp Quality Assurance event was saved in DSpace
|
||||
*/
|
||||
@autoserialize
|
||||
eventDate: string;
|
||||
eventDate: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance event status (ACCEPTED, REJECTED, DISCARDED, PENDING)
|
||||
*/
|
||||
@autoserialize
|
||||
status: string;
|
||||
status: string;
|
||||
|
||||
/**
|
||||
* The suggestion data. Data may vary depending on the source
|
||||
*/
|
||||
@autoserialize
|
||||
message: SourceQualityAssuranceEventMessageObject;
|
||||
message: SourceQualityAssuranceEventMessageObject;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
_links: {
|
||||
self: HALLink,
|
||||
target: HALLink,
|
||||
related: HALLink
|
||||
@@ -160,12 +168,12 @@ export class QualityAssuranceEventObject implements CacheableObject {
|
||||
* Will be undefined unless the {@item HALLink} has been resolved.
|
||||
*/
|
||||
@link(ITEM)
|
||||
target?: Observable<RemoteData<Item>>;
|
||||
target?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The related project for this Event
|
||||
* Will be undefined unless the {@related HALLink} has been resolved.
|
||||
*/
|
||||
@link(ITEM)
|
||||
related?: Observable<RemoteData<Item>>;
|
||||
related?: Observable<RemoteData<Item>>;
|
||||
}
|
||||
|
@@ -1,11 +1,14 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
import {
|
||||
autoserialize,
|
||||
deserialize,
|
||||
} from 'cerialize';
|
||||
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { typedObject } from '../../../cache/builders/build-decorators';
|
||||
import { CacheableObject } from '../../../cache/cacheable-object.model';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { QUALITY_ASSURANCE_SOURCE_OBJECT } from './quality-assurance-source-object.resource-type';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance source model
|
||||
@@ -21,32 +24,32 @@ export class QualityAssuranceSourceObject implements CacheableObject {
|
||||
* The Quality Assurance source id
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The date of the last udate from Notifications
|
||||
*/
|
||||
@autoserialize
|
||||
lastEvent: string;
|
||||
lastEvent: string;
|
||||
|
||||
/**
|
||||
* The total number of suggestions provided by Notifications for this source
|
||||
*/
|
||||
@autoserialize
|
||||
totalEvents: number;
|
||||
totalEvents: number;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
_links: {
|
||||
self: HALLink,
|
||||
};
|
||||
}
|
||||
|
@@ -1,11 +1,14 @@
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
import {
|
||||
autoserialize,
|
||||
deserialize,
|
||||
} from 'cerialize';
|
||||
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from './quality-assurance-topic-object.resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { typedObject } from '../../../cache/builders/build-decorators';
|
||||
import {CacheableObject} from '../../../cache/cacheable-object.model';
|
||||
import { CacheableObject } from '../../../cache/cacheable-object.model';
|
||||
import { HALLink } from '../../../shared/hal-link.model';
|
||||
import { ResourceType } from '../../../shared/resource-type';
|
||||
import { excludeFromEquals } from '../../../utilities/equals.decorators';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from './quality-assurance-topic-object.resource-type';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance topic model
|
||||
@@ -21,38 +24,38 @@ export class QualityAssuranceTopicObject implements CacheableObject {
|
||||
* The Quality Assurance topic id
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The Quality Assurance topic name to display
|
||||
*/
|
||||
@autoserialize
|
||||
name: string;
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The date of the last udate from Notifications
|
||||
*/
|
||||
@autoserialize
|
||||
lastEvent: string;
|
||||
lastEvent: string;
|
||||
|
||||
/**
|
||||
* The total number of suggestions provided by Notifications for this topic
|
||||
*/
|
||||
@autoserialize
|
||||
totalEvents: number;
|
||||
totalEvents: number;
|
||||
|
||||
/**
|
||||
* The type of this ConfigObject
|
||||
*/
|
||||
@excludeFromEquals
|
||||
@autoserialize
|
||||
type: ResourceType;
|
||||
type: ResourceType;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
_links: {
|
||||
self: HALLink,
|
||||
};
|
||||
}
|
||||
|
@@ -1,23 +1,25 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import {
|
||||
cold,
|
||||
getTestScheduler,
|
||||
} from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import {
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import {
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { QualityAssuranceSourceDataService } from './quality-assurance-source-data.service';
|
||||
|
||||
describe('QualityAssuranceSourceDataService', () => {
|
||||
@@ -56,16 +58,16 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaSourceObjectRD
|
||||
a: qaSourceObjectRD,
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
}),
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
getEndpoint: cold('a|', { a: endpointURL }),
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
@@ -77,7 +79,7 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
rdbService,
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService
|
||||
notificationsService,
|
||||
);
|
||||
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
@@ -89,7 +91,7 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
service.getSources().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -97,7 +99,7 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceSourceObject>> for the object with the given URL', () => {
|
||||
const result = service.getSources();
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -108,7 +110,7 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
service.getSource(qualityAssuranceSourceObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceSourceObjectMorePid.id, true, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -116,7 +118,7 @@ describe('QualityAssuranceSourceDataService', () => {
|
||||
it('should return a RemoteData<QualityAssuranceSourceObject> for the object with the given URL', () => {
|
||||
const result = service.getSource(qualityAssuranceSourceObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaSourceObjectRD
|
||||
a: qaSourceObjectRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
|
@@ -1,21 +1,23 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import {
|
||||
FindAllData,
|
||||
FindAllDataImpl,
|
||||
} from '../../../data/base/find-all-data';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { QualityAssuranceSourceObject } from '../models/quality-assurance-source.model';
|
||||
import { QUALITY_ASSURANCE_SOURCE_OBJECT } from '../models/quality-assurance-source-object.resource-type';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance source REST requests.
|
||||
@@ -39,7 +41,7 @@ export class QualityAssuranceSourceDataService extends IdentifiableDataService<Q
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService
|
||||
protected notificationsService: NotificationsService,
|
||||
) {
|
||||
super('qualityassurancesources', requestService, rdbService, objectCache, halService);
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
|
@@ -1,24 +1,26 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import {
|
||||
cold,
|
||||
getTestScheduler,
|
||||
} from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RestResponse } from '../../../cache/response.models';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../shared/remote-data.utils';
|
||||
import { QualityAssuranceTopicDataService } from './quality-assurance-topic-data.service';
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../../shared/mocks/notifications.mock';
|
||||
import { buildPaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RequestEntry } from '../../../data/request-entry.model';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { PageInfo } from '../../../shared/page-info.model';
|
||||
import { QualityAssuranceTopicDataService } from './quality-assurance-topic-data.service';
|
||||
|
||||
describe('QualityAssuranceTopicDataService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
@@ -56,16 +58,16 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
|
||||
rdbService = jasmine.createSpyObj('rdbService', {
|
||||
buildSingle: cold('(a)', {
|
||||
a: qaTopicObjectRD
|
||||
a: qaTopicObjectRD,
|
||||
}),
|
||||
buildList: cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
}),
|
||||
});
|
||||
|
||||
objectCache = {} as ObjectCacheService;
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
getEndpoint: cold('a|', { a: endpointURL })
|
||||
getEndpoint: cold('a|', { a: endpointURL }),
|
||||
});
|
||||
|
||||
notificationsService = {} as NotificationsService;
|
||||
@@ -77,7 +79,7 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
rdbService,
|
||||
objectCache,
|
||||
halService,
|
||||
notificationsService
|
||||
notificationsService,
|
||||
);
|
||||
|
||||
spyOn((service as any).findAllData, 'findAll').and.callThrough();
|
||||
@@ -89,7 +91,7 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
service.getTopics().subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findAllData.findAll).toHaveBeenCalledWith({}, true, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -97,7 +99,7 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
it('should return a RemoteData<PaginatedList<QualityAssuranceTopicObject>> for the object with the given URL', () => {
|
||||
const result = service.getTopics();
|
||||
const expected = cold('(a)', {
|
||||
a: paginatedListRD
|
||||
a: paginatedListRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -108,7 +110,7 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
service.getTopic(qualityAssuranceTopicObjectMorePid.id).subscribe(
|
||||
(res) => {
|
||||
expect((service as any).findById).toHaveBeenCalledWith(qualityAssuranceTopicObjectMorePid.id, true, true);
|
||||
}
|
||||
},
|
||||
);
|
||||
done();
|
||||
});
|
||||
@@ -116,7 +118,7 @@ describe('QualityAssuranceTopicDataService', () => {
|
||||
it('should return a RemoteData<QualityAssuranceTopicObject> for the object with the given URL', () => {
|
||||
const result = service.getTopic(qualityAssuranceTopicObjectMorePid.id);
|
||||
const expected = cold('(a)', {
|
||||
a: qaTopicObjectRD
|
||||
a: qaTopicObjectRD,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
|
@@ -1,21 +1,23 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { RemoteDataBuildService } from '../../../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../../../cache/object-cache.service';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { QualityAssuranceTopicObject } from '../models/quality-assurance-topic.model';
|
||||
import { FollowLinkConfig } from '../../../../shared/utils/follow-link-config.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { dataService } from '../../../data/base/data-service.decorator';
|
||||
import {
|
||||
FindAllData,
|
||||
FindAllDataImpl,
|
||||
} from '../../../data/base/find-all-data';
|
||||
import { IdentifiableDataService } from '../../../data/base/identifiable-data.service';
|
||||
import { FindListOptions } from '../../../data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../data/paginated-list.model';
|
||||
import { RemoteData } from '../../../data/remote-data';
|
||||
import { RequestService } from '../../../data/request.service';
|
||||
import { HALEndpointService } from '../../../shared/hal-endpoint.service';
|
||||
import { QualityAssuranceTopicObject } from '../models/quality-assurance-topic.model';
|
||||
import { QUALITY_ASSURANCE_TOPIC_OBJECT } from '../models/quality-assurance-topic-object.resource-type';
|
||||
import { FindAllData, FindAllDataImpl } from '../../../data/base/find-all-data';
|
||||
|
||||
/**
|
||||
* The service handling all Quality Assurance topic REST requests.
|
||||
@@ -39,7 +41,7 @@ export class QualityAssuranceTopicDataService extends IdentifiableDataService<Qu
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService
|
||||
protected notificationsService: NotificationsService,
|
||||
) {
|
||||
super('qualityassurancetopics', requestService, rdbService, objectCache, halService);
|
||||
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
|
||||
|
@@ -530,126 +530,126 @@ export class MenuResolver implements Resolve<boolean> {
|
||||
createSiteAdministratorMenuSections() {
|
||||
combineLatest([
|
||||
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
|
||||
this.authorizationService.isAuthorized(FeatureID.CanSeeQA)
|
||||
this.authorizationService.isAuthorized(FeatureID.CanSeeQA),
|
||||
])
|
||||
.subscribe(([authorized, canSeeQA]) => {
|
||||
const menuList = [
|
||||
.subscribe(([authorized, canSeeQA]) => {
|
||||
const menuList = [
|
||||
/* Notifications */
|
||||
{
|
||||
id: 'notifications',
|
||||
active: false,
|
||||
visible: authorized && canSeeQA,
|
||||
model: {
|
||||
type: MenuItemType.TEXT,
|
||||
text: 'menu.section.notifications'
|
||||
} as TextMenuItemModel,
|
||||
icon: 'bell',
|
||||
index: 4
|
||||
},
|
||||
{
|
||||
id: 'notifications_quality-assurance',
|
||||
parentID: 'notifications',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.quality-assurance',
|
||||
link: '/admin/notifications/quality-assurance'
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
/* Admin Search */
|
||||
{
|
||||
id: 'admin_search',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.admin_search',
|
||||
link: '/admin/search',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'search',
|
||||
index: 5,
|
||||
},
|
||||
/* Registries */
|
||||
{
|
||||
id: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.TEXT,
|
||||
text: 'menu.section.registries',
|
||||
} as TextMenuItemModel,
|
||||
icon: 'list',
|
||||
index: 6,
|
||||
},
|
||||
{
|
||||
id: 'registries_metadata',
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.registries_metadata',
|
||||
link: 'admin/registries/metadata',
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'registries_format',
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.registries_format',
|
||||
link: 'admin/registries/bitstream-formats',
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'notifications',
|
||||
active: false,
|
||||
visible: authorized && canSeeQA,
|
||||
model: {
|
||||
type: MenuItemType.TEXT,
|
||||
text: 'menu.section.notifications',
|
||||
} as TextMenuItemModel,
|
||||
icon: 'bell',
|
||||
index: 4,
|
||||
},
|
||||
{
|
||||
id: 'notifications_quality-assurance',
|
||||
parentID: 'notifications',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.quality-assurance',
|
||||
link: '/admin/notifications/quality-assurance',
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
/* Admin Search */
|
||||
{
|
||||
id: 'admin_search',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.admin_search',
|
||||
link: '/admin/search',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'search',
|
||||
index: 5,
|
||||
},
|
||||
/* Registries */
|
||||
{
|
||||
id: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.TEXT,
|
||||
text: 'menu.section.registries',
|
||||
} as TextMenuItemModel,
|
||||
icon: 'list',
|
||||
index: 6,
|
||||
},
|
||||
{
|
||||
id: 'registries_metadata',
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.registries_metadata',
|
||||
link: 'admin/registries/metadata',
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
{
|
||||
id: 'registries_format',
|
||||
parentID: 'registries',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.registries_format',
|
||||
link: 'admin/registries/bitstream-formats',
|
||||
} as LinkMenuItemModel,
|
||||
},
|
||||
|
||||
/* Curation tasks */
|
||||
{
|
||||
id: 'curation_tasks',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.curation_task',
|
||||
link: 'admin/curation-tasks',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'filter',
|
||||
index: 7,
|
||||
},
|
||||
/* Curation tasks */
|
||||
{
|
||||
id: 'curation_tasks',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.curation_task',
|
||||
link: 'admin/curation-tasks',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'filter',
|
||||
index: 7,
|
||||
},
|
||||
|
||||
/* Workflow */
|
||||
{
|
||||
id: 'workflow',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.workflow',
|
||||
link: '/admin/workflow',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'user-check',
|
||||
index: 11,
|
||||
},
|
||||
{
|
||||
id: 'system_wide_alert',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.system-wide-alert',
|
||||
link: '/admin/system-wide-alert',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'exclamation-circle',
|
||||
index: 12,
|
||||
},
|
||||
];
|
||||
/* Workflow */
|
||||
{
|
||||
id: 'workflow',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.workflow',
|
||||
link: '/admin/workflow',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'user-check',
|
||||
index: 11,
|
||||
},
|
||||
{
|
||||
id: 'system_wide_alert',
|
||||
active: false,
|
||||
visible: authorized,
|
||||
model: {
|
||||
type: MenuItemType.LINK,
|
||||
text: 'menu.section.system-wide-alert',
|
||||
link: '/admin/system-wide-alert',
|
||||
} as LinkMenuItemModel,
|
||||
icon: 'exclamation-circle',
|
||||
index: 12,
|
||||
},
|
||||
];
|
||||
|
||||
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, {
|
||||
shouldPersistOnRouteChange: true,
|
||||
})));
|
||||
});
|
||||
menuList.forEach((menuSection) => this.menuService.addSection(MenuID.ADMIN, Object.assign(menuSection, {
|
||||
shouldPersistOnRouteChange: true,
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,5 +3,5 @@ import { QualityAssuranceTopicsEffects } from './qa/topics/quality-assurance-top
|
||||
|
||||
export const notificationsEffects = [
|
||||
QualityAssuranceTopicsEffects,
|
||||
QualityAssuranceSourceEffects
|
||||
QualityAssuranceSourceEffects,
|
||||
];
|
||||
|
@@ -1,19 +1,23 @@
|
||||
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 { cold } from 'jasmine-marbles';
|
||||
import { suggestionNotificationsReducers } from './notifications.reducer';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
|
||||
import {
|
||||
qualityAssuranceSourceObjectMissingPid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceTopicObjectMissingPid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
} from '../shared/mocks/notifications.mock';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
import { suggestionNotificationsReducers } from './notifications.reducer';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
|
||||
describe('NotificationsStateService', () => {
|
||||
let service: NotificationsStateService;
|
||||
@@ -33,9 +37,9 @@ describe('NotificationsStateService', () => {
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0,
|
||||
totalLoadedPages: 0
|
||||
}
|
||||
}
|
||||
totalLoadedPages: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
} else {
|
||||
initialState = {
|
||||
@@ -44,16 +48,16 @@ describe('NotificationsStateService', () => {
|
||||
topics: [
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMissingPid
|
||||
qualityAssuranceTopicObjectMissingPid,
|
||||
],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
currentPage: 1,
|
||||
totalElements: 3,
|
||||
totalLoadedPages: 1
|
||||
}
|
||||
}
|
||||
totalLoadedPages: 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -67,8 +71,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -83,7 +87,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return an empty array', () => {
|
||||
const result = service.getQualityAssuranceTopics();
|
||||
const expected = cold('(a)', {
|
||||
a: []
|
||||
a: [],
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -93,7 +97,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getQualityAssuranceTopicsTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -103,7 +107,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return minus one (0)', () => {
|
||||
const result = service.getQualityAssuranceTopicsCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -113,7 +117,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getQualityAssuranceTopicsTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -123,7 +127,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isQualityAssuranceTopicsLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
a: true,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -133,7 +137,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceTopicsLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -143,7 +147,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceTopicsProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -159,8 +163,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -178,8 +182,8 @@ describe('NotificationsStateService', () => {
|
||||
a: [
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMissingPid
|
||||
]
|
||||
qualityAssuranceTopicObjectMissingPid,
|
||||
],
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -189,7 +193,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return one (1)', () => {
|
||||
const result = service.getQualityAssuranceTopicsTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
a: 1,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -199,7 +203,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return minus zero (1)', () => {
|
||||
const result = service.getQualityAssuranceTopicsCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
a: 1,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -209,7 +213,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return three (3)', () => {
|
||||
const result = service.getQualityAssuranceTopicsTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 3
|
||||
a: 3,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -219,7 +223,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceTopicsLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -229,7 +233,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isQualityAssuranceTopicsLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
a: true,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -239,7 +243,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceTopicsProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -255,8 +259,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -291,9 +295,9 @@ describe('NotificationsStateService', () => {
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0,
|
||||
totalLoadedPages: 0
|
||||
}
|
||||
}
|
||||
totalLoadedPages: 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
} else {
|
||||
initialState = {
|
||||
@@ -302,16 +306,16 @@ describe('NotificationsStateService', () => {
|
||||
source: [
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMissingPid
|
||||
qualityAssuranceSourceObjectMissingPid,
|
||||
],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
currentPage: 1,
|
||||
totalElements: 3,
|
||||
totalLoadedPages: 1
|
||||
}
|
||||
}
|
||||
totalLoadedPages: 1,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -325,8 +329,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -341,7 +345,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return an empty array', () => {
|
||||
const result = service.getQualityAssuranceSource();
|
||||
const expected = cold('(a)', {
|
||||
a: []
|
||||
a: [],
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -351,7 +355,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getQualityAssuranceSourceTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -361,7 +365,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return minus one (0)', () => {
|
||||
const result = service.getQualityAssuranceSourceCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -371,7 +375,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return zero (0)', () => {
|
||||
const result = service.getQualityAssuranceSourceTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 0
|
||||
a: 0,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -381,7 +385,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isQualityAssuranceSourceLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
a: true,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -391,7 +395,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceSourceLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -401,7 +405,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceSourceProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -417,8 +421,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -436,8 +440,8 @@ describe('NotificationsStateService', () => {
|
||||
a: [
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMissingPid
|
||||
]
|
||||
qualityAssuranceSourceObjectMissingPid,
|
||||
],
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -447,7 +451,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return one (1)', () => {
|
||||
const result = service.getQualityAssuranceSourceTotalPages();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
a: 1,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -457,7 +461,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return minus zero (1)', () => {
|
||||
const result = service.getQualityAssuranceSourceCurrentPage();
|
||||
const expected = cold('(a)', {
|
||||
a: 1
|
||||
a: 1,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -467,7 +471,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return three (3)', () => {
|
||||
const result = service.getQualityAssuranceSourceTotals();
|
||||
const expected = cold('(a)', {
|
||||
a: 3
|
||||
a: 3,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -477,7 +481,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceSourceLoading();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -487,7 +491,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return TRUE', () => {
|
||||
const result = service.isQualityAssuranceSourceLoaded();
|
||||
const expected = cold('(a)', {
|
||||
a: true
|
||||
a: true,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -497,7 +501,7 @@ describe('NotificationsStateService', () => {
|
||||
it('Should return FALSE', () => {
|
||||
const result = service.isQualityAssuranceSourceProcessing();
|
||||
const expected = cold('(a)', {
|
||||
a: false
|
||||
a: false,
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -513,8 +517,8 @@ describe('NotificationsStateService', () => {
|
||||
],
|
||||
providers: [
|
||||
provideMockStore({ initialState }),
|
||||
{ provide: NotificationsStateService, useValue: service }
|
||||
]
|
||||
{ provide: NotificationsStateService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -535,7 +539,7 @@ describe('NotificationsStateService', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
@@ -1,26 +1,30 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { select, Store } from '@ngrx/store';
|
||||
import {
|
||||
select,
|
||||
Store,
|
||||
} from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { SuggestionNotificationsState } from './notifications.reducer';
|
||||
import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
import {
|
||||
getQualityAssuranceSourceCurrentPageSelector,
|
||||
getQualityAssuranceSourceTotalPagesSelector,
|
||||
getQualityAssuranceSourceTotalsSelector,
|
||||
getQualityAssuranceTopicsCurrentPageSelector,
|
||||
getQualityAssuranceTopicsTotalPagesSelector,
|
||||
getQualityAssuranceTopicsTotalsSelector,
|
||||
isQualityAssuranceTopicsLoadedSelector,
|
||||
qualityAssuranceTopicsObjectSelector,
|
||||
isQualityAssuranceTopicsProcessingSelector,
|
||||
qualityAssuranceSourceObjectSelector,
|
||||
isQualityAssuranceSourceLoadedSelector,
|
||||
isQualityAssuranceSourceProcessingSelector,
|
||||
getQualityAssuranceSourceTotalPagesSelector,
|
||||
getQualityAssuranceSourceCurrentPageSelector,
|
||||
getQualityAssuranceSourceTotalsSelector
|
||||
isQualityAssuranceTopicsLoadedSelector,
|
||||
isQualityAssuranceTopicsProcessingSelector,
|
||||
qualityAssuranceSourceObjectSelector,
|
||||
qualityAssuranceTopicsObjectSelector,
|
||||
} from './selectors';
|
||||
import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { SuggestionNotificationsState } from './notifications.reducer';
|
||||
import { RetrieveAllTopicsAction } from './qa/topics/quality-assurance-topics.actions';
|
||||
import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { RetrieveAllSourceAction } from './qa/source/quality-assurance-source.actions';
|
||||
|
||||
/**
|
||||
* The service handling the Notifications State.
|
||||
@@ -56,7 +60,7 @@ export class NotificationsStateService {
|
||||
public isQualityAssuranceTopicsLoading(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(isQualityAssuranceTopicsLoadedSelector),
|
||||
map((loaded: boolean) => !loaded)
|
||||
map((loaded: boolean) => !loaded),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -131,7 +135,7 @@ export class NotificationsStateService {
|
||||
* @return Observable<QualityAssuranceSourceObject>
|
||||
* The list of Quality Assurance source.
|
||||
*/
|
||||
public getQualityAssuranceSource(): Observable<QualityAssuranceSourceObject[]> {
|
||||
public getQualityAssuranceSource(): Observable<QualityAssuranceSourceObject[]> {
|
||||
return this.store.pipe(select(qualityAssuranceSourceObjectSelector()));
|
||||
}
|
||||
|
||||
@@ -144,7 +148,7 @@ export class NotificationsStateService {
|
||||
public isQualityAssuranceSourceLoading(): Observable<boolean> {
|
||||
return this.store.pipe(
|
||||
select(isQualityAssuranceSourceLoadedSelector),
|
||||
map((loaded: boolean) => !loaded)
|
||||
map((loaded: boolean) => !loaded),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,31 +1,32 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Action, StoreConfig, StoreModule } from '@ngrx/store';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { EffectsModule } from '@ngrx/effects';
|
||||
|
||||
import { CoreModule } from '../core/core.module';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { storeModuleConfig } from '../app.reducer';
|
||||
import { QualityAssuranceTopicsComponent } from './qa/topics/quality-assurance-topics.component';
|
||||
import { QualityAssuranceEventsComponent } from './qa/events/quality-assurance-events.component';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
import { suggestionNotificationsReducers, SuggestionNotificationsState } from './notifications.reducer';
|
||||
import { notificationsEffects } from './notifications-effects';
|
||||
import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
|
||||
import {
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import {
|
||||
QualityAssuranceEventDataService
|
||||
} from '../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component';
|
||||
Action,
|
||||
StoreConfig,
|
||||
StoreModule,
|
||||
} from '@ngrx/store';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { storeModuleConfig } from '../app.reducer';
|
||||
import { CoreModule } from '../core/core.module';
|
||||
import { QualityAssuranceEventDataService } from '../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { QualityAssuranceSourceDataService } from '../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { QualityAssuranceTopicDataService } from '../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { SearchModule } from '../shared/search/search.module';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import {
|
||||
suggestionNotificationsReducers,
|
||||
SuggestionNotificationsState,
|
||||
} from './notifications.reducer';
|
||||
import { notificationsEffects } from './notifications-effects';
|
||||
import { NotificationsStateService } from './notifications-state.service';
|
||||
import { QualityAssuranceEventsComponent } from './qa/events/quality-assurance-events.component';
|
||||
import { ProjectEntryImportModalComponent } from './qa/project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { QualityAssuranceSourceComponent } from './qa/source/quality-assurance-source.component';
|
||||
import { QualityAssuranceSourceService } from './qa/source/quality-assurance-source.service';
|
||||
import {
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { QualityAssuranceTopicsComponent } from './qa/topics/quality-assurance-topics.component';
|
||||
import { QualityAssuranceTopicsService } from './qa/topics/quality-assurance-topics.service';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
@@ -34,19 +35,19 @@ const MODULES = [
|
||||
CoreModule.forRoot(),
|
||||
StoreModule.forFeature('suggestionNotifications', suggestionNotificationsReducers, storeModuleConfig as StoreConfig<SuggestionNotificationsState, Action>),
|
||||
EffectsModule.forFeature(notificationsEffects),
|
||||
TranslateModule
|
||||
TranslateModule,
|
||||
];
|
||||
|
||||
const COMPONENTS = [
|
||||
QualityAssuranceTopicsComponent,
|
||||
QualityAssuranceEventsComponent,
|
||||
QualityAssuranceSourceComponent
|
||||
QualityAssuranceSourceComponent,
|
||||
];
|
||||
|
||||
const DIRECTIVES = [ ];
|
||||
|
||||
const ENTRY_COMPONENTS = [
|
||||
ProjectEntryImportModalComponent
|
||||
ProjectEntryImportModalComponent,
|
||||
];
|
||||
|
||||
const PROVIDERS = [
|
||||
@@ -55,28 +56,28 @@ const PROVIDERS = [
|
||||
QualityAssuranceSourceService,
|
||||
QualityAssuranceTopicDataService,
|
||||
QualityAssuranceSourceDataService,
|
||||
QualityAssuranceEventDataService
|
||||
QualityAssuranceEventDataService,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
...MODULES
|
||||
],
|
||||
imports: [
|
||||
...MODULES,
|
||||
],
|
||||
declarations: [
|
||||
...COMPONENTS,
|
||||
...DIRECTIVES,
|
||||
...ENTRY_COMPONENTS
|
||||
...ENTRY_COMPONENTS,
|
||||
],
|
||||
providers: [
|
||||
...PROVIDERS
|
||||
...PROVIDERS,
|
||||
],
|
||||
entryComponents: [
|
||||
...ENTRY_COMPONENTS
|
||||
...ENTRY_COMPONENTS,
|
||||
],
|
||||
exports: [
|
||||
...COMPONENTS,
|
||||
...DIRECTIVES
|
||||
]
|
||||
...DIRECTIVES,
|
||||
],
|
||||
})
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,11 @@
|
||||
import { ActionReducerMap, createFeatureSelector } from '@ngrx/store';
|
||||
import {
|
||||
ActionReducerMap,
|
||||
createFeatureSelector,
|
||||
} from '@ngrx/store';
|
||||
|
||||
import {
|
||||
qualityAssuranceSourceReducer,
|
||||
QualityAssuranceSourceState
|
||||
QualityAssuranceSourceState,
|
||||
} from './qa/source/quality-assurance-source.reducer';
|
||||
import {
|
||||
qualityAssuranceTopicsReducer,
|
||||
@@ -18,7 +22,7 @@ export interface SuggestionNotificationsState {
|
||||
|
||||
export const suggestionNotificationsReducers: ActionReducerMap<SuggestionNotificationsState> = {
|
||||
qaTopic: qualityAssuranceTopicsReducer,
|
||||
qaSource: qualityAssuranceSourceReducer
|
||||
qaSource: qualityAssuranceSourceReducer,
|
||||
};
|
||||
|
||||
export const suggestionNotificationsSelector = createFeatureSelector<SuggestionNotificationsState>('suggestionNotifications');
|
||||
|
@@ -1,47 +1,61 @@
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
QualityAssuranceEventDataService
|
||||
} from '../../../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
|
||||
Component,
|
||||
NO_ERRORS_SCHEMA,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ComponentFixture,
|
||||
inject,
|
||||
TestBed,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import {
|
||||
TranslateModule,
|
||||
TranslateService,
|
||||
} from '@ngx-translate/core';
|
||||
import {
|
||||
cold,
|
||||
getTestScheduler,
|
||||
} from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
|
||||
import {
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceEventDataService } from '../../../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { QualityAssuranceEventObject } from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import {
|
||||
getMockQualityAssuranceEventRestService,
|
||||
ItemMockPid10,
|
||||
ItemMockPid8,
|
||||
ItemMockPid9,
|
||||
ItemMockPid10,
|
||||
NotificationsMockDspaceObject,
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectNotFound
|
||||
qualityAssuranceEventObjectMissingProjectNotFound,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import {
|
||||
QualityAssuranceEventObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { QualityAssuranceEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {
|
||||
createNoContentRemoteDataObject$,
|
||||
createSuccessfulRemoteDataObject,
|
||||
createSuccessfulRemoteDataObject$
|
||||
createSuccessfulRemoteDataObject$,
|
||||
} from '../../../shared/remote-data.utils';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { QualityAssuranceEventData } from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { QualityAssuranceEventsComponent } from './quality-assurance-events.component';
|
||||
|
||||
describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceEventsComponent>;
|
||||
@@ -50,24 +64,24 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
let scheduler: TestScheduler;
|
||||
|
||||
const modalStub = {
|
||||
open: () => ( {result: new Promise((res, rej) => 'do')} ),
|
||||
close: () => null,
|
||||
dismiss: () => null
|
||||
open: () => ( { result: new Promise((res, rej) => 'do') } ),
|
||||
close: () => null,
|
||||
dismiss: () => null,
|
||||
};
|
||||
const qualityAssuranceEventRestServiceStub: any = getMockQualityAssuranceEventRestService();
|
||||
const activatedRouteParams = {
|
||||
qualityAssuranceEventsParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 10
|
||||
}
|
||||
pageSize: 10,
|
||||
},
|
||||
};
|
||||
const activatedRouteParamsMap = {
|
||||
id: 'ENRICH!MISSING!PROJECT'
|
||||
id: 'ENRICH!MISSING!PROJECT',
|
||||
};
|
||||
|
||||
const events: QualityAssuranceEventObject[] = [
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
qualityAssuranceEventObjectMissingProjectNotFound
|
||||
qualityAssuranceEventObjectMissingProjectNotFound,
|
||||
];
|
||||
const paginationService = new PaginationServiceStub();
|
||||
|
||||
@@ -82,7 +96,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
handle: ItemMockPid10.handle,
|
||||
reason: null,
|
||||
isRunning: false,
|
||||
target: ItemMockPid8
|
||||
target: ItemMockPid8,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,7 +111,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
handle: null,
|
||||
reason: null,
|
||||
isRunning: false,
|
||||
target: ItemMockPid9
|
||||
target: ItemMockPid9,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -118,9 +132,9 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
{ provide: TranslateService, useValue: getMockTranslateService() },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
QualityAssuranceEventsComponent
|
||||
QualityAssuranceEventsComponent,
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents().then();
|
||||
scheduler = getTestScheduler();
|
||||
}));
|
||||
@@ -166,8 +180,8 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
const expected = cold('(a|)', {
|
||||
a: [
|
||||
getQualityAssuranceEventData1(),
|
||||
getQualityAssuranceEventData2()
|
||||
]
|
||||
getQualityAssuranceEventData2(),
|
||||
],
|
||||
});
|
||||
expect(result).toBeObservable(expected);
|
||||
});
|
||||
@@ -213,10 +227,10 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
externalSourceEntry: null,
|
||||
label: null,
|
||||
importedObject: observableOf({
|
||||
indexableObject: NotificationsMockDspaceObject
|
||||
})
|
||||
}
|
||||
}
|
||||
indexableObject: NotificationsMockDspaceObject,
|
||||
}),
|
||||
},
|
||||
},
|
||||
);
|
||||
scheduler.schedule(() => {
|
||||
comp.openModalLookup(getQualityAssuranceEventData1());
|
||||
@@ -233,7 +247,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
const action = 'ACCEPTED';
|
||||
spyOn(compAsAny, 'getQualityAssuranceEvents').and.returnValue(observableOf([
|
||||
getQualityAssuranceEventData1(),
|
||||
getQualityAssuranceEventData2()
|
||||
getQualityAssuranceEventData2(),
|
||||
]));
|
||||
qualityAssuranceEventRestServiceStub.patchEvent.and.returnValue(createSuccessfulRemoteDataObject$({}));
|
||||
|
||||
@@ -292,14 +306,14 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
comp.topic = activatedRouteParamsMap.id;
|
||||
const options: FindListOptions = Object.assign(new FindListOptions(), {
|
||||
currentPage: comp.paginationConfig.currentPage,
|
||||
elementsPerPage: comp.paginationConfig.pageSize
|
||||
elementsPerPage: comp.paginationConfig.pageSize,
|
||||
});
|
||||
|
||||
const pageInfo = new PageInfo({
|
||||
elementsPerPage: comp.paginationConfig.pageSize,
|
||||
totalElements: 2,
|
||||
totalPages: 1,
|
||||
currentPage: comp.paginationConfig.currentPage
|
||||
currentPage: comp.paginationConfig.currentPage,
|
||||
});
|
||||
const array = [
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
@@ -310,7 +324,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
qualityAssuranceEventRestServiceStub.getEventsByTopic.and.returnValue(observableOf(paginatedListRD));
|
||||
spyOn(compAsAny, 'fetchEvents').and.returnValue(observableOf([
|
||||
getQualityAssuranceEventData1(),
|
||||
getQualityAssuranceEventData2()
|
||||
getQualityAssuranceEventData2(),
|
||||
]));
|
||||
|
||||
scheduler.schedule(() => {
|
||||
@@ -321,7 +335,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
expect(compAsAny.qualityAssuranceEventRestService.getEventsByTopic).toHaveBeenCalledWith(
|
||||
activatedRouteParamsMap.id,
|
||||
options,
|
||||
followLink('target'),followLink('related')
|
||||
followLink('target'),followLink('related'),
|
||||
);
|
||||
expect(compAsAny.fetchEvents).toHaveBeenCalled();
|
||||
});
|
||||
@@ -333,7 +347,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
|
||||
|
@@ -1,36 +1,56 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BehaviorSubject, combineLatest, from, Observable, of, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, last, map, mergeMap, scan, switchMap, take, tap } from 'rxjs/operators';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
combineLatest,
|
||||
from,
|
||||
Observable,
|
||||
of,
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
distinctUntilChanged,
|
||||
last,
|
||||
map,
|
||||
mergeMap,
|
||||
scan,
|
||||
switchMap,
|
||||
take,
|
||||
tap,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import {
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { QualityAssuranceEventDataService } from '../../../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import {
|
||||
QualityAssuranceEventObject,
|
||||
SourceQualityAssuranceEventMessageObject,
|
||||
QualityAssuranceEventObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import {
|
||||
QualityAssuranceEventDataService
|
||||
} from '../../../core/notifications/qa/events/quality-assurance-event-data.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
ProjectEntryImportModalComponent,
|
||||
QualityAssuranceEventData
|
||||
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import {environment} from '../../../../environments/environment';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { ItemSearchResult } from '../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import {
|
||||
ProjectEntryImportModalComponent,
|
||||
QualityAssuranceEventData,
|
||||
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
|
||||
/**
|
||||
* Component to display the Quality Assurance event list.
|
||||
@@ -49,7 +69,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
id: 'bep',
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
pageSizeOptions: [5, 10, 20, 40, 60],
|
||||
});
|
||||
/**
|
||||
* The Quality Assurance event list sort options.
|
||||
@@ -125,7 +145,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceEventRestService: QualityAssuranceEventDataService,
|
||||
private paginationService: PaginationService,
|
||||
private translateService: TranslateService
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -136,17 +156,17 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
this.isEventPageLoading.next(true);
|
||||
|
||||
this.activatedRoute.paramMap.pipe(
|
||||
tap((params) => {
|
||||
this.sourceUrlForProjectSearch = environment.qualityAssuranceConfig.sourceUrlMapForProjectSearch[params.get('sourceId')];
|
||||
}),
|
||||
map((params) => params.get('topicId')),
|
||||
tap((params) => {
|
||||
this.sourceUrlForProjectSearch = environment.qualityAssuranceConfig.sourceUrlMapForProjectSearch[params.get('sourceId')];
|
||||
}),
|
||||
map((params) => params.get('topicId')),
|
||||
take(1),
|
||||
switchMap((id: string) => {
|
||||
const regEx = /!/g;
|
||||
this.showTopic = id.replace(regEx, '/');
|
||||
this.topic = id;
|
||||
return this.getQualityAssuranceEvents();
|
||||
})
|
||||
}),
|
||||
).subscribe((events: QualityAssuranceEventData[]) => {
|
||||
this.eventsUpdated$.next(events);
|
||||
this.isEventPageLoading.next(false);
|
||||
@@ -203,7 +223,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
(_reason) => {
|
||||
this.selectedReason = null;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,7 +235,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
public openModalLookup(eventData: QualityAssuranceEventData): void {
|
||||
this.modalRef = this.modalService.open(ProjectEntryImportModalComponent, {
|
||||
size: 'lg'
|
||||
size: 'lg',
|
||||
});
|
||||
const modalComp = this.modalRef.componentInstance;
|
||||
modalComp.externalSourceEntry = eventData;
|
||||
@@ -228,9 +248,9 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
eventData,
|
||||
object.indexableObject.id,
|
||||
projectTitle.value,
|
||||
object.indexableObject.handle
|
||||
object.indexableObject.handle,
|
||||
);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -250,20 +270,20 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
switchMap((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(
|
||||
this.translateService.instant('quality-assurance.event.action.saved')
|
||||
this.translateService.instant('quality-assurance.event.action.saved'),
|
||||
);
|
||||
return this.getQualityAssuranceEvents();
|
||||
} else {
|
||||
this.notificationsService.error(
|
||||
this.translateService.instant('quality-assurance.event.action.error')
|
||||
this.translateService.instant('quality-assurance.event.action.error'),
|
||||
);
|
||||
return of(this.eventsUpdated$.value);
|
||||
}
|
||||
})
|
||||
}),
|
||||
).subscribe((events: QualityAssuranceEventData[]) => {
|
||||
this.eventsUpdated$.next(events);
|
||||
eventData.isRunning = false;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -286,7 +306,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
.subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(
|
||||
this.translateService.instant('quality-assurance.event.project.bounded')
|
||||
this.translateService.instant('quality-assurance.event.project.bounded'),
|
||||
);
|
||||
eventData.hasProject = true;
|
||||
eventData.projectTitle = projectTitle;
|
||||
@@ -294,11 +314,11 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
eventData.projectId = projectId;
|
||||
} else {
|
||||
this.notificationsService.error(
|
||||
this.translateService.instant('quality-assurance.event.project.error')
|
||||
this.translateService.instant('quality-assurance.event.project.error'),
|
||||
);
|
||||
}
|
||||
eventData.isRunning = false;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -315,7 +335,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
.subscribe((rd: RemoteData<QualityAssuranceEventObject>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(
|
||||
this.translateService.instant('quality-assurance.event.project.removed')
|
||||
this.translateService.instant('quality-assurance.event.project.removed'),
|
||||
);
|
||||
eventData.hasProject = false;
|
||||
eventData.projectTitle = null;
|
||||
@@ -323,11 +343,11 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
eventData.projectId = null;
|
||||
} else {
|
||||
this.notificationsService.error(
|
||||
this.translateService.instant('quality-assurance.event.project.error')
|
||||
this.translateService.instant('quality-assurance.event.project.error'),
|
||||
);
|
||||
}
|
||||
eventData.isRunning = false;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -356,7 +376,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
switchMap((options: FindListOptions) => this.qualityAssuranceEventRestService.getEventsByTopic(
|
||||
this.topic,
|
||||
options,
|
||||
followLink('target'), followLink('related')
|
||||
followLink('target'), followLink('related'),
|
||||
)),
|
||||
getFirstCompletedRemoteData(),
|
||||
switchMap((rd: RemoteData<PaginatedList<QualityAssuranceEventObject>>) => {
|
||||
@@ -374,7 +394,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
take(1),
|
||||
tap(() => {
|
||||
this.qualityAssuranceEventRestService.clearFindByTopicRequests();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -401,7 +421,7 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
getFirstCompletedRemoteData(),
|
||||
);
|
||||
const target$ = event.target.pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
getFirstCompletedRemoteData(),
|
||||
);
|
||||
return combineLatest([related$, target$]).pipe(
|
||||
map(([relatedItemRD, targetItemRD]: [RemoteData<Item>, RemoteData<Item>]) => {
|
||||
@@ -424,11 +444,11 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
data.handle = relatedItemRD?.payload?.handle;
|
||||
}
|
||||
return data;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}),
|
||||
scan((acc: any, value: any) => [...acc, value], []),
|
||||
last()
|
||||
last(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +1,37 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
Component,
|
||||
NO_ERRORS_SCHEMA,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
async,
|
||||
ComponentFixture,
|
||||
inject,
|
||||
TestBed,
|
||||
} from '@angular/core/testing';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { ImportType, ProjectEntryImportModalComponent } from './project-entry-import-modal.component';
|
||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { getMockSearchService } from '../../../shared/mocks/search-service.mock';
|
||||
import { PaginatedSearchOptions } from '../../../shared/search/models/paginated-search-options.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import {
|
||||
ItemMockPid10,
|
||||
NotificationsMockDspaceObject,
|
||||
qualityAssuranceEventObjectMissingProjectFound,
|
||||
NotificationsMockDspaceObject
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { getMockSearchService } from '../../../shared/mocks/search-service.mock';
|
||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { PaginatedSearchOptions } from '../../../shared/search/models/paginated-search-options.model';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import {
|
||||
ImportType,
|
||||
ProjectEntryImportModalComponent,
|
||||
} from './project-entry-import-modal.component';
|
||||
|
||||
const eventData = {
|
||||
event: qualityAssuranceEventObjectMissingProjectFound,
|
||||
@@ -30,28 +42,28 @@ const eventData = {
|
||||
projectId: ItemMockPid10.id,
|
||||
handle: ItemMockPid10.handle,
|
||||
reason: null,
|
||||
isRunning: false
|
||||
isRunning: false,
|
||||
};
|
||||
|
||||
const searchString = 'Test project to search';
|
||||
const pagination = Object.assign(
|
||||
new PaginationComponentOptions(), {
|
||||
id: 'notifications-project-bound',
|
||||
pageSize: 3
|
||||
}
|
||||
pageSize: 3,
|
||||
},
|
||||
);
|
||||
const searchOptions = Object.assign(new PaginatedSearchOptions(
|
||||
{
|
||||
configuration: 'funding',
|
||||
query: searchString,
|
||||
pagination: pagination
|
||||
}
|
||||
pagination: pagination,
|
||||
},
|
||||
));
|
||||
const pageInfo = new PageInfo({
|
||||
elementsPerPage: 3,
|
||||
totalElements: 1,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
const array = [
|
||||
NotificationsMockDspaceObject,
|
||||
@@ -83,9 +95,9 @@ describe('ProjectEntryImportModalComponent test suite', () => {
|
||||
{ provide: NgbActiveModal, useValue: modalStub },
|
||||
{ provide: SearchService, useValue: searchServiceStub },
|
||||
{ provide: SelectableListService, useValue: jasmine.createSpyObj('selectableListService', ['deselect', 'select', 'deselectAll']) },
|
||||
ProjectEntryImportModalComponent
|
||||
ProjectEntryImportModalComponent,
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents().then();
|
||||
}));
|
||||
|
||||
@@ -203,7 +215,7 @@ describe('ProjectEntryImportModalComponent test suite', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
eventData = eventData;
|
||||
|
@@ -1,23 +1,36 @@
|
||||
import { Component, EventEmitter, Input, OnInit } from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
||||
import { PaginatedSearchOptions } from '../../../shared/search/models/paginated-search-options.model';
|
||||
import { CollectionElementLinkType } from '../../../shared/object-collection/collection-element-link.type';
|
||||
import { Context } from '../../../core/shared/context.model';
|
||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import {
|
||||
SourceQualityAssuranceEventMessageObject,
|
||||
Component,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import {
|
||||
Observable,
|
||||
of as observableOf,
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import {
|
||||
QualityAssuranceEventObject,
|
||||
SourceQualityAssuranceEventMessageObject,
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-event.model';
|
||||
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
||||
import { Context } from '../../../core/shared/context.model';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import {
|
||||
hasValue,
|
||||
isNotEmpty,
|
||||
} from '../../../shared/empty.util';
|
||||
import { CollectionElementLinkType } from '../../../shared/object-collection/collection-element-link.type';
|
||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||
import { SelectableListService } from '../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { PaginatedSearchOptions } from '../../../shared/search/models/paginated-search-options.model';
|
||||
import { SearchResult } from '../../../shared/search/models/search-result.model';
|
||||
|
||||
/**
|
||||
* The possible types of import for the external entry
|
||||
@@ -79,7 +92,7 @@ export interface QualityAssuranceEventData {
|
||||
@Component({
|
||||
selector: 'ds-project-entry-import-modal',
|
||||
styleUrls: ['./project-entry-import-modal.component.scss'],
|
||||
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 Quality Assurance event
|
||||
@@ -185,14 +198,14 @@ export class ProjectEntryImportModalComponent implements OnInit {
|
||||
{
|
||||
configuration: this.configuration,
|
||||
query: this.projectTitle,
|
||||
pagination: this.pagination
|
||||
}
|
||||
pagination: this.pagination,
|
||||
},
|
||||
));
|
||||
this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
|
||||
this.subs.push(
|
||||
this.localEntitiesRD$.subscribe(
|
||||
() => this.isLoading$ = observableOf(false)
|
||||
)
|
||||
() => this.isLoading$ = observableOf(false),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,14 +228,14 @@ export class ProjectEntryImportModalComponent implements OnInit {
|
||||
{
|
||||
configuration: this.configuration,
|
||||
query: (searchTitle) ? searchTitle.replace(filterRegEx, '') : searchTitle,
|
||||
pagination: this.pagination
|
||||
}
|
||||
pagination: this.pagination,
|
||||
},
|
||||
));
|
||||
this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
|
||||
this.subs.push(
|
||||
this.localEntitiesRD$.subscribe(
|
||||
() => this.isLoading$ = observableOf(false)
|
||||
)
|
||||
() => this.isLoading$ = observableOf(false),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { Action } from '@ngrx/store';
|
||||
import { type } from '../../../shared/ngrx/type';
|
||||
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { type } from '../../../shared/ngrx/type';
|
||||
|
||||
/**
|
||||
* For each action type in an action group, make a simple
|
||||
@@ -38,7 +39,7 @@ export class RetrieveAllSourceAction implements Action {
|
||||
constructor(elementsPerPage: number, currentPage: number) {
|
||||
this.payload = {
|
||||
elementsPerPage,
|
||||
currentPage
|
||||
currentPage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -80,7 +81,7 @@ export class AddSourceAction implements Action {
|
||||
source,
|
||||
totalPages,
|
||||
currentPage,
|
||||
totalElements
|
||||
totalElements,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,20 +1,29 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
NO_ERRORS_SCHEMA,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ComponentFixture,
|
||||
inject,
|
||||
TestBed,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { QualityAssuranceSourceComponent } from './quality-assurance-source.component';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import { QualityAssuranceSourceComponent } from './quality-assurance-source.component';
|
||||
|
||||
describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceSourceComponent>;
|
||||
@@ -24,8 +33,8 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
const activatedRouteParams = {
|
||||
qualityAssuranceSourceParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 5
|
||||
}
|
||||
pageSize: 5,
|
||||
},
|
||||
};
|
||||
const paginationService = new PaginationServiceStub();
|
||||
|
||||
@@ -43,13 +52,13 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
{ provide: NotificationsStateService, useValue: mockNotificationsStateService },
|
||||
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
QualityAssuranceSourceComponent
|
||||
QualityAssuranceSourceComponent,
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents().then(() => {
|
||||
mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
]));
|
||||
mockNotificationsStateService.getQualityAssuranceSourceTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getQualityAssuranceSourceCurrentPage.and.returnValue(observableOf(0));
|
||||
@@ -103,11 +112,11 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
expect(comp.sources$).toBeObservable(cold('(a|)', {
|
||||
a: [
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
qualityAssuranceSourceObjectMoreAbstract
|
||||
]
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
],
|
||||
}));
|
||||
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
||||
a: 2
|
||||
a: 2,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -122,13 +131,13 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
|
||||
it(('isSourceLoading should return FALSE'), () => {
|
||||
expect(comp.isSourceLoading()).toBeObservable(cold('(a|)', {
|
||||
a: false
|
||||
a: false,
|
||||
}));
|
||||
});
|
||||
|
||||
it(('isSourceProcessing should return FALSE'), () => {
|
||||
expect(comp.isSourceProcessing()).toBeObservable(cold('(a|)', {
|
||||
a: false
|
||||
a: false,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -145,7 +154,7 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
|
||||
|
@@ -1,13 +1,23 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, take } from 'rxjs/operators';
|
||||
import {
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
Observable,
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
distinctUntilChanged,
|
||||
take,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
|
||||
/**
|
||||
* Component to display the Quality Assurance source list.
|
||||
@@ -15,18 +25,18 @@ import { hasValue } from '../../../shared/empty.util';
|
||||
@Component({
|
||||
selector: 'ds-quality-assurance-source',
|
||||
templateUrl: './quality-assurance-source.component.html',
|
||||
styleUrls: ['./quality-assurance-source.component.scss']
|
||||
styleUrls: ['./quality-assurance-source.component.scss'],
|
||||
})
|
||||
export class QualityAssuranceSourceComponent implements OnInit {
|
||||
|
||||
/**
|
||||
/**
|
||||
* The pagination system configuration for HTML listing.
|
||||
* @type {PaginationComponentOptions}
|
||||
*/
|
||||
public paginationConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'btp',
|
||||
pageSize: 10,
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
pageSizeOptions: [5, 10, 20, 40, 60],
|
||||
});
|
||||
/**
|
||||
* The Quality Assurance source list sort options.
|
||||
@@ -71,10 +81,10 @@ export class QualityAssuranceSourceComponent implements OnInit {
|
||||
ngAfterViewInit(): void {
|
||||
this.subs.push(
|
||||
this.notificationsStateService.isQualityAssuranceSourceLoaded().pipe(
|
||||
take(1)
|
||||
take(1),
|
||||
).subscribe(() => {
|
||||
this.getQualityAssuranceSource();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -107,7 +117,7 @@ export class QualityAssuranceSourceComponent implements OnInit {
|
||||
).subscribe((options: PaginationComponentOptions) => {
|
||||
this.notificationsStateService.dispatchRetrieveQualityAssuranceSource(
|
||||
options.pageSize,
|
||||
options.currentPage
|
||||
options.currentPage,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@@ -1,26 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import {
|
||||
Actions,
|
||||
createEffect,
|
||||
ofType,
|
||||
} from '@ngrx/effects';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
catchError,
|
||||
map,
|
||||
switchMap,
|
||||
tap,
|
||||
withLatestFrom,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceSourceDataService } from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
AddSourceAction,
|
||||
QualityAssuranceSourceActionTypes,
|
||||
RetrieveAllSourceAction,
|
||||
RetrieveAllSourceErrorAction,
|
||||
} from './quality-assurance-source.actions';
|
||||
import {
|
||||
QualityAssuranceSourceObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
|
||||
/**
|
||||
* Provides effect methods for the Quality Assurance source actions.
|
||||
@@ -37,19 +42,19 @@ export class QualityAssuranceSourceEffects {
|
||||
switchMap(([action, currentState]: [RetrieveAllSourceAction, any]) => {
|
||||
return this.qualityAssuranceSourceService.getSources(
|
||||
action.payload.elementsPerPage,
|
||||
action.payload.currentPage
|
||||
action.payload.currentPage,
|
||||
).pipe(
|
||||
map((sources: PaginatedList<QualityAssuranceSourceObject>) =>
|
||||
new AddSourceAction(sources.page, sources.totalPages, sources.currentPage, sources.totalElements)
|
||||
new AddSourceAction(sources.page, sources.totalPages, sources.currentPage, sources.totalElements),
|
||||
),
|
||||
catchError((error: Error) => {
|
||||
if (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
return observableOf(new RetrieveAllSourceErrorAction());
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
));
|
||||
|
||||
/**
|
||||
@@ -59,7 +64,7 @@ export class QualityAssuranceSourceEffects {
|
||||
ofType(QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE_ERROR),
|
||||
tap(() => {
|
||||
this.notificationsService.error(null, this.translate.get('quality-assurance.source.error.service.retrieve'));
|
||||
})
|
||||
}),
|
||||
), { dispatch: false });
|
||||
|
||||
/**
|
||||
@@ -69,7 +74,7 @@ export class QualityAssuranceSourceEffects {
|
||||
ofType(QualityAssuranceSourceActionTypes.ADD_SOURCE),
|
||||
tap(() => {
|
||||
this.qualityAssuranceSourceDataService.clearFindAllSourceRequests();
|
||||
})
|
||||
}),
|
||||
), { dispatch: false });
|
||||
|
||||
/**
|
||||
@@ -87,7 +92,7 @@ export class QualityAssuranceSourceEffects {
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceSourceService: QualityAssuranceSourceService,
|
||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService
|
||||
private qualityAssuranceSourceDataService: QualityAssuranceSourceDataService,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
@@ -1,68 +1,71 @@
|
||||
import {
|
||||
AddSourceAction,
|
||||
RetrieveAllSourceAction,
|
||||
RetrieveAllSourceErrorAction
|
||||
} from './quality-assurance-source.actions';
|
||||
import { qualityAssuranceSourceReducer, QualityAssuranceSourceState } from './quality-assurance-source.reducer';
|
||||
import {
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import {
|
||||
AddSourceAction,
|
||||
RetrieveAllSourceAction,
|
||||
RetrieveAllSourceErrorAction,
|
||||
} from './quality-assurance-source.actions';
|
||||
import {
|
||||
qualityAssuranceSourceReducer,
|
||||
QualityAssuranceSourceState,
|
||||
} from './quality-assurance-source.reducer';
|
||||
|
||||
describe('qualityAssuranceSourceReducer test suite', () => {
|
||||
let qualityAssuranceSourceInitialState: QualityAssuranceSourceState;
|
||||
const elementPerPage = 3;
|
||||
const currentPage = 0;
|
||||
describe('qualityAssuranceSourceReducer test suite', () => {
|
||||
let qualityAssuranceSourceInitialState: QualityAssuranceSourceState;
|
||||
const elementPerPage = 3;
|
||||
const currentPage = 0;
|
||||
|
||||
beforeEach(() => {
|
||||
qualityAssuranceSourceInitialState = {
|
||||
source: [],
|
||||
processing: false,
|
||||
loaded: false,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
};
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_SOURCE should set the State property "processing" to TRUE', () => {
|
||||
const expectedState = qualityAssuranceSourceInitialState;
|
||||
expectedState.processing = true;
|
||||
|
||||
const action = new RetrieveAllSourceAction(elementPerPage, currentPage);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_SOURCE_ERROR should change the State to initial State but processing, loaded, and currentPage', () => {
|
||||
const expectedState = qualityAssuranceSourceInitialState;
|
||||
expectedState.processing = false;
|
||||
expectedState.loaded = true;
|
||||
expectedState.currentPage = 0;
|
||||
|
||||
const action = new RetrieveAllSourceErrorAction();
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
it('Action ADD_SOURCE should populate the State with Quality Assurance source', () => {
|
||||
const expectedState = {
|
||||
source: [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
currentPage: 0,
|
||||
totalElements: 2
|
||||
};
|
||||
|
||||
const action = new AddSourceAction(
|
||||
[ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
1, 0, 2
|
||||
);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
beforeEach(() => {
|
||||
qualityAssuranceSourceInitialState = {
|
||||
source: [],
|
||||
processing: false,
|
||||
loaded: false,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0,
|
||||
};
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_SOURCE should set the State property "processing" to TRUE', () => {
|
||||
const expectedState = qualityAssuranceSourceInitialState;
|
||||
expectedState.processing = true;
|
||||
|
||||
const action = new RetrieveAllSourceAction(elementPerPage, currentPage);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
it('Action RETRIEVE_ALL_SOURCE_ERROR should change the State to initial State but processing, loaded, and currentPage', () => {
|
||||
const expectedState = qualityAssuranceSourceInitialState;
|
||||
expectedState.processing = false;
|
||||
expectedState.loaded = true;
|
||||
expectedState.currentPage = 0;
|
||||
|
||||
const action = new RetrieveAllSourceErrorAction();
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
|
||||
it('Action ADD_SOURCE should populate the State with Quality Assurance source', () => {
|
||||
const expectedState = {
|
||||
source: [ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
processing: false,
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
currentPage: 0,
|
||||
totalElements: 2,
|
||||
};
|
||||
|
||||
const action = new AddSourceAction(
|
||||
[ qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMoreAbstract ],
|
||||
1, 0, 2,
|
||||
);
|
||||
const newState = qualityAssuranceSourceReducer(qualityAssuranceSourceInitialState, action);
|
||||
|
||||
expect(newState).toEqual(expectedState);
|
||||
});
|
||||
});
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceSourceActionTypes, QualityAssuranceSourceActions } from './quality-assurance-source.actions';
|
||||
import {
|
||||
QualityAssuranceSourceActions,
|
||||
QualityAssuranceSourceActionTypes,
|
||||
} from './quality-assurance-source.actions';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance source state.
|
||||
@@ -22,7 +25,7 @@ const qualityAssuranceSourceInitialState: QualityAssuranceSourceState = {
|
||||
loaded: false,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
totalElements: 0,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -40,7 +43,7 @@ export function qualityAssuranceSourceReducer(state = qualityAssuranceSourceInit
|
||||
case QualityAssuranceSourceActionTypes.RETRIEVE_ALL_SOURCE: {
|
||||
return Object.assign({}, state, {
|
||||
source: [],
|
||||
processing: true
|
||||
processing: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ export function qualityAssuranceSourceReducer(state = qualityAssuranceSourceInit
|
||||
loaded: true,
|
||||
totalPages: action.payload.totalPages,
|
||||
currentPage: state.currentPage,
|
||||
totalElements: action.payload.totalElements
|
||||
totalElements: action.payload.totalElements,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ export function qualityAssuranceSourceReducer(state = qualityAssuranceSourceInit
|
||||
loaded: true,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
totalElements: 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,20 +1,22 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
|
||||
import {
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceSourceDataService } from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import {
|
||||
getMockQualityAssuranceSourceRestService,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
qualityAssuranceSourceObjectMorePid
|
||||
qualityAssuranceSourceObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { QualityAssuranceSourceService } from './quality-assurance-source.service';
|
||||
|
||||
describe('QualityAssuranceSourceService', () => {
|
||||
let service: QualityAssuranceSourceService;
|
||||
@@ -33,8 +35,8 @@ describe('QualityAssuranceSourceService', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: QualityAssuranceSourceDataService, useClass: getMockQualityAssuranceSourceRestService },
|
||||
{ provide: QualityAssuranceSourceService, useValue: service }
|
||||
]
|
||||
{ provide: QualityAssuranceSourceService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -52,7 +54,7 @@ describe('QualityAssuranceSourceService', () => {
|
||||
const findListOptions: FindListOptions = {
|
||||
elementsPerPage: elementsPerPage,
|
||||
currentPage: currentPage,
|
||||
sort: sortOptions
|
||||
sort: sortOptions,
|
||||
};
|
||||
const result = service.getSources(elementsPerPage, currentPage);
|
||||
expect((service as any).qualityAssuranceSourceRestService.getSources).toHaveBeenCalledWith(findListOptions);
|
||||
@@ -60,7 +62,7 @@ describe('QualityAssuranceSourceService', () => {
|
||||
|
||||
it('Should return a paginated list of Quality Assurance Source', () => {
|
||||
const expected = cold('(a|)', {
|
||||
a: paginatedList
|
||||
a: paginatedList,
|
||||
});
|
||||
const result = service.getSources(elementsPerPage, currentPage);
|
||||
expect(result).toBeObservable(expected);
|
||||
|
@@ -1,18 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
QualityAssuranceSourceDataService
|
||||
} from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {
|
||||
QualityAssuranceSourceObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { QualityAssuranceSourceObject } from '../../../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceSourceDataService } from '../../../core/notifications/qa/source/quality-assurance-source-data.service';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
|
||||
/**
|
||||
@@ -26,7 +24,7 @@ export class QualityAssuranceSourceService {
|
||||
* @param {QualityAssuranceSourceDataService} qualityAssuranceSourceRestService
|
||||
*/
|
||||
constructor(
|
||||
private qualityAssuranceSourceRestService: QualityAssuranceSourceDataService
|
||||
private qualityAssuranceSourceRestService: QualityAssuranceSourceDataService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -46,7 +44,7 @@ export class QualityAssuranceSourceService {
|
||||
const findListOptions: FindListOptions = {
|
||||
elementsPerPage: elementsPerPage,
|
||||
currentPage: currentPage,
|
||||
sort: sortOptions
|
||||
sort: sortOptions,
|
||||
};
|
||||
|
||||
return this.qualityAssuranceSourceRestService.getSources(findListOptions).pipe(
|
||||
@@ -57,7 +55,7 @@ export class QualityAssuranceSourceService {
|
||||
} else {
|
||||
throw new Error('Can\'t retrieve Quality Assurance source from the Broker source REST service');
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import { Action } from '@ngrx/store';
|
||||
import { type } from '../../../shared/ngrx/type';
|
||||
|
||||
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { type } from '../../../shared/ngrx/type';
|
||||
|
||||
/**
|
||||
* For each action type in an action group, make a simple
|
||||
@@ -38,7 +39,7 @@ export class RetrieveAllTopicsAction implements Action {
|
||||
constructor(elementsPerPage: number, currentPage: number) {
|
||||
this.payload = {
|
||||
elementsPerPage,
|
||||
currentPage
|
||||
currentPage,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -80,7 +81,7 @@ export class AddTopicsAction implements Action {
|
||||
topics,
|
||||
totalPages,
|
||||
currentPage,
|
||||
totalElements
|
||||
totalElements,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,21 +1,30 @@
|
||||
/* eslint-disable no-empty, @typescript-eslint/no-empty-function */
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
NO_ERRORS_SCHEMA,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
ComponentFixture,
|
||||
inject,
|
||||
TestBed,
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { QualityAssuranceTopicsComponent } from './quality-assurance-topics.component';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { createTestComponent } from '../../../shared/testing/utils.test';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import { QualityAssuranceTopicsComponent } from './quality-assurance-topics.component';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
|
||||
describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
@@ -26,8 +35,8 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
const activatedRouteParams = {
|
||||
qualityAssuranceTopicsParams: {
|
||||
currentPage: 0,
|
||||
pageSize: 5
|
||||
}
|
||||
pageSize: 5,
|
||||
},
|
||||
};
|
||||
const paginationService = new PaginationServiceStub();
|
||||
|
||||
@@ -47,17 +56,17 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
paramMap: {
|
||||
get: () => 'openaire',
|
||||
},
|
||||
}}},
|
||||
} } },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
QualityAssuranceTopicsComponent,
|
||||
// tslint:disable-next-line: no-empty
|
||||
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } }}
|
||||
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } } },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents().then(() => {
|
||||
mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
]));
|
||||
mockNotificationsStateService.getQualityAssuranceTopicsTotalPages.and.returnValue(observableOf(1));
|
||||
mockNotificationsStateService.getQualityAssuranceTopicsCurrentPage.and.returnValue(observableOf(0));
|
||||
@@ -111,11 +120,11 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
expect(comp.topics$).toBeObservable(cold('(a|)', {
|
||||
a: [
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
qualityAssuranceTopicObjectMoreAbstract
|
||||
]
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
],
|
||||
}));
|
||||
expect(comp.totalElements$).toBeObservable(cold('(a|)', {
|
||||
a: 2
|
||||
a: 2,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -130,13 +139,13 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
|
||||
it(('isTopicsLoading should return FALSE'), () => {
|
||||
expect(comp.isTopicsLoading()).toBeObservable(cold('(a|)', {
|
||||
a: false
|
||||
a: false,
|
||||
}));
|
||||
});
|
||||
|
||||
it(('isTopicsProcessing should return FALSE'), () => {
|
||||
expect(comp.isTopicsProcessing()).toBeObservable(cold('(a|)', {
|
||||
a: false
|
||||
a: false,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -153,7 +162,7 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
|
||||
|
@@ -1,20 +1,24 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, take } from 'rxjs/operators';
|
||||
|
||||
import { SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import {
|
||||
QualityAssuranceTopicObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
Component,
|
||||
OnInit,
|
||||
} from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import {
|
||||
Observable,
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import {
|
||||
distinctUntilChanged,
|
||||
take,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { AdminQualityAssuranceTopicsPageParams } from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
import { SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||
import { NotificationsStateService } from '../../notifications-state.service';
|
||||
import {
|
||||
AdminQualityAssuranceTopicsPageParams
|
||||
} from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
|
||||
/**
|
||||
@@ -33,7 +37,7 @@ export class QualityAssuranceTopicsComponent implements OnInit {
|
||||
public paginationConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'btp',
|
||||
pageSize: 10,
|
||||
pageSizeOptions: [5, 10, 20, 40, 60]
|
||||
pageSizeOptions: [5, 10, 20, 40, 60],
|
||||
});
|
||||
/**
|
||||
* The Quality Assurance topic list sort options.
|
||||
@@ -71,7 +75,7 @@ export class QualityAssuranceTopicsComponent implements OnInit {
|
||||
private paginationService: PaginationService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private notificationsStateService: NotificationsStateService,
|
||||
private qualityAssuranceTopicsService: QualityAssuranceTopicsService
|
||||
private qualityAssuranceTopicsService: QualityAssuranceTopicsService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -91,10 +95,10 @@ export class QualityAssuranceTopicsComponent implements OnInit {
|
||||
ngAfterViewInit(): void {
|
||||
this.subs.push(
|
||||
this.notificationsStateService.isQualityAssuranceTopicsLoaded().pipe(
|
||||
take(1)
|
||||
take(1),
|
||||
).subscribe(() => {
|
||||
this.getQualityAssuranceTopics();
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -127,7 +131,7 @@ export class QualityAssuranceTopicsComponent implements OnInit {
|
||||
).subscribe((options: PaginationComponentOptions) => {
|
||||
this.notificationsStateService.dispatchRetrieveQualityAssuranceTopics(
|
||||
options.pageSize,
|
||||
options.currentPage
|
||||
options.currentPage,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@@ -1,26 +1,31 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import {
|
||||
Actions,
|
||||
createEffect,
|
||||
ofType,
|
||||
} from '@ngrx/effects';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { catchError, map, switchMap, tap, withLatestFrom } from 'rxjs/operators';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import {
|
||||
catchError,
|
||||
map,
|
||||
switchMap,
|
||||
tap,
|
||||
withLatestFrom,
|
||||
} from 'rxjs/operators';
|
||||
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceTopicDataService } from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
AddTopicsAction,
|
||||
QualityAssuranceTopicActionTypes,
|
||||
RetrieveAllTopicsAction,
|
||||
RetrieveAllTopicsErrorAction,
|
||||
} from './quality-assurance-topics.actions';
|
||||
import {
|
||||
QualityAssuranceTopicObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import {
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
|
||||
/**
|
||||
* Provides effect methods for the Quality Assurance topics actions.
|
||||
@@ -37,19 +42,19 @@ export class QualityAssuranceTopicsEffects {
|
||||
switchMap(([action, currentState]: [RetrieveAllTopicsAction, any]) => {
|
||||
return this.qualityAssuranceTopicService.getTopics(
|
||||
action.payload.elementsPerPage,
|
||||
action.payload.currentPage
|
||||
action.payload.currentPage,
|
||||
).pipe(
|
||||
map((topics: PaginatedList<QualityAssuranceTopicObject>) =>
|
||||
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements)
|
||||
new AddTopicsAction(topics.page, topics.totalPages, topics.currentPage, topics.totalElements),
|
||||
),
|
||||
catchError((error: Error) => {
|
||||
if (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
return observableOf(new RetrieveAllTopicsErrorAction());
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
));
|
||||
|
||||
/**
|
||||
@@ -59,7 +64,7 @@ export class QualityAssuranceTopicsEffects {
|
||||
ofType(QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS_ERROR),
|
||||
tap(() => {
|
||||
this.notificationsService.error(null, this.translate.get('quality-assurance.topic.error.service.retrieve'));
|
||||
})
|
||||
}),
|
||||
), { dispatch: false });
|
||||
|
||||
/**
|
||||
@@ -69,7 +74,7 @@ export class QualityAssuranceTopicsEffects {
|
||||
ofType(QualityAssuranceTopicActionTypes.ADD_TOPICS),
|
||||
tap(() => {
|
||||
this.qualityAssuranceTopicDataService.clearFindAllTopicsRequests();
|
||||
})
|
||||
}),
|
||||
), { dispatch: false });
|
||||
|
||||
/**
|
||||
@@ -87,6 +92,6 @@ export class QualityAssuranceTopicsEffects {
|
||||
private translate: TranslateService,
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceTopicService: QualityAssuranceTopicsService,
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService
|
||||
private qualityAssuranceTopicDataService: QualityAssuranceTopicDataService,
|
||||
) { }
|
||||
}
|
||||
|
@@ -1,13 +1,16 @@
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import {
|
||||
AddTopicsAction,
|
||||
RetrieveAllTopicsAction,
|
||||
RetrieveAllTopicsErrorAction
|
||||
RetrieveAllTopicsErrorAction,
|
||||
} from './quality-assurance-topics.actions';
|
||||
import { qualityAssuranceTopicsReducer, QualityAssuranceTopicState } from './quality-assurance-topics.reducer';
|
||||
import {
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
qualityAssuranceTopicsReducer,
|
||||
QualityAssuranceTopicState,
|
||||
} from './quality-assurance-topics.reducer';
|
||||
|
||||
describe('qualityAssuranceTopicsReducer test suite', () => {
|
||||
let qualityAssuranceTopicInitialState: QualityAssuranceTopicState;
|
||||
@@ -21,7 +24,7 @@ describe('qualityAssuranceTopicsReducer test suite', () => {
|
||||
loaded: false,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
totalElements: 0,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -54,12 +57,12 @@ describe('qualityAssuranceTopicsReducer test suite', () => {
|
||||
loaded: true,
|
||||
totalPages: 1,
|
||||
currentPage: 0,
|
||||
totalElements: 2
|
||||
totalElements: 2,
|
||||
};
|
||||
|
||||
const action = new AddTopicsAction(
|
||||
[ qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMoreAbstract ],
|
||||
1, 0, 2
|
||||
1, 0, 2,
|
||||
);
|
||||
const newState = qualityAssuranceTopicsReducer(qualityAssuranceTopicInitialState, action);
|
||||
|
||||
|
@@ -1,5 +1,8 @@
|
||||
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceTopicActionTypes, QualityAssuranceTopicsActions } from './quality-assurance-topics.actions';
|
||||
import {
|
||||
QualityAssuranceTopicActionTypes,
|
||||
QualityAssuranceTopicsActions,
|
||||
} from './quality-assurance-topics.actions';
|
||||
|
||||
/**
|
||||
* The interface representing the Quality Assurance topic state.
|
||||
@@ -22,7 +25,7 @@ const qualityAssuranceTopicInitialState: QualityAssuranceTopicState = {
|
||||
loaded: false,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
totalElements: 0,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -40,7 +43,7 @@ export function qualityAssuranceTopicsReducer(state = qualityAssuranceTopicIniti
|
||||
case QualityAssuranceTopicActionTypes.RETRIEVE_ALL_TOPICS: {
|
||||
return Object.assign({}, state, {
|
||||
topics: [],
|
||||
processing: true
|
||||
processing: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,7 +54,7 @@ export function qualityAssuranceTopicsReducer(state = qualityAssuranceTopicIniti
|
||||
loaded: true,
|
||||
totalPages: action.payload.totalPages,
|
||||
currentPage: state.currentPage,
|
||||
totalElements: action.payload.totalElements
|
||||
totalElements: action.payload.totalElements,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ export function qualityAssuranceTopicsReducer(state = qualityAssuranceTopicIniti
|
||||
loaded: true,
|
||||
totalPages: 0,
|
||||
currentPage: 0,
|
||||
totalElements: 0
|
||||
totalElements: 0,
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,21 +1,23 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
|
||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||
import {
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { QualityAssuranceTopicDataService } from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import {
|
||||
getMockQualityAssuranceTopicRestService,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
qualityAssuranceTopicObjectMorePid
|
||||
qualityAssuranceTopicObjectMorePid,
|
||||
} from '../../../shared/mocks/notifications.mock';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||
import { cold } from 'jasmine-marbles';
|
||||
import { buildPaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
|
||||
|
||||
describe('QualityAssuranceTopicsService', () => {
|
||||
let service: QualityAssuranceTopicsService;
|
||||
@@ -34,8 +36,8 @@ describe('QualityAssuranceTopicsService', () => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: QualityAssuranceTopicDataService, useClass: getMockQualityAssuranceTopicRestService },
|
||||
{ provide: QualityAssuranceTopicsService, useValue: service }
|
||||
]
|
||||
{ provide: QualityAssuranceTopicsService, useValue: service },
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
@@ -54,7 +56,7 @@ describe('QualityAssuranceTopicsService', () => {
|
||||
elementsPerPage: elementsPerPage,
|
||||
currentPage: currentPage,
|
||||
sort: sortOptions,
|
||||
searchParams: [new RequestParam('source', 'ENRICH!MORE!ABSTRACT')]
|
||||
searchParams: [new RequestParam('source', 'ENRICH!MORE!ABSTRACT')],
|
||||
};
|
||||
service.setSourceId('ENRICH!MORE!ABSTRACT');
|
||||
const result = service.getTopics(elementsPerPage, currentPage);
|
||||
@@ -63,7 +65,7 @@ describe('QualityAssuranceTopicsService', () => {
|
||||
|
||||
it('Should return a paginated list of Quality Assurance topics', () => {
|
||||
const expected = cold('(a|)', {
|
||||
a: paginatedList
|
||||
a: paginatedList,
|
||||
});
|
||||
const result = service.getTopics(elementsPerPage, currentPage);
|
||||
expect(result).toBeObservable(expected);
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import {
|
||||
QualityAssuranceTopicDataService
|
||||
} from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import {
|
||||
QualityAssuranceTopicObject
|
||||
} from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
|
||||
import { RequestParam } from '../../../core/cache/models/request-param.model';
|
||||
import {
|
||||
SortDirection,
|
||||
SortOptions,
|
||||
} from '../../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { QualityAssuranceTopicObject } from '../../../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceTopicDataService } from '../../../core/notifications/qa/topics/quality-assurance-topic-data.service';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,7 @@ export class QualityAssuranceTopicsService {
|
||||
* @param {QualityAssuranceTopicDataService} qualityAssuranceTopicRestService
|
||||
*/
|
||||
constructor(
|
||||
private qualityAssuranceTopicRestService: QualityAssuranceTopicDataService
|
||||
private qualityAssuranceTopicRestService: QualityAssuranceTopicDataService,
|
||||
) { }
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ export class QualityAssuranceTopicsService {
|
||||
elementsPerPage: elementsPerPage,
|
||||
currentPage: currentPage,
|
||||
sort: sortOptions,
|
||||
searchParams: [new RequestParam('source', this.sourceId)]
|
||||
searchParams: [new RequestParam('source', this.sourceId)],
|
||||
};
|
||||
|
||||
return this.qualityAssuranceTopicRestService.getTopics(findListOptions).pipe(
|
||||
@@ -61,7 +61,7 @@ export class QualityAssuranceTopicsService {
|
||||
} else {
|
||||
throw new Error('Can\'t retrieve Quality Assurance topics from the Broker topics REST service');
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,12 +1,18 @@
|
||||
import { createFeatureSelector, createSelector, MemoizedSelector } from '@ngrx/store';
|
||||
import { subStateSelector } from '../shared/selector.util';
|
||||
import { suggestionNotificationsSelector, SuggestionNotificationsState } from './notifications.reducer';
|
||||
import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { QualityAssuranceTopicState } from './qa/topics/quality-assurance-topics.reducer';
|
||||
import { QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
|
||||
import {
|
||||
QualityAssuranceSourceObject
|
||||
} from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
createFeatureSelector,
|
||||
createSelector,
|
||||
MemoizedSelector,
|
||||
} from '@ngrx/store';
|
||||
|
||||
import { QualityAssuranceSourceObject } from '../core/notifications/qa/models/quality-assurance-source.model';
|
||||
import { QualityAssuranceTopicObject } from '../core/notifications/qa/models/quality-assurance-topic.model';
|
||||
import { subStateSelector } from '../shared/selector.util';
|
||||
import {
|
||||
suggestionNotificationsSelector,
|
||||
SuggestionNotificationsState,
|
||||
} from './notifications.reducer';
|
||||
import { QualityAssuranceSourceState } from './qa/source/quality-assurance-source.reducer';
|
||||
import { QualityAssuranceTopicState } from './qa/topics/quality-assurance-topics.reducer';
|
||||
|
||||
/**
|
||||
* Returns the Notifications state.
|
||||
@@ -43,7 +49,7 @@ export function qualityAssuranceTopicsObjectSelector(): MemoizedSelector<Suggest
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isQualityAssuranceTopicsLoadedSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.loaded
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.loaded,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -52,7 +58,7 @@ export const isQualityAssuranceTopicsLoadedSelector = createSelector(_getNotific
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isQualityAssuranceTopicsProcessingSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.processing
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.processing,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -61,7 +67,7 @@ export const isQualityAssuranceTopicsProcessingSelector = createSelector(_getNot
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceTopicsTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.totalPages
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.totalPages,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -70,7 +76,7 @@ export const getQualityAssuranceTopicsTotalPagesSelector = createSelector(_getNo
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceTopicsCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.currentPage
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.currentPage,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -79,7 +85,7 @@ export const getQualityAssuranceTopicsCurrentPageSelector = createSelector(_getN
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceTopicsTotalsSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.totalElements
|
||||
(state: SuggestionNotificationsState) => state.qaTopic.totalElements,
|
||||
);
|
||||
|
||||
// Quality Assurance source
|
||||
@@ -90,7 +96,7 @@ export const getQualityAssuranceTopicsTotalsSelector = createSelector(_getNotifi
|
||||
* @function qualityAssuranceSourceStateSelector
|
||||
* @return {QualityAssuranceSourceState}
|
||||
*/
|
||||
export function qualityAssuranceSourceStateSelector(): MemoizedSelector<SuggestionNotificationsState, QualityAssuranceSourceState> {
|
||||
export function qualityAssuranceSourceStateSelector(): MemoizedSelector<SuggestionNotificationsState, QualityAssuranceSourceState> {
|
||||
return subStateSelector<SuggestionNotificationsState,QualityAssuranceSourceState>(suggestionNotificationsSelector, 'qaSource');
|
||||
}
|
||||
|
||||
@@ -109,7 +115,7 @@ export function qualityAssuranceSourceObjectSelector(): MemoizedSelector<Suggest
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isQualityAssuranceSourceLoadedSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaSource.loaded
|
||||
(state: SuggestionNotificationsState) => state.qaSource.loaded,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -118,7 +124,7 @@ export const isQualityAssuranceSourceLoadedSelector = createSelector(_getNotific
|
||||
* @return {boolean}
|
||||
*/
|
||||
export const isQualityAssuranceSourceProcessingSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaSource.processing
|
||||
(state: SuggestionNotificationsState) => state.qaSource.processing,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -127,7 +133,7 @@ export const isQualityAssuranceSourceProcessingSelector = createSelector(_getNot
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceSourceTotalPagesSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaSource.totalPages
|
||||
(state: SuggestionNotificationsState) => state.qaSource.totalPages,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -136,7 +142,7 @@ export const getQualityAssuranceSourceTotalPagesSelector = createSelector(_getNo
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceSourceCurrentPageSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaSource.currentPage
|
||||
(state: SuggestionNotificationsState) => state.qaSource.currentPage,
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -145,5 +151,5 @@ export const getQualityAssuranceSourceCurrentPageSelector = createSelector(_getN
|
||||
* @return {number}
|
||||
*/
|
||||
export const getQualityAssuranceSourceTotalsSelector = createSelector(_getNotificationsState,
|
||||
(state: SuggestionNotificationsState) => state.qaSource.totalElements
|
||||
(state: SuggestionNotificationsState) => state.qaSource.totalElements,
|
||||
);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,8 @@
|
||||
import { createSelector, MemoizedSelector } from '@ngrx/store';
|
||||
import {
|
||||
createSelector,
|
||||
MemoizedSelector,
|
||||
} from '@ngrx/store';
|
||||
|
||||
import { hasValue } from './empty.util';
|
||||
|
||||
/**
|
||||
|
@@ -17,9 +17,9 @@ import { InfoConfig } from './info-config.interface';
|
||||
import { ItemConfig } from './item-config.interface';
|
||||
import { LangConfig } from './lang-config.interface';
|
||||
import { MarkdownConfig } from './markdown-config.interface';
|
||||
import { QualityAssuranceConfig } from './quality-assurance.config';
|
||||
import { MediaViewerConfig } from './media-viewer-config.interface';
|
||||
import { INotificationBoardOptions } from './notifications-config.interfaces';
|
||||
import { QualityAssuranceConfig } from './quality-assurance.config';
|
||||
import { ServerConfig } from './server-config.interface';
|
||||
import { SubmissionConfig } from './submission-config.interface';
|
||||
import { ThemeConfig } from './theme.config';
|
||||
|
@@ -18,11 +18,11 @@ import { LangConfig } from './lang-config.interface';
|
||||
import { MarkdownConfig } from './markdown-config.interface';
|
||||
import { MediaViewerConfig } from './media-viewer-config.interface';
|
||||
import { INotificationBoardOptions } from './notifications-config.interfaces';
|
||||
import { QualityAssuranceConfig } from './quality-assurance.config';
|
||||
import { ServerConfig } from './server-config.interface';
|
||||
import { SubmissionConfig } from './submission-config.interface';
|
||||
import { ThemeConfig } from './theme.config';
|
||||
import { UIServerConfig } from './ui-server-config.interface';
|
||||
import { QualityAssuranceConfig } from './quality-assurance.config';
|
||||
|
||||
export class DefaultAppConfig implements AppConfig {
|
||||
production = false;
|
||||
@@ -438,7 +438,7 @@ export class DefaultAppConfig implements AppConfig {
|
||||
|
||||
qualityAssuranceConfig: QualityAssuranceConfig = {
|
||||
sourceUrlMapForProjectSearch: {
|
||||
openaire: 'https://explore.openaire.eu/search/project?projectId='
|
||||
openaire: 'https://explore.openaire.eu/search/project?projectId=',
|
||||
},
|
||||
pageSize: 5,
|
||||
};
|
||||
|
@@ -309,7 +309,7 @@ export const environment: BuildConfig = {
|
||||
},
|
||||
qualityAssuranceConfig: {
|
||||
sourceUrlMapForProjectSearch: {
|
||||
openaire: 'https://explore.openaire.eu/search/project?projectId='
|
||||
openaire: 'https://explore.openaire.eu/search/project?projectId=',
|
||||
},
|
||||
pageSize: 5,
|
||||
},
|
||||
|
Reference in New Issue
Block a user