fix missing label in modal, add search-labels, fix reprocess message

This commit is contained in:
FrancescoMolinaro
2024-01-12 16:44:32 +01:00
parent 1693d49e27
commit dbf4233e07
12 changed files with 105 additions and 71 deletions

View File

@@ -8,7 +8,7 @@
<div *ngFor="let key of notifyMessageKeys"> <div *ngFor="let key of notifyMessageKeys">
<div class="row mb-4"> <div class="row mb-4">
<div class="font-weight-bold col">{{ key + '.notify-detail-modal' | translate}}</div> <div class="font-weight-bold col">{{ key + '.notify-detail-modal' | translate}}</div>
<div class="col text-right">{{'notify-detail-modal.' + notifyMessage[key] | translate: {default: notifyMessage[key]} }}</div> <div class="col text-right">{{'notify-detail-modal.' + notifyMessage[key] | translate: {default: notifyMessage[key] ?? "n/a" } }}</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,8 +1,8 @@
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { AdminNotifyMessage } from '../models/admin-notify-message.model'; import { AdminNotifyMessage } from '../models/admin-notify-message.model';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from "@ngx-translate/core"; import { TranslateService } from '@ngx-translate/core';
import { MissingTranslationHelper } from "../../../shared/translate/missing-translation.helper"; import { MissingTranslationHelper } from '../../../shared/translate/missing-translation.helper';
@Component({ @Component({
selector: 'ds-admin-notify-detail-modal', selector: 'ds-admin-notify-detail-modal',

View File

@@ -15,9 +15,16 @@
<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="col-12 text-left h4 my-4">{{'admin.notify.dashboard.inbound' | translate}}</div> <div class="container my-4">
<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 <ds-themed-search
[configuration]="'NOTIFY.incoming'" [configuration]="defaultConfiguration"
[showViewModes]="false" [showViewModes]="false"
[searchEnabled]="false" [searchEnabled]="false"
[context]="context" [context]="context"

View File

@@ -1,4 +1,4 @@
import { Component, Inject } from '@angular/core'; import { Component, Inject, OnInit } 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 { 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,8 +14,14 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
} }
] ]
}) })
export class AdminNotifyIncomingComponent { export class AdminNotifyIncomingComponent implements OnInit{
public defaultConfiguration = 'NOTIFY.incoming';
protected readonly context = Context.CoarNotify; 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

@@ -15,7 +15,16 @@
<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="col-12 text-left h4 my-4">{{'admin.notify.dashboard.outbound' | translate}}</div> <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>
</div>
</div>
<ds-themed-search <ds-themed-search
[configuration]="'NOTIFY.outgoing'" [configuration]="'NOTIFY.outgoing'"
[showViewModes]="false" [showViewModes]="false"

View File

@@ -2,7 +2,7 @@
<div class="mb-2">{{ row.title | translate }}</div> <div class="mb-2">{{ row.title | translate }}</div>
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-sm" *ngFor="let box of row.boxes"> <div class="col-sm" *ngFor="let box of row.boxes">
<ds-notification-box [boxConfig]="box"></ds-notification-box> <ds-notification-box (selectedBoxConfig)="navigateToSelectedSearchConfig($event)" [boxConfig]="box"></ds-notification-box>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -9,4 +9,8 @@ export class AdminNotifyMetricsComponent {
@Input() @Input()
boxesConfig: AdminNotifyMetricsRow[]; boxesConfig: AdminNotifyMetricsRow[];
public navigateToSelectedSearchConfig($event: string) {
console.log($event);
}
} }

View File

@@ -1,41 +1,41 @@
<div class="table-responsive mt-2"> <div class="table-responsive mt-2">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr class="text-nowrap"> <tr class="text-nowrap">
<th scope="col">{{ 'notify-message-result.timestamp' | translate}}</th> <th scope="col">{{ 'notify-message-result.timestamp' | translate}}</th>
<th scope="col">{{'notify-message-result.repositoryItem' | translate}}</th> <th scope="col">{{'notify-message-result.repositoryItem' | translate}}</th>
<th scope="col">{{ 'notify-message-result.ldnService' | translate}}</th> <th scope="col">{{ 'notify-message-result.ldnService' | translate}}</th>
<th scope="col">{{ 'notify-message-result.type' | translate }}</th> <th scope="col">{{ 'notify-message-result.type' | translate }}</th>
<th scope="col">{{ 'notify-message-result.status' | translate }}</th> <th scope="col">{{ 'notify-message-result.status' | translate }}</th>
<th scope="col">{{ 'notify-message-result.action' | translate }}</th> <th scope="col">{{ 'notify-message-result.action' | translate }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let message of (messagesSubject$ | async)"> <tr *ngFor="let message of (messagesSubject$ | async)">
<td class="text-nowrap"> <td class="text-nowrap">
<div>{{ message.queueLastStartTime | date:"YYYY/MM/d hh:mm:ss" }}</div> <div>{{ message.queueLastStartTime | date:"YYYY/MM/d hh:mm:ss" }}</div>
</td> </td>
<td> <td>
<a [routerLink]="'/items/' + (isInbound ? message.context : message.object)">{{ message.relatedItem }}</a> <a [routerLink]="'/items/' + (isInbound ? message.context : message.object)">{{ message.relatedItem }}</a>
</td> </td>
<td> <td>
<div>{{ message.ldnService }}</div> <div>{{ message.ldnService }}</div>
</td> </td>
<td> <td>
<div>{{ message.activityStreamType }}</div> <div>{{ message.activityStreamType }}</div>
</td> </td>
<td> <td>
<div>{{ 'notify-detail-modal.' + message.queueStatusLabel | translate }}</div> <div>{{ 'notify-detail-modal.' + message.queueStatusLabel | translate }}</div>
</td> </td>
<td> <td>
<div class="d-flex flex-column"> <div class="d-flex flex-column">
<button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">{{ 'notify-message-result.detail' | translate }}</button> <button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">{{ 'notify-message-result.detail' | translate }}</button>
<button *ngIf="message.queueStatusLabel === reprocessStatus" (click)="reprocessMessage(message)" class="btn btn-warning"> <button *ngIf="message.queueStatusLabel !== reprocessStatus" (click)="reprocessMessage(message)" class="btn btn-warning">
{{ 'notify-message-result.reprocess' | translate }} {{ 'notify-message-result.reprocess' | translate }}
</button> </button>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@@ -70,7 +70,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListEleme
this.mapDetailsToMessages(); this.mapDetailsToMessages();
this.subs.push(this.searchConfigService.getCurrentConfiguration('') this.subs.push(this.searchConfigService.getCurrentConfiguration('')
.subscribe(configuration => { .subscribe(configuration => {
this.isInbound = configuration === 'NOTIFY.incoming'; this.isInbound = configuration.startsWith('NOTIFY.incoming');
}) })
); );
} }

