refactor, fix lint

This commit is contained in:
FrancescoMolinaro
2024-01-04 17:23:29 +01:00
parent 566c8b34a9
commit c434c06b04
9 changed files with 58 additions and 59 deletions

View File

@@ -14,8 +14,8 @@ import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.compo
import { AdminNotifySearchConfigurationService } from './config/admin-notify-search-configuration.service';
import { AdminNotifySearchFilterService } from './config/admin-notify-filter-service';
import { AdminNotifySearchFilterConfig } from './config/admin-notify-search-filter-config';
import { ViewMode } from "../../core/shared/view-mode.model";
import { Router } from "@angular/router";
import { ViewMode } from '../../core/shared/view-mode.model';
import { Router } from '@angular/router';
export const FILTER_SEARCH: InjectionToken<SearchFilterService> = new InjectionToken<SearchFilterService>('searchFilterService');

View File

@@ -1,4 +1,4 @@
<div class="d-flex bg-light w-100 align-items-center">
<div class="w-100">
<div class="table-responsive">
<table id="formats" class="table table-striped table-hover">
<thead>
@@ -11,21 +11,21 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let object of indexableObjects">
<tr *ngFor="let message of notifyMessages">
<td>
<div>{{object.queueTimeout}}</div>
<div>{{message.queueTimeout}}</div>
</td>
<td>
<div>{{object.source}}</div>
<div>{{message.source}}</div>
</td>
<td>
<div>{{object.target}}</div>
<div>{{message.target}}</div>
</td>
<td>
<div>{{object.coarNotifyType}}</div>
<div>{{message.coarNotifyType}}</div>
</td>
<td>
<div>{{object.queueStatusLabel}}</div>
<div>{{message.queueStatusLabel}}</div>
</td>
</tr>
</tbody>

View File

@@ -5,11 +5,11 @@ import { Context } from '../../../core/shared/context.model';
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
import {
tabulatableObjectsComponent
} from "../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator";
} 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 { PaginatedList } from "../../../core/data/paginated-list.model";
} from '../../../shared/object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
import { PaginatedList } from '../../../core/data/paginated-list.model';
@tabulatableObjectsComponent(AdminNotifySearchResult, ViewMode.Table, Context.CoarNotify)
@Component({
@@ -18,8 +18,8 @@ import { PaginatedList } from "../../../core/data/paginated-list.model";
styleUrls: ['./admin-notify-search-result.component.scss']
})
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifyMessage>, AdminNotifyMessage> implements OnInit{
public indexableObjects: AdminNotifyMessage[];
public notifyMessages: AdminNotifyMessage[];
ngOnInit() {
this.indexableObjects = this.objects.page.map(object => object.indexableObject);
this.notifyMessages = this.objects.page.map(object => object.indexableObject);
}
}

View File

