[DURACOM-191] Remove admin-notify-dashboard.module

This commit is contained in:
Giuseppe Digilio
2024-03-13 14:51:02 +01:00
parent 44c608c445
commit 8b4eedef32
3 changed files with 12 additions and 84 deletions

View File

@@ -1,51 +0,0 @@
import {
CommonModule,
DatePipe,
} from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SearchPageModule } from '../../search-page/search-page.module';
import { SearchModule } from '../../shared/search/search.module';
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
import { AdminNotifyDashboardRoutingModule } from './admin-notify-dashboard-routing.module';
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal/admin-notify-detail-modal.component';
import { AdminNotifyIncomingComponent } from './admin-notify-logs/admin-notify-incoming/admin-notify-incoming.component';
import { AdminNotifyLogsResultComponent } from './admin-notify-logs/admin-notify-logs-result/admin-notify-logs-result.component';
import { AdminNotifyOutgoingComponent } from './admin-notify-logs/admin-notify-outgoing/admin-notify-outgoing.component';
import { AdminNotifyMetricsComponent } from './admin-notify-metrics/admin-notify-metrics.component';
import { AdminNotifySearchResultComponent } from './admin-notify-search-result/admin-notify-search-result.component';
import { AdminNotifyMessagesService } from './services/admin-notify-messages.service';
const ENTRY_COMPONENTS = [
AdminNotifySearchResultComponent,
];
@NgModule({
imports: [
CommonModule,
RouterModule,
AdminNotifyDashboardRoutingModule,
SearchModule,
SearchPageModule,
...ENTRY_COMPONENTS,
AdminNotifyDashboardComponent,
AdminNotifyMetricsComponent,
AdminNotifyIncomingComponent,
AdminNotifyOutgoingComponent,
AdminNotifyDetailModalComponent,
AdminNotifySearchResultComponent,
AdminNotifyLogsResultComponent,
],
providers: [
AdminNotifyMessagesService,
DatePipe,
],
})
export class AdminNotifyDashboardModule {
static withEntryComponents() {
return {
ngModule: AdminNotifyDashboardModule,
providers: ENTRY_COMPONENTS.map((component) => ({ provide: component })),
};
}
}

View File