View File

@@ -73,25 +73,28 @@ export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNot
const requestId = this.requestService.generateRequestId(); const requestId = this.requestService.generateRequestId();
return this.halService.getEndpoint(this.reprocessEndpoint).pipe( return this.halService.getEndpoint(this.reprocessEndpoint).pipe(
map(endpoint => endpoint.replace('{id}', message.id)), map(endpoint => endpoint.replace('{id}', message.id)),
map((endpointURL: string) => new GetRequest(requestId, endpointURL)), map((endpointURL: string) => new GetRequest(requestId, endpointURL)),
tap(request => this.requestService.send(request)), tap(request => this.requestService.send(request)),
switchMap((request: RestRequest) => this.rdbService.buildFromRequestUUID<AdminNotifyMessage>(request.uuid)), switchMap((request: RestRequest) => this.rdbService.buildFromRequestUUID<AdminNotifyMessage>(request.uuid)),
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
getAllSucceededRemoteDataPayload(), getAllSucceededRemoteDataPayload(),
mergeMap(reprocessedMessage => this.getDetailedMessages([reprocessedMessage])),
).pipe( ).pipe(
mergeMap((newMessage) => messageSubject.pipe( mergeMap((newMessages) => messageSubject.pipe(
map(messages => { map(messages => {
const messageToUpdate = messages.find(currentMessage => currentMessage.id === message.id); const detailedReprocessedMessage = newMessages[0];
const indexOfMessageToUpdate = messages.indexOf(messageToUpdate); const messageToUpdate = messages.find(currentMessage => currentMessage.id === message.id);
newMessage.target = messageToUpdate.target; const indexOfMessageToUpdate = messages.indexOf(messageToUpdate);
newMessage.object = messageToUpdate.object; detailedReprocessedMessage.target = message.target;
newMessage.origin = messageToUpdate.origin; detailedReprocessedMessage.object = message.object;
newMessage.context = messageToUpdate.context; detailedReprocessedMessage.origin = message.origin;
messages[indexOfMessageToUpdate] = newMessage; detailedReprocessedMessage.context = message.context;
return messages; messages[indexOfMessageToUpdate] = detailedReprocessedMessage;
})
)), return messages;
})
)),
); );
} }
} }

View File

@@ -1,4 +1,4 @@
<div class="w-100 h-100 pt-4 pb-3 px-2 box-container" [ngStyle]="{'background-color': boxConfig.color}"> <div (click)="onClick(boxConfig)" class="w-100 h-100 pt-4 pb-3 px-2 box-container" [ngStyle]="{'background-color': boxConfig.color}">
<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,4 +1,4 @@
import { Component, Input } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { import {
AdminNotifyMetricsBox AdminNotifyMetricsBox
} from '../../admin/admin-notify-dashboard/admin-notify-metrics/admin-notify-metrics.model'; } from '../../admin/admin-notify-dashboard/admin-notify-metrics/admin-notify-metrics.model';
@@ -16,4 +16,9 @@ import { ViewMode } from '../../core/shared/view-mode.model';
}) })
export class NotificationBoxComponent { export class NotificationBoxComponent {
@Input() boxConfig: AdminNotifyMetricsBox; @Input() boxConfig: AdminNotifyMetricsBox;
@Output() selectedBoxConfig: EventEmitter<string> = new EventEmitter();
public onClick(boxConfig: AdminNotifyMetricsBox) {
this.selectedBoxConfig.emit(boxConfig.config);
}
} }