@@ -188,11 +188,11 @@ export class SearchService implements OnDestroy {
}
/**
* Method to directly attach the indexableObjects to search results, instead of using RemoteData.
* Method to directly attach the notifyMessages to search results, instead of using RemoteData.
* For compatibility with the way the search was written originally
*
* @param sqr$: a SearchObjects RemotaData Observable without its
* indexableObjects attached
* notifyMessages attached
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
* no valid cached version. Defaults to true
* @param reRequestOnStale Whether or not the request should automatically be re-
@@ -205,7 +205,7 @@ export class SearchService implements OnDestroy {
return sqr$.pipe(
switchMap((resultsRd: RemoteData<SearchObjects<T>>) => {
if (hasValue(resultsRd.payload) && isNotEmpty(resultsRd.payload.page)) {
// retrieve the indexableObjects for all search results on the page
// retrieve the notifyMessages for all search results on the page
const searchResult$Array: Observable<SearchResult<T>>[] = resultsRd.payload.page.map((result: SearchResult<T>) =>
this.dspaceObjectService.findByHref(result._links.indexableObject.href, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow as any).pipe(
getFirstCompletedRemoteData(),
@@ -227,7 +227,7 @@ export class SearchService implements OnDestroy {
);
// Swap the original page in the remoteData with the new one, now that the results have the
// correct types, and all indexableObjects are directly attached.
// correct types, and all notifyMessages are directly attached.
return observableCombineLatest(searchResult$Array).pipe(
map((page: SearchResult<T>[]) => {

View File

@@ -1,12 +1,11 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ListableObject } from "../listable-object.model";
import { CollectionElementLinkType } from "../../collection-element-link.type";
import { Context } from "../../../../core/shared/context.model";
import { ViewMode } from "../../../../core/shared/view-mode.model";
import { DSpaceObject } from "../../../../core/shared/dspace-object.model";
import { DSONameService } from "../../../../core/breadcrumbs/dso-name.service";
import { RemoteData } from "../../../../core/data/remote-data";
import { PaginatedList } from "../../../../core/data/paginated-list.model";
import { ListableObject } from '../listable-object.model';
import { CollectionElementLinkType } from '../../collection-element-link.type';
import { Context } from '../../../../core/shared/context.model';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { RemoteData } from '../../../../core/data/remote-data';
import { PaginatedList } from '../../../../core/data/paginated-list.model';
@Component({
selector: 'ds-objects-collection-tabulatable',

View File

@@ -11,18 +11,18 @@ import {
SimpleChanges,
ViewChild
} from '@angular/core';
import { ListableObject } from "../listable-object.model";
import { ViewMode } from "../../../../core/shared/view-mode.model";
import { Context } from "../../../../core/shared/context.model";
import { CollectionElementLinkType } from "../../collection-element-link.type";
import { combineLatest, Observable, of as observableOf, Subscription } from "rxjs";
import { ThemeService } from "../../../theme-support/theme.service";
import { hasNoValue, hasValue, isNotEmpty } from "../../../empty.util";
import { take } from "rxjs/operators";
import { GenericConstructor } from "../../../../core/shared/generic-constructor";
import { TabulatableObjectsDirective } from "./tabulatable-objects.directive";
import { PaginatedList } from "../../../../core/data/paginated-list.model";
import { getTabulatableObjectsComponent } from "./tabulatable-objects.decorator";
import { ListableObject } from '../listable-object.model';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { Context } from '../../../../core/shared/context.model';
import { CollectionElementLinkType } from '../../collection-element-link.type';
import { combineLatest, Observable, of as observableOf, Subscription } from 'rxjs';
import { ThemeService } from '../../../theme-support/theme.service';
import { hasNoValue, hasValue, isNotEmpty } from '../../../empty.util';
import { take } from 'rxjs/operators';
import { GenericConstructor } from '../../../../core/shared/generic-constructor';
import { TabulatableObjectsDirective } from './tabulatable-objects.directive';
import { PaginatedList } from '../../../../core/data/paginated-list.model';
import { getTabulatableObjectsComponent } from './tabulatable-objects.decorator';
@Component({
selector: 'ds-tabulatable-objects-loader',

View File

@@ -1,12 +1,12 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Component, Inject } from '@angular/core';
import {
AbstractTabulatableElementComponent
} from "../../../object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component";
import { DSpaceObject } from "../../../../core/shared/dspace-object.model";
import { TruncatableService } from "../../../truncatable/truncatable.service";
import { DSONameService } from "../../../../core/breadcrumbs/dso-name.service";
import { APP_CONFIG, AppConfig } from "../../../../../config/app-config.interface";
import { PaginatedList } from "../../../../core/data/paginated-list.model";
} from '../../../object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component';
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
import { TruncatableService } from '../../../truncatable/truncatable.service';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
import { PaginatedList } from '../../../../core/data/paginated-list.model';
@Component({
selector: 'ds-search-result-list-element',

View File

@@ -1,14 +1,14 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';
import { ViewMode } from "../../core/shared/view-mode.model";
import { PaginationComponentOptions } from "../pagination/pagination-component-options.model";
import { SortDirection, SortOptions } from "../../core/cache/models/sort-options.model";
import { CollectionElementLinkType } from "../object-collection/collection-element-link.type";
import { Context } from "../../core/shared/context.model";
import { BehaviorSubject} from "rxjs";
import { RemoteData } from "../../core/data/remote-data";
import { PaginatedList } from "../../core/data/paginated-list.model";
import { ListableObject } from "../object-collection/shared/listable-object.model";
import { fadeIn } from "../animations/fade";
import { ViewMode } from '../../core/shared/view-mode.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { CollectionElementLinkType } from '../object-collection/collection-element-link.type';
import { Context } from '../../core/shared/context.model';
import { BehaviorSubject} from 'rxjs';
import { RemoteData } from '../../core/data/remote-data';
import { PaginatedList } from '../../core/data/paginated-list.model';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { fadeIn } from '../animations/fade';
@Component({
@@ -151,7 +151,7 @@ export class ObjectTableComponent {
* Initialize the instance variables
*/
ngOnInit(): void {
console.log('table rendered')
console.log('table rendered');
}
/**

View File

@@ -290,13 +290,13 @@ import { ObjectTableComponent } from './object-table/object-table.component';
import { TabulatableObjectsLoaderComponent } from './object-collection/shared/tabulatable-objects/tabulatable-objects-loader.component';
import {
TabulatableObjectsDirective
} from "./object-collection/shared/tabulatable-objects/tabulatable-objects.directive";
} from './object-collection/shared/tabulatable-objects/tabulatable-objects.directive';
import {
AbstractTabulatableElementComponent
} from "./object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component";
} from './object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component';
import {
TabulatableResultListElementsComponent
} from "./object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component";
} from './object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component';
const MODULES = [
CommonModule,