mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
fix tests, small refactor, add translations
This commit is contained in:
@@ -1,14 +1,40 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MockActivatedRoute } from '../../../../shared/mocks/active-router.mock';
|
||||||
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
|
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||||
|
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||||
|
import { RequestService } from '../../../../core/data/request.service';
|
||||||
|
import { RemoteDataBuildService } from '../../../../core/cache/builders/remote-data-build.service';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
|
import { RouteService } from '../../../../core/services/route.service';
|
||||||
|
import { routeServiceStub } from '../../../../shared/testing/route-service.stub';
|
||||||
|
|
||||||
describe('AdminNotifyLogsComponent', () => {
|
describe('AdminNotifyLogsResultComponent', () => {
|
||||||
let component: AdminNotifyLogsResultComponent;
|
let component: AdminNotifyLogsResultComponent;
|
||||||
let fixture: ComponentFixture<AdminNotifyLogsResultComponent>;
|
let fixture: ComponentFixture<AdminNotifyLogsResultComponent>;
|
||||||
|
let objectCache: ObjectCacheService;
|
||||||
|
let requestService: RequestService;
|
||||||
|
let halService: HALEndpointService;
|
||||||
|
let rdbService: RemoteDataBuildService;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
declarations: [ AdminNotifyLogsResultComponent ]
|
imports: [TranslateModule.forRoot()],
|
||||||
|
declarations: [ AdminNotifyLogsResultComponent ],
|
||||||
|
providers: [
|
||||||
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
|
{ provide: Router, useValue: new RouterStub() },
|
||||||
|
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||||
|
{ provide: HALEndpointService, useValue: halService },
|
||||||
|
{ provide: ObjectCacheService, useValue: objectCache },
|
||||||
|
{ provide: RequestService, useValue: requestService },
|
||||||
|
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||||
|
provideMockStore({}),
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@ export class AdminNotifyLogsResultComponent implements OnInit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get resolved url from route
|
||||||
*
|
*
|
||||||
* @param route url path
|
* @param route url path
|
||||||
* @returns url path
|
* @returns url path
|
||||||
|
@@ -53,20 +53,16 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
* Keys to be not shown in detail
|
* Keys to be not shown in detail
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private hiddenKeys: string[] = [
|
private messageKeys: string[] = [
|
||||||
'target',
|
'type',
|
||||||
'object',
|
'id',
|
||||||
'context',
|
'coarNotifyType',
|
||||||
'origin',
|
'activityStreamType',
|
||||||
'_links',
|
'inReplyTo',
|
||||||
'metadata',
|
'queueAttempts',
|
||||||
'thumbnail',
|
'queueLastStartTime',
|
||||||
'item',
|
'queueStatusLabel',
|
||||||
'accessStatus',
|
'queueTimeout'
|
||||||
'queueStatus',
|
|
||||||
'notificationId',
|
|
||||||
'notificationType',
|
|
||||||
'message'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,10 +101,8 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
openDetailModal(notifyMessage: AdminNotifyMessage) {
|
openDetailModal(notifyMessage: AdminNotifyMessage) {
|
||||||
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
||||||
const messageToOpen = {...notifyMessage};
|
const messageToOpen = {...notifyMessage};
|
||||||
// we exclude not necessary or not readable keys
|
|
||||||
const messageKeys = Object.keys(messageToOpen).filter(key => !this.hiddenKeys.includes(key));
|
|
||||||
|
|
||||||
messageKeys.forEach(key => {
|
this.messageKeys.forEach(key => {
|
||||||
if (this.dateTypeKeys.includes(key)) {
|
if (this.dateTypeKeys.includes(key)) {
|
||||||
messageToOpen[key] = this.datePipe.transform(messageToOpen[key], this.dateFormat);
|
messageToOpen[key] = this.datePipe.transform(messageToOpen[key], this.dateFormat);
|
||||||
}
|
}
|
||||||
@@ -117,7 +111,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
messageToOpen.message = JSON.stringify(JSON.parse(notifyMessage.message), null, 2);
|
messageToOpen.message = JSON.stringify(JSON.parse(notifyMessage.message), null, 2);
|
||||||
|
|
||||||
modalRef.componentInstance.notifyMessage = messageToOpen;
|
modalRef.componentInstance.notifyMessage = messageToOpen;
|
||||||
modalRef.componentInstance.notifyMessageKeys = messageKeys;
|
modalRef.componentInstance.notifyMessageKeys = this.messageKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3609,6 +3609,10 @@
|
|||||||
|
|
||||||
"sorting.queue_attempts.ASC": "Queue attempted Ascending",
|
"sorting.queue_attempts.ASC": "Queue attempted Ascending",
|
||||||
|
|
||||||
|
"NOTIFY.incoming.involvedItems.search.results.head": "Related items",
|
||||||
|
|
||||||
|
"NOTIFY.outgoing.involvedItems.search.results.head": "Related items",
|
||||||
|
|
||||||
"type.notify-detail-modal": "Type",
|
"type.notify-detail-modal": "Type",
|
||||||
|
|
||||||
"id.notify-detail-modal": "Id",
|
"id.notify-detail-modal": "Id",
|
||||||
|
Reference in New Issue
Block a user