diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-detail-modal/admin-notify-detail-modal.component.spec.ts b/src/app/admin/admin-notify-dashboard/admin-notify-detail-modal/admin-notify-detail-modal.component.spec.ts index 7ac979050c..77a878429c 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-detail-modal/admin-notify-detail-modal.component.spec.ts +++ b/src/app/admin/admin-notify-dashboard/admin-notify-detail-modal/admin-notify-detail-modal.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal.component'; +import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap"; describe('AdminNotifyDetailModalComponent', () => { let component: AdminNotifyDetailModalComponent; @@ -8,7 +9,8 @@ describe('AdminNotifyDetailModalComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ AdminNotifyDetailModalComponent ] + declarations: [ AdminNotifyDetailModalComponent ], + providers: [NgbActiveModal] }) .compileComponents(); diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component.spec.ts b/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component.spec.ts index d32e100686..dba177f8f8 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component.spec.ts +++ b/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component.spec.ts @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component'; import { TranslateModule } from '@ngx-translate/core'; +import { ActivatedRoute } from "@angular/router"; describe('AdminNotifyLogsComponent', () => { let component: AdminNotifyIncomingComponent; @@ -10,7 +11,8 @@ describe('AdminNotifyLogsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], - declarations: [ AdminNotifyIncomingComponent ] + declarations: [ AdminNotifyIncomingComponent ], + providers: [ActivatedRoute] }) .compileComponents(); diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component.spec.ts b/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component.spec.ts index dafa72c52e..3cb67e9636 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component.spec.ts +++ b/src/app/admin/admin-notify-dashboard/admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component.spec.ts @@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component'; import { TranslateModule } from '@ngx-translate/core'; +import { ActivatedRoute } from "@angular/router"; describe('AdminNotifyLogsComponent', () => { let component: AdminNotifyOutgoingComponent; @@ -10,7 +11,8 @@ describe('AdminNotifyLogsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], - declarations: [ AdminNotifyOutgoingComponent ] + declarations: [ AdminNotifyOutgoingComponent ], + providers: [ActivatedRoute] }) .compileComponents(); diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.html b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.html index 80c7faa086..a1ba0670bc 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.html +++ b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.html @@ -30,7 +30,7 @@
- +
diff --git a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.ts b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.ts index 9c28a7e836..8d6430da9f 100644 --- a/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.ts +++ b/src/app/admin/admin-notify-dashboard/admin-notify-search-result/admin-notify-search-result.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model'; import { ViewMode } from '../../../core/shared/view-mode.model'; import { Context } from '../../../core/shared/context.model'; -import { AdminNotifyMessage } from '../models/admin-notify-message.model'; +import { AdminNotifyMessage, QueueStatusMap } from '../models/admin-notify-message.model'; import { tabulatableObjectsComponent } from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator'; @@ -12,6 +12,7 @@ import { import { PaginatedList } from '../../../core/data/paginated-list.model'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component'; +import { objects } from "../../../shared/search/search-results/search-results.component.spec"; @tabulatableObjectsComponent(PaginatedList, ViewMode.Table, Context.CoarNotify) @Component({ @@ -21,12 +22,7 @@ import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/ad }) export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent, AdminNotifySearchResult> implements OnInit{ public notifyMessages: AdminNotifyMessage[]; - - private queueStatusMap = { - QUEUE_STATUS_PROCESSED: 'Processed', - QUEUE_STATUS_FAILED: 'Failed', - QUEUE_STATUS_UNMAPPED_ACTION: 'Unmapped action', - }; + public reprocessStatus = QueueStatusMap.QUEUE_STATUS_QUEUED_FOR_RETRY; constructor(private modalService: NgbModal) { super(); @@ -36,10 +32,11 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListElem * Map messages on init for readable representation */ ngOnInit() { + console.log(this.objects.page.splice(0,2)) this.notifyMessages = this.objects.page.map(object => { const indexableObject = object.indexableObject; indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1]; - indexableObject.queueStatusLabel = this.queueStatusMap[indexableObject.queueStatusLabel]; + indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel]; return indexableObject; }); } diff --git a/src/app/admin/admin-notify-dashboard/models/admin-notify-message.model.ts b/src/app/admin/admin-notify-dashboard/models/admin-notify-message.model.ts index a463de483a..6114ab6084 100644 --- a/src/app/admin/admin-notify-dashboard/models/admin-notify-message.model.ts +++ b/src/app/admin/admin-notify-dashboard/models/admin-notify-message.model.ts @@ -6,6 +6,15 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { GenericConstructor } from '../../../core/shared/generic-constructor'; import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model'; +export enum QueueStatusMap { + QUEUE_STATUS_PROCESSED = 'Processed', + QUEUE_STATUS_FAILED = 'Failed', + QUEUE_STATUS_UNMAPPED_ACTION = 'Unmapped action', + QUEUE_STATUS_QUEUED_FOR_RETRY = 'Queued for retry', + QUEUE_STATUS_PROCESSING = 'Processing', + QUEUE_STATUS_QUEUED = 'Queued', + QUEUE_STATUS_UNTRUSTED = 'Untrusted', +}; /** * A message that includes admin notify info */ diff --git a/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.spec.ts b/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.spec.ts index 59d0a42ecd..9fe3065714 100644 --- a/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.spec.ts +++ b/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.spec.ts @@ -1,19 +1,45 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TabulatableObjectsLoaderComponent } from './tabulatable-objects-loader.component'; +import { ThemeService } from "../../../theme-support/theme.service"; +import { provideMockStore } from "@ngrx/store/testing"; +import { ListableObject } from "../listable-object.model"; +import { PaginatedList } from "../../../../core/data/paginated-list.model"; +import { Context } from "../../../../core/shared/context.model"; +import { GenericConstructor } from "../../../../core/shared/generic-constructor"; -describe('TabulatableObjectsComponent', () => { +const testType = 'TestType'; +class TestType extends ListableObject { + getRenderTypes(): (string | GenericConstructor)[] { + return [testType]; + } +} + +class TestTypes extends PaginatedList { + page: TestType[] +} + + +describe('TabulatableObjectsLoaderComponent', () => { let component: TabulatableObjectsLoaderComponent; let fixture: ComponentFixture; + let themeService: ThemeService; + beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ TabulatableObjectsLoaderComponent ] + declarations: [ TabulatableObjectsLoaderComponent ], + providers: [ + provideMockStore({}), + { provide: ThemeService, useValue: themeService }, + ] }) .compileComponents(); fixture = TestBed.createComponent(TabulatableObjectsLoaderComponent); component = fixture.componentInstance; + component.objects = new TestTypes(); + component.context = Context.Search; fixture.detectChanges(); }); diff --git a/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.ts b/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.ts index 1c68718bd6..467f2a12fe 100644 --- a/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.ts +++ b/src/app/shared/object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component.ts @@ -148,7 +148,7 @@ export class TabulatableObjectsLoaderComponent implements OnInit, OnChanges, OnD private instantiateComponent(objects: PaginatedList, changes?: SimpleChanges): void { // objects need to have same render type so we access just the first in the page - const component = this.getComponent(objects.page[0].getRenderTypes(), this.viewMode, this.context); + const component = this.getComponent(objects.page[0]?.getRenderTypes(), this.viewMode, this.context); const viewContainerRef = this.tabulatableObjectsDirective.viewContainerRef; viewContainerRef.clear(); diff --git a/src/app/shared/object-table/object-table.component.html b/src/app/shared/object-table/object-table.component.html index fcfa4aa691..8212b5a796 100644 --- a/src/app/shared/object-table/object-table.component.html +++ b/src/app/shared/object-table/object-table.component.html @@ -26,8 +26,8 @@ - - + +