mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
implement items clickable, fix minor issues, add filters
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
|||||||
AdminNotifySearchResultComponent
|
AdminNotifySearchResultComponent
|
||||||
} from './admin-notify-search-result/admin-notify-search-result.component';
|
} from './admin-notify-search-result/admin-notify-search-result.component';
|
||||||
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
|
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
|
||||||
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component';
|
||||||
|
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
@@ -40,7 +41,9 @@ const ENTRY_COMPONENTS = [
|
|||||||
AdminNotifyMetricsComponent,
|
AdminNotifyMetricsComponent,
|
||||||
AdminNotifyIncomingComponent,
|
AdminNotifyIncomingComponent,
|
||||||
AdminNotifyOutgoingComponent,
|
AdminNotifyOutgoingComponent,
|
||||||
AdminNotifyDetailModalComponent
|
AdminNotifyDetailModalComponent,
|
||||||
|
AdminNotifySearchResultComponent,
|
||||||
|
AdminNotifyLogsResultComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminNotifyDashboardModule {
|
export class AdminNotifyDashboardModule {
|
||||||
|
@@ -15,29 +15,7 @@
|
|||||||
<a class="nav-link" [routerLink]="'../outbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.outbound-logs' | translate}}</a>
|
<a class="nav-link" [routerLink]="'../outbound'" [queryParams]="{view: 'table'}">{{'admin.notify.dashboard.outbound-logs' | translate}}</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="container my-4">
|
<ds-admin-notify-logs-result [defaultConfiguration]="'NOTIFY.incoming'" ></ds-admin-notify-logs-result>
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
|
||||||
<div class="h4">
|
|
||||||
<button (click)="resetDefaultConfiguration()" *ngIf="(selectedSearchConfig$ | async) !== defaultConfiguration" class="badge badge-primary mr-1 mb-1">
|
|
||||||
{{'admin.notify.dashboard.configuration' | translate}} {{ selectedSearchConfig$ | async }}
|
|
||||||
<span> ×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<ds-themed-search
|
|
||||||
*ngIf="!isLoading"
|
|
||||||
[configuration]="selectedSearchConfig$ | async"
|
|
||||||
[showViewModes]="false"
|
|
||||||
[searchEnabled]="false"
|
|
||||||
[context]="context"
|
|
||||||
></ds-themed-search>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
import { Context } from '../../../../core/shared/context.model';
|
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { tap } from 'rxjs/operators';
|
|
||||||
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -18,39 +13,7 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminNotifyIncomingComponent implements OnInit{
|
export class AdminNotifyIncomingComponent {
|
||||||
public selectedSearchConfig$: Observable<string>;
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
public defaultConfiguration = 'NOTIFY.incoming';
|
|
||||||
public isLoading = true;
|
|
||||||
|
|
||||||
|
|
||||||
protected readonly context = Context.CoarNotify;
|
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration).pipe(
|
|
||||||
tap(() => this.isLoading = false)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetDefaultConfiguration() {
|
|
||||||
this.router.navigate([this.getResolvedUrl(this.route.snapshot)], {
|
|
||||||
queryParams: {
|
|
||||||
configuration: this.defaultConfiguration,
|
|
||||||
view: ViewMode.Table
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param route url path
|
|
||||||
* @returns url path
|
|
||||||
*/
|
|
||||||
private getResolvedUrl(route: ActivatedRouteSnapshot): string {
|
|
||||||
return route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
<div class="container my-4">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
||||||
|
<div class="h4">
|
||||||
|
<button (click)="resetDefaultConfiguration()" *ngIf="(selectedSearchConfig$ | async) !== defaultConfiguration" class="badge badge-primary mr-1 mb-1">
|
||||||
|
{{'admin.notify.dashboard.configuration' | translate}} {{ selectedSearchConfig$ | async }}
|
||||||
|
<span> ×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div >
|
||||||
|
<ds-themed-search
|
||||||
|
[configuration]="selectedSearchConfig$ | async"
|
||||||
|
[showViewModes]="false"
|
||||||
|
[searchEnabled]="false"
|
||||||
|
[context]="context"
|
||||||
|
></ds-themed-search>
|
||||||
|
</div>
|
||||||
|
|
@@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AdminNotifyLogsResultComponent } from './admin-notify-logs-result.component';
|
||||||
|
|
||||||
|
describe('AdminNotifyLogsComponent', () => {
|
||||||
|
let component: AdminNotifyLogsResultComponent;
|
||||||
|
let fixture: ComponentFixture<AdminNotifyLogsResultComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ AdminNotifyLogsResultComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(AdminNotifyLogsResultComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@@ -0,0 +1,58 @@
|
|||||||
|
import { Component, Inject, Input, OnInit } from '@angular/core';
|
||||||
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-admin-notify-logs-result',
|
||||||
|
templateUrl: './admin-notify-logs-result.component.html',
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: SEARCH_CONFIG_SERVICE,
|
||||||
|
useClass: SearchConfigurationService
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AdminNotifyLogsResultComponent implements OnInit{
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
defaultConfiguration: string;
|
||||||
|
|
||||||
|
public selectedSearchConfig$: Observable<string>;
|
||||||
|
|
||||||
|
protected readonly context = Context.CoarNotify;
|
||||||
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
// override the route reuse strategy to prevent issue on result loading
|
||||||
|
this.router.routeReuseStrategy.shouldReuseRoute = () => {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public resetDefaultConfiguration() {
|
||||||
|
this.router.navigate([this.getResolvedUrl(this.route.snapshot)], {
|
||||||
|
queryParams: {
|
||||||
|
configuration: this.defaultConfiguration,
|
||||||
|
view: ViewMode.Table,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param route url path
|
||||||
|
* @returns url path
|
||||||
|
*/
|
||||||
|
private getResolvedUrl(route: ActivatedRouteSnapshot): string {
|
||||||
|
return route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/');
|
||||||
|
}
|
||||||
|
}
|
@@ -15,29 +15,8 @@
|
|||||||
<a class="nav-link active">{{'admin.notify.dashboard.outbound-logs' | translate}}</a>
|
<a class="nav-link active">{{'admin.notify.dashboard.outbound-logs' | translate}}</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="container my-4">
|
<ds-admin-notify-logs-result [defaultConfiguration]="'NOTIFY.outgoing'" ></ds-admin-notify-logs-result>
|
||||||
<div class="row">
|
|
||||||
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
|
||||||
<div class="h4">
|
|
||||||
<button (click)="resetDefaultConfiguration()" *ngIf="(selectedSearchConfig$ | async) !== defaultConfiguration" class="badge badge-primary mr-1 mb-1">
|
|
||||||
{{'admin.notify.dashboard.configuration' | translate}} {{ selectedSearchConfig$ | async }}
|
|
||||||
<span> ×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<ds-themed-search
|
|
||||||
*ngIf="!isLoading"
|
|
||||||
[configuration]="selectedSearchConfig$ | async"
|
|
||||||
[showViewModes]="false"
|
|
||||||
[searchEnabled]="false"
|
|
||||||
[context]="context"
|
|
||||||
></ds-themed-search>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component, Inject } from '@angular/core';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||||
import { Context } from '../../../../core/shared/context.model';
|
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
|
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
|
||||||
import { tap } from 'rxjs/operators';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -19,38 +14,6 @@ import { tap } from 'rxjs/operators';
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminNotifyOutgoingComponent {
|
export class AdminNotifyOutgoingComponent {
|
||||||
public selectedSearchConfig$: Observable<string>;
|
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
||||||
public defaultConfiguration = 'NOTIFY.outgoing';
|
|
||||||
public isLoading = true;
|
|
||||||
|
|
||||||
|
|
||||||
protected readonly context = Context.CoarNotify;
|
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration).pipe(
|
|
||||||
tap(() => this.isLoading = false)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public resetDefaultConfiguration() {
|
|
||||||
this.router.navigate([this.getResolvedUrl(this.route.snapshot)], {
|
|
||||||
queryParams: {
|
|
||||||
configuration: this.defaultConfiguration,
|
|
||||||
view: ViewMode.Table
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param route url path
|
|
||||||
* @returns url path
|
|
||||||
*/
|
|
||||||
private getResolvedUrl(route: ActivatedRouteSnapshot): string {
|
|
||||||
return route.pathFromRoot.map(v => v.url.map(segment => segment.toString()).join('/')).join('/');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,14 +13,29 @@ export class AdminNotifyMetricsComponent {
|
|||||||
boxesConfig: AdminNotifyMetricsRow[];
|
boxesConfig: AdminNotifyMetricsRow[];
|
||||||
|
|
||||||
private incomingConfiguration = 'NOTIFY.incoming';
|
private incomingConfiguration = 'NOTIFY.incoming';
|
||||||
|
private involvedItemsSuffix = 'involvedItems';
|
||||||
private inboundPath = '/inbound';
|
private inboundPath = '/inbound';
|
||||||
private outboundPath = '/outbound';
|
private outboundPath = '/outbound';
|
||||||
|
private adminSearchPath = '/admin/search';
|
||||||
|
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public navigateToSelectedSearchConfig(searchConfig: string) {
|
public navigateToSelectedSearchConfig(searchConfig: string) {
|
||||||
|
const isRelatedItemsConfig = searchConfig.endsWith(this.involvedItemsSuffix);
|
||||||
|
|
||||||
|
if (isRelatedItemsConfig) {
|
||||||
|
this.router.navigate([this.adminSearchPath], {
|
||||||
|
queryParams: {
|
||||||
|
configuration: searchConfig,
|
||||||
|
view: ViewMode.ListElement
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const isIncomingConfig = searchConfig.startsWith(this.incomingConfiguration);
|
const isIncomingConfig = searchConfig.startsWith(this.incomingConfiguration);
|
||||||
const selectedPath = isIncomingConfig ? this.inboundPath : this.outboundPath;
|
const selectedPath = isIncomingConfig ? this.inboundPath : this.outboundPath;
|
||||||
|
|
||||||
|
@@ -50,6 +50,26 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
|
|
||||||
private dateTypeKeys: string[] = ['queueLastStartTime', 'queueTimeout'];
|
private dateTypeKeys: string[] = ['queueLastStartTime', 'queueTimeout'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keys to be not shown in detail
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
private hiddenKeys: string[] = [
|
||||||
|
'target',
|
||||||
|
'object',
|
||||||
|
'context',
|
||||||
|
'origin',
|
||||||
|
'_links',
|
||||||
|
'metadata',
|
||||||
|
'thumbnail',
|
||||||
|
'item',
|
||||||
|
'accessStatus',
|
||||||
|
'queueStatus',
|
||||||
|
'notificationId',
|
||||||
|
'notificationType',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The format for the date values
|
* The format for the date values
|
||||||
* @private
|
* @private
|
||||||
@@ -87,18 +107,8 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
|
|||||||
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
const modalRef = this.modalService.open(AdminNotifyDetailModalComponent);
|
||||||
const messageToOpen = {...message};
|
const messageToOpen = {...message};
|
||||||
// we delete not necessary or not readable keys
|
// we delete not necessary or not readable keys
|
||||||
delete messageToOpen.target;
|
|
||||||
delete messageToOpen.object;
|
|
||||||
delete messageToOpen.context;
|
|
||||||
delete messageToOpen.origin;
|
|
||||||
delete messageToOpen._links;
|
|
||||||
delete messageToOpen.metadata;
|
|
||||||
delete messageToOpen.thumbnail;
|
|
||||||
delete messageToOpen.item;
|
|
||||||
delete messageToOpen.accessStatus;
|
|
||||||
delete messageToOpen.queueStatus;
|
|
||||||
|
|
||||||
const messageKeys = Object.keys(messageToOpen);
|
const messageKeys = Object.keys(messageToOpen).filter(key => !this.hiddenKeys.includes(key));
|
||||||
messageKeys.forEach(key => {
|
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);
|
||||||
|
@@ -26,6 +26,18 @@ export class AdminNotifyMessage extends DSpaceObject {
|
|||||||
@autoserialize
|
@autoserialize
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the notification
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
notificationId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of the notification
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
notificationType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the notification
|
* The type of the notification
|
||||||
*/
|
*/
|
||||||
|
@@ -3471,6 +3471,8 @@
|
|||||||
|
|
||||||
"admin.notify.dashboard.configuration": "Configuration: ",
|
"admin.notify.dashboard.configuration": "Configuration: ",
|
||||||
|
|
||||||
|
"search.filters.applied.f.relateditem": "Related items",
|
||||||
|
|
||||||
"admin.notify.dashboard.outbound": "Outbound messages",
|
"admin.notify.dashboard.outbound": "Outbound messages",
|
||||||
|
|
||||||
"admin.notify.dashboard.outbound-logs": "Logs/Outbound",
|
"admin.notify.dashboard.outbound-logs": "Logs/Outbound",
|
||||||
|
Reference in New Issue
Block a user