@@ -19,11 +19,8 @@ import {
} from 'rxjs'; } from 'rxjs';
import { PaginatedList } from '../../../core/data/paginated-list.model'; import { PaginatedList } from '../../../core/data/paginated-list.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 { ViewMode } from '../../../core/shared/view-mode.model';
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service'; import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service';
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 { TabulatableResultListElementsComponent } from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component'; import { TruncatableComponent } from '../../../shared/truncatable/truncatable.component';
import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component'; import { TruncatablePartComponent } from '../../../shared/truncatable/truncatable-part/truncatable-part.component';
@@ -32,7 +29,6 @@ import { AdminNotifyMessage } from '../models/admin-notify-message.model';
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model'; import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service'; import { AdminNotifyMessagesService } from '../services/admin-notify-messages.service';
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
@Component({ @Component({
selector: 'ds-admin-notify-search-result', selector: 'ds-admin-notify-search-result',
templateUrl: './admin-notify-search-result.component.html', templateUrl: './admin-notify-search-result.component.html',
@@ -57,8 +53,6 @@ import { AdminNotifyMessagesService } from '../services/admin-notify-messages.se
/** /**
* Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent * Component for visualization in table format of the search results related to the AdminNotifyDashboardComponent
*/ */
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{ export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit, OnDestroy{
public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]); public messagesSubject$: BehaviorSubject<AdminNotifyMessage[]> = new BehaviorSubject([]);
public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY'; public reprocessStatus = 'QUEUE_STATUS_QUEUED_FOR_RETRY';

View File

@@ -1,4 +1,4 @@
import { PaginatedList } from '../../../../core/data/paginated-list.model'; import { AdminNotifySearchResult } from '../../../../admin/admin-notify-dashboard/models/admin-notify-message-search-result.model';
import { Context } from '../../../../core/shared/context.model'; import { Context } from '../../../../core/shared/context.model';
import { GenericConstructor } from '../../../../core/shared/generic-constructor'; import { GenericConstructor } from '../../../../core/shared/generic-constructor';
import { ViewMode } from '../../../../core/shared/view-mode.model'; import { ViewMode } from '../../../../core/shared/view-mode.model';
@@ -6,6 +6,7 @@ import {
hasNoValue, hasNoValue,
hasValue, hasValue,
} from '../../../empty.util'; } from '../../../empty.util';
import { TabulatableResultListElementsComponent } from '../../../object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
import { ListableObject } from '../listable-object.model'; import { ListableObject } from '../listable-object.model';
import { import {
DEFAULT_CONTEXT, DEFAULT_CONTEXT,
@@ -15,32 +16,16 @@ import {
MatchRelevancy, MatchRelevancy,
} from '../listable-object/listable-object.decorator'; } from '../listable-object/listable-object.decorator';
const map = new Map(); type TabulatableComponentType = typeof TabulatableResultListElementsComponent;
/** export const TABUTABLE_DECORATOR_MAP =
* Decorator used for rendering tabulatable objects new Map<string | GenericConstructor<ListableObject>, Map<ViewMode, Map<Context, Map<string, TabulatableComponentType>>>>([
* @param objectsType The object type or entity type the component represents [AdminNotifySearchResult, new Map([
* @param viewMode The view mode the component represents [ViewMode.Table, new Map([
* @param context The optional context the component represents [Context.CoarNotify, new Map([[DEFAULT_THEME, TabulatableResultListElementsComponent as any]])]
* @param theme The optional theme for the component ])],
*/ ])],
export function tabulatableObjectsComponent(objectsType: string | GenericConstructor<PaginatedList<ListableObject>>, viewMode: ViewMode, context: Context = DEFAULT_CONTEXT, theme = DEFAULT_THEME) { ]);
return function decorator(component: any) {
if (hasNoValue(objectsType)) {
return;
}
if (hasNoValue(map.get(objectsType))) {
map.set(objectsType, new Map());
}
if (hasNoValue(map.get(objectsType).get(viewMode))) {
map.get(objectsType).set(viewMode, new Map());
}
if (hasNoValue(map.get(objectsType).get(viewMode).get(context))) {
map.get(objectsType).get(viewMode).set(context, new Map());
}
map.get(objectsType).get(viewMode).get(context).set(theme, component);
};
}
/** /**
* Getter to retrieve the matching tabulatable objects component * Getter to retrieve the matching tabulatable objects component
@@ -56,7 +41,7 @@ export function tabulatableObjectsComponent(objectsType: string | GenericConstru
export function getTabulatableObjectsComponent(types: (string | GenericConstructor<ListableObject>)[], viewMode: ViewMode, context: Context = DEFAULT_CONTEXT, theme: string = DEFAULT_THEME) { export function getTabulatableObjectsComponent(types: (string | GenericConstructor<ListableObject>)[], viewMode: ViewMode, context: Context = DEFAULT_CONTEXT, theme: string = DEFAULT_THEME) {
let currentBestMatch: MatchRelevancy = null; let currentBestMatch: MatchRelevancy = null;
for (const type of types) { for (const type of types) {
const typeMap = map.get(PaginatedList<typeof type>); const typeMap = TABUTABLE_DECORATOR_MAP.get(type);
if (hasValue(typeMap)) { if (hasValue(typeMap)) {
const match = getMatch(typeMap, [viewMode, context, theme], [DEFAULT_VIEW_MODE, DEFAULT_CONTEXT, DEFAULT_THEME]); const match = getMatch(typeMap, [viewMode, context, theme], [DEFAULT_VIEW_MODE, DEFAULT_CONTEXT, DEFAULT_THEME]);