Merge branch 'coar-notify-7-part-two' into CST-13053-logs-detail-message

This commit is contained in:
FrancescoMolinaro
2024-01-15 15:35:39 +01:00
13 changed files with 172 additions and 46 deletions

View File

@@ -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 {

View File

@@ -15,20 +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.inbound' | translate}}</div>
<div class="col-md-9">
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
</div>
</div>
</div>
<ds-themed-search
[configuration]="defaultConfiguration"
[showViewModes]="false"
[searchEnabled]="false"
[context]="context"
></ds-themed-search>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,5 @@
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';
@@ -14,14 +13,7 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
} }
] ]
}) })
export class AdminNotifyIncomingComponent implements OnInit{ export class AdminNotifyIncomingComponent {
public defaultConfiguration = 'NOTIFY.incoming';
protected readonly context = Context.CoarNotify;
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) { constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
} }
ngOnInit() {
this.searchConfigService.getCurrentConfiguration('').subscribe(x => console.log(x));
}
} }

View File

@@ -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>

View File

@@ -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();
});
});

View File

@@ -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('/');
}
}

View File

@@ -15,22 +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>
</div>
</div>
<ds-themed-search
[configuration]="'NOTIFY.outgoing'"
[showViewModes]="false"
[searchEnabled]="false"
[context]="context"
></ds-themed-search>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,5 @@
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';
@@ -15,8 +14,6 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
] ]
}) })
export class AdminNotifyOutgoingComponent { export class AdminNotifyOutgoingComponent {
protected readonly context = Context.CoarNotify;
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) { constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
} }
} }

View File

@@ -1,5 +1,7 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model'; import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
import { Router } from '@angular/router';
import { ViewMode } from '../../../core/shared/view-mode.model';
@Component({ @Component({
selector: 'ds-admin-notify-metrics', selector: 'ds-admin-notify-metrics',
@@ -10,7 +12,38 @@ export class AdminNotifyMetricsComponent {
@Input() @Input()
boxesConfig: AdminNotifyMetricsRow[]; boxesConfig: AdminNotifyMetricsRow[];
public navigateToSelectedSearchConfig($event: string) { private incomingConfiguration = 'NOTIFY.incoming';
console.log($event); private involvedItemsSuffix = 'involvedItems';
private inboundPath = '/inbound';
private outboundPath = '/outbound';
private adminSearchPath = '/admin/search';
constructor(private router: Router) {
}
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 selectedPath = isIncomingConfig ? this.inboundPath : this.outboundPath;
this.router.navigate([`${this.router.url}${selectedPath}`], {
queryParams: {
configuration: searchConfig,
view: ViewMode.Table
},
});
} }
} }

View File

@@ -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
*/ */

View File

@@ -1,4 +1,9 @@
<div (click)="onClick(boxConfig)" class="w-100 h-100 pt-4 pb-3 px-2 box-container" [ngStyle]="{'background-color': boxConfig.color}"> <div role="button"
class="w-100 h-100 pt-4 pb-3 px-2 box-container"
[ngStyle]="{'background-color': boxConfig.color}"
[dsHoverClass]="'shadow-lg'"
(click)="onClick(boxConfig)"
>
<div [ngStyle]="{'color': boxConfig.textColor}" class="d-flex flex-column justify-content-center align-items-center"> <div [ngStyle]="{'color': boxConfig.textColor}" class="d-flex flex-column justify-content-center align-items-center">
<div class="mb-3 font-weight-bold box-counter">{{ boxConfig.count ?? 0 }}</div> <div class="mb-3 font-weight-bold box-counter">{{ boxConfig.count ?? 0 }}</div>
<div class="font-weight-bold d-flex justify-content-center w-100">{{ boxConfig.title | translate }}</div> <div class="font-weight-bold d-flex justify-content-center w-100">{{ boxConfig.title | translate }}</div>

View File

@@ -1,6 +1,7 @@
.box-container { .box-container {
min-width: max-content; min-width: max-content;
} }
.box-counter { .box-counter {
font-size: calc(var(--bs-font-size-lg) * 1.5); font-size: calc(var(--bs-font-size-lg) * 1.5);
} }

View File

@@ -3469,6 +3469,10 @@
"admin.notify.dashboard.inbound-logs": "Logs/Inbound", "admin.notify.dashboard.inbound-logs": "Logs/Inbound",
"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",