mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 19:13:08 +00:00
add navigation with new config, add custom filter
This commit is contained in:
@@ -17,14 +17,23 @@
|
|||||||
|
|
||||||
<div class="container my-4">
|
<div class="container my-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.inbound' | translate}}</div>
|
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<ds-themed-search
|
<ds-themed-search
|
||||||
[configuration]="defaultConfiguration"
|
*ngIf="!isLoading"
|
||||||
|
[configuration]="selectedSearchConfig$ | async"
|
||||||
[showViewModes]="false"
|
[showViewModes]="false"
|
||||||
[searchEnabled]="false"
|
[searchEnabled]="false"
|
||||||
[context]="context"
|
[context]="context"
|
||||||
|
@@ -2,6 +2,10 @@ 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';
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { map, tap } from "rxjs/operators";
|
||||||
|
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from "@angular/router";
|
||||||
|
import { ViewMode } from "../../../../core/shared/view-mode.model";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -15,13 +19,38 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminNotifyIncomingComponent implements OnInit{
|
export class AdminNotifyIncomingComponent implements OnInit{
|
||||||
|
public selectedSearchConfig$: Observable<string>;
|
||||||
public defaultConfiguration = 'NOTIFY.incoming';
|
public defaultConfiguration = 'NOTIFY.incoming';
|
||||||
|
public isLoading = true;
|
||||||
|
|
||||||
|
|
||||||
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,
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.searchConfigService.getCurrentConfiguration('').subscribe(x => console.log(x));
|
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('/');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,13 +20,20 @@
|
|||||||
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
<div class="col-12 col-md-3 text-left h4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<ds-search-labels [inPlaceSearch]="true"></ds-search-labels>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<ds-themed-search
|
<ds-themed-search
|
||||||
[configuration]="'NOTIFY.outgoing'"
|
*ngIf="!isLoading"
|
||||||
|
[configuration]="selectedSearchConfig$ | async"
|
||||||
[showViewModes]="false"
|
[showViewModes]="false"
|
||||||
[searchEnabled]="false"
|
[searchEnabled]="false"
|
||||||
[context]="context"
|
[context]="context"
|
||||||
|
@@ -2,6 +2,10 @@ 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 { 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({
|
||||||
@@ -15,8 +19,38 @@ import { SearchConfigurationService } from '../../../../core/shared/search/searc
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminNotifyOutgoingComponent {
|
export class AdminNotifyOutgoingComponent {
|
||||||
protected readonly context = Context.CoarNotify;
|
public selectedSearchConfig$: Observable<string>;
|
||||||
|
public defaultConfiguration = 'NOTIFY.outgoing';
|
||||||
|
public isLoading = true;
|
||||||
|
|
||||||
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService) {
|
|
||||||
|
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('/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
import { AdminNotifyMetricsRow } from './admin-notify-metrics.model';
|
||||||
|
import { ActivatedRoute, 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,23 @@ export class AdminNotifyMetricsComponent {
|
|||||||
@Input()
|
@Input()
|
||||||
boxesConfig: AdminNotifyMetricsRow[];
|
boxesConfig: AdminNotifyMetricsRow[];
|
||||||
|
|
||||||
public navigateToSelectedSearchConfig($event: string) {
|
private incomingConfiguration = 'NOTIFY.incoming';
|
||||||
console.log($event);
|
private inboundPath = '/inbound';
|
||||||
|
private outboundPath = '/outbound';
|
||||||
|
|
||||||
|
constructor(private router: Router) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public navigateToSelectedSearchConfig(searchConfig: string) {
|
||||||
|
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
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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>
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
@@ -3469,6 +3469,8 @@
|
|||||||
|
|
||||||
"admin.notify.dashboard.inbound-logs": "Logs/Inbound",
|
"admin.notify.dashboard.inbound-logs": "Logs/Inbound",
|
||||||
|
|
||||||
|
"admin.notify.dashboard.configuration": "Configuration: ",
|
||||||
|
|
||||||
"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