diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index b377353382..05efde7cf7 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -1,6 +1,7 @@ import { AsyncPipe, NgClass, + NgFor, NgIf, } from '@angular/common'; import { @@ -83,6 +84,7 @@ import { ValidateEmailNotTaken } from './validators/email-taken.validator'; imports: [ FormComponent, NgIf, + NgFor, AsyncPipe, TranslateModule, NgClass, diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts index 35a80f8e1e..cc2cba4704 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.ts @@ -1,6 +1,7 @@ import { AsyncPipe, NgClass, + NgFor, NgIf, } from '@angular/common'; import { @@ -54,6 +55,7 @@ import { LdnService } from '../ldn-services-model/ldn-services.model'; changeDetection: ChangeDetectionStrategy.Default, imports: [ NgIf, + NgFor, TranslateModule, AsyncPipe, PaginationComponent, diff --git a/src/app/admin/admin-notify-dashboard/models/admin-notify-message-search-result.model.ts b/src/app/admin/admin-notify-dashboard/models/admin-notify-message-search-result.model.ts index 5115118993..c4df75ef3e 100644 --- a/src/app/admin/admin-notify-dashboard/models/admin-notify-message-search-result.model.ts +++ b/src/app/admin/admin-notify-dashboard/models/admin-notify-message-search-result.model.ts @@ -1,7 +1,5 @@ import { SearchResult } from '../../../shared/search/models/search-result.model'; -import { searchResultFor } from '../../../shared/search/search-result-element-decorator'; import { AdminNotifyMessage } from './admin-notify-message.model'; -@searchResultFor(AdminNotifyMessage) export class AdminNotifySearchResult extends SearchResult { } diff --git a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts index 559a74ded9..9fd4643573 100644 --- a/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts +++ b/src/app/admin/admin-reports/filtered-items/filtered-items.component.ts @@ -1,6 +1,7 @@ import { AsyncPipe, NgForOf, + NgIf, } from '@angular/common'; import { Component, @@ -59,6 +60,7 @@ import { QueryPredicate } from './query-predicate.model'; NgbAccordionModule, TranslateModule, AsyncPipe, + NgIf, NgForOf, FiltersComponent, ], diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.ts index 2bb6dbb32a..60740fb34b 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component.ts @@ -8,7 +8,10 @@ import { OnInit, } from '@angular/core'; import { TranslateModule } from '@ngx-translate/core'; -import { Observable } from 'rxjs'; +import { + BehaviorSubject, + Observable, +} from 'rxjs'; import { APP_CONFIG, @@ -20,7 +23,7 @@ import { RemoteData } from '../../../../../core/data/remote-data'; import { Context } from '../../../../../core/shared/context.model'; import { Item } from '../../../../../core/shared/item.model'; import { - getAllSucceededRemoteData, + getFirstCompletedRemoteData, getRemoteDataPayload, } from '../../../../../core/shared/operators'; import { ViewMode } from '../../../../../core/shared/view-mode.model'; @@ -49,7 +52,7 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S /** * The item linked to the workflow item */ - public item$: Observable; + public item$: BehaviorSubject = new BehaviorSubject(undefined); constructor(private linkService: LinkService, protected truncatableService: TruncatableService, @@ -65,6 +68,11 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S ngOnInit(): void { super.ngOnInit(); this.dso = this.linkService.resolveLink(this.dso, followLink('item')); - this.item$ = (this.dso.item as Observable>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload()); + (this.dso.item as Observable>).pipe( + getFirstCompletedRemoteData(), + getRemoteDataPayload()) + .subscribe((item: Item) => { + this.item$.next(item); + }); } } diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workspace-item/workspace-item-search-result-admin-workflow-list-element.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workspace-item/workspace-item-search-result-admin-workflow-list-element.component.ts index 3fce9ebdab..7cf63a603b 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workspace-item/workspace-item-search-result-admin-workflow-list-element.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-list-element/workspace-item/workspace-item-search-result-admin-workflow-list-element.component.ts @@ -31,7 +31,6 @@ import { Context } from '../../../../../core/shared/context.model'; import { DSpaceObject } from '../../../../../core/shared/dspace-object.model'; import { Item } from '../../../../../core/shared/item.model'; import { - getAllSucceededRemoteData, getFirstCompletedRemoteData, getRemoteDataPayload, } from '../../../../../core/shared/operators'; @@ -63,7 +62,7 @@ export class WorkspaceItemSearchResultAdminWorkflowListElementComponent extends /** * The item linked to the workflow item */ - public item$: Observable; + public item$: BehaviorSubject = new BehaviorSubject(undefined); /** * The id of the item linked to the workflow item @@ -90,11 +89,14 @@ export class WorkspaceItemSearchResultAdminWorkflowListElementComponent extends ngOnInit(): void { super.ngOnInit(); this.dso = this.linkService.resolveLink(this.dso, followLink('item')); - this.item$ = (this.dso.item as Observable>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload()); + const item$ = (this.dso.item as Observable>).pipe(getFirstCompletedRemoteData(), getRemoteDataPayload()); - this.item$.pipe( + item$.pipe( take(1), - tap((item: Item) => this.itemId = item.id), + tap((item: Item) => { + this.item$.next(item); + this.itemId = item.id; + }), mergeMap((item: Item) => this.retrieveSupervisorOrders(item.id)), ).subscribe((supervisionOrderList: SupervisionOrder[]) => { this.supervisionOrder$.next(supervisionOrderList); diff --git a/src/app/app-routes.ts b/src/app/app-routes.ts index ba322eef45..3d5dbbaba4 100644 --- a/src/app/app-routes.ts +++ b/src/app/app-routes.ts @@ -1,7 +1,7 @@ import { - ExtraOptions, - NoPreloading, + InMemoryScrollingOptions, Route, + RouterConfigOptions, } from '@angular/router'; import { NOTIFICATIONS_MODULE_PATH } from './admin/admin-routing-paths'; @@ -26,6 +26,7 @@ import { COMMUNITY_MODULE_PATH } from './community-page/community-page-routing-p import { AuthBlockingGuard } from './core/auth/auth-blocking.guard'; import { AuthenticatedGuard } from './core/auth/authenticated.guard'; import { GroupAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/group-administrator.guard'; +import { SiteAdministratorGuard } from './core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; import { SiteRegisterGuard } from './core/data/feature-authorization/feature-authorization-guard/site-register.guard'; import { EndUserAgreementCurrentUserGuard } from './core/end-user-agreement/end-user-agreement-current-user.guard'; import { ReloadGuard } from './core/reload/reload.guard'; @@ -155,7 +156,7 @@ export const APP_ROUTES: Route[] = [ path: ADMIN_MODULE_PATH, loadChildren: () => import('./admin/admin-routes') .then((m) => m.ROUTES), - canActivate: [EndUserAgreementCurrentUserGuard], + canActivate: [SiteAdministratorGuard, EndUserAgreementCurrentUserGuard], }, { path: NOTIFICATIONS_MODULE_PATH, @@ -260,12 +261,10 @@ export const APP_ROUTES: Route[] = [ ], }, ]; -export const APP_ROUTING_CONF: ExtraOptions = { - // enableTracing: true, - useHash: false, - scrollPositionRestoration: 'enabled', - anchorScrolling: 'enabled', - initialNavigation: 'enabledBlocking', - preloadingStrategy: NoPreloading, +export const APP_ROUTING_CONF: RouterConfigOptions = { onSameUrlNavigation: 'reload', }; +export const APP_ROUTING_SCROLL_CONF: InMemoryScrollingOptions = { + scrollPositionRestoration: 'top', + anchorScrolling: 'enabled', +}; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index da6fe26a70..093cb003e9 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -12,7 +12,11 @@ import { NgModule, } from '@angular/core'; import { + NoPreloading, provideRouter, + withEnabledBlockingInitialNavigation, + withInMemoryScrolling, + withPreloading, withRouterConfig, } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @@ -52,6 +56,7 @@ import { import { APP_ROUTES, APP_ROUTING_CONF, + APP_ROUTING_SCROLL_CONF, } from './app-routes'; import { BROWSE_BY_DECORATOR_MAP } from './browse-by/browse-by-switcher/browse-by-decorator'; import { AuthInterceptor } from './core/auth/auth.interceptor'; @@ -105,7 +110,13 @@ const IMPORTS = [ ]; const PROVIDERS = [ - provideRouter(APP_ROUTES, withRouterConfig(APP_ROUTING_CONF)), + provideRouter( + APP_ROUTES, + withRouterConfig(APP_ROUTING_CONF), + withInMemoryScrolling(APP_ROUTING_SCROLL_CONF), + withEnabledBlockingInitialNavigation(), + withPreloading(NoPreloading), + ), { provide: APP_BASE_HREF, useFactory: getBaseHref, diff --git a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts index 831b46887e..b45c18a587 100644 --- a/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts +++ b/src/app/forgot-password/forgot-password-form/forgot-password-form.component.spec.ts @@ -24,6 +24,7 @@ import { AuthenticateAction } from '../../core/auth/auth.actions'; import { CoreState } from '../../core/core-state.model'; import { EPersonDataService } from '../../core/eperson/eperson-data.service'; import { Registration } from '../../core/shared/registration.model'; +import { ProfilePageSecurityFormComponent } from '../../profile-page/profile-page-security-form/profile-page-security-form.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { createFailedRemoteDataObject$, @@ -84,6 +85,8 @@ describe('ForgotPasswordFormComponent', () => { { provide: NotificationsService, useValue: notificationsService }, ], schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).overrideComponent(ForgotPasswordFormComponent, { + remove: { imports: [ ProfilePageSecurityFormComponent ] }, }).compileComponents(); })); beforeEach(() => { diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts index 384e475c37..087866959c 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts @@ -166,7 +166,7 @@ describe('EditRelationshipComponent', () => { comp.url = url; comp.fieldUpdate = fieldUpdate1; comp.editItem = item; - comp.relatedItem$ = observableOf(relatedItem); + comp.relatedItem$.next(relatedItem); fixture.detectChanges(); }); diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts index 36df6a50f0..8341070537 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts @@ -13,9 +13,9 @@ import { } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { + BehaviorSubject, combineLatest as observableCombineLatest, Observable, - of, } from 'rxjs'; import { filter, @@ -45,7 +45,6 @@ import { ListableObjectComponentLoaderComponent } from '../../../../shared/objec import { VirtualMetadataComponent } from '../../virtual-metadata/virtual-metadata.component'; @Component({ - // eslint-disable-next-line @angular-eslint/component-selector selector: 'ds-edit-relationship', styleUrls: ['./edit-relationship.component.scss'], templateUrl: './edit-relationship.component.html', @@ -95,7 +94,7 @@ export class EditRelationshipComponent implements OnChanges { /** * The related item of this relationship */ - relatedItem$: Observable; + relatedItem$: BehaviorSubject = new BehaviorSubject(null); /** * The view-mode we're currently on @@ -128,16 +127,19 @@ export class EditRelationshipComponent implements OnChanges { getRemoteDataPayload(), filter((item: Item) => hasValue(item) && isNotEmpty(item.uuid)), ); - this.relatedItem$ = observableCombineLatest( + observableCombineLatest([ this.leftItem$, this.rightItem$, - ).pipe( + ]).pipe( map((items: Item[]) => items.find((item) => item.uuid !== this.editItem.uuid), ), - ); + take(1), + ).subscribe((relatedItem) => { + this.relatedItem$.next(relatedItem); + }); } else { - this.relatedItem$ = of(this.update.relatedItem); + this.relatedItem$.next(this.update.relatedItem); } } @@ -146,10 +148,10 @@ export class EditRelationshipComponent implements OnChanges { */ remove(): void { this.closeVirtualMetadataModal(); - observableCombineLatest( + observableCombineLatest([ this.leftItem$, this.rightItem$, - ).pipe( + ]).pipe( map((items: Item[]) => items.map((item) => this.objectUpdatesService .isSelectedVirtualMetadata(this.url, this.relationship.id, item.uuid)), diff --git a/src/app/notifications/qa/events/ePerson-data/ePerson-data.component.ts b/src/app/notifications/qa/events/ePerson-data/ePerson-data.component.ts index 8e7667911a..7fe17040e8 100644 --- a/src/app/notifications/qa/events/ePerson-data/ePerson-data.component.ts +++ b/src/app/notifications/qa/events/ePerson-data/ePerson-data.component.ts @@ -1,5 +1,6 @@ import { AsyncPipe, + NgFor, NgIf, } from '@angular/common'; import { @@ -21,6 +22,7 @@ import { standalone: true, imports: [ NgIf, + NgFor, AsyncPipe, ], styleUrls: ['./ePerson-data.component.scss'], diff --git a/src/app/notifications/suggestion-list-element/suggestion-evidences/suggestion-evidences.component.ts b/src/app/notifications/suggestion-list-element/suggestion-evidences/suggestion-evidences.component.ts index 265ab1d5a2..7fe10fc6c5 100644 --- a/src/app/notifications/suggestion-list-element/suggestion-evidences/suggestion-evidences.component.ts +++ b/src/app/notifications/suggestion-list-element/suggestion-evidences/suggestion-evidences.component.ts @@ -1,4 +1,7 @@ -import { NgIf } from '@angular/common'; +import { + NgFor, + NgIf, +} from '@angular/common'; import { Component, Input, @@ -20,6 +23,7 @@ import { ObjectKeysPipe } from '../../../shared/utils/object-keys-pipe'; imports: [ TranslateModule, NgIf, + NgFor, ObjectKeysPipe, ], standalone: true, diff --git a/src/app/notifications/suggestion-list-element/suggestion-list-element.component.ts b/src/app/notifications/suggestion-list-element/suggestion-list-element.component.ts index 67b7254f91..c636fabe10 100644 --- a/src/app/notifications/suggestion-list-element/suggestion-list-element.component.ts +++ b/src/app/notifications/suggestion-list-element/suggestion-list-element.component.ts @@ -1,3 +1,4 @@ +import { NgIf } from '@angular/common'; import { Component, EventEmitter, @@ -26,6 +27,7 @@ import { SuggestionEvidencesComponent } from './suggestion-evidences/suggestion- templateUrl: './suggestion-list-element.component.html', animations: [fadeIn], imports: [ + NgIf, TranslateModule, ItemSearchResultListElementComponent, SuggestionActionsComponent, diff --git a/src/app/notifications/suggestion-targets/publication-claim/publication-claim.component.ts b/src/app/notifications/suggestion-targets/publication-claim/publication-claim.component.ts index 700aa9631a..95788bf4ba 100644 --- a/src/app/notifications/suggestion-targets/publication-claim/publication-claim.component.ts +++ b/src/app/notifications/suggestion-targets/publication-claim/publication-claim.component.ts @@ -1,5 +1,6 @@ import { AsyncPipe, + NgFor, NgIf, } from '@angular/common'; import { @@ -44,6 +45,7 @@ import { SuggestionTargetsStateService } from '../suggestion-targets.state.servi TranslateModule, PaginationComponent, NgIf, + NgFor, RouterLink, ], standalone: true, diff --git a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts index 0975954ccc..c4f22f4dd7 100644 --- a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts +++ b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.spec.ts @@ -13,7 +13,9 @@ import { of as observableOf } from 'rxjs'; import { RestResponse } from '../../core/cache/response.models'; import { EPersonDataService } from '../../core/eperson/eperson-data.service'; +import { AlertComponent } from '../../shared/alert/alert.component'; import { FormBuilderService } from '../../shared/form/builder/form-builder.service'; +import { FormComponent } from '../../shared/form/form.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { VarDirective } from '../../shared/utils/var.directive'; import { ProfilePageSecurityFormComponent } from './profile-page-security-form.component'; @@ -52,6 +54,8 @@ describe('ProfilePageSecurityFormComponent', () => { FormBuilderService, ], schemas: [NO_ERRORS_SCHEMA], + }).overrideComponent(ProfilePageSecurityFormComponent, { + remove: { imports: [ FormComponent, AlertComponent ] }, }).compileComponents(); })); diff --git a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts index 41a6064857..929ff280c5 100644 --- a/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts +++ b/src/app/profile-page/profile-page-security-form/profile-page-security-form.component.ts @@ -1,3 +1,4 @@ +import { NgIf } from '@angular/common'; import { Component, EventEmitter, @@ -32,6 +33,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s selector: 'ds-profile-page-security-form', templateUrl: './profile-page-security-form.component.html', imports: [ + NgIf, FormComponent, AlertComponent, TranslateModule, diff --git a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts index c28f37717f..c61be492cd 100644 --- a/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts +++ b/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts @@ -12,7 +12,6 @@ import { import { FormsModule } from '@angular/forms'; import { EventType, - NavigationEnd, Router, RouterLink, RouterLinkActive, @@ -26,7 +25,10 @@ import { Subscription, } from 'rxjs'; import { + distinctUntilChanged, + filter, map, + startWith, take, } from 'rxjs/operators'; @@ -37,6 +39,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model'; import { RemoteData } from '../../../core/data/remote-data'; import { BrowseDefinition } from '../../../core/shared/browse-definition.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; +import { isNotEmpty } from '../../empty.util'; export interface ComColPageNavOption { id: string; @@ -123,13 +126,16 @@ export class ComcolPageBrowseByComponent implements OnDestroy, OnInit { this.subs.push(combineLatest([ this.allOptions$, - this.router.events, - ]).subscribe(([navOptions, scrollEvent]: [ComColPageNavOption[], Scroll]) => { - if (scrollEvent.type === EventType.Scroll) { - for (const option of navOptions) { - if (option.routerLink === (scrollEvent.routerEvent as NavigationEnd).urlAfterRedirects.split('?')[0]) { - this.currentOption$.next(option); - } + this.router.events.pipe( + startWith(this.router), + filter((next: Router|Scroll) => (isNotEmpty((next as Router)?.url) || (next as Scroll)?.type === EventType.Scroll)), + map((next: Router|Scroll) => (next as Router)?.url || (next as Scroll).routerEvent.urlAfterRedirects), + distinctUntilChanged(), + ), + ]).subscribe(([navOptions, url]: [ComColPageNavOption[], string]) => { + for (const option of navOptions) { + if (option.routerLink === url?.split('?')[0]) { + this.currentOption$.next(option); } } })); diff --git a/src/app/shared/correction-suggestion/withdrawn-reinstate-modal.component.ts b/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.ts similarity index 97% rename from src/app/shared/correction-suggestion/withdrawn-reinstate-modal.component.ts rename to src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.ts index 1c7e33718f..ab8cb689e8 100644 --- a/src/app/shared/correction-suggestion/withdrawn-reinstate-modal.component.ts +++ b/src/app/shared/correction-suggestion/item-withdrawn-reinstate-modal.component.ts @@ -1,4 +1,7 @@ -import { AsyncPipe } from '@angular/common'; +import { + AsyncPipe, + NgIf, +} from '@angular/common'; import { Component, EventEmitter, @@ -18,6 +21,7 @@ import { LoadingComponent } from '../loading/loading.component'; templateUrl: './item-withdrawn-reinstate-modal.component.html', styleUrls: ['./item-withdrawn-reinstate-modal.component.scss'], imports: [ + NgIf, TranslateModule, LoadingComponent, FormsModule, diff --git a/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts b/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts index c52b435af4..bc2cfba481 100644 --- a/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts +++ b/src/app/shared/dso-page/dso-withdrawn-reinstate-service/dso-withdrawn-reinstate-modal.service.ts @@ -3,15 +3,15 @@ import { Router } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core'; import { take } from 'rxjs/operators'; -import { Item } from 'src/app/core/shared/item.model'; import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service'; import { ItemDataService } from '../../../core/data/item-data.service'; import { RemoteData } from '../../../core/data/remote-data'; import { QualityAssuranceEventDataService } from '../../../core/notifications/qa/events/quality-assurance-event-data.service'; import { QualityAssuranceEventObject } from '../../../core/notifications/qa/models/quality-assurance-event.model'; +import { Item } from '../../../core/shared/item.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; -import { ItemWithdrawnReinstateModalComponent } from '../../correction-suggestion/withdrawn-reinstate-modal.component'; +import { ItemWithdrawnReinstateModalComponent } from '../../correction-suggestion/item-withdrawn-reinstate-modal.component'; import { NotificationsService } from '../../notifications/notifications.service'; export const REQUEST_WITHDRAWN = 'REQUEST/WITHDRAWN'; diff --git a/src/app/shared/menu/menu-item/external-link-menu-item.component.ts b/src/app/shared/menu/menu-item/external-link-menu-item.component.ts index 69a92023b0..69693ceada 100644 --- a/src/app/shared/menu/menu-item/external-link-menu-item.component.ts +++ b/src/app/shared/menu/menu-item/external-link-menu-item.component.ts @@ -4,6 +4,7 @@ import { Inject, OnInit, } from '@angular/core'; +import { RouterLinkActive } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { isNotEmpty } from '../../empty.util'; @@ -17,7 +18,7 @@ import { ExternalLinkMenuItemModel } from './models/external-link.model'; styleUrls: ['./menu-item.component.scss'], templateUrl: './external-link-menu-item.component.html', standalone: true, - imports: [NgClass, TranslateModule], + imports: [NgClass, TranslateModule, RouterLinkActive], }) export class ExternalLinkMenuItemComponent implements OnInit { item: ExternalLinkMenuItemModel; diff --git a/src/app/shared/menu/menu-item/onclick-menu-item.component.ts b/src/app/shared/menu/menu-item/onclick-menu-item.component.ts index 9ec1e8d5e0..3073ecc470 100644 --- a/src/app/shared/menu/menu-item/onclick-menu-item.component.ts +++ b/src/app/shared/menu/menu-item/onclick-menu-item.component.ts @@ -3,6 +3,7 @@ import { Component, Inject, } from '@angular/core'; +import { RouterLinkActive } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { OnClickMenuItemModel } from './models/onclick.model'; @@ -15,7 +16,7 @@ import { OnClickMenuItemModel } from './models/onclick.model'; styleUrls: ['./menu-item.component.scss', './onclick-menu-item.component.scss'], templateUrl: './onclick-menu-item.component.html', standalone: true, - imports: [NgIf, TranslateModule], + imports: [NgIf, TranslateModule, RouterLinkActive], }) export class OnClickMenuItemComponent { item: OnClickMenuItemModel; diff --git a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-loader.component.ts b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-loader.component.ts index bda1c765b0..4efbc01e48 100644 --- a/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-loader.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/switcher/claimed-task-actions-loader.component.ts @@ -10,6 +10,7 @@ import { Item } from '../../../../core/shared/item.model'; import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model'; import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model'; import { AbstractComponentLoaderComponent } from '../../../abstract-component-loader/abstract-component-loader.component'; +import { DynamicComponentLoaderDirective } from '../../../abstract-component-loader/dynamic-component-loader.directive'; import { MyDSpaceActionsResult } from '../../mydspace-actions'; import { ClaimedTaskActionsAbstractComponent } from '../abstract/claimed-task-actions-abstract.component'; import { getComponentByWorkflowTaskOption } from './claimed-task-actions-decorator'; @@ -18,6 +19,7 @@ import { getComponentByWorkflowTaskOption } from './claimed-task-actions-decorat selector: 'ds-claimed-task-actions-loader', templateUrl: '../../../abstract-component-loader/abstract-component-loader.component.html', standalone: true, + imports: [ DynamicComponentLoaderDirective ], }) /** * Component for loading a ClaimedTaskAction component depending on the "option" input diff --git a/src/app/shared/object-collection/shared/claimed-task-search-result.model.ts b/src/app/shared/object-collection/shared/claimed-task-search-result.model.ts index f8d0752245..8f580f1924 100644 --- a/src/app/shared/object-collection/shared/claimed-task-search-result.model.ts +++ b/src/app/shared/object-collection/shared/claimed-task-search-result.model.ts @@ -1,10 +1,8 @@ import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; /** * Represents a search result object of a ClaimedTask object */ -@searchResultFor(ClaimedTask) export class ClaimedTaskSearchResult extends SearchResult { } diff --git a/src/app/shared/object-collection/shared/collection-search-result.model.ts b/src/app/shared/object-collection/shared/collection-search-result.model.ts index bd2f547808..cff44c0ba2 100644 --- a/src/app/shared/object-collection/shared/collection-search-result.model.ts +++ b/src/app/shared/object-collection/shared/collection-search-result.model.ts @@ -1,7 +1,5 @@ import { Collection } from '../../../core/shared/collection.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; -@searchResultFor(Collection) export class CollectionSearchResult extends SearchResult { } diff --git a/src/app/shared/object-collection/shared/community-search-result.model.ts b/src/app/shared/object-collection/shared/community-search-result.model.ts index e80dfdaecf..0812767175 100644 --- a/src/app/shared/object-collection/shared/community-search-result.model.ts +++ b/src/app/shared/object-collection/shared/community-search-result.model.ts @@ -1,7 +1,5 @@ import { Community } from '../../../core/shared/community.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; -@searchResultFor(Community) export class CommunitySearchResult extends SearchResult { } diff --git a/src/app/shared/object-collection/shared/item-search-result.model.ts b/src/app/shared/object-collection/shared/item-search-result.model.ts index 5409bdbec7..4704a9ffe6 100644 --- a/src/app/shared/object-collection/shared/item-search-result.model.ts +++ b/src/app/shared/object-collection/shared/item-search-result.model.ts @@ -2,10 +2,8 @@ import { GenericConstructor } from '../../../core/shared/generic-constructor'; import { Item } from '../../../core/shared/item.model'; import { inheritEquatable } from '../../../core/utilities/equals.decorators'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; import { ListableObject } from './listable-object.model'; -@searchResultFor(Item) @inheritEquatable(SearchResult) export class ItemSearchResult extends SearchResult { diff --git a/src/app/shared/object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component.ts b/src/app/shared/object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component.ts index 84042358b3..f1368b6278 100644 --- a/src/app/shared/object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component.ts +++ b/src/app/shared/object-collection/shared/objects-collection-tabulatable/objects-collection-tabulatable.component.ts @@ -15,6 +15,7 @@ import { ListableObject } from '../listable-object.model'; @Component({ selector: 'ds-objects-collection-tabulatable', template: ``, + standalone: true, }) /** diff --git a/src/app/shared/object-collection/shared/pool-task-search-result.model.ts b/src/app/shared/object-collection/shared/pool-task-search-result.model.ts index 9ee74bcd4b..e6d06b4e66 100644 --- a/src/app/shared/object-collection/shared/pool-task-search-result.model.ts +++ b/src/app/shared/object-collection/shared/pool-task-search-result.model.ts @@ -1,10 +1,8 @@ import { PoolTask } from '../../../core/tasks/models/pool-task-object.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; /** * Represents a search result object of a PoolTask object */ -@searchResultFor(PoolTask) export class PoolTaskSearchResult extends SearchResult { } diff --git a/src/app/shared/object-collection/shared/workflow-item-search-result.model.ts b/src/app/shared/object-collection/shared/workflow-item-search-result.model.ts index 8611f8678a..431974cbcc 100644 --- a/src/app/shared/object-collection/shared/workflow-item-search-result.model.ts +++ b/src/app/shared/object-collection/shared/workflow-item-search-result.model.ts @@ -1,10 +1,8 @@ import { WorkflowItem } from '../../../core/submission/models/workflowitem.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; /** * Represents a search result object of a WorkflowItem object */ -@searchResultFor(WorkflowItem) export class WorkflowItemSearchResult extends SearchResult { } diff --git a/src/app/shared/object-collection/shared/workspace-item-search-result.model.ts b/src/app/shared/object-collection/shared/workspace-item-search-result.model.ts index 3f57d2f4cd..f0b65c4bd1 100644 --- a/src/app/shared/object-collection/shared/workspace-item-search-result.model.ts +++ b/src/app/shared/object-collection/shared/workspace-item-search-result.model.ts @@ -1,10 +1,8 @@ import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model'; import { SearchResult } from '../../search/models/search-result.model'; -import { searchResultFor } from '../../search/search-result-element-decorator'; /** * Represents a search result object of a WorkspaceItem object */ -@searchResultFor(WorkspaceItem) export class WorkspaceItemSearchResult extends SearchResult { } diff --git a/src/app/shared/search/search-result-element-decorator.ts b/src/app/shared/search/search-result-element-decorator.ts index 5241318122..56d712ce26 100644 --- a/src/app/shared/search/search-result-element-decorator.ts +++ b/src/app/shared/search/search-result-element-decorator.ts @@ -1,24 +1,36 @@ +import { AdminNotifyMessage } from '../../admin/admin-notify-dashboard/models/admin-notify-message.model'; +import { AdminNotifySearchResult } from '../../admin/admin-notify-dashboard/models/admin-notify-message-search-result.model'; +import { Collection } from '../../core/shared/collection.model'; +import { Community } from '../../core/shared/community.model'; import { GenericConstructor } from '../../core/shared/generic-constructor'; +import { Item } from '../../core/shared/item.model'; +import { WorkflowItem } from '../../core/submission/models/workflowitem.model'; +import { WorkspaceItem } from '../../core/submission/models/workspaceitem.model'; +import { ClaimedTask } from '../../core/tasks/models/claimed-task-object.model'; +import { PoolTask } from '../../core/tasks/models/pool-task-object.model'; +import { ClaimedTaskSearchResult } from '../object-collection/shared/claimed-task-search-result.model'; +import { CollectionSearchResult } from '../object-collection/shared/collection-search-result.model'; +import { CommunitySearchResult } from '../object-collection/shared/community-search-result.model'; +import { ItemSearchResult } from '../object-collection/shared/item-search-result.model'; import { ListableObject } from '../object-collection/shared/listable-object.model'; +import { PoolTaskSearchResult } from '../object-collection/shared/pool-task-search-result.model'; +import { WorkflowItemSearchResult } from '../object-collection/shared/workflow-item-search-result.model'; +import { WorkspaceItemSearchResult } from '../object-collection/shared/workspace-item-search-result.model'; /** * Contains the mapping between a search result component and a DSpaceObject */ -const searchResultMap = new Map(); +export const SEARCH_RESULT_MAP = new Map, GenericConstructor>([ + [AdminNotifyMessage, AdminNotifySearchResult], + [ClaimedTask, ClaimedTaskSearchResult], + [PoolTask, PoolTaskSearchResult], + [Collection, CollectionSearchResult], + [Community, CommunitySearchResult], + [Item, ItemSearchResult], + [WorkflowItem, WorkflowItemSearchResult], + [WorkspaceItem, WorkspaceItemSearchResult], +]); -/** - * Used to map Search Result components to their matching DSpaceObject - * @param {GenericConstructor} domainConstructor The constructor of the DSpaceObject - * @returns Decorator function that performs the actual mapping on initialization of the component - */ -export function searchResultFor(domainConstructor: GenericConstructor) { - return function decorator(searchResult: any) { - if (!searchResult) { - return; - } - searchResultMap.set(domainConstructor, searchResult); - }; -} /** * Requests the matching component based on a given DSpaceObject's constructor @@ -26,5 +38,5 @@ export function searchResultFor(domainConstructor: GenericConstructor) { - return searchResultMap.get(domainConstructor); + return SEARCH_RESULT_MAP.get(domainConstructor); } diff --git a/src/app/shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component.html b/src/app/shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component.html index 3d1d2b3734..babfa91f0b 100644 --- a/src/app/shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component.html +++ b/src/app/shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component.html @@ -14,10 +14,10 @@

{{ fileObject.name }}

+ *ngIf="fileObject"> {{ fileObject?.name }}

{{ (fileObject === null ? dropMessageLabel : dropMessageLabelReplacement) | translate}} {{'uploader.or' | translate}} + aria-hidden="true"> {{ ((fileObject === null || fileObject === undefined) ? dropMessageLabel : dropMessageLabelReplacement) | translate}} {{'uploader.or' | translate}}