mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
separate results, config routes, add data mapping, add service
This commit is contained in:
@@ -6,6 +6,12 @@ import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.componen
|
||||
import {
|
||||
SiteAdministratorGuard
|
||||
} from '../../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||
import {
|
||||
AdminNotifyIncomingComponent
|
||||
} from "./admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component";
|
||||
import {
|
||||
AdminNotifyOutgoingComponent
|
||||
} from "./admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -22,8 +28,18 @@ import {
|
||||
title: 'admin.notify.dashboard.page.title',
|
||||
breadcrumbKey: 'admin.notify.dashboard',
|
||||
showBreadcrumbsFluid: false
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'inbound',
|
||||
component: AdminNotifyIncomingComponent,
|
||||
canActivate: [SiteAdministratorGuard],
|
||||
},
|
||||
{
|
||||
path: 'outbound',
|
||||
component: AdminNotifyOutgoingComponent,
|
||||
canActivate: [SiteAdministratorGuard],
|
||||
}
|
||||
])
|
||||
],
|
||||
providers: [
|
||||
|
@@ -3,35 +3,19 @@
|
||||
<div class="col-12">
|
||||
<h2 class="border-bottom pb-2">{{'admin-notify-dashboard.title'| translate}}</h2>
|
||||
<div>
|
||||
<ul ngbNav #nav="ngbNav" [activeId]="'metrics'" class="nav-tabs">
|
||||
<li [ngbNavItem]="'metrics'">
|
||||
<a ngbNavLink>{{'admin-notify-dashboard.metrics' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="metrics">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active">{{'admin-notify-dashboard.metrics' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'inbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.inbound' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'outbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.outbound' | translate}}</a>
|
||||
</ul>
|
||||
<div class="mt-2">
|
||||
<ds-admin-notify-metrics *ngIf="(notifyMetricsRows$ | async)?.length" [boxesConfig]="notifyMetricsRows$ | async"></ds-admin-notify-metrics>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'inbound'" (click)="activateTableMode()">
|
||||
<a ngbNavLink>{{'admin.notify.dashboard.inbound' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="inbound">
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.inbound' | translate}}</div>
|
||||
<ds-admin-notify-incoming></ds-admin-notify-incoming>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'outbound'" (click)="activateTableMode()">
|
||||
<a ngbNavLink>{{'admin.notify.dashboard.outbound'| translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="outbound">
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||
<ds-admin-notify-outgoing></ds-admin-notify-outgoing>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
</ul>
|
||||
<div [ngbNavOutlet]="nav" class="mt-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -9,15 +9,11 @@ import { map } from 'rxjs/operators';
|
||||
import { SearchObjects } from '../../shared/search/models/search-objects.model';
|
||||
import { AdminNotifyMetricsBox, AdminNotifyMetricsRow } from './admin-notify-metrics/admin-notify-metrics.model';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { FILTER_CONFIG, SearchFilterService } from '../../core/shared/search/search-filter.service';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component';
|
||||
import { AdminNotifySearchConfigurationService } from './config/admin-notify-search-configuration.service';
|
||||
import { AdminNotifySearchFilterService } from './config/admin-notify-filter-service';
|
||||
import { AdminNotifySearchFilterConfig } from './config/admin-notify-search-filter-config';
|
||||
import { ViewMode } from '../../core/shared/view-mode.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { SearchConfigurationService } from "../../core/shared/search/search-configuration.service";
|
||||
|
||||
export const FILTER_SEARCH: InjectionToken<SearchFilterService> = new InjectionToken<SearchFilterService>('searchFilterService');
|
||||
|
||||
@Component({
|
||||
selector: 'ds-admin-notify-dashboard',
|
||||
@@ -26,15 +22,7 @@ export const FILTER_SEARCH: InjectionToken<SearchFilterService> = new InjectionT
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
useClass: SearchConfigurationService
|
||||
}
|
||||
]
|
||||
})
|
||||
|
@@ -8,11 +8,15 @@ import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-i
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import { SearchModule } from '../../shared/search/search.module';
|
||||
import { SearchPageModule } from '../../search-page/search-page.module';
|
||||
import { AdminNotifySearchResultComponent } from './admin-notify-search-result/admin-notify-search-result.component';
|
||||
import { AdminNotifyIncomingSearchResultComponent } from './admin-notify-search-result/incoming/admin-notify-incoming-search-result.component';
|
||||
import {
|
||||
AdminNotifyOutgoingComponent
|
||||
} from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
|
||||
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||
import {
|
||||
AdminNotifyOutgoingSearchResultComponent
|
||||
} from "./admin-notify-search-result/outgoing/admin-notify-outgoing-search-result.component";
|
||||
import { AdminNotifyMessagesService } from "./services/admin-notify-messages.service";
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -24,12 +28,16 @@ import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/adm
|
||||
SearchModule,
|
||||
SearchPageModule,
|
||||
],
|
||||
providers: [
|
||||
AdminNotifyMessagesService
|
||||
],
|
||||
declarations: [
|
||||
AdminNotifyDashboardComponent,
|
||||
AdminNotifyMetricsComponent,
|
||||
AdminNotifyIncomingComponent,
|
||||
AdminNotifyOutgoingComponent,
|
||||
AdminNotifySearchResultComponent,
|
||||
AdminNotifyIncomingSearchResultComponent,
|
||||
AdminNotifyOutgoingSearchResultComponent,
|
||||
AdminNotifyDetailModalComponent
|
||||
]
|
||||
})
|
||||
|
@@ -1,9 +1,30 @@
|
||||
<ds-themed-search
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2 class="border-bottom pb-2">{{'admin-notify-dashboard.title'| translate}}</h2>
|
||||
<div>
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'../'">{{'admin-notify-dashboard.metrics' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active">{{'admin.notify.dashboard.inbound' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'../outbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.outbound' | translate}}</a>
|
||||
</ul>
|
||||
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.inbound' | translate}}</div>
|
||||
<ds-themed-search
|
||||
[configuration]="'NOTIFY.incoming'"
|
||||
[showViewModes]="false"
|
||||
[searchEnabled]="false"
|
||||
[context]="context"
|
||||
[useUniquePageId]="true"
|
||||
[routeConfigParam]="'configuration-incoming'"
|
||||
></ds-themed-search>
|
||||
|
||||
></ds-themed-search>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -7,15 +7,13 @@ import { MockActivatedRoute } from "../../../../shared/mocks/active-router.mock"
|
||||
import { provideMockStore } from "@ngrx/store/testing";
|
||||
import { HALEndpointService } from "../../../../core/shared/hal-endpoint.service";
|
||||
import { SEARCH_CONFIG_SERVICE } from "../../../../my-dspace-page/my-dspace-page.component";
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { FILTER_CONFIG, SearchFilterService } from "../../../../core/shared/search/search-filter.service";
|
||||
import { RouteService } from "../../../../core/services/route.service";
|
||||
import { routeServiceStub } from "../../../../shared/testing/route-service.stub";
|
||||
import { RequestService } from "../../../../core/data/request.service";
|
||||
import { RemoteDataBuildService } from "../../../../core/cache/builders/remote-data-build.service";
|
||||
import { getMockRemoteDataBuildService } from "../../../../shared/mocks/remote-data-build.service.mock";
|
||||
import { SearchConfigurationService } from "../../../../core/shared/search/search-configuration.service";
|
||||
|
||||
describe('AdminNotifyIncomingComponent', () => {
|
||||
let component: AdminNotifyIncomingComponent;
|
||||
@@ -39,9 +37,7 @@ describe('AdminNotifyIncomingComponent', () => {
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyIncomingComponent ],
|
||||
providers: [
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: FILTER_SEARCH, useValue: AdminNotifySearchFilterService },
|
||||
{ provide: FILTER_CONFIG, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||
{ provide: HALEndpointService, useValue: halService },
|
||||
|
@@ -1,11 +1,7 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { AdminNotifySearchConfigurationService } from '../../config/admin-notify-search-configuration.service';
|
||||
import { FILTER_SEARCH } from '../../admin-notify-dashboard.component';
|
||||
import { AdminNotifySearchFilterService } from '../../config/admin-notify-filter-service';
|
||||
import { FILTER_CONFIG } from '../../../../core/shared/search/search-filter.service';
|
||||
import { AdminNotifySearchFilterConfig } from '../../config/admin-notify-search-filter-config';
|
||||
import { SearchConfigurationService } from "../../../../core/shared/search/search-configuration.service";
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -15,26 +11,12 @@ import { AdminNotifySearchFilterConfig } from '../../config/admin-notify-search-
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
useClass: SearchConfigurationService
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AdminNotifyIncomingComponent {
|
||||
protected readonly context = Context.CoarNotify;
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: AdminNotifySearchConfigurationService,
|
||||
@Inject(FILTER_SEARCH) public searchFilterService: AdminNotifySearchFilterService,
|
||||
@Inject(FILTER_CONFIG) public filterConfig: AdminNotifySearchFilterConfig) {
|
||||
const incomingPrefix = 'incoming.f';
|
||||
this.searchConfigService.setParamPrefix(incomingPrefix);
|
||||
this.searchFilterService.setParamPrefix(incomingPrefix);
|
||||
this.filterConfig.paramNamePrefix = incomingPrefix;
|
||||
protected readonly context = Context.CoarNotifyIncoming;
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,30 @@
|
||||
<ds-themed-search
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2 class="border-bottom pb-2">{{'admin-notify-dashboard.title'| translate}}</h2>
|
||||
<div>
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'../'">{{'admin-notify-dashboard.metrics' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [routerLink]="'../inbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.inbound' | translate}}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active">{{'admin.notify.dashboard.outbound' | translate}}</a>
|
||||
</ul>
|
||||
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||
<ds-themed-search
|
||||
[configuration]="'NOTIFY.outgoing'"
|
||||
[showViewModes]="false"
|
||||
[searchEnabled]="false"
|
||||
[context]="context"
|
||||
[routeConfigParam]="'configuration-outgoing'"
|
||||
[useUniquePageId]="true"
|
||||
></ds-themed-search>
|
||||
|
||||
></ds-themed-search>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -7,15 +7,13 @@ import { MockActivatedRoute } from "../../../../shared/mocks/active-router.mock"
|
||||
import { provideMockStore } from "@ngrx/store/testing";
|
||||
import { HALEndpointService } from "../../../../core/shared/hal-endpoint.service";
|
||||
import { SEARCH_CONFIG_SERVICE } from "../../../../my-dspace-page/my-dspace-page.component";
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { RouteService } from "../../../../core/services/route.service";
|
||||
import { routeServiceStub } from "../../../../shared/testing/route-service.stub";
|
||||
import { RequestService } from "../../../../core/data/request.service";
|
||||
import { getMockRemoteDataBuildService } from "../../../../shared/mocks/remote-data-build.service.mock";
|
||||
import { RemoteDataBuildService } from "../../../../core/cache/builders/remote-data-build.service";
|
||||
import { SearchConfigurationService } from "../../../../core/shared/search/search-configuration.service";
|
||||
|
||||
describe('AdminNotifyOutgoingComponent', () => {
|
||||
let component: AdminNotifyOutgoingComponent;
|
||||
@@ -38,9 +36,7 @@ describe('AdminNotifyOutgoingComponent', () => {
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyOutgoingComponent ],
|
||||
providers: [
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: FILTER_SEARCH, useValue: AdminNotifySearchFilterService },
|
||||
{ provide: FILTER_CONFIG, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: SearchConfigurationService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||
{ provide: HALEndpointService, useValue: halService },
|
||||
|
@@ -1,11 +1,7 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
import { AdminNotifySearchConfigurationService } from '../../config/admin-notify-search-configuration.service';
|
||||
import { FILTER_SEARCH } from '../../admin-notify-dashboard.component';
|
||||
import { AdminNotifySearchFilterService } from '../../config/admin-notify-filter-service';
|
||||
import { FILTER_CONFIG } from '../../../../core/shared/search/search-filter.service';
|
||||
import { AdminNotifySearchFilterConfig } from '../../config/admin-notify-search-filter-config';
|
||||
import { SearchConfigurationService } from "../../../../core/shared/search/search-configuration.service";
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -15,27 +11,13 @@ import { AdminNotifySearchFilterConfig } from '../../config/admin-notify-search-
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: AdminNotifySearchConfigurationService
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: AdminNotifySearchFilterService
|
||||
},
|
||||
{
|
||||
provide: FILTER_CONFIG,
|
||||
useClass: AdminNotifySearchFilterConfig
|
||||
useClass: SearchConfigurationService
|
||||
}
|
||||
]
|
||||
})
|
||||
export class AdminNotifyOutgoingComponent {
|
||||
protected readonly context = Context.CoarNotify;
|
||||
protected readonly context = Context.CoarNotifyOutgoing;
|
||||
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: AdminNotifySearchConfigurationService,
|
||||
@Inject(FILTER_SEARCH) public searchFilterService: AdminNotifySearchFilterService,
|
||||
@Inject(FILTER_CONFIG) public filterConfig: AdminNotifySearchFilterConfig) {
|
||||
const outgoingPrefix = 'outgoing.f';
|
||||
this.searchConfigService.setParamPrefix(outgoingPrefix);
|
||||
this.searchFilterService.setParamPrefix(outgoingPrefix);
|
||||
this.filterConfig.paramNamePrefix = outgoingPrefix;
|
||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||
}
|
||||
}
|
||||
|
@@ -1,22 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminNotifySearchResultComponent } from './admin-notify-search-result.component';
|
||||
|
||||
describe('AdminNotifySearchResultComponent', () => {
|
||||
let component: AdminNotifySearchResultComponent;
|
||||
let fixture: ComponentFixture<AdminNotifySearchResultComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminNotifySearchResultComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdminNotifySearchResultComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -1,58 +0,0 @@
|
||||
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, QueueStatusMap } from '../models/admin-notify-message.model';
|
||||
import {
|
||||
tabulatableObjectsComponent
|
||||
} from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
||||
import {
|
||||
TabulatableResultListElementsComponent
|
||||
} from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
||||
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';
|
||||
|
||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
|
||||
@Component({
|
||||
selector: 'ds-admin-notify-search-result',
|
||||
templateUrl: './admin-notify-search-result.component.html',
|
||||
styleUrls: ['./admin-notify-search-result.component.scss']
|
||||
})
|
||||
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit{
|
||||
public notifyMessages: AdminNotifyMessage[];
|
||||
public reprocessStatus = QueueStatusMap.QUEUE_STATUS_QUEUED_FOR_RETRY;
|
||||
|
||||
constructor(private modalService: NgbModal) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map messages on init for readable representation
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.notifyMessages = this.objects?.page.map(object => {
|
||||
const indexableObject = object.indexableObject;
|
||||
indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1];
|
||||
indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel];
|
||||
return indexableObject;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open modal for details visualization
|
||||
* @param message the message to be displayed
|
||||
*/
|
||||
openDetailModal(message: AdminNotifyMessage) {
|
||||
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
||||
const messageKeys = Object.keys(message);
|
||||
const keysToRead = [];
|
||||
messageKeys.forEach((key) => {
|
||||
if (typeof message[key] !== 'object') {
|
||||
keysToRead.push(key);
|
||||
}
|
||||
});
|
||||
modalRef.componentInstance.notifyMessage = message;
|
||||
modalRef.componentInstance.notifyMessageKeys = keysToRead;
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
|
||||
<div class="table-responsive mt-2">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Timestamp</th>
|
||||
<th scope="col">LDN Service</th>
|
||||
<th scope="col">Repository Item</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let message of (notifyMessages$ | async)">
|
||||
<td>
|
||||
<div>{{message.queueTimeout}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.origin}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.context}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.coarNotifyType}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.queueStatusLabel}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">Detail</button>
|
||||
<button *ngIf="message.queueStatusLabel === reprocessStatus" (click)="reprocessMessage(message)" class="btn btn-warning">Reprocess</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
@@ -0,0 +1,22 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminNotifyIncomingSearchResultComponent } from './admin-notify-incoming-search-result.component';
|
||||
|
||||
describe('AdminNotifySearchResultComponent', () => {
|
||||
let component: AdminNotifyIncomingSearchResultComponent;
|
||||
let fixture: ComponentFixture<AdminNotifyIncomingSearchResultComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminNotifyIncomingSearchResultComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdminNotifyIncomingSearchResultComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,97 @@
|
||||
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, QueueStatusMap } from '../../models/admin-notify-message.model';
|
||||
import {
|
||||
tabulatableObjectsComponent
|
||||
} from '../../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
||||
import {
|
||||
TabulatableResultListElementsComponent
|
||||
} from '../../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
||||
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 { LdnServicesService } from "../../../admin-ldn-services/ldn-services-data/ldn-services-data.service";
|
||||
import { BehaviorSubject, concatMap, from, Observable, of, scan, switchMap } from "rxjs";
|
||||
import { RemoteData } from "../../../../core/data/remote-data";
|
||||
import { LdnService } from "../../../admin-ldn-services/ldn-services-model/ldn-services.model";
|
||||
import { filter, map, mergeMap, take, tap, toArray } from "rxjs/operators";
|
||||
import { getAllSucceededRemoteDataPayload } from "../../../../core/shared/operators";
|
||||
import { ItemDataService } from "../../../../core/data/item-data.service";
|
||||
import { AdminNotifyMessagesService } from "../../services/admin-notify-messages.service";
|
||||
|
||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotifyIncoming)
|
||||
@Component({
|
||||
selector: 'ds-admin-notify-search-result',
|
||||
templateUrl: './admin-notify-incoming-search-result.component.html',
|
||||
styleUrls: ['./admin-notify-incoming-search-result.component.scss']
|
||||
})
|
||||
export class AdminNotifyIncomingSearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit{
|
||||
public notifyMessages: AdminNotifyMessage[];
|
||||
public notifyMessages$: Observable<AdminNotifyMessage[]>;
|
||||
public reprocessStatus = QueueStatusMap.QUEUE_STATUS_QUEUED_FOR_RETRY;
|
||||
|
||||
|
||||
|
||||
constructor(private modalService: NgbModal,
|
||||
private ldnServicesService: LdnServicesService,
|
||||
private itemDataService: ItemDataService,
|
||||
private adminNotifyMessagesService: AdminNotifyMessagesService) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map messages on init for readable representation
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.notifyMessages = this.objects?.page.map(object => {
|
||||
const indexableObject = object.indexableObject;
|
||||
indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1];
|
||||
indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel];
|
||||
return indexableObject;
|
||||
});
|
||||
|
||||
this.notifyMessages$ = from(this.notifyMessages).pipe(
|
||||
mergeMap(message => of(message)),
|
||||
mergeMap(message =>
|
||||
message.origin ? this.ldnServicesService.findById(message.origin.toString()).pipe(
|
||||
getAllSucceededRemoteDataPayload(),
|
||||
map(detail => ({...message, origin: detail.name}))
|
||||
) : of(message),
|
||||
),
|
||||
mergeMap(message =>
|
||||
message.context ? this.itemDataService.findById(message.context.toString()).pipe(
|
||||
getAllSucceededRemoteDataPayload(),
|
||||
map(detail => ({...message, context: detail.name}))
|
||||
) : of(message),
|
||||
),
|
||||
scan((acc: any, value: any) => [...acc, value], []),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Open modal for details visualization
|
||||
* @param message the message to be displayed
|
||||
*/
|
||||
openDetailModal(message: AdminNotifyMessage) {
|
||||
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
||||
const messageKeys = Object.keys(message);
|
||||
const keysToRead = [];
|
||||
messageKeys.forEach((key) => {
|
||||
if (typeof message[key] !== 'object') {
|
||||
keysToRead.push(key);
|
||||
}
|
||||
});
|
||||
modalRef.componentInstance.notifyMessage = message;
|
||||
modalRef.componentInstance.notifyMessageKeys = keysToRead;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reprocess message in status QUEUE_STATUS_QUEUED_FOR_RETRY and update results
|
||||
* @param message
|
||||
*/
|
||||
reprocessMessage(message: AdminNotifyMessage) {
|
||||
// TODO implement reprocess
|
||||
}
|
||||
}
|
@@ -3,20 +3,20 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Timestamp</th>
|
||||
<th scope="col">Origin</th>
|
||||
<th scope="col">Target</th>
|
||||
<th scope="col">Repository Item</th>
|
||||
<th scope="col">LDN Service</th>
|
||||
<th scope="col">Type</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let message of notifyMessages">
|
||||
<tr *ngFor="let message of (notifyMessages$ | async)">
|
||||
<td>
|
||||
<div class="text-nowrap">{{message.queueTimeout}}</div>
|
||||
<div>{{message.queueTimeout}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.origin}}</div>
|
||||
<div>{{message.object}}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>{{message.target}}</div>
|
||||
@@ -30,7 +30,7 @@
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">Detail</button>
|
||||
<button *ngIf="message.queueStatusLabel === reprocessStatus" class="btn btn-warning">Reprocess</button>
|
||||
<button *ngIf="message.queueStatusLabel === reprocessStatus" (click)="reprocessMessage(message)" class="btn btn-warning">Reprocess</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
@@ -0,0 +1,22 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminNotifyOutgoingSearchResultComponent } from './admin-notify-outgoing-search-result.component';
|
||||
|
||||
describe('AdminNotifySearchResultComponent', () => {
|
||||
let component: AdminNotifyOutgoingSearchResultComponent;
|
||||
let fixture: ComponentFixture<AdminNotifyOutgoingSearchResultComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminNotifyOutgoingSearchResultComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdminNotifyOutgoingSearchResultComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@@ -0,0 +1,98 @@
|
||||
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, QueueStatusMap } from '../../models/admin-notify-message.model';
|
||||
import {
|
||||
tabulatableObjectsComponent
|
||||
} from '../../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
||||
import {
|
||||
TabulatableResultListElementsComponent
|
||||
} from '../../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
|
||||
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 { LdnServicesService } from "../../../admin-ldn-services/ldn-services-data/ldn-services-data.service";
|
||||
import { from, Observable, of, scan, switchMap } from "rxjs";
|
||||
import { combineLatest, filter, map, mergeMap } from "rxjs/operators";
|
||||
import { getAllSucceededRemoteDataPayload } from "../../../../core/shared/operators";
|
||||
import { ItemDataService } from "../../../../core/data/item-data.service";
|
||||
import { AdminNotifyMessagesService } from "../../services/admin-notify-messages.service";
|
||||
|
||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotifyOutgoing)
|
||||
@Component({
|
||||
selector: 'ds-admin-notify-search-result',
|
||||
templateUrl: './admin-notify-outgoing-search-result.component.html',
|
||||
styleUrls: ['./admin-notify-outgoing-search-result.component.scss']
|
||||
})
|
||||
export class AdminNotifyOutgoingSearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit{
|
||||
public notifyMessages: AdminNotifyMessage[];
|
||||
public notifyMessages$: Observable<AdminNotifyMessage[]>;
|
||||
public reprocessStatus = QueueStatusMap.QUEUE_STATUS_QUEUED_FOR_RETRY;
|
||||
|
||||
constructor(private modalService: NgbModal,
|
||||
private ldnServicesService: LdnServicesService,
|
||||
private itemDataService: ItemDataService,
|
||||
private adminNotifyMessagesService: AdminNotifyMessagesService) {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map messages on init for readable representation
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.mapDetailsToMessages()
|
||||
}
|
||||
|
||||
/**
|
||||
* Open modal for details visualization
|
||||
* @param message the message to be displayed
|
||||
*/
|
||||
openDetailModal(message: AdminNotifyMessage) {
|
||||
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
||||
const messageKeys = Object.keys(message);
|
||||
modalRef.componentInstance.notifyMessage = message;
|
||||
modalRef.componentInstance.notifyMessageKeys = messageKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reprocess message in status QUEUE_STATUS_QUEUED_FOR_RETRY and update results
|
||||
* @param message
|
||||
*/
|
||||
reprocessMessage(message: AdminNotifyMessage) {
|
||||
this.adminNotifyMessagesService.findById(message.id).pipe(getAllSucceededRemoteDataPayload()).subscribe(response => {
|
||||
console.log(response);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map readable results to messages
|
||||
* @private
|
||||
*/
|
||||
private mapDetailsToMessages() {
|
||||
this.notifyMessages = this.objects?.page.map(object => {
|
||||
const indexableObject = object.indexableObject;
|
||||
indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1];
|
||||
indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel];
|
||||
return indexableObject;
|
||||
});
|
||||
|
||||
this.notifyMessages$ = from(this.notifyMessages).pipe(
|
||||
mergeMap(message => of(message)),
|
||||
mergeMap(message =>
|
||||
message.target ? this.ldnServicesService.findById(message.target.toString()).pipe(
|
||||
getAllSucceededRemoteDataPayload(),
|
||||
map(detail => ({...message, target: detail.name}))
|
||||
) : of(message),
|
||||
),
|
||||
mergeMap(message =>
|
||||
message.object ? this.itemDataService.findById(message.object.toString()).pipe(
|
||||
getAllSucceededRemoteDataPayload(),
|
||||
map(detail => ({...message, object: detail.name}))
|
||||
) : of(message),
|
||||
),
|
||||
scan((acc: any, value: any) => [...acc, value], []),
|
||||
)
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||
import { deserialize } from 'cerialize';
|
||||
import { HALLink } from '../../../core/shared/hal-link.model';
|
||||
import { CacheableObject } from '../../../core/cache/cacheable-object.model';
|
||||
import { AdminNotifySearchFilterConfig } from './admin-notify-search-filter-config';
|
||||
import { FACET_CONFIG_RESPONSE } from '../../../shared/search/models/types/facet-config-response.resouce-type';
|
||||
|
||||
/**
|
||||
* The response from the discover/facets endpoint
|
||||
*/
|
||||
@typedObject
|
||||
export class AdminNotifyFacetConfigResponse implements CacheableObject {
|
||||
static type = FACET_CONFIG_RESPONSE;
|
||||
|
||||
/**
|
||||
* The object type,
|
||||
* hardcoded because rest doesn't a unique one.
|
||||
*/
|
||||
@excludeFromEquals
|
||||
type = FACET_CONFIG_RESPONSE;
|
||||
|
||||
/**
|
||||
* the filters in this response
|
||||
*/
|
||||
filters: AdminNotifySearchFilterConfig[];
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this SearchFilterConfig
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink;
|
||||
};
|
||||
}
|
@@ -1,38 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { FacetConfigResponseParsingService } from '../../../core/data/facet-config-response-parsing.service';
|
||||
import { RestRequest } from '../../../core/data/rest-request.model';
|
||||
import { RawRestResponse } from '../../../core/dspace-rest/raw-rest-response.model';
|
||||
import { ParsedResponse } from '../../../core/cache/response.models';
|
||||
import { DSpaceSerializer } from '../../../core/dspace-rest/dspace.serializer';
|
||||
import { AdminNotifySearchFilterConfig } from './admin-notify-search-filter-config';
|
||||
import { FacetConfigResponse } from '../../../shared/search/models/facet-config-response.model';
|
||||
|
||||
@Injectable()
|
||||
export class AdminNotifyFacetResponseParsingService extends FacetConfigResponseParsingService {
|
||||
parse(request: RestRequest, data: RawRestResponse): ParsedResponse {
|
||||
|
||||
const config = data.payload._embedded.facets;
|
||||
const serializer = new DSpaceSerializer(AdminNotifySearchFilterConfig);
|
||||
const filters = serializer.deserializeArray(config);
|
||||
|
||||
const _links = {
|
||||
self: data.payload._links.self
|
||||
};
|
||||
|
||||
// fill in the missing links section
|
||||
filters.forEach((filterConfig: AdminNotifySearchFilterConfig) => {
|
||||
_links[filterConfig.name] = {
|
||||
href: filterConfig._links.self.href
|
||||
};
|
||||
});
|
||||
|
||||
const facetConfigResponse = Object.assign(new FacetConfigResponse(), {
|
||||
filters,
|
||||
_links
|
||||
});
|
||||
|
||||
this.addToObjectCache(facetConfigResponse, request, data);
|
||||
|
||||
return new ParsedResponse(data.statusCode, facetConfigResponse._links.self);
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { SearchFilterService } from '../../../core/shared/search/search-filter.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { SearchFiltersState } from '../../../shared/search/search-filters/search-filter/search-filter.reducer';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
|
||||
|
||||
/**
|
||||
* Service that performs all actions that have to do with search filters and facets
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotifySearchFilterService extends SearchFilterService {
|
||||
|
||||
public filterPrefix: string;
|
||||
constructor(protected store: Store<SearchFiltersState>,
|
||||
protected routeService: RouteService) {
|
||||
super(store, routeService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the current active filters from the query parameters
|
||||
* @returns {Observable<Params>}
|
||||
*/
|
||||
getCurrentFilters() {
|
||||
return this.routeService.getQueryParamsWithPrefix(`${this.filterPrefix}.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param prefix
|
||||
*/
|
||||
setParamPrefix(prefix: string): void {
|
||||
this.filterPrefix = prefix;
|
||||
}
|
||||
}
|
@@ -1,145 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||
import { RouteService } from '../../../core/services/route.service';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
import { HALEndpointService } from '../../../core/shared/hal-endpoint.service';
|
||||
import { RequestService } from '../../../core/data/request.service';
|
||||
import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { GetRequest } from '../../../core/data/request.models';
|
||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
||||
import { ResponseParsingService } from '../../../core/data/parsing.service';
|
||||
import { hasNoValue, isNotEmpty } from '../../../shared/empty.util';
|
||||
import { AdminNotifyFacetResponseParsingService } from './admin-notify-facet-response-parsing.service';
|
||||
import { AdminNotifySearchFilterConfig } from './admin-notify-search-filter-config';
|
||||
import { AdminNotifyFacetConfigResponse } from './admin-notify-facet-config-response.model';
|
||||
import { SearchFilter } from '../../../shared/search/models/search-filter.model';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Service that performs all actions that have to do with the current admin notify configuration
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdminNotifySearchConfigurationService extends SearchConfigurationService {
|
||||
|
||||
public paramPrefix: string;
|
||||
/**
|
||||
* Initialize class
|
||||
*
|
||||
* @param {RouteService} routeService
|
||||
* @param {PaginationService} paginationService
|
||||
* @param {ActivatedRoute} route
|
||||
* @param linkService
|
||||
* @param halService
|
||||
* @param requestService
|
||||
* @param rdb
|
||||
*/
|
||||
constructor(protected routeService: RouteService,
|
||||
protected paginationService: PaginationService,
|
||||
protected route: ActivatedRoute,
|
||||
protected linkService: LinkService,
|
||||
protected halService: HALEndpointService,
|
||||
protected requestService: RequestService,
|
||||
protected rdb: RemoteDataBuildService) {
|
||||
super(routeService, paginationService, route, linkService, halService, requestService, rdb);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<Params>} Emits the current active filters with their values as they are displayed in the frontend URL
|
||||
*/
|
||||
getCurrentFrontendFilters(): Observable<Params> {
|
||||
return this.routeService.getQueryParamsWithPrefix(`${this.paramPrefix}.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param prefix
|
||||
*/
|
||||
setParamPrefix(prefix: string): void {
|
||||
this.paramPrefix = prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the filter configuration for a given scope or the whole repository
|
||||
* @param {string} scope UUID of the object for which config the filter config is requested, when no scope is provided the configuration for the whole repository is loaded
|
||||
* @param {string} configurationName the name of the configuration
|
||||
* @returns {Observable<RemoteData<SearchFilterConfig[]>>} The found filter configuration
|
||||
*/
|
||||
getConfig(scope?: string, configurationName?: string): Observable<RemoteData<AdminNotifySearchFilterConfig[]>> {
|
||||
const href$ = this.halService.getEndpoint(this.facetLinkPathPrefix).pipe(
|
||||
map((url: string) => this.getConfigUrl(url, scope, configurationName)),
|
||||
);
|
||||
|
||||
href$.pipe(take(1)).subscribe((url: string) => {
|
||||
let request = new GetRequest(this.requestService.generateRequestId(), url);
|
||||
request = Object.assign(request, {
|
||||
getResponseParser(): GenericConstructor<ResponseParsingService> {
|
||||
return AdminNotifyFacetResponseParsingService;
|
||||
}
|
||||
});
|
||||
this.requestService.send(request, true);
|
||||
});
|
||||
|
||||
return this.rdb.buildFromHref(href$).pipe(
|
||||
map((rd: RemoteData<AdminNotifyFacetConfigResponse>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
let filters: AdminNotifySearchFilterConfig[];
|
||||
if (isNotEmpty(rd.payload.filters)) {
|
||||
filters = rd.payload.filters
|
||||
.map((filter: any) => Object.assign(new AdminNotifySearchFilterConfig(), filter));
|
||||
filters.forEach(filter => filter.namePrefix = this.paramPrefix);
|
||||
} else {
|
||||
filters = [];
|
||||
}
|
||||
|
||||
return new RemoteData(
|
||||
rd.timeCompleted,
|
||||
rd.msToLive,
|
||||
rd.lastUpdated,
|
||||
rd.state,
|
||||
rd.errorMessage,
|
||||
filters,
|
||||
rd.statusCode,
|
||||
);
|
||||
} else {
|
||||
return rd as any as RemoteData<AdminNotifySearchFilterConfig[]>;
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<Params>} Emits the current active filters with their values as they are sent to the backend
|
||||
*/
|
||||
getCurrentFilters(): Observable<SearchFilter[]> {
|
||||
return this.getCurrentFrontendFilters().pipe(map((filterParams) => {
|
||||
if (isNotEmpty(filterParams)) {
|
||||
const filters = [];
|
||||
Object.keys(filterParams).forEach((key) => {
|
||||
// we add one to keep in account the point at the end of the prefix and set back the prefix f.
|
||||
const updatedKey = `f.${key.substring(this.paramPrefix.length + 1, key.length)}`;
|
||||
|
||||
delete Object.assign(filterParams, {[updatedKey]: filterParams[key] })[key];
|
||||
key = updatedKey;
|
||||
if (key.endsWith('.min') || key.endsWith('.max')) {
|
||||
const realKey = key.slice(0, -4);
|
||||
if (hasNoValue(filters.find((f) => f.key === realKey))) {
|
||||
const min = filterParams[realKey + '.min'] ? filterParams[realKey + '.min'][0] : '*';
|
||||
const max = filterParams[realKey + '.max'] ? filterParams[realKey + '.max'][0] : '*';
|
||||
filters.push(new SearchFilter(realKey, ['[' + min + ' TO ' + max + ']'], 'equals'));
|
||||
}
|
||||
} else {
|
||||
filters.push(new SearchFilter(key, filterParams[key]));
|
||||
}
|
||||
});
|
||||
return filters;
|
||||
}
|
||||
return [];
|
||||
}));
|
||||
}
|
||||
}
|
@@ -1,94 +0,0 @@
|
||||
import { typedObject } from '../../../core/cache/builders/build-decorators';
|
||||
import { SearchFilterConfig } from '../../../shared/search/models/search-filter-config.model';
|
||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||
import { HALLink } from '../../../core/shared/hal-link.model';
|
||||
import { excludeFromEquals } from '../../../core/utilities/equals.decorators';
|
||||
import { SEARCH_FILTER_CONFIG } from '../../../shared/search/models/types/search-filter-config.resource-type';
|
||||
import { FilterType } from '../../../shared/search/models/filter-type.model';
|
||||
|
||||
/**
|
||||
* The configuration for a search filter
|
||||
*/
|
||||
@typedObject
|
||||
export class AdminNotifySearchFilterConfig implements SearchFilterConfig {
|
||||
static type = SEARCH_FILTER_CONFIG;
|
||||
|
||||
/**
|
||||
* The prefix of this filter
|
||||
*/
|
||||
@autoserialize
|
||||
namePrefix: string;
|
||||
|
||||
/**
|
||||
* The object type,
|
||||
* hardcoded because rest doesn't set one.
|
||||
*/
|
||||
@excludeFromEquals
|
||||
type = SEARCH_FILTER_CONFIG;
|
||||
|
||||
/**
|
||||
* The name of this filter
|
||||
*/
|
||||
@autoserialize
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The FilterType of this filter
|
||||
*/
|
||||
@autoserializeAs(String, 'facetType')
|
||||
filterType: FilterType;
|
||||
|
||||
/**
|
||||
* True if the filter has facets
|
||||
*/
|
||||
@autoserialize
|
||||
hasFacets: boolean;
|
||||
|
||||
/**
|
||||
* @type {number} The page size used for this facet
|
||||
*/
|
||||
@autoserializeAs(String, 'facetLimit')
|
||||
pageSize = 5;
|
||||
|
||||
/**
|
||||
* Defines if the item facet is collapsed by default or not on the search page
|
||||
*/
|
||||
@autoserialize
|
||||
isOpenByDefault: boolean;
|
||||
|
||||
/**
|
||||
* Minimum value possible for this facet in the repository
|
||||
*/
|
||||
@autoserialize
|
||||
maxValue: string;
|
||||
|
||||
/**
|
||||
* Maximum value possible for this facet in the repository
|
||||
*/
|
||||
@autoserialize
|
||||
minValue: string;
|
||||
|
||||
/**
|
||||
* The {@link HALLink}s for this SearchFilterConfig
|
||||
*/
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set prefix to be used for route filters
|
||||
* @param namePrefix
|
||||
*/
|
||||
set paramNamePrefix(namePrefix: string) {
|
||||
this.namePrefix = namePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of this configuration that can be used in a url
|
||||
* @returns Parameter name
|
||||
*/
|
||||
get paramName(): string {
|
||||
return `${this.namePrefix}.${this.name}`;
|
||||
}
|
||||
}
|
@@ -29,6 +29,12 @@ export class AdminNotifyMessage extends DSpaceObject {
|
||||
@excludeFromEquals
|
||||
type = ADMIN_NOTIFY_MESSAGE;
|
||||
|
||||
/**
|
||||
* The id of the message
|
||||
*/
|
||||
@autoserialize
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The type of the notification
|
||||
*/
|
||||
@@ -47,6 +53,18 @@ export class AdminNotifyMessage extends DSpaceObject {
|
||||
@autoserialize
|
||||
inReplyTo: string;
|
||||
|
||||
/**
|
||||
* The object the message relates to
|
||||
*/
|
||||
@autoserialize
|
||||
object: string;
|
||||
|
||||
/**
|
||||
* The context of the message
|
||||
*/
|
||||
@autoserialize
|
||||
context: string;
|
||||
|
||||
/**
|
||||
* The attempts of the queue
|
||||
*/
|
||||
@@ -63,13 +81,13 @@ export class AdminNotifyMessage extends DSpaceObject {
|
||||
* The type of the activity stream
|
||||
*/
|
||||
@autoserialize
|
||||
origin: number;
|
||||
origin: number | string;
|
||||
|
||||
/**
|
||||
* The type of the activity stream
|
||||
*/
|
||||
@autoserialize
|
||||
target: number;
|
||||
target: number | string;
|
||||
|
||||
/**
|
||||
* The label for the status of the queue
|
||||
|
@@ -0,0 +1,45 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {dataService} from '../../../core/data/base/data-service.decorator';
|
||||
import {IdentifiableDataService} from '../../../core/data/base/identifiable-data.service';
|
||||
import {FindAllData, FindAllDataImpl} from '../../../core/data/base/find-all-data';
|
||||
import {DeleteData, DeleteDataImpl} from '../../../core/data/base/delete-data';
|
||||
import {RequestService} from '../../../core/data/request.service';
|
||||
import {RemoteDataBuildService} from '../../../core/cache/builders/remote-data-build.service';
|
||||
import {ObjectCacheService} from '../../../core/cache/object-cache.service';
|
||||
import {HALEndpointService} from '../../../core/shared/hal-endpoint.service';
|
||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
||||
import {FindListOptions} from '../../../core/data/find-list-options.model';
|
||||
import {FollowLinkConfig} from '../../../shared/utils/follow-link-config.model';
|
||||
import {Observable} from 'rxjs';
|
||||
import {RemoteData} from '../../../core/data/remote-data';
|
||||
import {PaginatedList} from '../../../core/data/paginated-list.model';
|
||||
import {NoContent} from '../../../core/shared/NoContent.model';
|
||||
import {PatchData, PatchDataImpl} from '../../../core/data/base/patch-data';
|
||||
import {ChangeAnalyzer} from '../../../core/data/change-analyzer';
|
||||
import {Operation} from 'fast-json-patch';
|
||||
import {RestRequestMethod} from '../../../core/data/rest-request-method';
|
||||
import {CreateData, CreateDataImpl} from '../../../core/data/base/create-data';
|
||||
import {SearchDataImpl} from '../../../core/data/base/search-data';
|
||||
import { ADMIN_NOTIFY_MESSAGE } from "../models/admin-notify-message.resource-type";
|
||||
import { AdminNotifyMessage } from "../models/admin-notify-message.model";
|
||||
|
||||
/**
|
||||
* Injectable service responsible for fetching/sending data from/to the REST API on the messages endpoint.
|
||||
*
|
||||
* @export
|
||||
* @class AdminNotifyMessagesService
|
||||
* @extends {IdentifiableDataService<AdminNotifyMessage>}
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(ADMIN_NOTIFY_MESSAGE)
|
||||
export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNotifyMessage> {
|
||||
constructor(
|
||||
protected requestService: RequestService,
|
||||
protected rdbService: RemoteDataBuildService,
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected halService: HALEndpointService,
|
||||
protected notificationsService: NotificationsService,
|
||||
) {
|
||||
super('messages', requestService, rdbService, objectCache, halService);
|
||||
}
|
||||
}
|
@@ -198,11 +198,6 @@ import { SubmissionCoarNotifyConfig } from '../submission/sections/section-coar-
|
||||
import { NotifyRequestsStatus } from '../item-page/simple/notify-requests-status/notify-requests-status.model';
|
||||
import { NotifyRequestsStatusDataService } from './data/notify-services-status-data.service';
|
||||
import { AdminNotifyMessage } from '../admin/admin-notify-dashboard/models/admin-notify-message.model';
|
||||
import {
|
||||
AdminNotifyFacetResponseParsingService
|
||||
} from '../admin/admin-notify-dashboard/config/admin-notify-facet-response-parsing.service';
|
||||
import { FILTER_SEARCH } from '../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
import { AdminNotifySearchFilterService } from '../admin/admin-notify-dashboard/config/admin-notify-filter-service';
|
||||
|
||||
|
||||
/**
|
||||
@@ -235,10 +230,6 @@ const PROVIDERS = [
|
||||
DSOResponseParsingService,
|
||||
{ provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap },
|
||||
{ provide: DspaceRestService, useFactory: restServiceFactory, deps: [MOCK_RESPONSE_MAP, HttpClient] },
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
useClass: SearchFilterService
|
||||
},
|
||||
EPersonDataService,
|
||||
LinkHeadService,
|
||||
HALEndpointService,
|
||||
@@ -254,7 +245,6 @@ const PROVIDERS = [
|
||||
EndpointMapResponseParsingService,
|
||||
FacetValueResponseParsingService,
|
||||
FacetConfigResponseParsingService,
|
||||
AdminNotifyFacetResponseParsingService,
|
||||
DebugResponseParsingService,
|
||||
SearchResponseParsingService,
|
||||
MyDSpaceResponseParsingService,
|
||||
@@ -294,7 +284,6 @@ const PROVIDERS = [
|
||||
SearchService,
|
||||
SidebarService,
|
||||
SearchFilterService,
|
||||
AdminNotifySearchFilterService,
|
||||
SearchConfigurationService,
|
||||
SelectableListService,
|
||||
RelationshipTypeDataService,
|
||||
|
@@ -40,5 +40,6 @@ export enum Context {
|
||||
|
||||
Bitstream = 'bitstream',
|
||||
|
||||
CoarNotify = 'coarNotify'
|
||||
CoarNotifyIncoming = 'coarNotifyIncoming',
|
||||
CoarNotifyOutgoing = 'coarNotifyOutgoing',
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetOptionComponent', () => {
|
||||
let comp: SearchFacetOptionComponent;
|
||||
@@ -103,7 +102,7 @@ describe('SearchFacetOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
provide: SearchFilterService, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -11,7 +11,6 @@ import { hasValue } from '../../../../../empty.util';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { getFacetValueForType } from '../../../../search.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from '../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-option',
|
||||
@@ -65,7 +64,7 @@ export class SearchFacetOptionComponent implements OnInit, OnDestroy {
|
||||
paginationId: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -23,7 +23,6 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetRangeOptionComponent', () => {
|
||||
let comp: SearchFacetRangeOptionComponent;
|
||||
@@ -77,7 +76,7 @@ describe('SearchFacetRangeOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
provide: SearchFilterService, useValue: {
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||
|
@@ -14,7 +14,6 @@ import { SearchConfigurationService } from '../../../../../../core/shared/search
|
||||
import { hasValue } from '../../../../../empty.util';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from '../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
const rangeDelimiter = '-';
|
||||
|
||||
@@ -65,7 +64,7 @@ export class SearchFacetRangeOptionComponent implements OnInit, OnDestroy {
|
||||
searchLink: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -17,7 +17,6 @@ import { SearchFacetSelectedOptionComponent } from './search-facet-selected-opti
|
||||
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetSelectedOptionComponent', () => {
|
||||
let comp: SearchFacetSelectedOptionComponent;
|
||||
@@ -127,7 +126,7 @@ describe('SearchFacetSelectedOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
provide: SearchFilterService, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -10,7 +10,6 @@ import { FacetValue } from '../../../../models/facet-value.model';
|
||||
import { currentPath } from '../../../../../utils/route.utils';
|
||||
import { getFacetValueForType } from '../../../../search.utils';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { FILTER_SEARCH } from '../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-selected-option',
|
||||
@@ -58,7 +57,7 @@ export class SearchFacetSelectedOptionComponent implements OnInit, OnDestroy {
|
||||
searchLink: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected searchConfigService: SearchConfigurationService,
|
||||
protected router: Router,
|
||||
protected paginationService: PaginationService
|
||||
|
@@ -24,7 +24,6 @@ import { RemoteDataBuildService } from '../../../../../core/cache/builders/remot
|
||||
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service.stub';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetFilterComponent', () => {
|
||||
let comp: SearchFacetFilterComponent;
|
||||
@@ -101,7 +100,7 @@ describe('SearchFacetFilterComponent', () => {
|
||||
{ provide: IN_PLACE_SEARCH, useValue: false },
|
||||
{ provide: REFRESH_FILTER, useValue: new BehaviorSubject<boolean>(false) },
|
||||
{
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
provide: SearchFilterService, useValue: {
|
||||
getSelectedValuesForFilter: () => observableOf(selectedValues),
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => true,
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -35,7 +35,6 @@ import { currentPath } from '../../../../utils/route.utils';
|
||||
import { getFacetValueForType, stripOperatorFromFilterValue } from '../../../search.utils';
|
||||
import { createPendingRemoteDataObject } from '../../../../remote-data.utils';
|
||||
import { FacetValues } from '../../../models/facet-values.model';
|
||||
import { FILTER_SEARCH } from '../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-facet-filter',
|
||||
@@ -99,7 +98,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
currentUrl: string;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
protected router: Router,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
|
||||
|
@@ -14,7 +14,6 @@ import { SearchConfigurationServiceStub } from '../../../testing/search-configur
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SequenceService } from '../../../../core/shared/sequence.service';
|
||||
import { BrowserOnlyMockPipe } from '../../../testing/browser-only-mock.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFilterComponent', () => {
|
||||
let comp: SearchFilterComponent;
|
||||
@@ -71,7 +70,7 @@ describe('SearchFilterComponent', () => {
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchServiceStub },
|
||||
{
|
||||
provide: FILTER_SEARCH,
|
||||
provide: SearchFilterService,
|
||||
useValue: mockFilterService
|
||||
},
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
|
||||
|
@@ -11,7 +11,6 @@ import { SearchService } from '../../../../core/shared/search/search.service';
|
||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SequenceService } from '../../../../core/shared/sequence.service';
|
||||
import { FILTER_SEARCH } from '../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-filter',
|
||||
@@ -72,7 +71,7 @@ export class SearchFilterComponent implements OnInit {
|
||||
private readonly sequenceId: number;
|
||||
|
||||
constructor(
|
||||
@Inject(FILTER_SEARCH) private filterService: SearchFilterService,
|
||||
private filterService: SearchFilterService,
|
||||
private searchService: SearchService,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) private searchConfigService: SearchConfigurationService,
|
||||
private sequenceService: SequenceService,
|
||||
|
@@ -26,7 +26,6 @@ import { SearchConfigurationServiceStub } from '../../../../testing/search-confi
|
||||
import { VocabularyEntryDetail } from '../../../../../core/submission/vocabularies/models/vocabulary-entry-detail.model';
|
||||
import { FacetValue} from '../../../models/facet-value.model';
|
||||
import { SearchFilterConfig } from '../../../models/search-filter-config.model';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchHierarchyFilterComponent', () => {
|
||||
|
||||
@@ -68,7 +67,7 @@ describe('SearchHierarchyFilterComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchService },
|
||||
{ provide: FILTER_SEARCH, useValue: searchFilterService },
|
||||
{ provide: SearchFilterService, useValue: searchFilterService },
|
||||
{ provide: RemoteDataBuildService, useValue: {} },
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: NgbModal, useValue: ngbModal },
|
||||
|
@@ -26,7 +26,6 @@ import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||
import { environment } from '../../../../../../environments/environment';
|
||||
import { addOperatorToFilterValue } from '../../../search.utils';
|
||||
import { VocabularyTreeviewModalComponent } from '../../../../form/vocabulary-treeview-modal/vocabulary-treeview-modal.component';
|
||||
import { FILTER_SEARCH } from '../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-hierarchy-filter',
|
||||
@@ -42,7 +41,7 @@ import { FILTER_SEARCH } from '../../../../../admin/admin-notify-dashboard/admin
|
||||
export class SearchHierarchyFilterComponent extends SearchFacetFilterComponent implements OnInit {
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
protected router: Router,
|
||||
protected modalService: NgbModal,
|
||||
|
@@ -25,7 +25,6 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-p
|
||||
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service.stub';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||
import { RouteService } from '../../../../../core/services/route.service';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchRangeFilterComponent', () => {
|
||||
let comp: SearchRangeFilterComponent;
|
||||
@@ -107,7 +106,7 @@ describe('SearchRangeFilterComponent', () => {
|
||||
{ provide: IN_PLACE_SEARCH, useValue: false },
|
||||
{ provide: REFRESH_FILTER, useValue: new BehaviorSubject<boolean>(false) },
|
||||
{
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
provide: SearchFilterService, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => true,
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -21,7 +21,6 @@ import { SearchConfigurationService } from '../../../../../core/shared/search/se
|
||||
import { RouteService } from '../../../../../core/services/route.service';
|
||||
import { hasValue } from '../../../../empty.util';
|
||||
import { yearFromString } from 'src/app/shared/date.util';
|
||||
import { FILTER_SEARCH } from '../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
/**
|
||||
* The suffix for a range filters' minimum in the frontend URL
|
||||
@@ -93,7 +92,7 @@ export class SearchRangeFilterComponent extends SearchFacetFilterComponent imple
|
||||
keyboardControl: boolean;
|
||||
|
||||
constructor(protected searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
protected router: Router,
|
||||
protected rdbs: RemoteDataBuildService,
|
||||
private translateService: TranslateService,
|
||||
|
@@ -9,7 +9,6 @@ import { SearchFiltersComponent } from './search-filters.component';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SearchConfigurationServiceStub } from '../../testing/search-configuration-service.stub';
|
||||
import { FILTER_SEARCH } from "../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFiltersComponent', () => {
|
||||
let comp: SearchFiltersComponent;
|
||||
@@ -37,7 +36,7 @@ describe('SearchFiltersComponent', () => {
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchServiceStub },
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
|
||||
{ provide: FILTER_SEARCH, useValue: searchFiltersStub },
|
||||
{ provide: SearchFilterService, useValue: searchFiltersStub },
|
||||
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -12,7 +12,6 @@ import { SearchFilterService } from '../../../core/shared/search/search-filter.s
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||
import { currentPath } from '../../utils/route.utils';
|
||||
import { hasValue } from '../../empty.util';
|
||||
import { FILTER_SEARCH } from '../../../admin/admin-notify-dashboard/admin-notify-dashboard.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-filters',
|
||||
@@ -72,7 +71,7 @@ export class SearchFiltersComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
constructor(
|
||||
private searchService: SearchService,
|
||||
@Inject(FILTER_SEARCH) protected filterService: SearchFilterService,
|
||||
protected filterService: SearchFilterService,
|
||||
private router: Router,
|
||||
@Inject(SEARCH_CONFIG_SERVICE) private searchConfigService: SearchConfigurationService) {
|
||||
}
|
||||
|
@@ -101,11 +101,6 @@ export class SearchComponent implements OnInit {
|
||||
*/
|
||||
@Input() searchEnabled = true;
|
||||
|
||||
/**
|
||||
* Config param for route service
|
||||
*/
|
||||
@Input() routeConfigParam: string;
|
||||
|
||||
/**
|
||||
* The width of the sidebar (bootstrap columns)
|
||||
*/
|
||||
@@ -297,12 +292,8 @@ export class SearchComponent implements OnInit {
|
||||
|
||||
this.searchConfigService.setPaginationId(this.paginationId);
|
||||
|
||||
if (this.routeConfigParam) {
|
||||
this.searchConfigService.setRouteConfigurationParamName(this.routeConfigParam);
|
||||
}
|
||||
|
||||
if (hasValue(this.configuration)) {
|
||||
this.routeService.setParameter(this.routeConfigParam ?? 'configuration', this.configuration);
|
||||
this.routeService.setParameter('configuration', this.configuration);
|
||||
}
|
||||
if (hasValue(this.fixedFilterQuery)) {
|
||||
this.routeService.setParameter('fixedFilterQuery', this.fixedFilterQuery);
|
||||
|
@@ -20,7 +20,7 @@ import { ListableObject } from '../object-collection/shared/listable-object.mode
|
||||
})
|
||||
export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
|
||||
|
||||
protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'routeConfigParam', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showCsvExport', 'showSidebar', 'showThumbnails', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics', 'query'];
|
||||
protected inAndOutputNames: (keyof SearchComponent & keyof this)[] = ['configurationList', 'context', 'configuration', 'fixedFilterQuery', 'useCachedVersionIfAvailable', 'inPlaceSearch', 'linkType', 'paginationId', 'searchEnabled', 'sideBarWidth', 'searchFormPlaceholder', 'selectable', 'selectionConfig', 'showCsvExport', 'showSidebar', 'showThumbnails', 'showViewModes', 'useUniquePageId', 'viewModeList', 'showScopeSelector', 'resultFound', 'deselectObject', 'selectObject', 'trackStatistics', 'query'];
|
||||
|
||||
@Input() configurationList: SearchConfigurationOption[];
|
||||
|
||||
@@ -30,8 +30,6 @@ export class ThemedSearchComponent extends ThemedComponent<SearchComponent> {
|
||||
|
||||
@Input() fixedFilterQuery: string;
|
||||
|
||||
@Input() routeConfigParam: string;
|
||||
|
||||
@Input() useCachedVersionIfAvailable: boolean;
|
||||
|
||||
@Input() inPlaceSearch: boolean;
|
||||
|
Reference in New Issue
Block a user