From 36edc58979f3dab654d96ae9270fa93a55ddad32 Mon Sep 17 00:00:00 2001 From: Andrea Barbasso <´andrea.barbasso@4science.com´> Date: Tue, 5 Mar 2024 10:44:39 +0100 Subject: [PATCH] [DURACOM-191] migrate components to standalone --- .../browse-by-switcher.component.ts | 3 ++- src/app/item-page/simple/item-page.component.ts | 8 +++++++- .../notify-requests-status.component.ts | 10 ++++++++++ .../request-status-alert-box.component.ts | 11 +++++++++++ .../qa-event-notification.component.ts | 15 ++++++++++++++- .../my-dspace-page/my-dspace-page.component.ts | 10 +++++++++- ...my-dspace-qa-events-notifications.component.ts | 13 ++++++++++++- .../events/quality-assurance-events.component.ts | 3 ++- src/app/shared/browse-by/browse-by.component.ts | 3 ++- .../comcol-browse-by.component.ts | 7 +++++++ .../comcol-search-section.component.ts | 11 +++++++++-- .../metadata-representation-loader.component.ts | 5 +++-- .../starts-with/starts-with-loader.component.ts | 1 + src/app/shared/utils/split.pipe.ts | 3 ++- 14 files changed, 91 insertions(+), 12 deletions(-) diff --git a/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.ts b/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.ts index 913d576bd4..7549a62f19 100644 --- a/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.ts +++ b/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.ts @@ -5,11 +5,12 @@ import { AbstractComponentLoaderComponent } from '../../shared/abstract-componen import { BrowseByDataType } from './browse-by-data-type'; import { Context } from '../../core/shared/context.model'; import { AsyncPipe, NgComponentOutlet } from '@angular/common'; +import { DynamicComponentLoaderDirective } from './dynamic-component-loader.directive'; @Component({ selector: 'ds-browse-by-switcher', templateUrl: '../../shared/abstract-component-loader/abstract-component-loader.component.html', - imports: [AsyncPipe, NgComponentOutlet], + imports: [AsyncPipe, NgComponentOutlet, DynamicComponentLoaderDirective], standalone: true }) export class BrowseBySwitcherComponent extends AbstractComponentLoaderComponent { diff --git a/src/app/item-page/simple/item-page.component.ts b/src/app/item-page/simple/item-page.component.ts index 4d84146dea..b7775b9ff3 100644 --- a/src/app/item-page/simple/item-page.component.ts +++ b/src/app/item-page/simple/item-page.component.ts @@ -33,6 +33,10 @@ import { ErrorComponent } from '../../shared/error/error.component'; import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; import { TranslateModule } from '@ngx-translate/core'; import { NotifyInfoService } from 'src/app/core/coar-notify/notify-info/notify-info.service'; +import { + NotifyRequestsStatusComponent +} from './notify-requests-status/notify-requests-status-component/notify-requests-status.component'; +import { QaEventNotificationComponent } from './qa-event-notification/qa-event-notification.component'; /** * This component renders a simple item page. @@ -57,7 +61,9 @@ import { NotifyInfoService } from 'src/app/core/coar-notify/notify-info/notify-i ThemedLoadingComponent, TranslateModule, AsyncPipe, - NgIf + NgIf, + NotifyRequestsStatusComponent, + QaEventNotificationComponent ] }) export class ItemPageComponent implements OnInit, OnDestroy { diff --git a/src/app/item-page/simple/notify-requests-status/notify-requests-status-component/notify-requests-status.component.ts b/src/app/item-page/simple/notify-requests-status/notify-requests-status-component/notify-requests-status.component.ts index 381a3751a9..99c62e0aa8 100644 --- a/src/app/item-page/simple/notify-requests-status/notify-requests-status-component/notify-requests-status.component.ts +++ b/src/app/item-page/simple/notify-requests-status/notify-requests-status-component/notify-requests-status.component.ts @@ -16,11 +16,21 @@ import { getRemoteDataPayload, } from '../../../../core/shared/operators'; import { hasValue } from '../../../../shared/empty.util'; +import { RequestStatusAlertBoxComponent } from '../request-status-alert-box/request-status-alert-box.component'; +import { AsyncPipe, KeyValuePipe, NgForOf, NgIf } from '@angular/common'; @Component({ selector: 'ds-notify-requests-status', templateUrl: './notify-requests-status.component.html', styleUrls: ['./notify-requests-status.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [ + RequestStatusAlertBoxComponent, + AsyncPipe, + KeyValuePipe, + NgForOf, + NgIf + ] }) /** diff --git a/src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts b/src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts index 355980836a..d091f1fb46 100644 --- a/src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts +++ b/src/app/item-page/simple/notify-requests-status/request-status-alert-box/request-status-alert-box.component.ts @@ -6,12 +6,23 @@ import { } from '@angular/core'; import { NotifyStatuses } from '../notify-requests-status.model'; import { RequestStatusEnum } from '../notify-status.enum'; +import { TruncatablePartComponent } from '../../../../shared/truncatable/truncatable-part/truncatable-part.component'; +import { TruncatableComponent } from '../../../../shared/truncatable/truncatable.component'; +import { NgForOf } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; @Component({ selector: 'ds-request-status-alert-box', templateUrl: './request-status-alert-box.component.html', styleUrls: ['./request-status-alert-box.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [ + TruncatablePartComponent, + TruncatableComponent, + NgForOf, + TranslateModule + ] }) /** * Represents a component that displays the status of a request. diff --git a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts index 1557a65a0e..3c0df2d978 100644 --- a/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts +++ b/src/app/item-page/simple/qa-event-notification/qa-event-notification.component.ts @@ -10,13 +10,26 @@ import { catchError, map } from 'rxjs/operators'; import { RemoteData } from '../../../core/data/remote-data'; import { getNotificatioQualityAssuranceRoute } from '../../../admin/admin-routing-paths'; import { PaginatedList } from '../../../core/data/paginated-list.model'; +import { AsyncPipe, NgForOf, NgIf } from '@angular/common'; +import { RouterLink } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { SplitPipe } from '../../../shared/utils/split.pipe'; @Component({ selector: 'ds-qa-event-notification', templateUrl: './qa-event-notification.component.html', styleUrls: ['./qa-event-notification.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - providers: [QualityAssuranceSourceDataService] + providers: [QualityAssuranceSourceDataService], + imports: [ + NgIf, + NgForOf, + AsyncPipe, + RouterLink, + TranslateModule, + SplitPipe + ], + standalone: true }) /** * Component for displaying quality assurance event notifications for an item. diff --git a/src/app/my-dspace-page/my-dspace-page.component.ts b/src/app/my-dspace-page/my-dspace-page.component.ts index 00142fd7c0..6443c02841 100644 --- a/src/app/my-dspace-page/my-dspace-page.component.ts +++ b/src/app/my-dspace-page/my-dspace-page.component.ts @@ -16,6 +16,12 @@ import { ThemedSearchComponent } from '../shared/search/themed-search.component' import { MyDSpaceNewSubmissionComponent } from './my-dspace-new-submission/my-dspace-new-submission.component'; import { AsyncPipe, NgIf } from '@angular/common'; import { RoleDirective } from '../shared/roles/role.directive'; +import { + SuggestionsNotificationComponent +} from '../notifications/suggestions-notification/suggestions-notification.component'; +import { + MyDspaceQaEventsNotificationsComponent +} from './my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component'; export const MYDSPACE_ROUTE = '/mydspace'; @@ -38,7 +44,9 @@ export const MYDSPACE_ROUTE = '/mydspace'; MyDSpaceNewSubmissionComponent, AsyncPipe, RoleDirective, - NgIf + NgIf, + SuggestionsNotificationComponent, + MyDspaceQaEventsNotificationsComponent ], standalone: true }) diff --git a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts index 2c5f34cbd7..439d4d1953 100644 --- a/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts +++ b/src/app/my-dspace-page/my-dspace-qa-events-notifications/my-dspace-qa-events-notifications.component.ts @@ -4,12 +4,23 @@ import { getFirstCompletedRemoteData, getPaginatedListPayload, getRemoteDataPayl import { Observable, of, tap } from 'rxjs'; import { getNotificatioQualityAssuranceRoute } from '../../admin/admin-routing-paths'; import { QualityAssuranceSourceObject } from 'src/app/core/notifications/qa/models/quality-assurance-source.model'; +import { AsyncPipe, NgForOf, NgIf } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterLink } from '@angular/router'; @Component({ selector: 'ds-my-dspace-qa-events-notifications', templateUrl: './my-dspace-qa-events-notifications.component.html', styleUrls: ['./my-dspace-qa-events-notifications.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [ + AsyncPipe, + NgForOf, + TranslateModule, + RouterLink, + NgIf + ], + standalone: true }) export class MyDspaceQaEventsNotificationsComponent implements OnInit { diff --git a/src/app/notifications/qa/events/quality-assurance-events.component.ts b/src/app/notifications/qa/events/quality-assurance-events.component.ts index 81bbc3ef38..ff4bdd7014 100644 --- a/src/app/notifications/qa/events/quality-assurance-events.component.ts +++ b/src/app/notifications/qa/events/quality-assurance-events.component.ts @@ -40,6 +40,7 @@ import { NgIf, NgFor, AsyncPipe } from '@angular/common'; import { AlertComponent } from '../../../shared/alert/alert.component'; import { getItemPageRoute } from '../../../item-page/item-page-routing-paths'; import { ItemDataService } from '../../../core/data/item-data.service'; +import { EPersonDataComponent } from './ePerson-data/ePerson-data.component'; /** * Component to display the Quality Assurance event list. @@ -49,7 +50,7 @@ import { ItemDataService } from '../../../core/data/item-data.service'; templateUrl: './quality-assurance-events.component.html', styleUrls: ['./quality-assurance-events.component.scss'], standalone: true, - imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule] + imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule, EPersonDataComponent] }) export class QualityAssuranceEventsComponent implements OnInit, OnDestroy { /** diff --git a/src/app/shared/browse-by/browse-by.component.ts b/src/app/shared/browse-by/browse-by.component.ts index 77d260c0e6..b0a4360660 100644 --- a/src/app/shared/browse-by/browse-by.component.ts +++ b/src/app/shared/browse-by/browse-by.component.ts @@ -19,6 +19,7 @@ import { ObjectCollectionComponent } from '../object-collection/object-collectio import { ThemedResultsBackButtonComponent } from '../results-back-button/themed-results-back-button.component'; import { NgClass, NgComponentOutlet, NgIf, AsyncPipe } from '@angular/common'; import { VarDirective } from '../utils/var.directive'; +import { StartsWithLoaderComponent } from '../starts-with/starts-with-loader.component'; @Component({ selector: 'ds-browse-by', @@ -29,7 +30,7 @@ import { VarDirective } from '../utils/var.directive'; fadeInOut ], standalone: true, - imports: [VarDirective, NgClass, NgComponentOutlet, NgIf, ThemedResultsBackButtonComponent, ObjectCollectionComponent, ThemedLoadingComponent, ErrorComponent, AsyncPipe, TranslateModule] + imports: [VarDirective, NgClass, NgComponentOutlet, NgIf, ThemedResultsBackButtonComponent, ObjectCollectionComponent, ThemedLoadingComponent, ErrorComponent, AsyncPipe, TranslateModule, StartsWithLoaderComponent] }) /** * Component to display a browse-by page for any ListableObject diff --git a/src/app/shared/comcol/sections/comcol-browse-by/comcol-browse-by.component.ts b/src/app/shared/comcol/sections/comcol-browse-by/comcol-browse-by.component.ts index 76aa6c6981..c9ba2af098 100644 --- a/src/app/shared/comcol/sections/comcol-browse-by/comcol-browse-by.component.ts +++ b/src/app/shared/comcol/sections/comcol-browse-by/comcol-browse-by.component.ts @@ -4,11 +4,18 @@ import { BrowseByDataType } from '../../../../browse-by/browse-by-switcher/brows import { ActivatedRoute, Data } from '@angular/router'; import { map } from 'rxjs/operators'; import { BrowseDefinition } from '../../../../core/shared/browse-definition.model'; +import { BrowseBySwitcherComponent } from '../../../../browse-by/browse-by-switcher/browse-by-switcher.component'; +import { AsyncPipe } from '@angular/common'; @Component({ selector: 'ds-comcol-browse-by', templateUrl: './comcol-browse-by.component.html', styleUrls: ['./comcol-browse-by.component.scss'], + imports: [ + BrowseBySwitcherComponent, + AsyncPipe + ], + standalone: true }) export class ComcolBrowseByComponent implements OnInit { diff --git a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts index fe50147395..aa8c4856e5 100644 --- a/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts +++ b/src/app/shared/comcol/sections/comcol-search-section/comcol-search-section.component.ts @@ -1,14 +1,16 @@ -import { Component, OnInit, Inject } from '@angular/core'; +import { Component, Inject, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { ActivatedRoute, Data } from '@angular/router'; import { map } from 'rxjs/operators'; -import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component'; import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service'; import { RemoteData } from '../../../../core/data/remote-data'; import { Community } from '../../../../core/shared/community.model'; import { Collection } from '../../../../core/shared/collection.model'; import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface'; import { hasValue } from '../../../empty.util'; +import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-configuration.service'; +import { ThemedSearchComponent } from '../../../search/themed-search.component'; +import { AsyncPipe } from '@angular/common'; /** * The search tab on community & collection pages @@ -23,6 +25,11 @@ import { hasValue } from '../../../empty.util'; useClass: SearchConfigurationService, }, ], + imports: [ + ThemedSearchComponent, + AsyncPipe + ], + standalone: true }) export class ComcolSearchSectionComponent implements OnInit { diff --git a/src/app/shared/metadata-representation/metadata-representation-loader.component.ts b/src/app/shared/metadata-representation/metadata-representation-loader.component.ts index 4dc4e1a057..66f30e1a10 100644 --- a/src/app/shared/metadata-representation/metadata-representation-loader.component.ts +++ b/src/app/shared/metadata-representation/metadata-representation-loader.component.ts @@ -6,7 +6,9 @@ import { import { METADATA_REPRESENTATION_COMPONENT_FACTORY } from './metadata-representation.decorator'; import { Context } from '../../core/shared/context.model'; import { GenericConstructor } from '../../core/shared/generic-constructor'; -import { MetadataRepresentationListElementComponent } from '../object-list/metadata-representation-list-element/metadata-representation-list-element.component'; +import { + MetadataRepresentationListElementComponent +} from '../object-list/metadata-representation-list-element/metadata-representation-list-element.component'; import { ThemeService } from '../theme-support/theme.service'; import { AbstractComponentLoaderComponent } from '../abstract-component-loader/abstract-component-loader.component'; @@ -14,7 +16,6 @@ import { AbstractComponentLoaderComponent } from '../abstract-component-loader/a selector: 'ds-metadata-representation-loader', templateUrl: '../abstract-component-loader/abstract-component-loader.component.html', standalone: true, - imports: [MetadataRepresentationDirective] }) /** * Component for determining what component to use depending on the item's entity type (dspace.entity.type), its metadata representation and, optionally, its context diff --git a/src/app/shared/starts-with/starts-with-loader.component.ts b/src/app/shared/starts-with/starts-with-loader.component.ts index 085daa4dd0..599c91874d 100644 --- a/src/app/shared/starts-with/starts-with-loader.component.ts +++ b/src/app/shared/starts-with/starts-with-loader.component.ts @@ -10,6 +10,7 @@ import { StartsWithAbstractComponent } from './starts-with-abstract.component'; @Component({ selector: 'ds-starts-with-loader', templateUrl: '../abstract-component-loader/abstract-component-loader.component.html', + standalone: true, }) export class StartsWithLoaderComponent extends AbstractComponentLoaderComponent { diff --git a/src/app/shared/utils/split.pipe.ts b/src/app/shared/utils/split.pipe.ts index e4d0f2cc49..2e8a936592 100644 --- a/src/app/shared/utils/split.pipe.ts +++ b/src/app/shared/utils/split.pipe.ts @@ -6,7 +6,8 @@ import { Pipe, PipeTransform } from '@angular/core'; * @returns An array of substrings. */ @Pipe({ - name: 'dsSplit' + name: 'dsSplit', + standalone: true }) export class SplitPipe implements PipeTransform { transform(value: string, separator: string): string[] {