diff --git a/.eslintrc.json b/.eslintrc.json index af1b97849b6..985126bbc29 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -139,7 +139,6 @@ } ], "@angular-eslint/no-attribute-decorator": "error", - "@angular-eslint/no-forward-ref": "error", "@angular-eslint/no-output-native": "warn", "@angular-eslint/no-output-on-prefix": "warn", "@angular-eslint/no-conflicting-lifecycle": "warn", diff --git a/src/app/access-control/access-control.module.ts b/src/app/access-control/access-control.module.ts index 3dc4b6cedc7..46257267655 100644 --- a/src/app/access-control/access-control.module.ts +++ b/src/app/access-control/access-control.module.ts @@ -28,36 +28,34 @@ export const ValidateEmailErrorStateMatcher: DynamicErrorMessagesMatcher = }; @NgModule({ - imports: [ - CommonModule, - SharedModule, - RouterModule, - AccessControlRoutingModule, - FormModule, - NgbAccordionModule, - SearchModule, - AccessControlFormModule, - ], - exports: [ - MembersListComponent, - ], - declarations: [ - EPeopleRegistryComponent, - EPersonFormComponent, - GroupsRegistryComponent, - GroupFormComponent, - SubgroupsListComponent, - MembersListComponent, - BulkAccessComponent, - BulkAccessBrowseComponent, - BulkAccessSettingsComponent, - ], - providers: [ - { - provide: DYNAMIC_ERROR_MESSAGES_MATCHER, - useValue: ValidateEmailErrorStateMatcher - }, - ] + imports: [ + CommonModule, + SharedModule, + RouterModule, + AccessControlRoutingModule, + FormModule, + NgbAccordionModule, + SearchModule, + AccessControlFormModule, + EPeopleRegistryComponent, + EPersonFormComponent, + GroupsRegistryComponent, + GroupFormComponent, + SubgroupsListComponent, + MembersListComponent, + BulkAccessComponent, + BulkAccessBrowseComponent, + BulkAccessSettingsComponent + ], + exports: [ + MembersListComponent, + ], + providers: [ + { + provide: DYNAMIC_ERROR_MESSAGES_MATCHER, + useValue: ValidateEmailErrorStateMatcher + }, + ] }) /** * This module handles all components related to the access control pages diff --git a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts index 87b2a8d5684..a42c98cb614 100644 --- a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts +++ b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.spec.ts @@ -28,17 +28,17 @@ describe('BulkAccessBrowseComponent', () => { const selectableListService = jasmine.createSpyObj('SelectableListService', ['getSelectableList', 'deselectAll']); beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ + imports: [ NgbAccordionModule, NgbNavModule, - TranslateModule.forRoot() - ], - declarations: [BulkAccessBrowseComponent], - providers: [ { provide: SelectableListService, useValue: selectableListService }, ], - schemas: [ + TranslateModule.forRoot(), + BulkAccessBrowseComponent + ], + providers: [{ provide: SelectableListService, useValue: selectableListService },], + schemas: [ NO_ERRORS_SCHEMA - ] - }).compileComponents(); + ] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.ts b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.ts index e806e729c8e..8b8e3626cf7 100644 --- a/src/app/access-control/bulk-access/browse/bulk-access-browse.component.ts +++ b/src/app/access-control/bulk-access/browse/bulk-access-browse.component.ts @@ -14,6 +14,19 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut import { PageInfo } from '../../../core/shared/page-info.model'; import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model'; import { hasValue } from '../../../shared/empty.util'; +import { PaginationComponent } from '../../../shared/pagination/pagination.component'; +import { AsyncPipe, NgForOf, NgIf } from '@angular/common'; +import { NgbAccordionModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedSearchComponent } from '../../../shared/search/themed-search.component'; +import { BrowserOnlyPipe } from '../../../shared/utils/browser-only.pipe'; +import { NgxPaginationModule } from 'ngx-pagination'; +import { + SelectableListItemControlComponent +} from '../../../shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component'; +import { + ListableObjectComponentLoaderComponent +} from '../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; @Component({ selector: 'ds-bulk-access-browse', @@ -24,7 +37,22 @@ import { hasValue } from '../../../shared/empty.util'; provide: SEARCH_CONFIG_SERVICE, useClass: SearchConfigurationService } - ] + ], + imports: [ + PaginationComponent, + AsyncPipe, + NgbAccordionModule, + TranslateModule, + NgIf, + NgbNavModule, + ThemedSearchComponent, + BrowserOnlyPipe, + NgForOf, + NgxPaginationModule, + SelectableListItemControlComponent, + ListableObjectComponentLoaderComponent + ], + standalone: true }) export class BulkAccessBrowseComponent implements OnInit, OnDestroy { diff --git a/src/app/access-control/bulk-access/bulk-access.component.spec.ts b/src/app/access-control/bulk-access/bulk-access.component.spec.ts index e9b253147dc..562c7427ecb 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.spec.ts +++ b/src/app/access-control/bulk-access/bulk-access.component.spec.ts @@ -69,18 +69,18 @@ describe('BulkAccessComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ + imports: [ RouterTestingModule, - TranslateModule.forRoot() - ], - declarations: [ BulkAccessComponent ], - providers: [ + TranslateModule.forRoot(), + BulkAccessComponent + ], + providers: [ { provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock }, { provide: NotificationsService, useValue: NotificationsServiceStub }, { provide: SelectableListService, useValue: selectableListServiceMock } - ], - schemas: [NO_ERRORS_SCHEMA] - }) + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); }); diff --git a/src/app/access-control/bulk-access/bulk-access.component.ts b/src/app/access-control/bulk-access/bulk-access.component.ts index 04724614cb6..85fde3b208b 100644 --- a/src/app/access-control/bulk-access/bulk-access.component.ts +++ b/src/app/access-control/bulk-access/bulk-access.component.ts @@ -7,11 +7,19 @@ import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.com import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service'; import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer'; import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { BulkAccessBrowseComponent } from './browse/bulk-access-browse.component'; @Component({ selector: 'ds-bulk-access', templateUrl: './bulk-access.component.html', - styleUrls: ['./bulk-access.component.scss'] + styleUrls: ['./bulk-access.component.scss'], + imports: [ + TranslateModule, + BulkAccessSettingsComponent, + BulkAccessBrowseComponent + ], + standalone: true }) export class BulkAccessComponent implements OnInit { diff --git a/src/app/access-control/bulk-access/settings/bulk-access-settings.component.spec.ts b/src/app/access-control/bulk-access/settings/bulk-access-settings.component.spec.ts index 14e0fdefb21..bed7084d833 100644 --- a/src/app/access-control/bulk-access/settings/bulk-access-settings.component.spec.ts +++ b/src/app/access-control/bulk-access/settings/bulk-access-settings.component.spec.ts @@ -3,6 +3,9 @@ import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { BulkAccessSettingsComponent } from './bulk-access-settings.component'; import { NO_ERRORS_SCHEMA } from '@angular/core'; +import { + AccessControlFormContainerComponent +} from '../../../shared/access-control-form-container/access-control-form-container.component'; describe('BulkAccessSettingsComponent', () => { let component: BulkAccessSettingsComponent; @@ -41,10 +44,13 @@ describe('BulkAccessSettingsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [NgbAccordionModule, TranslateModule.forRoot()], - declarations: [BulkAccessSettingsComponent], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + imports: [NgbAccordionModule, TranslateModule.forRoot(), BulkAccessSettingsComponent], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(BulkAccessSettingsComponent, { + remove: { imports: [AccessControlFormContainerComponent]} + }) + .compileComponents(); }); beforeEach(() => { diff --git a/src/app/access-control/bulk-access/settings/bulk-access-settings.component.ts b/src/app/access-control/bulk-access/settings/bulk-access-settings.component.ts index eecc0162451..a19adecb349 100644 --- a/src/app/access-control/bulk-access/settings/bulk-access-settings.component.ts +++ b/src/app/access-control/bulk-access/settings/bulk-access-settings.component.ts @@ -2,12 +2,22 @@ import { Component, ViewChild } from '@angular/core'; import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component'; +import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgIf } from '@angular/common'; @Component({ selector: 'ds-bulk-access-settings', templateUrl: 'bulk-access-settings.component.html', styleUrls: ['./bulk-access-settings.component.scss'], - exportAs: 'dsBulkSettings' + exportAs: 'dsBulkSettings', + imports: [ + NgbAccordionModule, + TranslateModule, + NgIf, + AccessControlFormContainerComponent + ], + standalone: true }) export class BulkAccessSettingsComponent { diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts index 4a09913862f..d72e0a0cff9 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.spec.ts @@ -27,6 +27,9 @@ import { RequestService } from '../../core/data/request.service'; import { PaginationService } from '../../core/pagination/pagination.service'; import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub'; import { FindListOptions } from '../../core/data/find-list-options.model'; +import { EPersonFormComponent } from './eperson-form/eperson-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { PaginationComponent } from '../../shared/pagination/pagination.component'; describe('EPeopleRegistryComponent', () => { let component: EPeopleRegistryComponent; @@ -123,26 +126,34 @@ describe('EPeopleRegistryComponent', () => { paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [EPeopleRegistryComponent], + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), EPeopleRegistryComponent], providers: [ - { provide: EPersonDataService, useValue: ePersonDataServiceStub }, - { provide: NotificationsService, useValue: new NotificationsServiceStub() }, - { provide: AuthorizationDataService, useValue: authorizationService }, - { provide: FormBuilderService, useValue: builderService }, - { provide: Router, useValue: new RouterStub() }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }, - { provide: PaginationService, useValue: paginationService } + {provide: EPersonDataService, useValue: ePersonDataServiceStub}, + {provide: NotificationsService, useValue: new NotificationsServiceStub()}, + {provide: AuthorizationDataService, useValue: authorizationService}, + {provide: FormBuilderService, useValue: builderService}, + {provide: Router, useValue: new RouterStub()}, + {provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])}, + {provide: PaginationService, useValue: paginationService} ], schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + }) + .overrideComponent(EPeopleRegistryComponent, { + remove: { + imports: [ + EPersonFormComponent, + ThemedLoadingComponent, + PaginationComponent, + ] + } + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.ts b/src/app/access-control/epeople-registry/epeople-registry.component.ts index fb045ebb883..db7fc969632 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.ts +++ b/src/app/access-control/epeople-registry/epeople-registry.component.ts @@ -1,7 +1,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { UntypedFormBuilder } from '@angular/forms'; +import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, combineLatest, Observable, Subscription } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model'; @@ -22,10 +22,26 @@ import { PageInfo } from '../../core/shared/page-info.model'; import { NoContent } from '../../core/shared/NoContent.model'; import { PaginationService } from '../../core/pagination/pagination.service'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; +import { EPersonFormComponent } from './eperson-form/eperson-form.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { PaginationComponent } from '../../shared/pagination/pagination.component'; @Component({ selector: 'ds-epeople-registry', templateUrl: './epeople-registry.component.html', + imports: [ + TranslateModule, + AsyncPipe, + NgIf, + EPersonFormComponent, + ReactiveFormsModule, + ThemedLoadingComponent, + PaginationComponent, + NgClass, + NgForOf + ], + standalone: true }) /** * A component used for managing all existing epeople within the repository. diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index fb911e709c4..7c540f895ff 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -31,6 +31,9 @@ import { PaginationServiceStub } from '../../../shared/testing/pagination-servic import { FindListOptions } from '../../../core/data/find-list-options.model'; import { ValidateEmailNotTaken } from './validators/email-taken.validator'; import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service'; +import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; +import { PaginationComponent } from '../../../shared/pagination/pagination.component'; +import { FormComponent } from '../../../shared/form/form.component'; describe('EPersonFormComponent', () => { let component: EPersonFormComponent; @@ -183,16 +186,14 @@ describe('EPersonFormComponent', () => { paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [EPersonFormComponent], - providers: [ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), EPersonFormComponent], + providers: [ { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: GroupDataService, useValue: groupsDataService }, { provide: FormBuilderService, useValue: builderService }, @@ -200,12 +201,16 @@ describe('EPersonFormComponent', () => { { provide: AuthService, useValue: authService }, { provide: AuthorizationDataService, useValue: authorizationService }, { provide: PaginationService, useValue: paginationService }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])}, + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }, { provide: EpersonRegistrationService, useValue: epersonRegistrationService }, EPeopleRegistryComponent - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(EPersonFormComponent, { + remove: { imports: [ ThemedLoadingComponent, PaginationComponent,FormComponent]} + }) + .compileComponents(); })); epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', { 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 d009d560589..23dd42257a5 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 @@ -6,7 +6,7 @@ import { DynamicFormLayout, DynamicInputModel } from '@ng-dynamic-forms/core'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { combineLatest as observableCombineLatest, Observable, of as observableOf, Subscription } from 'rxjs'; import { debounceTime, finalize, map, switchMap, take } from 'rxjs/operators'; import { PaginatedList } from '../../../core/data/paginated-list.model'; @@ -38,10 +38,26 @@ import { Registration } from '../../../core/shared/registration.model'; import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service'; import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; +import { FormComponent } from '../../../shared/form/form.component'; +import { AsyncPipe, NgClass, NgIf } from '@angular/common'; +import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; +import { PaginationComponent } from '../../../shared/pagination/pagination.component'; +import { RouterLink } from '@angular/router'; @Component({ selector: 'ds-eperson-form', templateUrl: './eperson-form.component.html', + imports: [ + FormComponent, + NgIf, + AsyncPipe, + TranslateModule, + NgClass, + ThemedLoadingComponent, + PaginationComponent, + RouterLink + ], + standalone: true }) /** * A form used for creating and editing EPeople diff --git a/src/app/access-control/group-registry/group-form/group-form.component.spec.ts b/src/app/access-control/group-registry/group-form/group-form.component.spec.ts index f8c5f3cd870..5d1fd1e8701 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.spec.ts @@ -38,6 +38,11 @@ import { ValidateGroupExists } from './validators/group-exists.validator'; import { NoContent } from '../../../core/shared/NoContent.model'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { DSONameServiceMock } from '../../../shared/mocks/dso-name.service.mock'; +import { FormComponent } from '../../../shared/form/form.component'; +import { AlertComponent } from '../../../shared/alert/alert.component'; +import { ContextHelpDirective } from '../../../shared/context-help.directive'; +import { MembersListComponent } from './members-list/members-list.component'; +import { SubgroupsListComponent } from './subgroup-list/subgroups-list.component'; describe('GroupFormComponent', () => { let component: GroupFormComponent; @@ -191,16 +196,14 @@ describe('GroupFormComponent', () => { router = new RouterMock(); notificationService = new NotificationsServiceStub(); return TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [GroupFormComponent], - providers: [ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), GroupFormComponent], + providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: GroupDataService, useValue: groupsDataServiceStub }, @@ -215,14 +218,24 @@ describe('GroupFormComponent', () => { { provide: RemoteDataBuildService, useValue: {} }, { provide: HALEndpointService, useValue: {} }, { - provide: ActivatedRoute, - useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) } + provide: ActivatedRoute, + useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) } }, { provide: Router, useValue: router }, { provide: AuthorizationDataService, useValue: authorizationService }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(GroupFormComponent, { + remove: { imports: [ + FormComponent, + AlertComponent, + ContextHelpDirective, + MembersListComponent, + SubgroupsListComponent + ]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/group-registry/group-form/group-form.component.ts b/src/app/access-control/group-registry/group-form/group-form.component.ts index 693e283b4a0..e75f4744362 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.ts @@ -8,7 +8,7 @@ import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { ObservedValueOf, combineLatest as observableCombineLatest, @@ -48,10 +48,27 @@ import { Operation } from 'fast-json-patch'; import { ValidateGroupExists } from './validators/group-exists.validator'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { environment } from '../../../../environments/environment'; +import { FormComponent } from '../../../shared/form/form.component'; +import { AlertComponent } from '../../../shared/alert/alert.component'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ContextHelpDirective } from '../../../shared/context-help.directive'; +import { MembersListComponent } from './members-list/members-list.component'; +import { SubgroupsListComponent } from './subgroup-list/subgroups-list.component'; @Component({ selector: 'ds-group-form', - templateUrl: './group-form.component.html' + templateUrl: './group-form.component.html', + imports: [ + FormComponent, + AlertComponent, + NgIf, + AsyncPipe, + TranslateModule, + ContextHelpDirective, + MembersListComponent, + SubgroupsListComponent + ], + standalone: true }) /** * A form used for creating and editing groups diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts index 7c8db399bcd..06abf0c3f36 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts @@ -121,16 +121,14 @@ describe('MembersListComponent', () => { paginationService = new PaginationServiceStub(); return TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [MembersListComponent], - providers: [MembersListComponent, + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), MembersListComponent], + providers: [MembersListComponent, { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: GroupDataService, useValue: groupsDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, @@ -138,9 +136,9 @@ describe('MembersListComponent', () => { { provide: Router, useValue: new RouterMock() }, { provide: PaginationService, useValue: paginationService }, { provide: DSONameService, useValue: new DSONameServiceMock() }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts index b3e686c0123..d02e77bc3fc 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core'; -import { UntypedFormBuilder } from '@angular/forms'; -import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { Observable, of as observableOf, @@ -28,6 +28,9 @@ import { PaginationComponentOptions } from '../../../../shared/pagination/pagina import { EpersonDtoModel } from '../../../../core/eperson/models/eperson-dto.model'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; +import { ContextHelpDirective } from '../../../../shared/context-help.directive'; +import { PaginationComponent } from '../../../../shared/pagination/pagination.component'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; /** * Keys to keep track of specific subscriptions @@ -69,7 +72,19 @@ export interface EPersonListActionConfig { @Component({ selector: 'ds-members-list', - templateUrl: './members-list.component.html' + templateUrl: './members-list.component.html', + imports: [ + TranslateModule, + ContextHelpDirective, + ReactiveFormsModule, + PaginationComponent, + NgIf, + AsyncPipe, + RouterLink, + NgClass, + NgForOf + ], + standalone: true }) /** * The list of members in the edit group page diff --git a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts index ac5750dcaca..013aff47519 100644 --- a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts @@ -100,25 +100,23 @@ describe('SubgroupsListComponent', () => { paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [SubgroupsListComponent], - providers: [SubgroupsListComponent, + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), SubgroupsListComponent], + providers: [SubgroupsListComponent, { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: GroupDataService, useValue: groupsDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: FormBuilderService, useValue: builderService }, { provide: Router, useValue: routerStub }, { provide: PaginationService, useValue: paginationService }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts index 0cff730c628..f66fb1942ae 100644 --- a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts +++ b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnDestroy, OnInit } from '@angular/core'; -import { UntypedFormBuilder } from '@angular/forms'; -import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs'; import { map, mergeMap, switchMap, take } from 'rxjs/operators'; import { PaginatedList } from '../../../../core/data/paginated-list.model'; @@ -19,6 +19,9 @@ import { NoContent } from '../../../../core/shared/NoContent.model'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { followLink } from '../../../../shared/utils/follow-link-config.model'; import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; +import { AsyncPipe, NgForOf, NgIf } from "@angular/common"; +import { ContextHelpDirective } from "../../../../shared/context-help.directive"; +import { PaginationComponent } from "../../../../shared/pagination/pagination.component"; /** * Keys to keep track of specific subscriptions @@ -31,7 +34,18 @@ enum SubKey { @Component({ selector: 'ds-subgroups-list', - templateUrl: './subgroups-list.component.html' + templateUrl: './subgroups-list.component.html', + imports: [ + RouterLink, + AsyncPipe, + NgForOf, + ContextHelpDirective, + TranslateModule, + ReactiveFormsModule, + PaginationComponent, + NgIf + ], + standalone: true }) /** * The list of subgroups in the edit group page diff --git a/src/app/access-control/group-registry/groups-registry.component.spec.ts b/src/app/access-control/group-registry/groups-registry.component.spec.ts index 635ba727c26..6a6b9b4dabf 100644 --- a/src/app/access-control/group-registry/groups-registry.component.spec.ts +++ b/src/app/access-control/group-registry/groups-registry.component.spec.ts @@ -3,10 +3,10 @@ import { NO_ERRORS_SCHEMA } from '@angular/core'; import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from '@angular/core/testing'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule, By } from '@angular/platform-browser'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; -import { Observable, of as observableOf } from 'rxjs'; +import { Observable, of, of as observableOf } from 'rxjs'; import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service'; import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service'; import { buildPaginatedList, PaginatedList } from '../../core/data/paginated-list.model'; @@ -34,6 +34,9 @@ import { FeatureID } from '../../core/data/feature-authorization/feature-id'; import { NoContent } from '../../core/shared/NoContent.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { DSONameServiceMock, UNDEFINED_NAME } from '../../shared/mocks/dso-name.service.mock'; +import { ActivatedRouteStub } from '../../shared/testing/active-router.stub'; +import { provideMockStore } from '@ngrx/store/testing'; +import { ConfigurationDataService } from '../../core/data/configuration-data.service'; describe('GroupsRegistryComponent', () => { let component: GroupsRegistryComponent; @@ -42,6 +45,7 @@ describe('GroupsRegistryComponent', () => { let groupsDataServiceStub: any; let dsoDataServiceStub: any; let authorizationService: AuthorizationDataService; + let configurationDataService: jasmine.SpyObj; let mockGroups; let mockEPeople; @@ -159,33 +163,38 @@ describe('GroupsRegistryComponent', () => { } }; + configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { + findByPropertyName: of({ payload: { value: 'test' } }), + }); + authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']); setIsAuthorized(true, true); paginationService = new PaginationServiceStub(); return TestBed.configureTestingModule({ - imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, + imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }), - ], - declarations: [GroupsRegistryComponent], - providers: [GroupsRegistryComponent, + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), GroupsRegistryComponent], + providers: [GroupsRegistryComponent, { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: EPersonDataService, useValue: ePersonDataServiceStub }, { provide: GroupDataService, useValue: groupsDataServiceStub }, { provide: DSpaceObjectDataService, useValue: dsoDataServiceStub }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, + { provide: ConfigurationDataService, useValue: configurationDataService }, { provide: RouteService, useValue: routeServiceStub }, + { provide: ActivatedRoute, useValue: new ActivatedRouteStub() }, { provide: Router, useValue: new RouterMock() }, { provide: AuthorizationDataService, useValue: authorizationService }, { provide: PaginationService, useValue: paginationService }, - { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + { provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }, + provideMockStore(), + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/access-control/group-registry/groups-registry.component.ts b/src/app/access-control/group-registry/groups-registry.component.ts index ccfd155e393..1a483c52334 100644 --- a/src/app/access-control/group-registry/groups-registry.component.ts +++ b/src/app/access-control/group-registry/groups-registry.component.ts @@ -1,7 +1,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { UntypedFormBuilder } from '@angular/forms'; -import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { ReactiveFormsModule, UntypedFormBuilder } from '@angular/forms'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { BehaviorSubject, combineLatest as observableCombineLatest, @@ -38,10 +38,28 @@ import { NoContent } from '../../core/shared/NoContent.model'; import { PaginationService } from '../../core/pagination/pagination.service'; import { followLink } from '../../shared/utils/follow-link-config.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { AsyncPipe, NgForOf, NgIf, NgSwitch, NgSwitchCase } from '@angular/common'; +import { PaginationComponent } from '../../shared/pagination/pagination.component'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'ds-groups-registry', templateUrl: './groups-registry.component.html', + imports: [ + ThemedLoadingComponent, + TranslateModule, + RouterLink, + ReactiveFormsModule, + AsyncPipe, + NgIf, + PaginationComponent, + NgSwitch, + NgSwitchCase, + NgbTooltipModule, + NgForOf + ], + standalone: true }) /** * A component used for managing all existing groups within the repository. diff --git a/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts b/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts index 358bd0d01e7..bbbfa106ab8 100644 --- a/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts +++ b/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.spec.ts @@ -9,10 +9,9 @@ describe('AdminCurationTasksComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], - declarations: [AdminCurationTasksComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + imports: [TranslateModule.forRoot(), AdminCurationTasksComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.ts b/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.ts index 9a80f341b91..aec23b7641d 100644 --- a/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.ts +++ b/src/app/admin/admin-curation-tasks/admin-curation-tasks.component.ts @@ -1,4 +1,6 @@ import { Component } from '@angular/core'; +import { CurationFormComponent } from "../../curation-form/curation-form.component"; +import { TranslateModule } from "@ngx-translate/core"; /** * Component responsible for rendering the system wide Curation Task UI @@ -6,6 +8,11 @@ import { Component } from '@angular/core'; @Component({ selector: 'ds-admin-curation-task', templateUrl: './admin-curation-tasks.component.html', + imports: [ + CurationFormComponent, + TranslateModule + ], + standalone: true }) export class AdminCurationTasksComponent { diff --git a/src/app/admin/admin-import-batch-page/batch-import-page.component.spec.ts b/src/app/admin/admin-import-batch-page/batch-import-page.component.spec.ts index 341aefb7044..8fbb02bbbe7 100644 --- a/src/app/admin/admin-import-batch-page/batch-import-page.component.spec.ts +++ b/src/app/admin/admin-import-batch-page/batch-import-page.component.spec.ts @@ -45,20 +45,20 @@ describe('BatchImportPageComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ FormsModule, TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [BatchImportPageComponent, FileValueAccessorDirective, FileValidator], - providers: [ + RouterTestingModule.withRoutes([]), + BatchImportPageComponent, FileValueAccessorDirective, FileValidator + ], + providers: [ { provide: NotificationsService, useValue: notificationService }, { provide: ScriptDataService, useValue: scriptService }, { provide: Router, useValue: router }, { provide: Location, useValue: locationStub }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-import-batch-page/batch-import-page.component.ts b/src/app/admin/admin-import-batch-page/batch-import-page.component.ts index 673e1f23f54..664fdb20e25 100644 --- a/src/app/admin/admin-import-batch-page/batch-import-page.component.ts +++ b/src/app/admin/admin-import-batch-page/batch-import-page.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; -import { Location } from '@angular/common'; -import { TranslateService } from '@ngx-translate/core'; +import { Location, NgIf } from '@angular/common'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { BATCH_IMPORT_SCRIPT_NAME, ScriptDataService } from '../../core/data/processes/script-data.service'; import { Router } from '@angular/router'; @@ -17,10 +17,23 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { take } from 'rxjs/operators'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { FormsModule } from "@angular/forms"; +import { UiSwitchModule } from "ngx-ui-switch"; +import { + FileDropzoneNoUploaderComponent +} from "../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component"; @Component({ selector: 'ds-batch-import-page', - templateUrl: './batch-import-page.component.html' + templateUrl: './batch-import-page.component.html', + imports: [ + NgIf, + TranslateModule, + FormsModule, + UiSwitchModule, + FileDropzoneNoUploaderComponent + ], + standalone: true }) export class BatchImportPageComponent { /** diff --git a/src/app/admin/admin-import-metadata-page/metadata-import-page.component.spec.ts b/src/app/admin/admin-import-metadata-page/metadata-import-page.component.spec.ts index 814757ec713..f2b8b777955 100644 --- a/src/app/admin/admin-import-metadata-page/metadata-import-page.component.spec.ts +++ b/src/app/admin/admin-import-metadata-page/metadata-import-page.component.spec.ts @@ -42,20 +42,20 @@ describe('MetadataImportPageComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ FormsModule, TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [MetadataImportPageComponent, FileValueAccessorDirective, FileValidator], - providers: [ + RouterTestingModule.withRoutes([]), + MetadataImportPageComponent, FileValueAccessorDirective, FileValidator + ], + providers: [ { provide: NotificationsService, useValue: notificationService }, { provide: ScriptDataService, useValue: scriptService }, { provide: Router, useValue: router }, { provide: Location, useValue: locationStub }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-import-metadata-page/metadata-import-page.component.ts b/src/app/admin/admin-import-metadata-page/metadata-import-page.component.ts index 4236d152dcb..dd40326ac3d 100644 --- a/src/app/admin/admin-import-metadata-page/metadata-import-page.component.ts +++ b/src/app/admin/admin-import-metadata-page/metadata-import-page.component.ts @@ -1,7 +1,7 @@ import { Location } from '@angular/common'; import { Component } from '@angular/core'; import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { METADATA_IMPORT_SCRIPT_NAME, ScriptDataService } from '../../core/data/processes/script-data.service'; import { ProcessParameter } from '../../process-page/processes/process-parameter.model'; import { isNotEmpty } from '../../shared/empty.util'; @@ -10,10 +10,20 @@ import { RemoteData } from '../../core/data/remote-data'; import { Process } from '../../process-page/processes/process.model'; import { getFirstCompletedRemoteData } from '../../core/shared/operators'; import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths'; +import { FormsModule } from '@angular/forms'; +import { + FileDropzoneNoUploaderComponent +} from '../../shared/upload/file-dropzone-no-uploader/file-dropzone-no-uploader.component'; @Component({ selector: 'ds-metadata-import-page', - templateUrl: './metadata-import-page.component.html' + templateUrl: './metadata-import-page.component.html', + imports: [ + TranslateModule, + FormsModule, + FileDropzoneNoUploaderComponent + ], + standalone: true }) /** diff --git a/src/app/admin/admin-registries/admin-registries.module.ts b/src/app/admin/admin-registries/admin-registries.module.ts index 65f7b614197..b438838aa73 100644 --- a/src/app/admin/admin-registries/admin-registries.module.ts +++ b/src/app/admin/admin-registries/admin-registries.module.ts @@ -11,20 +11,18 @@ import { BitstreamFormatsModule } from './bitstream-formats/bitstream-formats.mo import { FormModule } from '../../shared/form/form.module'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - RouterModule, - BitstreamFormatsModule, - AdminRegistriesRoutingModule, - FormModule - ], - declarations: [ - MetadataRegistryComponent, - MetadataSchemaComponent, - MetadataSchemaFormComponent, - MetadataFieldFormComponent - ] + imports: [ + CommonModule, + SharedModule, + RouterModule, + BitstreamFormatsModule, + AdminRegistriesRoutingModule, + FormModule, + MetadataRegistryComponent, + MetadataSchemaComponent, + MetadataSchemaFormComponent, + MetadataFieldFormComponent + ] }) export class AdminRegistriesModule { diff --git a/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts b/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts index 6787350d865..2771455decc 100644 --- a/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts +++ b/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.spec.ts @@ -42,15 +42,14 @@ describe('AddBitstreamFormatComponent', () => { }); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [AddBitstreamFormatComponent], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, AddBitstreamFormatComponent], + providers: [ { provide: Router, useValue: router }, { provide: NotificationsService, useValue: notificationService }, { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); }; const initBeforeEach = () => { @@ -82,15 +81,14 @@ describe('AddBitstreamFormatComponent', () => { }); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [AddBitstreamFormatComponent], - providers: [ - { provide: Router, useValue: router }, - { provide: NotificationsService, useValue: notificationService }, - { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, AddBitstreamFormatComponent], + providers: [ + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); })); beforeEach(initBeforeEach); it('should send the updated form to the service, show a notification and navigate to ', () => { diff --git a/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts b/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts index 132343dcf06..15638486504 100644 --- a/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts +++ b/src/app/admin/admin-registries/bitstream-formats/add-bitstream-format/add-bitstream-format.component.ts @@ -3,10 +3,11 @@ import { Component } from '@angular/core'; import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; import { RemoteData } from '../../../../core/data/remote-data'; import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; +import { FormatFormComponent } from '../format-form/format-form.component'; /** * This component renders the page to create a new bitstream format. @@ -14,6 +15,11 @@ import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; @Component({ selector: 'ds-add-bitstream-format', templateUrl: './add-bitstream-format.component.html', + imports: [ + FormatFormComponent, + TranslateModule + ], + standalone: true }) export class AddBitstreamFormatComponent { diff --git a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts index 8a44240b7e2..f74ff68dabb 100644 --- a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts +++ b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.spec.ts @@ -1,6 +1,6 @@ import { BitstreamFormatsComponent } from './bitstream-formats.component'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; -import { of as observableOf } from 'rxjs'; +import { of, of as observableOf } from 'rxjs'; import { CommonModule } from '@angular/common'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -18,14 +18,18 @@ import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-form import { cold, getTestScheduler, hot } from 'jasmine-marbles'; import { TestScheduler } from 'rxjs/testing'; import { + createFailedRemoteDataObject$, createNoContentRemoteDataObject$, createSuccessfulRemoteDataObject, - createSuccessfulRemoteDataObject$, - createFailedRemoteDataObject$ + createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { createPaginatedList } from '../../../shared/testing/utils.test'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub'; +import { GroupDataService } from '../../../core/eperson/group-data.service'; +import { ConfigurationDataService } from '../../../core/data/configuration-data.service'; +import { Component, NO_ERRORS_SCHEMA } from '@angular/core'; +import { provideMockStore } from '@ngrx/store/testing'; describe('BitstreamFormatsComponent', () => { let comp: BitstreamFormatsComponent; @@ -91,7 +95,7 @@ describe('BitstreamFormatsComponent', () => { bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { findAll: observableOf(mockFormatsRD), find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), - getSelectedBitstreamFormats: hot('a', { a: mockFormatsList }), + getSelectedBitstreamFormats: hot('a', {a: mockFormatsList}), selectBitstreamFormat: {}, deselectBitstreamFormat: {}, deselectAllBitstreamFormats: {}, @@ -99,17 +103,31 @@ describe('BitstreamFormatsComponent', () => { clearBitStreamFormatRequests: observableOf('cleared') }); + const groupDataService = jasmine.createSpyObj('groupsDataService', { + findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), + getGroupRegistryRouterLink: '', + getUUIDFromString: '', + }); + + + const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { + findByPropertyName: of({payload: {value: 'test'}}), + }); + paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], providers: [ - { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, - { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, - { provide: NotificationsService, useValue: notificationsServiceStub }, - { provide: PaginationService, useValue: paginationService } - ] + provideMockStore(), + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub}, + {provide: PaginationService, useValue: paginationService}, + {provide: GroupDataService, useValue: groupDataService}, + {provide: ConfigurationDataService, useValue: configurationDataService} + ], + schemas: [NO_ERRORS_SCHEMA] }).compileComponents(); }; @@ -212,33 +230,54 @@ describe('BitstreamFormatsComponent', () => { describe('deleteFormats success', () => { beforeEach(waitForAsync(() => { - notificationsServiceStub = new NotificationsServiceStub(); - - scheduler = getTestScheduler(); - - bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { - findAll: observableOf(mockFormatsRD), - find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), - getSelectedBitstreamFormats: observableOf(mockFormatsList), - selectBitstreamFormat: {}, - deselectBitstreamFormat: {}, - deselectAllBitstreamFormats: {}, - delete: createNoContentRemoteDataObject$(), - clearBitStreamFormatRequests: observableOf('cleared') - }); + notificationsServiceStub = new NotificationsServiceStub(); + + scheduler = getTestScheduler(); + + bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { + findAll: observableOf(mockFormatsRD), + find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), + getSelectedBitstreamFormats: observableOf(mockFormatsList), + selectBitstreamFormat: {}, + deselectBitstreamFormat: {}, + deselectAllBitstreamFormats: {}, + delete: createNoContentRemoteDataObject$(), + clearBitStreamFormatRequests: observableOf('cleared') + }); + + const groupDataService = jasmine.createSpyObj('groupsDataService', { + findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), + getGroupRegistryRouterLink: '', + getUUIDFromString: '', + }); + + const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { + findByPropertyName: of({payload: {value: 'test'}}), + }); paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], - providers: [ - { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, - { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, - { provide: NotificationsService, useValue: notificationsServiceStub }, - { provide: PaginationService, useValue: paginationService } - ] - }).compileComponents(); + imports: [ + CommonModule, + RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, + BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], + providers: [ + provideMockStore(), + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub}, + {provide: PaginationService, useValue: paginationService}, + {provide: GroupDataService, useValue: groupDataService}, + {provide: ConfigurationDataService, useValue: configurationDataService} + ], + schemas: [NO_ERRORS_SCHEMA] + }) + .overrideComponent(BitstreamFormatsComponent, { + remove: {imports: [PaginationComponent]}, + add: {imports: [TestPaginationComponent]} + }) + .compileComponents(); } )); @@ -261,33 +300,52 @@ describe('BitstreamFormatsComponent', () => { describe('deleteFormats error', () => { beforeEach(waitForAsync(() => { - notificationsServiceStub = new NotificationsServiceStub(); - - scheduler = getTestScheduler(); - - bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { - findAll: observableOf(mockFormatsRD), - find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), - getSelectedBitstreamFormats: observableOf(mockFormatsList), - selectBitstreamFormat: {}, - deselectBitstreamFormat: {}, - deselectAllBitstreamFormats: {}, - delete: createFailedRemoteDataObject$(), - clearBitStreamFormatRequests: observableOf('cleared') - }); + notificationsServiceStub = new NotificationsServiceStub(); + + scheduler = getTestScheduler(); + + bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', { + findAll: observableOf(mockFormatsRD), + find: createSuccessfulRemoteDataObject$(mockFormatsList[0]), + getSelectedBitstreamFormats: observableOf(mockFormatsList), + selectBitstreamFormat: {}, + deselectBitstreamFormat: {}, + deselectAllBitstreamFormats: {}, + delete: createFailedRemoteDataObject$(), + clearBitStreamFormatRequests: observableOf('cleared') + }); + + const groupDataService = jasmine.createSpyObj('groupsDataService', { + findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), + getGroupRegistryRouterLink: '', + getUUIDFromString: '', + }); + + const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', { + findByPropertyName: of({payload: {value: 'test'}}), + }); paginationService = new PaginationServiceStub(); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], - providers: [ - { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, - { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, - { provide: NotificationsService, useValue: notificationsServiceStub }, - { provide: PaginationService, useValue: paginationService } - ] - }).compileComponents(); + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe], + providers: [ + provideMockStore(), + {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, + {provide: HostWindowService, useValue: new HostWindowServiceStub(0)}, + {provide: NotificationsService, useValue: notificationsServiceStub}, + {provide: PaginationService, useValue: paginationService}, + {provide: PaginationService, useValue: paginationService}, + {provide: GroupDataService, useValue: groupDataService}, + {provide: ConfigurationDataService, useValue: configurationDataService} + ], + schemas: [NO_ERRORS_SCHEMA] + }) + .overrideComponent(BitstreamFormatsComponent, { + remove: {imports: [PaginationComponent]}, + add: {imports: [TestPaginationComponent]} + }) + .compileComponents(); } )); @@ -307,3 +365,12 @@ describe('BitstreamFormatsComponent', () => { }); }); }); + +@Component({ + exportAs: 'paginationComponent', + selector: 'ds-pagination', + template: ``, + standalone: true, +}) +export class TestPaginationComponent { +} diff --git a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.ts b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.ts index 162bf2bdb28..1727834be4d 100644 --- a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.ts +++ b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.component.ts @@ -7,19 +7,30 @@ import { BitstreamFormat } from '../../../core/shared/bitstream-format.model'; import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service'; import { map, mergeMap, switchMap, take, toArray } from 'rxjs/operators'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; -import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { NoContent } from '../../../core/shared/NoContent.model'; import { PaginationService } from '../../../core/pagination/pagination.service'; import { FindListOptions } from '../../../core/data/find-list-options.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; +import { AsyncPipe, NgForOf, NgIf } from "@angular/common"; +import { PaginationComponent } from "../../../shared/pagination/pagination.component"; /** * This component renders a list of bitstream formats */ @Component({ selector: 'ds-bitstream-formats', - templateUrl: './bitstream-formats.component.html' + templateUrl: './bitstream-formats.component.html', + imports: [ + NgIf, + AsyncPipe, + RouterLink, + TranslateModule, + PaginationComponent, + NgForOf + ], + standalone: true }) export class BitstreamFormatsComponent implements OnInit, OnDestroy { diff --git a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.module.ts b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.module.ts index afbe35a1f6b..fe4d453578a 100644 --- a/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.module.ts +++ b/src/app/admin/admin-registries/bitstream-formats/bitstream-formats.module.ts @@ -10,19 +10,17 @@ import { AddBitstreamFormatComponent } from './add-bitstream-format/add-bitstrea import { FormModule } from '../../../shared/form/form.module'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - RouterModule, - BitstreamFormatsRoutingModule, - FormModule - ], - declarations: [ - BitstreamFormatsComponent, - EditBitstreamFormatComponent, - AddBitstreamFormatComponent, - FormatFormComponent - ] + imports: [ + CommonModule, + SharedModule, + RouterModule, + BitstreamFormatsRoutingModule, + FormModule, + BitstreamFormatsComponent, + EditBitstreamFormatComponent, + AddBitstreamFormatComponent, + FormatFormComponent + ] }) export class BitstreamFormatsModule { diff --git a/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts b/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts index b09c50c70ad..bd60c6f19c3 100644 --- a/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts +++ b/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.spec.ts @@ -52,16 +52,15 @@ describe('EditBitstreamFormatComponent', () => { }); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [EditBitstreamFormatComponent], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, EditBitstreamFormatComponent], + providers: [ { provide: ActivatedRoute, useValue: routeStub }, { provide: Router, useValue: router }, { provide: NotificationsService, useValue: notificationService }, { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); }; const initBeforeEach = () => { @@ -103,16 +102,15 @@ describe('EditBitstreamFormatComponent', () => { }); TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [EditBitstreamFormatComponent], - providers: [ - { provide: ActivatedRoute, useValue: routeStub }, - { provide: Router, useValue: router }, - { provide: NotificationsService, useValue: notificationService }, - { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, EditBitstreamFormatComponent], + providers: [ + { provide: ActivatedRoute, useValue: routeStub }, + { provide: Router, useValue: router }, + { provide: NotificationsService, useValue: notificationService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService }, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); })); beforeEach(initBeforeEach); it('should send the updated form to the service, show a notification and navigate to ', () => { diff --git a/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts b/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts index 14b109fe268..cfd7550c7b6 100644 --- a/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts +++ b/src/app/admin/admin-registries/bitstream-formats/edit-bitstream-format/edit-bitstream-format.component.ts @@ -6,9 +6,11 @@ import { RemoteData } from '../../../../core/data/remote-data'; import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service'; import { NotificationsService } from '../../../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; +import { FormatFormComponent } from '../format-form/format-form.component'; +import { AsyncPipe } from '@angular/common'; /** * This component renders the edit page of a bitstream format. @@ -17,6 +19,12 @@ import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; @Component({ selector: 'ds-edit-bitstream-format', templateUrl: './edit-bitstream-format.component.html', + imports: [ + FormatFormComponent, + TranslateModule, + AsyncPipe + ], + standalone: true }) export class EditBitstreamFormatComponent implements OnInit { diff --git a/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts b/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts index ca3fbcbc99a..cd5f338f813 100644 --- a/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts +++ b/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.spec.ts @@ -40,13 +40,12 @@ describe('FormatFormComponent', () => { const initAsync = () => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), ReactiveFormsModule, FormsModule, TranslateModule.forRoot(), NgbModule], - declarations: [FormatFormComponent], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), ReactiveFormsModule, FormsModule, TranslateModule.forRoot(), NgbModule, FormatFormComponent], + providers: [ { provide: Router, useValue: router }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); }; const initBeforeEach = () => { diff --git a/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.ts b/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.ts index 142f6fb83d5..168ab6ebcde 100644 --- a/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.ts +++ b/src/app/admin/admin-registries/bitstream-formats/format-form/format-form.component.ts @@ -16,13 +16,20 @@ import { hasValue, isEmpty } from '../../../../shared/empty.util'; import { TranslateService } from '@ngx-translate/core'; import { getBitstreamFormatsModuleRoute } from '../../admin-registries-routing-paths'; import { environment } from '../../../../../environments/environment'; +import { FormComponent } from '../../../../shared/form/form.component'; +import { NgIf } from '@angular/common'; /** * The component responsible for rendering the form to create/edit a bitstream format */ @Component({ selector: 'ds-bitstream-format-form', - templateUrl: './format-form.component.html' + templateUrl: './format-form.component.html', + imports: [ + FormComponent, + NgIf + ], + standalone: true }) export class FormatFormComponent implements OnInit { diff --git a/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts b/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts index 944288a7a51..70356e0a91f 100644 --- a/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts +++ b/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.spec.ts @@ -69,16 +69,15 @@ describe('MetadataRegistryComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [MetadataRegistryComponent, PaginationComponent, EnumKeysPipe], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, MetadataRegistryComponent, PaginationComponent, EnumKeysPipe], + providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: PaginationService, useValue: paginationService }, { provide: NotificationsService, useValue: new NotificationsServiceStub() } - ], - schemas: [NO_ERRORS_SCHEMA] - }).overrideComponent(MetadataRegistryComponent, { + ], + schemas: [NO_ERRORS_SCHEMA] +}).overrideComponent(MetadataRegistryComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); diff --git a/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.ts b/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.ts index 857034604e9..ae3c1f9ffa4 100644 --- a/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.ts +++ b/src/app/admin/admin-registries/metadata-registry/metadata-registry.component.ts @@ -7,18 +7,32 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio import { filter, map, switchMap, take } from 'rxjs/operators'; import { hasValue } from '../../../shared/empty.util'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; -import { Router } from '@angular/router'; -import { TranslateService } from '@ngx-translate/core'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { MetadataSchema } from '../../../core/metadata/metadata-schema.model'; import { toFindListOptions } from '../../../shared/pagination/pagination.utils'; import { NoContent } from '../../../core/shared/NoContent.model'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { PaginationService } from '../../../core/pagination/pagination.service'; +import { MetadataSchemaFormComponent } from './metadata-schema-form/metadata-schema-form.component'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; +import { PaginationComponent } from '../../../shared/pagination/pagination.component'; @Component({ selector: 'ds-metadata-registry', templateUrl: './metadata-registry.component.html', - styleUrls: ['./metadata-registry.component.scss'] + styleUrls: ['./metadata-registry.component.scss'], + imports: [ + MetadataSchemaFormComponent, + TranslateModule, + AsyncPipe, + PaginationComponent, + NgIf, + NgForOf, + NgClass, + RouterLink + ], + standalone: true }) /** * A component used for managing all existing metadata schemas within the repository. diff --git a/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts b/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts index b758767ddbe..3e999296d31 100644 --- a/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts +++ b/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.spec.ts @@ -38,14 +38,13 @@ describe('MetadataSchemaFormComponent', () => { beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [MetadataSchemaFormComponent, EnumKeysPipe], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, MetadataSchemaFormComponent, EnumKeysPipe], + providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: FormBuilderService, useValue: formBuilderServiceStub } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.ts b/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.ts index 24bf4306619..19b2cb5734f 100644 --- a/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.ts +++ b/src/app/admin/admin-registries/metadata-registry/metadata-schema-form/metadata-schema-form.component.ts @@ -9,13 +9,22 @@ import { UntypedFormGroup } from '@angular/forms'; import { RegistryService } from '../../../../core/registry/registry.service'; import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service'; import { switchMap, take, tap } from 'rxjs/operators'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { Observable, combineLatest } from 'rxjs'; import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { FormComponent } from '../../../../shared/form/form.component'; @Component({ selector: 'ds-metadata-schema-form', - templateUrl: './metadata-schema-form.component.html' + templateUrl: './metadata-schema-form.component.html', + imports: [ + NgIf, + AsyncPipe, + TranslateModule, + FormComponent + ], + standalone: true }) /** * A form used for creating and editing metadata schemas diff --git a/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts b/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts index ad7b54945dd..d6f99701b0d 100644 --- a/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts +++ b/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.spec.ts @@ -12,6 +12,7 @@ import { FormBuilderService } from '../../../../shared/form/builder/form-builder import { NO_ERRORS_SCHEMA } from '@angular/core'; import { MetadataField } from '../../../../core/metadata/metadata-field.model'; import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'; +import { FormComponent } from '../../../../shared/form/form.component'; describe('MetadataFieldFormComponent', () => { let component: MetadataFieldFormComponent; @@ -49,14 +50,17 @@ describe('MetadataFieldFormComponent', () => { beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [MetadataFieldFormComponent, EnumKeysPipe], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, MetadataFieldFormComponent, EnumKeysPipe], + providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: FormBuilderService, useValue: formBuilderServiceStub } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(MetadataFieldFormComponent, { + remove: { imports: [FormComponent]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.ts b/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.ts index 773e0600fbf..7be58ff02f9 100644 --- a/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.ts +++ b/src/app/admin/admin-registries/metadata-schema/metadata-field-form/metadata-field-form.component.ts @@ -9,14 +9,23 @@ import { UntypedFormGroup } from '@angular/forms'; import { RegistryService } from '../../../../core/registry/registry.service'; import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service'; import { take } from 'rxjs/operators'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { combineLatest } from 'rxjs'; import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'; import { MetadataField } from '../../../../core/metadata/metadata-field.model'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { FormComponent } from '../../../../shared/form/form.component'; @Component({ selector: 'ds-metadata-field-form', - templateUrl: './metadata-field-form.component.html' + templateUrl: './metadata-field-form.component.html', + imports: [ + NgIf, + FormComponent, + TranslateModule, + AsyncPipe + ], + standalone: true }) /** * A form used for creating and editing metadata fields diff --git a/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts b/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts index 2b660a63634..8fde011dda6 100644 --- a/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts +++ b/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.spec.ts @@ -131,18 +131,17 @@ describe('MetadataSchemaComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [MetadataSchemaComponent, PaginationComponent, EnumKeysPipe, VarDirective], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, MetadataSchemaComponent, PaginationComponent, EnumKeysPipe, VarDirective], + providers: [ { provide: RegistryService, useValue: registryServiceStub }, { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: Router, useValue: new RouterStub() }, { provide: PaginationService, useValue: paginationService }, { provide: NotificationsService, useValue: new NotificationsServiceStub() } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.ts b/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.ts index d0827e6e4d5..6816b5c16d4 100644 --- a/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.ts +++ b/src/app/admin/admin-registries/metadata-schema/metadata-schema.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { RegistryService } from '../../../core/registry/registry.service'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { BehaviorSubject, combineLatest as observableCombineLatest, @@ -15,18 +15,34 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio import { map, switchMap, take } from 'rxjs/operators'; import { hasValue } from '../../../shared/empty.util'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { MetadataField } from '../../../core/metadata/metadata-field.model'; import { MetadataSchema } from '../../../core/metadata/metadata-schema.model'; import { getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators'; import { toFindListOptions } from '../../../shared/pagination/pagination.utils'; import { NoContent } from '../../../core/shared/NoContent.model'; import { PaginationService } from '../../../core/pagination/pagination.service'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; +import { VarDirective } from '../../../shared/utils/var.directive'; +import { MetadataFieldFormComponent } from './metadata-field-form/metadata-field-form.component'; +import { PaginationComponent } from '../../../shared/pagination/pagination.component'; @Component({ selector: 'ds-metadata-schema', templateUrl: './metadata-schema.component.html', - styleUrls: ['./metadata-schema.component.scss'] + styleUrls: ['./metadata-schema.component.scss'], + imports: [ + AsyncPipe, + VarDirective, + MetadataFieldFormComponent, + TranslateModule, + PaginationComponent, + NgIf, + NgForOf, + NgClass, + RouterLink + ], + standalone: true }) /** * A component used for managing all existing metadata fields within the current metadata schema. diff --git a/src/app/admin/admin-search-page/admin-search-page.component.spec.ts b/src/app/admin/admin-search-page/admin-search-page.component.spec.ts index 7be486d7da4..9ca5c874b45 100644 --- a/src/app/admin/admin-search-page/admin-search-page.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-page.component.spec.ts @@ -9,9 +9,9 @@ describe('AdminSearchPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [AdminSearchPageComponent], - schemas: [NO_ERRORS_SCHEMA] - }) + imports: [AdminSearchPageComponent], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-page.component.ts b/src/app/admin/admin-search-page/admin-search-page.component.ts index c9c6b84245d..f2a4f9c427c 100644 --- a/src/app/admin/admin-search-page/admin-search-page.component.ts +++ b/src/app/admin/admin-search-page/admin-search-page.component.ts @@ -1,10 +1,13 @@ import { Component } from '@angular/core'; import { Context } from '../../core/shared/context.model'; +import { ConfigurationSearchPageComponent } from '../../search-page/configuration-search-page.component'; @Component({ - selector: 'ds-admin-search-page', - templateUrl: './admin-search-page.component.html', - styleUrls: ['./admin-search-page.component.scss'] + selector: 'ds-admin-search-page', + templateUrl: './admin-search-page.component.html', + styleUrls: ['./admin-search-page.component.scss'], + standalone: true, + imports: [ConfigurationSearchPageComponent] }) /** diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts index 1ea27b36b69..2ea87c3e065 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.spec.ts @@ -43,14 +43,14 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ NoopAnimationsModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), - SharedModule - ], - declarations: [CollectionAdminSearchResultGridElementComponent], - providers: [ + SharedModule, + CollectionAdminSearchResultGridElementComponent + ], + providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, { provide: LinkService, useValue: linkService }, @@ -58,8 +58,8 @@ describe('CollectionAdminSearchResultGridElementComponent', () => { { provide: FileService, useClass: FileServiceStub }, { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub }, { provide: ThemeService, useValue: getMockThemeService() }, - ] - }) + ] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts index 1412090e0fe..dae11f55d06 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/collection-search-result/collection-admin-search-result-grid-element.component.ts @@ -6,12 +6,16 @@ import { CollectionSearchResult } from '../../../../../shared/object-collection/ import { Collection } from '../../../../../core/shared/collection.model'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths'; +import { RouterLink } from '@angular/router'; +import { CollectionSearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/collection-search-result/collection-search-result-grid-element.component'; @listableObjectComponent(CollectionSearchResult, ViewMode.GridElement, Context.AdminSearch) @Component({ - selector: 'ds-collection-admin-search-result-list-element', - styleUrls: ['./collection-admin-search-result-grid-element.component.scss'], - templateUrl: './collection-admin-search-result-grid-element.component.html' + selector: 'ds-collection-admin-search-result-list-element', + styleUrls: ['./collection-admin-search-result-grid-element.component.scss'], + templateUrl: './collection-admin-search-result-grid-element.component.html', + standalone: true, + imports: [CollectionSearchResultGridElementComponent, RouterLink] }) /** * The component for displaying a list element for a collection search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts index 996366e20a4..33de48884cf 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.spec.ts @@ -45,14 +45,14 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ NoopAnimationsModule, TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), - SharedModule - ], - declarations: [CommunityAdminSearchResultGridElementComponent], - providers: [ + SharedModule, + CommunityAdminSearchResultGridElementComponent + ], + providers: [ { provide: TruncatableService, useValue: mockTruncatableService }, { provide: BitstreamDataService, useValue: {} }, { provide: LinkService, useValue: linkService }, @@ -60,9 +60,9 @@ describe('CommunityAdminSearchResultGridElementComponent', () => { { provide: FileService, useClass: FileServiceStub }, { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub }, { provide: ThemeService, useValue: getMockThemeService() }, - ], - schemas: [NO_ERRORS_SCHEMA] - }) + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts index b0d603338b8..db1eb41414f 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/community-search-result/community-admin-search-result-grid-element.component.ts @@ -6,12 +6,16 @@ import { CommunitySearchResult } from '../../../../../shared/object-collection/s import { Community } from '../../../../../core/shared/community.model'; import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component'; import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths'; +import { RouterLink } from '@angular/router'; +import { CommunitySearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/community-search-result/community-search-result-grid-element.component'; @listableObjectComponent(CommunitySearchResult, ViewMode.GridElement, Context.AdminSearch) @Component({ - selector: 'ds-community-admin-search-result-grid-element', - styleUrls: ['./community-admin-search-result-grid-element.component.scss'], - templateUrl: './community-admin-search-result-grid-element.component.html' + selector: 'ds-community-admin-search-result-grid-element', + styleUrls: ['./community-admin-search-result-grid-element.component.scss'], + templateUrl: './community-admin-search-result-grid-element.component.html', + standalone: true, + imports: [CommunitySearchResultGridElementComponent, RouterLink] }) /** * The component for displaying a list element for a community search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts index ee3de421317..6ef58321196 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.spec.ts @@ -58,24 +58,24 @@ describe('ItemAdminSearchResultGridElementComponent', () => { init(); TestBed.configureTestingModule( { - declarations: [ItemAdminSearchResultGridElementComponent], - imports: [ - NoopAnimationsModule, - TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]), - SharedModule - ], - providers: [ - { provide: TruncatableService, useValue: mockTruncatableService }, - { provide: BitstreamDataService, useValue: mockBitstreamDataService }, - { provide: ThemeService, useValue: mockThemeService }, - { provide: AccessStatusDataService, useValue: mockAccessStatusDataService }, - { provide: AuthService, useClass: AuthServiceStub }, - { provide: FileService, useClass: FileServiceStub }, - { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub }, - ], - schemas: [NO_ERRORS_SCHEMA] - }) + imports: [ + NoopAnimationsModule, + TranslateModule.forRoot(), + RouterTestingModule.withRoutes([]), + SharedModule, + ItemAdminSearchResultGridElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, + { provide: BitstreamDataService, useValue: mockBitstreamDataService }, + { provide: ThemeService, useValue: mockThemeService }, + { provide: AccessStatusDataService, useValue: mockAccessStatusDataService }, + { provide: AuthService, useClass: AuthServiceStub }, + { provide: FileService, useClass: FileServiceStub }, + { provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub }, + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts index dab6694f368..ab857023d06 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-grid-element/item-search-result/item-admin-search-result-grid-element.component.ts @@ -14,12 +14,15 @@ import { GenericConstructor } from '../../../../../core/shared/generic-construct import { ListableObjectDirective } from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive'; import { ThemeService } from '../../../../../shared/theme-support/theme.service'; import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; +import { ItemAdminSearchResultActionsComponent } from '../../item-admin-search-result-actions.component'; @listableObjectComponent(ItemSearchResult, ViewMode.GridElement, Context.AdminSearch) @Component({ - selector: 'ds-item-admin-search-result-grid-element', - styleUrls: ['./item-admin-search-result-grid-element.component.scss'], - templateUrl: './item-admin-search-result-grid-element.component.html' + selector: 'ds-item-admin-search-result-grid-element', + styleUrls: ['./item-admin-search-result-grid-element.component.scss'], + templateUrl: './item-admin-search-result-grid-element.component.html', + standalone: true, + imports: [ListableObjectDirective, ItemAdminSearchResultActionsComponent] }) /** * The component for displaying a list element for an item search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts index 8937847ff53..482c26643c0 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.spec.ts @@ -15,6 +15,12 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock'; import { APP_CONFIG } from '../../../../../../config/app-config.interface'; import { environment } from '../../../../../../environments/environment'; +import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service'; +import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock'; +import { ThemeService } from '../../../../../shared/theme-support/theme.service'; +import { + CollectionSearchResultListElementComponent +} from '../../../../../shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component'; describe('CollectionAdminSearchResultListElementComponent', () => { let component: CollectionAdminSearchResultListElementComponent; @@ -32,16 +38,22 @@ describe('CollectionAdminSearchResultListElementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [CollectionAdminSearchResultListElementComponent], - providers: [{ provide: TruncatableService, useValue: {} }, + RouterTestingModule.withRoutes([]), + CollectionAdminSearchResultListElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, { provide: DSONameService, useClass: DSONameServiceMock }, - { provide: APP_CONFIG, useValue: environment }], - schemas: [NO_ERRORS_SCHEMA] - }) + { provide: APP_CONFIG, useValue: environment }, + { provide: ThemeService, useValue: getMockThemeService() } + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(CollectionAdminSearchResultListElementComponent, { + remove: { imports: [CollectionSearchResultListElementComponent]} + }) .compileComponents(); })); @@ -52,7 +64,7 @@ describe('CollectionAdminSearchResultListElementComponent', () => { component.linkTypes = CollectionElementLinkType; component.index = 0; component.viewModes = ViewMode; - fixture.detectChanges(); + }); it('should create', () => { @@ -60,6 +72,10 @@ describe('CollectionAdminSearchResultListElementComponent', () => { }); it('should render an edit button with the correct link', () => { + component.ngOnInit(); + fixture.detectChanges(); + console.log(component.editPath); + const a = fixture.debugElement.query(By.css('a')); const link = a.nativeElement.href; expect(link).toContain(getCollectionEditRoute(id)); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts index 8bcf20b2305..f04b2d346db 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/collection-search-result/collection-admin-search-result-list-element.component.ts @@ -6,12 +6,17 @@ import { SearchResultListElementComponent } from '../../../../../shared/object-l import { CollectionSearchResult } from '../../../../../shared/object-collection/shared/collection-search-result.model'; import { Collection } from '../../../../../core/shared/collection.model'; import { getCollectionEditRoute } from '../../../../../collection-page/collection-page-routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterLink } from '@angular/router'; +import { CollectionSearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/collection-search-result/collection-search-result-list-element.component'; @listableObjectComponent(CollectionSearchResult, ViewMode.ListElement, Context.AdminSearch) @Component({ - selector: 'ds-collection-admin-search-result-list-element', - styleUrls: ['./collection-admin-search-result-list-element.component.scss'], - templateUrl: './collection-admin-search-result-list-element.component.html' + selector: 'ds-collection-admin-search-result-list-element', + styleUrls: ['./collection-admin-search-result-list-element.component.scss'], + templateUrl: './collection-admin-search-result-list-element.component.html', + standalone: true, + imports: [CollectionSearchResultListElementComponent, RouterLink, TranslateModule] }) /** * The component for displaying a list element for a collection search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts index 110d77b1e56..3f2a27a9521 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.spec.ts @@ -15,6 +15,10 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock'; import { APP_CONFIG } from '../../../../../../config/app-config.interface'; import { environment } from '../../../../../../environments/environment'; +import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service'; +import { + CommunitySearchResultListElementComponent +} from '../../../../../shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component'; describe('CommunityAdminSearchResultListElementComponent', () => { let component: CommunityAdminSearchResultListElementComponent; @@ -32,16 +36,20 @@ describe('CommunityAdminSearchResultListElementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [CommunityAdminSearchResultListElementComponent], - providers: [{ provide: TruncatableService, useValue: {} }, - { provide: DSONameService, useClass: DSONameServiceMock }, + RouterTestingModule.withRoutes([]), + CommunityAdminSearchResultListElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, + { provide: DSONameService, useClass: DSONameServiceMock }, { provide: APP_CONFIG, useValue: environment }], - schemas: [NO_ERRORS_SCHEMA] - }) + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(CommunityAdminSearchResultListElementComponent, { + remove: { imports: [CommunitySearchResultListElementComponent]} + }) .compileComponents(); })); @@ -52,6 +60,7 @@ describe('CommunityAdminSearchResultListElementComponent', () => { component.linkTypes = CollectionElementLinkType; component.index = 0; component.viewModes = ViewMode; + component.ngOnInit(); fixture.detectChanges(); }); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts index 9419ae3f3f1..9812b91a448 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/community-search-result/community-admin-search-result-list-element.component.ts @@ -6,12 +6,17 @@ import { SearchResultListElementComponent } from '../../../../../shared/object-l import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model'; import { Community } from '../../../../../core/shared/community.model'; import { getCommunityEditRoute } from '../../../../../community-page/community-page-routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterLink } from '@angular/router'; +import { CommunitySearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/community-search-result/community-search-result-list-element.component'; @listableObjectComponent(CommunitySearchResult, ViewMode.ListElement, Context.AdminSearch) @Component({ - selector: 'ds-community-admin-search-result-list-element', - styleUrls: ['./community-admin-search-result-list-element.component.scss'], - templateUrl: './community-admin-search-result-list-element.component.html' + selector: 'ds-community-admin-search-result-list-element', + styleUrls: ['./community-admin-search-result-list-element.component.scss'], + templateUrl: './community-admin-search-result-list-element.component.html', + standalone: true, + imports: [CommunitySearchResultListElementComponent, RouterLink, TranslateModule] }) /** * The component for displaying a list element for a community search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts index 667e8edea9f..7555ecf9a46 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.spec.ts @@ -12,6 +12,11 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock'; import { APP_CONFIG } from '../../../../../../config/app-config.interface'; import { environment } from '../../../../../../environments/environment'; +import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service'; +import { + ListableObjectComponentLoaderComponent +} from '../../../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; +import { ItemAdminSearchResultActionsComponent } from '../../item-admin-search-result-actions.component'; describe('ItemAdminSearchResultListElementComponent', () => { let component: ItemAdminSearchResultListElementComponent; @@ -29,16 +34,20 @@ describe('ItemAdminSearchResultListElementComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [ItemAdminSearchResultListElementComponent], - providers: [{ provide: TruncatableService, useValue: {} }, - { provide: DSONameService, useClass: DSONameServiceMock }, + RouterTestingModule.withRoutes([]), + ItemAdminSearchResultListElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, + { provide: DSONameService, useClass: DSONameServiceMock }, { provide: APP_CONFIG, useValue: environment }], - schemas: [NO_ERRORS_SCHEMA] - }) + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(ItemAdminSearchResultListElementComponent, { + remove: { imports: [ListableObjectComponentLoaderComponent, ItemAdminSearchResultActionsComponent]} + }) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.ts b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.ts index b1dea113414..3c3fd182580 100644 --- a/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/admin-search-result-list-element/item-search-result/item-admin-search-result-list-element.component.ts @@ -5,12 +5,16 @@ import { listableObjectComponent } from '../../../../../shared/object-collection import { Context } from '../../../../../core/shared/context.model'; import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model'; import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component'; +import { ItemAdminSearchResultActionsComponent } from '../../item-admin-search-result-actions.component'; +import { ListableObjectComponentLoaderComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; @listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.AdminSearch) @Component({ - selector: 'ds-item-admin-search-result-list-element', - styleUrls: ['./item-admin-search-result-list-element.component.scss'], - templateUrl: './item-admin-search-result-list-element.component.html' + selector: 'ds-item-admin-search-result-list-element', + styleUrls: ['./item-admin-search-result-list-element.component.scss'], + templateUrl: './item-admin-search-result-list-element.component.html', + standalone: true, + imports: [ListableObjectComponentLoaderComponent, ItemAdminSearchResultActionsComponent] }) /** * The component for displaying a list element for an item search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts b/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts index f354ac5f895..3a78620ea4a 100644 --- a/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts +++ b/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.spec.ts @@ -32,13 +32,13 @@ describe('ItemAdminSearchResultActionsComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [ItemAdminSearchResultActionsComponent], - schemas: [NO_ERRORS_SCHEMA] - }) + RouterTestingModule.withRoutes([]), + ItemAdminSearchResultActionsComponent + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts b/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts index fcc3cf0f17b..4651f022607 100644 --- a/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts +++ b/src/app/admin/admin-search-page/admin-search-results/item-admin-search-result-actions.component.ts @@ -10,11 +10,16 @@ import { ITEM_EDIT_REINSTATE_PATH, ITEM_EDIT_WITHDRAW_PATH } from '../../../item-page/edit-item-page/edit-item-page.routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterLink } from '@angular/router'; +import { NgClass, NgIf } from '@angular/common'; @Component({ - selector: 'ds-item-admin-search-result-actions-element', - styleUrls: ['./item-admin-search-result-actions.component.scss'], - templateUrl: './item-admin-search-result-actions.component.html' + selector: 'ds-item-admin-search-result-actions-element', + styleUrls: ['./item-admin-search-result-actions.component.scss'], + templateUrl: './item-admin-search-result-actions.component.html', + standalone: true, + imports: [NgClass, RouterLink, NgIf, TranslateModule] }) /** * The component for displaying the actions for a list element for an item search result on the admin search page diff --git a/src/app/admin/admin-search-page/admin-search.module.ts b/src/app/admin/admin-search-page/admin-search.module.ts index 353d6dd4985..e88fc8b5b59 100644 --- a/src/app/admin/admin-search-page/admin-search.module.ts +++ b/src/app/admin/admin-search-page/admin-search.module.ts @@ -24,16 +24,14 @@ const ENTRY_COMPONENTS = [ ]; @NgModule({ - imports: [ - SearchModule, - SharedModule.withEntryComponents(), - JournalEntitiesModule.withEntryComponents(), - ResearchEntitiesModule.withEntryComponents() - ], - declarations: [ - AdminSearchPageComponent, - ...ENTRY_COMPONENTS - ] + imports: [ + SearchModule, + SharedModule.withEntryComponents(), + JournalEntitiesModule.withEntryComponents(), + ResearchEntitiesModule.withEntryComponents(), + AdminSearchPageComponent, + ...ENTRY_COMPONENTS + ] }) export class AdminSearchModule { /** diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts index 260a364d7a8..efea15bfaf1 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.spec.ts @@ -21,14 +21,13 @@ describe('AdminSidebarSectionComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [NoopAnimationsModule, RouterTestingModule, TranslateModule.forRoot()], - declarations: [AdminSidebarSectionComponent, TestComponent], - providers: [ - {provide: 'sectionDataProvider', useValue: {model: {link: 'google.com'}, icon: iconString}}, - {provide: MenuService, useValue: menuService}, - {provide: CSSVariableService, useClass: CSSVariableServiceStub}, - ] - }).overrideComponent(AdminSidebarSectionComponent, { + imports: [NoopAnimationsModule, RouterTestingModule, TranslateModule.forRoot(), AdminSidebarSectionComponent, TestComponent], + providers: [ + { provide: 'sectionDataProvider', useValue: { model: { link: 'google.com' }, icon: iconString } }, + { provide: MenuService, useValue: menuService }, + { provide: CSSVariableService, useClass: CSSVariableServiceStub }, + ] +}).overrideComponent(AdminSidebarSectionComponent, { set: { entryComponents: [TestComponent] } @@ -61,14 +60,13 @@ describe('AdminSidebarSectionComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [NoopAnimationsModule, RouterTestingModule, TranslateModule.forRoot()], - declarations: [AdminSidebarSectionComponent, TestComponent], - providers: [ - {provide: 'sectionDataProvider', useValue: {model: {link: 'google.com', disabled: true}, icon: iconString}}, - {provide: MenuService, useValue: menuService}, - {provide: CSSVariableService, useClass: CSSVariableServiceStub}, - ] - }).overrideComponent(AdminSidebarSectionComponent, { + imports: [NoopAnimationsModule, RouterTestingModule, TranslateModule.forRoot(), AdminSidebarSectionComponent, TestComponent], + providers: [ + { provide: 'sectionDataProvider', useValue: { model: { link: 'google.com', disabled: true }, icon: iconString } }, + { provide: MenuService, useValue: menuService }, + { provide: CSSVariableService, useClass: CSSVariableServiceStub }, + ] +}).overrideComponent(AdminSidebarSectionComponent, { set: { entryComponents: [TestComponent] } @@ -101,8 +99,10 @@ describe('AdminSidebarSectionComponent', () => { // declare a test component @Component({ - selector: 'ds-test-cmp', - template: `` + selector: 'ds-test-cmp', + template: ``, + standalone: true, + imports: [RouterTestingModule] }) class TestComponent { } diff --git a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts index d6cd803622b..e56836d11ba 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts @@ -6,17 +6,20 @@ import { LinkMenuItemModel } from '../../../shared/menu/menu-item/models/link.mo import { MenuSection } from '../../../shared/menu/menu-section.model'; import { MenuID } from '../../../shared/menu/menu-id.model'; import { isEmpty } from '../../../shared/empty.util'; -import { Router } from '@angular/router'; +import { Router, RouterLink } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgClass } from '@angular/common'; /** * Represents a non-expandable section in the admin sidebar */ @Component({ - /* eslint-disable @angular-eslint/component-selector */ - selector: 'li[ds-admin-sidebar-section]', - templateUrl: './admin-sidebar-section.component.html', - styleUrls: ['./admin-sidebar-section.component.scss'], - + /* eslint-disable @angular-eslint/component-selector */ + selector: 'li[ds-admin-sidebar-section]', + templateUrl: './admin-sidebar-section.component.html', + styleUrls: ['./admin-sidebar-section.component.scss'], + standalone: true, + imports: [NgClass, RouterLink, TranslateModule] }) @rendersSectionForMenu(MenuID.ADMIN, false) export class AdminSidebarSectionComponent extends MenuSectionComponent implements OnInit { diff --git a/src/app/admin/admin-sidebar/admin-sidebar.component.spec.ts b/src/app/admin/admin-sidebar/admin-sidebar.component.spec.ts index 88efd2a711e..36fb094880a 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar.component.spec.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar.component.spec.ts @@ -57,9 +57,8 @@ describe('AdminSidebarComponent', () => { }); scriptService = jasmine.createSpyObj('scriptService', { scriptWithNameExistsAndCanExecute: observableOf(true) }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule], - declarations: [AdminSidebarComponent], - providers: [ + imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule, AdminSidebarComponent], + providers: [ Injector, { provide: ThemeService, useValue: getMockThemeService() }, { provide: MenuService, useValue: menuService }, @@ -70,14 +69,14 @@ describe('AdminSidebarComponent', () => { { provide: ScriptDataService, useValue: scriptService }, { provide: ActivatedRoute, useValue: routeStub }, { - provide: NgbModal, useValue: { - open: () => {/*comment*/ + provide: NgbModal, useValue: { + open: () => { + } } - } } - ], - schemas: [NO_ERRORS_SCHEMA] - }).overrideComponent(AdminSidebarComponent, { + ], + schemas: [NO_ERRORS_SCHEMA] +}).overrideComponent(AdminSidebarComponent, { set: { changeDetection: ChangeDetectionStrategy.Default, } diff --git a/src/app/admin/admin-sidebar/admin-sidebar.component.ts b/src/app/admin/admin-sidebar/admin-sidebar.component.ts index 26ded965d4d..2c0caf619fd 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar.component.ts +++ b/src/app/admin/admin-sidebar/admin-sidebar.component.ts @@ -10,15 +10,20 @@ import { AuthorizationDataService } from '../../core/data/feature-authorization/ import { MenuID } from '../../shared/menu/menu-id.model'; import { ActivatedRoute } from '@angular/router'; import { ThemeService } from '../../shared/theme-support/theme.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgIf, NgClass, NgFor, NgComponentOutlet, AsyncPipe } from '@angular/common'; /** * Component representing the admin sidebar */ @Component({ - selector: 'ds-admin-sidebar', - templateUrl: './admin-sidebar.component.html', - styleUrls: ['./admin-sidebar.component.scss'], - animations: [slideSidebar] + selector: 'ds-admin-sidebar', + templateUrl: './admin-sidebar.component.html', + styleUrls: ['./admin-sidebar.component.scss'], + animations: [slideSidebar], + standalone: true, + imports: [NgIf, NgbDropdownModule, NgClass, NgFor, NgComponentOutlet, AsyncPipe, TranslateModule] }) export class AdminSidebarComponent extends MenuComponent implements OnInit { /** diff --git a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts index dd31f757c23..c995357cc72 100644 --- a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts +++ b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.spec.ts @@ -20,15 +20,14 @@ describe('ExpandableAdminSidebarSectionComponent', () => { const iconString = 'test'; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [NoopAnimationsModule, TranslateModule.forRoot()], - declarations: [ExpandableAdminSidebarSectionComponent, TestComponent], - providers: [ + imports: [NoopAnimationsModule, TranslateModule.forRoot(), ExpandableAdminSidebarSectionComponent, TestComponent], + providers: [ { provide: 'sectionDataProvider', useValue: { icon: iconString, model: {} } }, { provide: MenuService, useValue: menuService }, { provide: CSSVariableService, useClass: CSSVariableServiceStub }, { provide: Router, useValue: new RouterStub() }, - ] - }).overrideComponent(ExpandableAdminSidebarSectionComponent, { + ] +}).overrideComponent(ExpandableAdminSidebarSectionComponent, { set: { entryComponents: [TestComponent] } @@ -71,8 +70,9 @@ describe('ExpandableAdminSidebarSectionComponent', () => { // declare a test component @Component({ - selector: 'ds-test-cmp', - template: `` + selector: 'ds-test-cmp', + template: ``, + standalone: true }) class TestComponent { } diff --git a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts index 4555c0fa938..94679086b24 100644 --- a/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts +++ b/src/app/admin/admin-sidebar/expandable-admin-sidebar-section/expandable-admin-sidebar-section.component.ts @@ -10,16 +10,20 @@ import { map } from 'rxjs/operators'; import { rendersSectionForMenu } from '../../../shared/menu/menu-section.decorator'; import { MenuID } from '../../../shared/menu/menu-id.model'; import { Router } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgClass, NgComponentOutlet, NgIf, NgFor, AsyncPipe } from '@angular/common'; /** * Represents a expandable section in the sidebar */ @Component({ - /* eslint-disable @angular-eslint/component-selector */ - selector: 'li[ds-expandable-admin-sidebar-section]', - templateUrl: './expandable-admin-sidebar-section.component.html', - styleUrls: ['./expandable-admin-sidebar-section.component.scss'], - animations: [rotate, slide, bgColor] + /* eslint-disable @angular-eslint/component-selector */ + selector: 'li[ds-expandable-admin-sidebar-section]', + templateUrl: './expandable-admin-sidebar-section.component.html', + styleUrls: ['./expandable-admin-sidebar-section.component.scss'], + animations: [rotate, slide, bgColor], + standalone: true, + imports: [NgClass, NgComponentOutlet, NgIf, NgFor, AsyncPipe, TranslateModule] }) @rendersSectionForMenu(MenuID.ADMIN, true) diff --git a/src/app/admin/admin-sidebar/themed-admin-sidebar.component.ts b/src/app/admin/admin-sidebar/themed-admin-sidebar.component.ts index f2f35725e8a..917c2302a5b 100644 --- a/src/app/admin/admin-sidebar/themed-admin-sidebar.component.ts +++ b/src/app/admin/admin-sidebar/themed-admin-sidebar.component.ts @@ -6,9 +6,10 @@ import { AdminSidebarComponent } from './admin-sidebar.component'; * Themed wrapper for AdminSidebarComponent */ @Component({ - selector: 'ds-themed-admin-sidebar', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-admin-sidebar', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedAdminSidebarComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/admin/admin-workflow-page/admin-workflow-page.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-page.component.spec.ts index c80bc677f22..95d84ab8065 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-page.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-page.component.spec.ts @@ -9,9 +9,9 @@ describe('AdminSearchPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [AdminWorkflowPageComponent], - schemas: [NO_ERRORS_SCHEMA] - }) + imports: [AdminWorkflowPageComponent], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-page.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-page.component.ts index c3ccc9555a2..085b5c2976c 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-page.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-page.component.ts @@ -1,10 +1,13 @@ import { Component } from '@angular/core'; import { Context } from '../../core/shared/context.model'; +import { ConfigurationSearchPageComponent } from '../../search-page/configuration-search-page.component'; @Component({ - selector: 'ds-admin-workflow-page', - templateUrl: './admin-workflow-page.component.html', - styleUrls: ['./admin-workflow-page.component.scss'] + selector: 'ds-admin-workflow-page', + templateUrl: './admin-workflow-page.component.html', + styleUrls: ['./admin-workflow-page.component.scss'], + standalone: true, + imports: [ConfigurationSearchPageComponent] }) /** diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts index 04377fcc81a..92c2f4b1064 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.spec.ts @@ -35,13 +35,13 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [WorkflowItemAdminWorkflowActionsComponent], - schemas: [NO_ERRORS_SCHEMA] - }) + RouterTestingModule.withRoutes([]), + WorkflowItemAdminWorkflowActionsComponent + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.ts index 480c48f25ef..b8753129182 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component.ts @@ -5,11 +5,16 @@ import { getWorkflowItemDeleteRoute, getWorkflowItemSendBackRoute } from '../../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterLink } from '@angular/router'; +import { NgClass, NgIf } from '@angular/common'; @Component({ - selector: 'ds-workflow-item-admin-workflow-actions-element', - styleUrls: ['./workflow-item-admin-workflow-actions.component.scss'], - templateUrl: './workflow-item-admin-workflow-actions.component.html' + selector: 'ds-workflow-item-admin-workflow-actions-element', + styleUrls: ['./workflow-item-admin-workflow-actions.component.scss'], + templateUrl: './workflow-item-admin-workflow-actions.component.html', + standalone: true, + imports: [NgClass, RouterLink, NgIf, TranslateModule] }) /** * The component for displaying the actions for a list element for a workflow-item on the admin workflow search page diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts index 6e917ed0888..7e899fd58e4 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.spec.ts @@ -1,13 +1,14 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap'; import { SupervisionOrderGroupSelectorComponent } from './supervision-order-group-selector.component'; import { SupervisionOrderDataService } from '../../../../../../core/supervision-order/supervision-order-data.service'; import { NotificationsService } from '../../../../../../shared/notifications/notifications.service'; import { Group } from '../../../../../../core/eperson/models/group.model'; import { SupervisionOrder } from '../../../../../../core/supervision-order/models/supervision-order.model'; import { of } from 'rxjs'; +import { EpersonGroupListComponent } from '../../../../../../shared/eperson-group-list/eperson-group-list.component'; describe('SupervisionOrderGroupSelectorComponent', () => { let component: SupervisionOrderGroupSelectorComponent; @@ -31,15 +32,22 @@ describe('SupervisionOrderGroupSelectorComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], - declarations: [SupervisionOrderGroupSelectorComponent], - providers: [ + imports: [ + NgbPaginationModule, + TranslateModule.forRoot(), + SupervisionOrderGroupSelectorComponent + ], + providers: [ { provide: NgbActiveModal, useValue: modalStub }, { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService }, { provide: NotificationsService, useValue: {} }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(SupervisionOrderGroupSelectorComponent, { + remove: { imports: [EpersonGroupListComponent]} + }) + .compileComponents(); })); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts index 2eec0cfd0cc..fee610ff538 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, Output } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateService, TranslateModule } from '@ngx-translate/core'; import { getFirstCompletedRemoteData } from 'src/app/core/shared/operators'; import { NotificationsService } from 'src/app/shared/notifications/notifications.service'; import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service'; @@ -8,6 +8,10 @@ import { Group } from '../../../../../../core/eperson/models/group.model'; import { SupervisionOrder } from '../../../../../../core/supervision-order/models/supervision-order.model'; import { SupervisionOrderDataService } from '../../../../../../core/supervision-order/supervision-order-data.service'; import { RemoteData } from '../../../../../../core/data/remote-data'; +import { EpersonGroupListComponent } from '../../../../../../shared/eperson-group-list/eperson-group-list.component'; +import { ErrorComponent } from '../../../../../../shared/error/error.component'; +import { NgIf } from '@angular/common'; +import { FormsModule } from '@angular/forms'; /** * Component to wrap a dropdown - for type of order - @@ -17,9 +21,11 @@ import { RemoteData } from '../../../../../../core/data/remote-data'; */ @Component({ - selector: 'ds-supervision-group-selector', - styleUrls: ['./supervision-order-group-selector.component.scss'], - templateUrl: './supervision-order-group-selector.component.html', + selector: 'ds-supervision-group-selector', + styleUrls: ['./supervision-order-group-selector.component.scss'], + templateUrl: './supervision-order-group-selector.component.html', + standalone: true, + imports: [FormsModule, NgIf, ErrorComponent, EpersonGroupListComponent, TranslateModule] }) export class SupervisionOrderGroupSelectorComponent { diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.spec.ts index 2f4ed631ccc..b3f8e5ef59a 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.spec.ts @@ -16,20 +16,20 @@ describe('SupervisionOrderStatusComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ + imports: [ NgbTooltipModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }) - ], - declarations: [ SupervisionOrderStatusComponent, VarDirective ], - schemas: [ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), + SupervisionOrderStatusComponent, VarDirective + ], + schemas: [ NO_ERRORS_SCHEMA - ] - }) + ] +}) .compileComponents(); }); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.ts index 93c6441e920..c0dd5eb5782 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component.ts @@ -9,6 +9,10 @@ import { getFirstCompletedRemoteData } from '../../../../../../core/shared/opera import { isNotEmpty } from '../../../../../../shared/empty.util'; import { RemoteData } from '../../../../../../core/data/remote-data'; import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgIf, NgFor, AsyncPipe } from '@angular/common'; +import { VarDirective } from '../../../../../../shared/utils/var.directive'; export interface SupervisionOrderListEntry { supervisionOrder: SupervisionOrder; @@ -16,9 +20,11 @@ export interface SupervisionOrderListEntry { } @Component({ - selector: 'ds-supervision-order-status', - templateUrl: './supervision-order-status.component.html', - styleUrls: ['./supervision-order-status.component.scss'] + selector: 'ds-supervision-order-status', + templateUrl: './supervision-order-status.component.html', + styleUrls: ['./supervision-order-status.component.scss'], + standalone: true, + imports: [VarDirective, NgIf, NgFor, NgbTooltipModule, AsyncPipe, TranslateModule] }) export class SupervisionOrderStatusComponent implements OnChanges { diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts index a8f0581ec0e..e9afa547988 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.spec.ts @@ -53,19 +53,19 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => { beforeEach(waitForAsync(() => { init(); TestBed.configureTestingModule({ - imports: [ + imports: [ NgbModalModule, TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]) - ], - declarations: [WorkspaceItemAdminWorkflowActionsComponent], - providers: [ + RouterTestingModule.withRoutes([]), + WorkspaceItemAdminWorkflowActionsComponent + ], + providers: [ { provide: DSONameService, useClass: DSONameServiceMock }, { provide: NotificationsService, useValue: notificationService }, { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService } - ], - schemas: [NO_ERRORS_SCHEMA] - }) + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.ts index 36678460da1..9329cc20e39 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component.ts @@ -3,7 +3,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { map, Observable } from 'rxjs'; import { switchMap, take, tap } from 'rxjs/operators'; import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateService, TranslateModule } from '@ngx-translate/core'; import { Item } from '../../../../../core/shared/item.model'; import { getFirstSucceededRemoteDataPayload } from '../../../../../core/shared/operators'; @@ -16,7 +16,7 @@ import { import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../../../item-page/edit-item-page/edit-item-page.routing-paths'; import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model'; import { SupervisionOrder } from '../../../../../core/supervision-order/models/supervision-order.model'; -import { SupervisionOrderListEntry } from './supervision-order-status/supervision-order-status.component'; +import { SupervisionOrderListEntry, SupervisionOrderStatusComponent } from './supervision-order-status/supervision-order-status.component'; import { ConfirmationModalComponent } from '../../../../../shared/confirmation-modal/confirmation-modal.component'; import { hasValue } from '../../../../../shared/empty.util'; import { NotificationsService } from '../../../../../shared/notifications/notifications.service'; @@ -24,11 +24,15 @@ import { SupervisionOrderDataService } from '../../../../../core/supervision-ord import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; import { DSpaceObject } from '../../../../../core/shared/dspace-object.model'; import { getSearchResultFor } from '../../../../../shared/search/search-result-element-decorator'; +import { RouterLink } from '@angular/router'; +import { NgClass, NgIf } from '@angular/common'; @Component({ - selector: 'ds-workspace-item-admin-workflow-actions-element', - styleUrls: ['./workspace-item-admin-workflow-actions.component.scss'], - templateUrl: './workspace-item-admin-workflow-actions.component.html' + selector: 'ds-workspace-item-admin-workflow-actions-element', + styleUrls: ['./workspace-item-admin-workflow-actions.component.scss'], + templateUrl: './workspace-item-admin-workflow-actions.component.html', + standalone: true, + imports: [SupervisionOrderStatusComponent, NgClass, RouterLink, NgIf, TranslateModule] }) /** * The component for displaying the actions for a list element for a workspace-item on the admin workflow search page diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts index 8035c53547e..c3ee9fa37b9 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.spec.ts @@ -55,24 +55,24 @@ describe('WorkflowItemSearchResultAdminWorkflowGridElementComponent', () => { init(); TestBed.configureTestingModule( { - declarations: [WorkflowItemSearchResultAdminWorkflowGridElementComponent, ItemGridElementComponent, ListableObjectDirective], - imports: [ - NoopAnimationsModule, - TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]), - ], - providers: [ - { provide: LinkService, useValue: linkService }, - { provide: ThemeService, useValue: themeService }, - { + imports: [ + NoopAnimationsModule, + TranslateModule.forRoot(), + RouterTestingModule.withRoutes([]), + WorkflowItemSearchResultAdminWorkflowGridElementComponent, ItemGridElementComponent, ListableObjectDirective + ], + providers: [ + { provide: LinkService, useValue: linkService }, + { provide: ThemeService, useValue: themeService }, + { provide: TruncatableService, useValue: { - isCollapsed: () => observableOf(true), + isCollapsed: () => observableOf(true), } - }, - { provide: BitstreamDataService, useValue: {} }, - ], - schemas: [NO_ERRORS_SCHEMA] - }) + }, + { provide: BitstreamDataService, useValue: {} }, + ], + schemas: [NO_ERRORS_SCHEMA] +}) .overrideComponent(WorkflowItemSearchResultAdminWorkflowGridElementComponent, { set: { entryComponents: [ItemGridElementComponent] diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.ts index fd9d21e227d..421b924cc60 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component.ts @@ -24,12 +24,17 @@ import { take } from 'rxjs/operators'; import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model'; import { ThemeService } from '../../../../../shared/theme-support/theme.service'; import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { WorkflowItemAdminWorkflowActionsComponent } from '../../actions/workflow-item/workflow-item-admin-workflow-actions.component'; +import { NgIf } from '@angular/common'; @listableObjectComponent(WorkflowItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch) @Component({ - selector: 'ds-workflow-item-search-result-admin-workflow-grid-element', - styleUrls: ['./workflow-item-search-result-admin-workflow-grid-element.component.scss'], - templateUrl: './workflow-item-search-result-admin-workflow-grid-element.component.html' + selector: 'ds-workflow-item-search-result-admin-workflow-grid-element', + styleUrls: ['./workflow-item-search-result-admin-workflow-grid-element.component.scss'], + templateUrl: './workflow-item-search-result-admin-workflow-grid-element.component.html', + standalone: true, + imports: [ListableObjectDirective, NgIf, WorkflowItemAdminWorkflowActionsComponent, TranslateModule] }) /** * The component for displaying a grid element for an workflow item on the admin workflow search page diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.spec.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.spec.ts index b9e752c1047..6a1edc4240b 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.spec.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.spec.ts @@ -67,25 +67,25 @@ describe('WorkspaceItemSearchResultAdminWorkflowGridElementComponent', () => { init(); TestBed.configureTestingModule( { - declarations: [WorkspaceItemSearchResultAdminWorkflowGridElementComponent, ItemGridElementComponent, ListableObjectDirective], - imports: [ - NoopAnimationsModule, - TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]), - ], - providers: [ - { provide: LinkService, useValue: linkService }, - { provide: ThemeService, useValue: themeService }, - { + imports: [ + NoopAnimationsModule, + TranslateModule.forRoot(), + RouterTestingModule.withRoutes([]), + WorkspaceItemSearchResultAdminWorkflowGridElementComponent, ItemGridElementComponent, ListableObjectDirective + ], + providers: [ + { provide: LinkService, useValue: linkService }, + { provide: ThemeService, useValue: themeService }, + { provide: TruncatableService, useValue: { - isCollapsed: () => observableOf(true), + isCollapsed: () => observableOf(true), } - }, - { provide: BitstreamDataService, useValue: {} }, - { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService } - ], - schemas: [NO_ERRORS_SCHEMA] - }) + }, + { provide: BitstreamDataService, useValue: {} }, + { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService } + ], + schemas: [NO_ERRORS_SCHEMA] +}) .overrideComponent(WorkspaceItemSearchResultAdminWorkflowGridElementComponent, { set: { entryComponents: [ItemGridElementComponent] diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.ts index d6f39e79feb..067a8312489 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component.ts @@ -37,12 +37,17 @@ import { SupervisionOrder } from '../../../../../core/supervision-order/models/s import { PaginatedList } from '../../../../../core/data/paginated-list.model'; import { SupervisionOrderDataService } from '../../../../../core/supervision-order/supervision-order-data.service'; import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { AsyncPipe } from '@angular/common'; +import { WorkspaceItemAdminWorkflowActionsComponent } from '../../actions/workspace-item/workspace-item-admin-workflow-actions.component'; @listableObjectComponent(WorkspaceItemSearchResult, ViewMode.GridElement, Context.AdminWorkflowSearch) @Component({ - selector: 'ds-workflow-item-search-result-admin-workflow-grid-element', - styleUrls: ['./workspace-item-search-result-admin-workflow-grid-element.component.scss'], - templateUrl: './workspace-item-search-result-admin-workflow-grid-element.component.html' + selector: 'ds-workflow-item-search-result-admin-workflow-grid-element', + styleUrls: ['./workspace-item-search-result-admin-workflow-grid-element.component.scss'], + templateUrl: './workspace-item-search-result-admin-workflow-grid-element.component.html', + standalone: true, + imports: [ListableObjectDirective, WorkspaceItemAdminWorkflowActionsComponent, AsyncPipe, TranslateModule] }) /** * The component for displaying a grid element for an workflow item on the admin workflow search page 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.spec.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.spec.ts index ab5d8b79a84..957b55c9ae1 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.spec.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.spec.ts @@ -48,20 +48,20 @@ describe('WorkflowItemSearchResultAdminWorkflowListElementComponent', () => { init(); TestBed.configureTestingModule( { - declarations: [WorkflowItemSearchResultAdminWorkflowListElementComponent], - imports: [ - NoopAnimationsModule, - TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]), - ], - providers: [ - { provide: TruncatableService, useValue: mockTruncatableService }, - { provide: LinkService, useValue: linkService }, - { provide: DSONameService, useClass: DSONameServiceMock }, - { provide: APP_CONFIG, useValue: environment } - ], - schemas: [NO_ERRORS_SCHEMA] - }) + imports: [ + NoopAnimationsModule, + TranslateModule.forRoot(), + RouterTestingModule.withRoutes([]), + WorkflowItemSearchResultAdminWorkflowListElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, + { provide: LinkService, useValue: linkService }, + { provide: DSONameService, useClass: DSONameServiceMock }, + { provide: APP_CONFIG, useValue: environment } + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); 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 d0e773d696c..da3ab10a761 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 @@ -20,12 +20,18 @@ import { } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model'; import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service'; import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface'; +import { TranslateModule } from '@ngx-translate/core'; +import { WorkflowItemAdminWorkflowActionsComponent } from '../../actions/workflow-item/workflow-item-admin-workflow-actions.component'; +import { ListableObjectComponentLoaderComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; +import { NgIf, AsyncPipe } from '@angular/common'; @listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch) @Component({ - selector: 'ds-workflow-item-search-result-admin-workflow-list-element', - styleUrls: ['./workflow-item-search-result-admin-workflow-list-element.component.scss'], - templateUrl: './workflow-item-search-result-admin-workflow-list-element.component.html' + selector: 'ds-workflow-item-search-result-admin-workflow-list-element', + styleUrls: ['./workflow-item-search-result-admin-workflow-list-element.component.scss'], + templateUrl: './workflow-item-search-result-admin-workflow-list-element.component.html', + standalone: true, + imports: [NgIf, ListableObjectComponentLoaderComponent, WorkflowItemAdminWorkflowActionsComponent, AsyncPipe, TranslateModule] }) /** * The component for displaying a list element for a workflow item on the admin workflow search page 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.spec.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.spec.ts index 19eefc9c481..1a4d4392fe8 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.spec.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.spec.ts @@ -60,21 +60,21 @@ describe('WorkspaceItemSearchResultAdminWorkflowListElementComponent', () => { init(); TestBed.configureTestingModule( { - declarations: [WorkspaceItemSearchResultAdminWorkflowListElementComponent], - imports: [ - NoopAnimationsModule, - TranslateModule.forRoot(), - RouterTestingModule.withRoutes([]), - ], - providers: [ - { provide: TruncatableService, useValue: mockTruncatableService }, - { provide: LinkService, useValue: linkService }, - { provide: DSONameService, useClass: DSONameServiceMock }, - { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService }, - { provide: APP_CONFIG, useValue: environment } - ], - schemas: [NO_ERRORS_SCHEMA] - }) + imports: [ + NoopAnimationsModule, + TranslateModule.forRoot(), + RouterTestingModule.withRoutes([]), + WorkspaceItemSearchResultAdminWorkflowListElementComponent + ], + providers: [ + { provide: TruncatableService, useValue: mockTruncatableService }, + { provide: LinkService, useValue: linkService }, + { provide: DSONameService, useClass: DSONameServiceMock }, + { provide: SupervisionOrderDataService, useValue: supervisionOrderDataService }, + { provide: APP_CONFIG, useValue: environment } + ], + schemas: [NO_ERRORS_SCHEMA] +}) .compileComponents(); })); 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 3d6d1c8e445..2de5cfcb7a2 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,12 +31,18 @@ import { SupervisionOrder } from '../../../../../core/supervision-order/models/s import { SupervisionOrderDataService } from '../../../../../core/supervision-order/supervision-order-data.service'; import { PaginatedList } from '../../../../../core/data/paginated-list.model'; import { DSpaceObject } from '../../../../../core/shared/dspace-object.model'; +import { TranslateModule } from '@ngx-translate/core'; +import { WorkspaceItemAdminWorkflowActionsComponent } from '../../actions/workspace-item/workspace-item-admin-workflow-actions.component'; +import { ListableObjectComponentLoaderComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object-component-loader.component'; +import { NgIf, AsyncPipe } from '@angular/common'; @listableObjectComponent(WorkspaceItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch) @Component({ - selector: 'ds-workflow-item-search-result-admin-workflow-list-element', - styleUrls: ['./workspace-item-search-result-admin-workflow-list-element.component.scss'], - templateUrl: './workspace-item-search-result-admin-workflow-list-element.component.html' + selector: 'ds-workflow-item-search-result-admin-workflow-list-element', + styleUrls: ['./workspace-item-search-result-admin-workflow-list-element.component.scss'], + templateUrl: './workspace-item-search-result-admin-workflow-list-element.component.html', + standalone: true, + imports: [NgIf, ListableObjectComponentLoaderComponent, WorkspaceItemAdminWorkflowActionsComponent, AsyncPipe, TranslateModule] }) /** * The component for displaying a list element for a workflow item on the admin workflow search page diff --git a/src/app/admin/admin-workflow-page/admin-workflow.module.ts b/src/app/admin/admin-workflow-page/admin-workflow.module.ts index 21990c1ea9b..64f3747be33 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow.module.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow.module.ts @@ -37,21 +37,19 @@ const ENTRY_COMPONENTS = [ ]; @NgModule({ - imports: [ - SearchModule, - SharedModule.withEntryComponents() - ], - declarations: [ - AdminWorkflowPageComponent, - SupervisionOrderGroupSelectorComponent, - SupervisionOrderStatusComponent, - WorkflowItemAdminWorkflowActionsComponent, - WorkspaceItemAdminWorkflowActionsComponent, - ...ENTRY_COMPONENTS - ], - exports: [ - AdminWorkflowPageComponent - ] + imports: [ + SearchModule, + SharedModule.withEntryComponents(), + AdminWorkflowPageComponent, + SupervisionOrderGroupSelectorComponent, + SupervisionOrderStatusComponent, + WorkflowItemAdminWorkflowActionsComponent, + WorkspaceItemAdminWorkflowActionsComponent, + ...ENTRY_COMPONENTS + ], + exports: [ + AdminWorkflowPageComponent + ] }) export class AdminWorkflowModuleModule { /** diff --git a/src/app/admin/admin.module.ts b/src/app/admin/admin.module.ts index 3dc0036854e..4da844f728d 100644 --- a/src/app/admin/admin.module.ts +++ b/src/app/admin/admin.module.ts @@ -21,21 +21,19 @@ const ENTRY_COMPONENTS = [ @NgModule({ - imports: [ - AdminRoutingModule, - AdminRegistriesModule, - AccessControlModule, - AdminSearchModule.withEntryComponents(), - AdminWorkflowModuleModule.withEntryComponents(), - SharedModule, - UiSwitchModule, - UploadModule, - ], - declarations: [ - AdminCurationTasksComponent, - MetadataImportPageComponent, - BatchImportPageComponent - ] + imports: [ + AdminRoutingModule, + AdminRegistriesModule, + AccessControlModule, + AdminSearchModule.withEntryComponents(), + AdminWorkflowModuleModule.withEntryComponents(), + SharedModule, + UiSwitchModule, + UploadModule, + AdminCurationTasksComponent, + MetadataImportPageComponent, + BatchImportPageComponent + ] }) export class AdminModule { /** diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index deb68f1ea92..d621f96a70d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -186,8 +186,8 @@ import { ThemedPageErrorComponent } from './page-error/themed-page-error.compone }, { path: WORKFLOW_ITEM_MODULE_PATH, - loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page.module') - .then((m) => m.WorkflowItemsEditPageModule), + loadChildren: () => import('./workflowitems-edit-page/workflowitems-edit-page.routes') + .then((m) => m.workflowItemsEditPageRoutes), canActivate: [EndUserAgreementCurrentUserGuard] }, { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ba7b7382278..b61d23b183c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -27,16 +27,15 @@ import { isAuthenticationBlocking } from './core/auth/selectors'; import { AuthService } from './core/auth/auth.service'; import { CSSVariableService } from './shared/sass-helper/css-variable.service'; import { environment } from '../environments/environment'; -import { models } from './core/core.module'; import { ThemeService } from './shared/theme-support/theme.service'; import { IdleModalComponent } from './shared/idle-modal/idle-modal.component'; import { distinctNext } from './core/shared/distinct-next'; @Component({ - selector: 'ds-app', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'ds-app', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class AppComponent implements OnInit, AfterViewInit { notificationOptions; @@ -77,9 +76,6 @@ export class AppComponent implements OnInit, AfterViewInit { ) { this.notificationOptions = environment.notifications; - /* Use models object so all decorators are actually called */ - this.models = models; - if (isPlatformBrowser(this.platformId)) { this.trackIdleModal(); } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 89e361821ba..9df65372317 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,7 +16,6 @@ import { AppComponent } from './app.component'; import { appEffects } from './app.effects'; import { appMetaReducers, debugMetaReducers } from './app.metareducers'; import { appReducers, AppState, storeModuleConfig } from './app.reducer'; -import { CoreModule } from './core/core.module'; import { ClientCookieService } from './core/services/client-cookie.service'; import { NavbarModule } from './navbar/navbar.module'; import { DSpaceRouterStateSerializer } from './shared/ngrx/dspace-router-state-serializer'; @@ -30,6 +29,8 @@ import { EagerThemesModule } from '../themes/eager-themes.module'; import { APP_CONFIG, AppConfig } from '../config/app-config.interface'; import { StoreDevModules } from '../config/store/devtools'; import { RootModule } from './root.module'; +import { models, provideCore } from './core/provide-core'; +import { ThemedRootComponent } from './root/themed-root.component'; export function getConfig() { return environment; @@ -51,7 +52,6 @@ const IMPORTS = [ NavbarModule, HttpClientModule, AppRoutingModule, - CoreModule.forRoot(), ScrollToModule.forRoot(), NgbModule, TranslateModule.forRoot(), @@ -107,29 +107,24 @@ const PROVIDERS = [ ...DYNAMIC_MATCHER_PROVIDERS, ]; -const DECLARATIONS = [ - AppComponent, -]; - -const EXPORTS = [ -]; @NgModule({ + declarations: [ + AppComponent, + ], imports: [ - BrowserModule.withServerTransition({ appId: 'dspace-angular' }), - ...IMPORTS + BrowserModule.withServerTransition({appId: 'dspace-angular'}), + ...IMPORTS, + ThemedRootComponent ], providers: [ - ...PROVIDERS - ], - declarations: [ - ...DECLARATIONS, + ...PROVIDERS, + provideCore(), ], - exports: [ - ...EXPORTS, - ...DECLARATIONS, - ] + bootstrap: [AppComponent] }) export class AppModule { + /* Use models object so all decorators are actually called */ + modelList = models; } diff --git a/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.spec.ts b/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.spec.ts index c41351f3806..1de4e081875 100644 --- a/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.spec.ts +++ b/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.spec.ts @@ -12,6 +12,7 @@ import { BitstreamAuthorizationsComponent } from './bitstream-authorizations.com import { Bitstream } from '../../core/shared/bitstream.model'; import { createSuccessfulRemoteDataObject } from '../../shared/remote-data.utils'; import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; +import { ResourcePoliciesComponent } from '../../shared/resource-policies/resource-policies.component'; describe('BitstreamAuthorizationsComponent', () => { let comp: BitstreamAuthorizationsComponent; @@ -42,23 +43,27 @@ describe('BitstreamAuthorizationsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ + imports: [ CommonModule, TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - } - }) - ], - declarations: [BitstreamAuthorizationsComponent], - providers: [ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + } + }), + BitstreamAuthorizationsComponent + ], + providers: [ { provide: ActivatedRoute, useValue: routeStub }, ChangeDetectorRef, BitstreamAuthorizationsComponent, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(BitstreamAuthorizationsComponent, { + remove: { imports: [ResourcePoliciesComponent]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.ts b/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.ts index adc06387804..480a59e33a1 100644 --- a/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.ts +++ b/src/app/bitstream-page/bitstream-authorizations/bitstream-authorizations.component.ts @@ -1,15 +1,25 @@ import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, RouterLink } from '@angular/router'; import { Observable } from 'rxjs'; import { first, map } from 'rxjs/operators'; import { RemoteData } from '../../core/data/remote-data'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; +import { ResourcePoliciesComponent } from '../../shared/resource-policies/resource-policies.component'; +import { AsyncPipe } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; @Component({ selector: 'ds-collection-authorizations', templateUrl: './bitstream-authorizations.component.html', + imports: [ + ResourcePoliciesComponent, + AsyncPipe, + TranslateModule, + RouterLink + ], + standalone: true }) /** * Component that handles the Collection Authorizations diff --git a/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.spec.ts b/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.spec.ts index 59261e56d28..f18a65329ee 100644 --- a/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.spec.ts +++ b/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.spec.ts @@ -90,9 +90,8 @@ describe('BitstreamDownloadPageComponent', () => { function initTestbed() { TestBed.configureTestingModule({ - imports: [CommonModule, TranslateModule.forRoot()], - declarations: [BitstreamDownloadPageComponent], - providers: [ + imports: [CommonModule, TranslateModule.forRoot(), BitstreamDownloadPageComponent], + providers: [ { provide: ActivatedRoute, useValue: activatedRoute }, { provide: Router, useValue: router }, { provide: AuthorizationDataService, useValue: authorizationService }, @@ -102,8 +101,8 @@ describe('BitstreamDownloadPageComponent', () => { { provide: ServerResponseService, useValue: serverResponseService }, { provide: SignpostingDataService, useValue: signpostingDataService }, { provide: PLATFORM_ID, useValue: 'server' } - ] - }) + ] +}) .compileComponents(); } diff --git a/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.ts b/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.ts index 0b8e6a66e5b..2e28968ed77 100644 --- a/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.ts +++ b/src/app/bitstream-page/bitstream-download-page/bitstream-download-page.component.ts @@ -13,15 +13,21 @@ import { HardRedirectService } from '../../core/services/hard-redirect.service'; import { getForbiddenRoute } from '../../app-routing-paths'; import { RemoteData } from '../../core/data/remote-data'; import { redirectOn4xx } from '../../core/shared/authorized.operators'; -import { isPlatformServer, Location } from '@angular/common'; +import { AsyncPipe, isPlatformServer, Location } from '@angular/common'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; import { SignpostingDataService } from '../../core/data/signposting-data.service'; import { ServerResponseService } from '../../core/services/server-response.service'; import { SignpostingLink } from '../../core/data/signposting-links.model'; +import { TranslateModule } from '@ngx-translate/core'; @Component({ selector: 'ds-bitstream-download-page', - templateUrl: './bitstream-download-page.component.html' + templateUrl: './bitstream-download-page.component.html', + imports: [ + AsyncPipe, + TranslateModule + ], + standalone: true }) /** * Page component for downloading a bitstream diff --git a/src/app/bitstream-page/bitstream-page.module.ts b/src/app/bitstream-page/bitstream-page.module.ts index 9bbe3d200c2..dbe897c8c69 100644 --- a/src/app/bitstream-page/bitstream-page.module.ts +++ b/src/app/bitstream-page/bitstream-page.module.ts @@ -13,19 +13,17 @@ import { ThemedEditBitstreamPageComponent } from './edit-bitstream-page/themed-e * This module handles all components that are necessary for Bitstream related pages */ @NgModule({ - imports: [ - CommonModule, - SharedModule, - BitstreamPageRoutingModule, - FormModule, - ResourcePoliciesModule - ], - declarations: [ - BitstreamAuthorizationsComponent, - EditBitstreamPageComponent, - ThemedEditBitstreamPageComponent, - BitstreamDownloadPageComponent, - ] + imports: [ + CommonModule, + SharedModule, + BitstreamPageRoutingModule, + FormModule, + ResourcePoliciesModule, + BitstreamAuthorizationsComponent, + EditBitstreamPageComponent, + ThemedEditBitstreamPageComponent, + BitstreamDownloadPageComponent + ] }) export class BitstreamPageModule { } diff --git a/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts b/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts index b83f2b96643..68f50a84246 100644 --- a/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts +++ b/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.spec.ts @@ -192,26 +192,25 @@ describe('EditBitstreamPageComponent', () => { }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective], - providers: [ - { provide: NotificationsService, useValue: notificationsService }, - { provide: DynamicFormService, useValue: formService }, - { + imports: [TranslateModule.forRoot(), RouterTestingModule, EditBitstreamPageComponent, FileSizePipe, VarDirective], + providers: [ + { provide: NotificationsService, useValue: notificationsService }, + { provide: DynamicFormService, useValue: formService }, + { provide: ActivatedRoute, useValue: { - data: observableOf({ bitstream: createSuccessfulRemoteDataObject(bitstream) }), - snapshot: { queryParams: {} } + data: observableOf({ bitstream: createSuccessfulRemoteDataObject(bitstream) }), + snapshot: { queryParams: {} } } - }, - { provide: BitstreamDataService, useValue: bitstreamService }, - { provide: DSONameService, useValue: dsoNameService }, - { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, - { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, - ChangeDetectorRef - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + }, + { provide: BitstreamDataService, useValue: bitstreamService }, + { provide: DSONameService, useValue: dsoNameService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, + ChangeDetectorRef + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); @@ -481,26 +480,25 @@ describe('EditBitstreamPageComponent', () => { }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective], - providers: [ - {provide: NotificationsService, useValue: notificationsService}, - {provide: DynamicFormService, useValue: formService}, - { + imports: [TranslateModule.forRoot(), RouterTestingModule, EditBitstreamPageComponent, FileSizePipe, VarDirective], + providers: [ + { provide: NotificationsService, useValue: notificationsService }, + { provide: DynamicFormService, useValue: formService }, + { provide: ActivatedRoute, useValue: { - data: observableOf({bitstream: createSuccessfulRemoteDataObject(bitstream)}), - snapshot: {queryParams: {}} + data: observableOf({ bitstream: createSuccessfulRemoteDataObject(bitstream) }), + snapshot: { queryParams: {} } } - }, - {provide: BitstreamDataService, useValue: bitstreamService}, - {provide: DSONameService, useValue: dsoNameService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, - { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, - ChangeDetectorRef - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + }, + { provide: BitstreamDataService, useValue: bitstreamService }, + { provide: DSONameService, useValue: dsoNameService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, + ChangeDetectorRef + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { @@ -606,25 +604,24 @@ describe('EditBitstreamPageComponent', () => { }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective], - providers: [ - {provide: NotificationsService, useValue: notificationsService}, - {provide: DynamicFormService, useValue: formService}, - {provide: ActivatedRoute, - useValue: { - data: observableOf({bitstream: createSuccessfulRemoteDataObject(bitstream)}), - snapshot: {queryParams: {}} - } - }, - {provide: BitstreamDataService, useValue: bitstreamService}, - {provide: DSONameService, useValue: dsoNameService}, - {provide: BitstreamFormatDataService, useValue: bitstreamFormatService}, - { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, - ChangeDetectorRef - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + imports: [TranslateModule.forRoot(), RouterTestingModule, EditBitstreamPageComponent, FileSizePipe, VarDirective], + providers: [ + { provide: NotificationsService, useValue: notificationsService }, + { provide: DynamicFormService, useValue: formService }, + { provide: ActivatedRoute, + useValue: { + data: observableOf({ bitstream: createSuccessfulRemoteDataObject(bitstream) }), + snapshot: { queryParams: {} } + } + }, + { provide: BitstreamDataService, useValue: bitstreamService }, + { provide: DSONameService, useValue: dsoNameService }, + { provide: BitstreamFormatDataService, useValue: bitstreamFormatService }, + { provide: PrimaryBitstreamService, useValue: primaryBitstreamService }, + ChangeDetectorRef + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts b/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts index b77d2151a9b..202d17633c6 100644 --- a/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts +++ b/src/app/bitstream-page/edit-bitstream-page/edit-bitstream-page.component.ts @@ -1,11 +1,11 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { Bitstream } from '../../core/shared/bitstream.model'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { filter, map, switchMap, tap } from 'rxjs/operators'; import { combineLatest, combineLatest as observableCombineLatest, Observable, of as observableOf, Subscription } from 'rxjs'; import { DynamicFormControlModel, DynamicFormGroupModel, DynamicFormLayout, DynamicFormService, DynamicInputModel, DynamicSelectModel } from '@ng-dynamic-forms/core'; import { UntypedFormGroup } from '@angular/forms'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { DynamicCustomSwitchModel } from '../../shared/form/builder/ds-dynamic-form-ui/models/custom-switch/custom-switch.model'; import cloneDeep from 'lodash/cloneDeep'; import { BitstreamDataService } from '../../core/data/bitstream-data.service'; @@ -16,7 +16,7 @@ import { BitstreamFormat } from '../../core/shared/bitstream-format.model'; import { BitstreamFormatSupportLevel } from '../../core/shared/bitstream-format-support-level'; import { hasValue, hasValueOperator, isEmpty, isNotEmpty } from '../../shared/empty.util'; import { Metadata } from '../../core/shared/metadata.utils'; -import { Location } from '@angular/common'; +import { AsyncPipe, Location, NgIf } from '@angular/common'; import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list.model'; import { getEntityEditRoute } from '../../item-page/item-page-routing-paths'; @@ -26,12 +26,31 @@ import { Item } from '../../core/shared/item.model'; import { DsDynamicInputModel } from '../../shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-input.model'; import { DsDynamicTextAreaModel } from '../../shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-textarea.model'; import { PrimaryBitstreamService } from '../../core/data/primary-bitstream.service'; +import { FormComponent } from '../../shared/form/form.component'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { ThemedThumbnailComponent } from '../../thumbnail/themed-thumbnail.component'; +import { ErrorComponent } from '../../shared/error/error.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { FileSizePipe } from '../../shared/utils/file-size-pipe'; @Component({ selector: 'ds-edit-bitstream-page', styleUrls: ['./edit-bitstream-page.component.scss'], templateUrl: './edit-bitstream-page.component.html', - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [ + FormComponent, + NgIf, + VarDirective, + ThemedThumbnailComponent, + AsyncPipe, + RouterLink, + ErrorComponent, + ThemedLoadingComponent, + TranslateModule, + FileSizePipe + ], + standalone: true }) /** * Page component for editing a bitstream diff --git a/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts b/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts index dcca28a495e..48f4e32c9e8 100644 --- a/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts +++ b/src/app/bitstream-page/edit-bitstream-page/themed-edit-bitstream-page.component.ts @@ -3,9 +3,10 @@ import { EditBitstreamPageComponent } from './edit-bitstream-page.component'; import { ThemedComponent } from '../../shared/theme-support/themed.component'; @Component({ - selector: 'ds-themed-edit-bitstream-page', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-edit-bitstream-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedEditBitstreamPageComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/breadcrumbs/breadcrumbs.component.spec.ts b/src/app/breadcrumbs/breadcrumbs.component.spec.ts index 69387e75346..a52df4d8a4f 100644 --- a/src/app/breadcrumbs/breadcrumbs.component.spec.ts +++ b/src/app/breadcrumbs/breadcrumbs.component.spec.ts @@ -40,23 +40,21 @@ describe('BreadcrumbsComponent', () => { } as BreadcrumbsService; TestBed.configureTestingModule({ - declarations: [ - BreadcrumbsComponent, - VarDirective, - ], - imports: [ + imports: [ RouterTestingModule.withRoutes([]), TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock, - } + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock, + } }), - ], - providers: [ + BreadcrumbsComponent, + VarDirective + ], + providers: [ { provide: BreadcrumbsService, useValue: breadcrumbsServiceMock }, - ], - }).compileComponents(); + ] +}).compileComponents(); fixture = TestBed.createComponent(BreadcrumbsComponent); component = fixture.componentInstance; diff --git a/src/app/breadcrumbs/breadcrumbs.component.ts b/src/app/breadcrumbs/breadcrumbs.component.ts index 248fb446ed7..7511d47d055 100644 --- a/src/app/breadcrumbs/breadcrumbs.component.ts +++ b/src/app/breadcrumbs/breadcrumbs.component.ts @@ -2,6 +2,11 @@ import { Component } from '@angular/core'; import { Breadcrumb } from './breadcrumb/breadcrumb.model'; import { BreadcrumbsService } from './breadcrumbs.service'; import { Observable } from 'rxjs'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'; +import { RouterLink } from '@angular/router'; +import { AsyncPipe, NgFor, NgIf, NgTemplateOutlet } from '@angular/common'; +import { VarDirective } from '../shared/utils/var.directive'; /** * Component representing the breadcrumbs of a page @@ -9,7 +14,9 @@ import { Observable } from 'rxjs'; @Component({ selector: 'ds-breadcrumbs', templateUrl: './breadcrumbs.component.html', - styleUrls: ['./breadcrumbs.component.scss'] + styleUrls: ['./breadcrumbs.component.scss'], + standalone: true, + imports: [VarDirective, NgIf, NgTemplateOutlet, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule] }) export class BreadcrumbsComponent { diff --git a/src/app/breadcrumbs/themed-breadcrumbs.component.ts b/src/app/breadcrumbs/themed-breadcrumbs.component.ts index 1869a440b90..73efb811aec 100644 --- a/src/app/breadcrumbs/themed-breadcrumbs.component.ts +++ b/src/app/breadcrumbs/themed-breadcrumbs.component.ts @@ -6,9 +6,10 @@ import { BreadcrumbsComponent } from './breadcrumbs.component'; * Themed wrapper for BreadcrumbsComponent */ @Component({ - selector: 'ds-themed-breadcrumbs', - styleUrls: [], - templateUrl: '../shared/theme-support/themed.component.html', + selector: 'ds-themed-breadcrumbs', + styleUrls: [], + templateUrl: '../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedBreadcrumbsComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts index e41d3a45b25..d6bb0715c5d 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts @@ -85,9 +85,8 @@ describe('BrowseByDatePageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BrowseByDatePageComponent, EnumKeysPipe, VarDirective], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BrowseByDatePageComponent, EnumKeysPipe, VarDirective], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: BrowseService, useValue: mockBrowseService }, { provide: DSpaceObjectDataService, useValue: mockDsoService }, @@ -95,9 +94,9 @@ describe('BrowseByDatePageComponent', () => { { provide: PaginationService, useValue: paginationService }, { provide: ChangeDetectorRef, useValue: mockCdRef }, { provide: APP_CONFIG, useValue: environment } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts index 7074190e1eb..048cc0e6b07 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts @@ -19,11 +19,41 @@ import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface'; import { RemoteData } from '../../core/data/remote-data'; import { Item } from '../../core/shared/item.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { + ThemedComcolPageHandleComponent +} from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { BrowseByComponent } from '../../shared/browse-by/browse-by.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; @Component({ selector: 'ds-browse-by-date-page', styleUrls: ['../browse-by-metadata-page/browse-by-metadata-page.component.scss'], - templateUrl: '../browse-by-metadata-page/browse-by-metadata-page.component.html' + templateUrl: '../browse-by-metadata-page/browse-by-metadata-page.component.html', + standalone: true, + imports: [ + VarDirective, + AsyncPipe, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + NgIf, + ThemedComcolPageHandleComponent, + ComcolPageContentComponent, + DsoEditMenuComponent, + ThemedComcolPageBrowseByComponent, + BrowseByComponent, + TranslateModule, + ThemedLoadingComponent + ] }) /** * Component for browsing items by metadata definition of type 'date' diff --git a/src/app/browse-by/browse-by-date-page/themed-browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/themed-browse-by-date-page.component.ts index 8eeae0c5de5..c2548178364 100644 --- a/src/app/browse-by/browse-by-date-page/themed-browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/themed-browse-by-date-page.component.ts @@ -7,9 +7,10 @@ import {BrowseByDataType, rendersBrowseBy} from '../browse-by-switcher/browse-by * Themed wrapper for BrowseByDatePageComponent * */ @Component({ - selector: 'ds-themed-browse-by-metadata-page', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-browse-by-metadata-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) @rendersBrowseBy(BrowseByDataType.Date) diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts index a5beeb8a452..18aea01330a 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts @@ -102,18 +102,17 @@ describe('BrowseByMetadataPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BrowseByMetadataPageComponent, EnumKeysPipe, VarDirective], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BrowseByMetadataPageComponent, EnumKeysPipe, VarDirective], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: BrowseService, useValue: mockBrowseService }, { provide: DSpaceObjectDataService, useValue: mockDsoService }, { provide: PaginationService, useValue: paginationService }, { provide: Router, useValue: new RouterMock() }, { provide: APP_CONFIG, useValue: environmentMock } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts index 113bc67c924..0173e3f13c2 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts @@ -22,13 +22,43 @@ import { Collection } from '../../core/shared/collection.model'; import { Community } from '../../core/shared/community.model'; import { APP_CONFIG, AppConfig } from '../../../config/app-config.interface'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { + ThemedComcolPageHandleComponent +} from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { BrowseByComponent } from '../../shared/browse-by/browse-by.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; export const BBM_PAGINATION_ID = 'bbm'; @Component({ selector: 'ds-browse-by-metadata-page', styleUrls: ['./browse-by-metadata-page.component.scss'], - templateUrl: './browse-by-metadata-page.component.html' + templateUrl: './browse-by-metadata-page.component.html', + imports: [ + VarDirective, + AsyncPipe, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + NgIf, + ThemedComcolPageHandleComponent, + ComcolPageContentComponent, + DsoEditMenuComponent, + ThemedComcolPageBrowseByComponent, + BrowseByComponent, + TranslateModule, + ThemedLoadingComponent + ], + standalone: true }) /** * Component for browsing (items) by metadata definition. diff --git a/src/app/browse-by/browse-by-metadata-page/themed-browse-by-metadata-page.component.ts b/src/app/browse-by/browse-by-metadata-page/themed-browse-by-metadata-page.component.ts index b0679258e91..ff16fda15f2 100644 --- a/src/app/browse-by/browse-by-metadata-page/themed-browse-by-metadata-page.component.ts +++ b/src/app/browse-by/browse-by-metadata-page/themed-browse-by-metadata-page.component.ts @@ -7,9 +7,10 @@ import {BrowseByDataType, rendersBrowseBy} from '../browse-by-switcher/browse-by * Themed wrapper for BrowseByMetadataPageComponent **/ @Component({ - selector: 'ds-themed-browse-by-metadata-page', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-browse-by-metadata-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) @rendersBrowseBy(BrowseByDataType.Metadata) diff --git a/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.spec.ts b/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.spec.ts index c13405dd4d2..752693998d3 100644 --- a/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.spec.ts +++ b/src/app/browse-by/browse-by-switcher/browse-by-switcher.component.spec.ts @@ -57,14 +57,14 @@ describe('BrowseBySwitcherComponent', () => { }); TestBed.configureTestingModule({ - declarations: [BrowseBySwitcherComponent], - providers: [ + imports: [BrowseBySwitcherComponent], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: ThemeService, useValue: themeService }, { provide: BROWSE_BY_COMPONENT_FACTORY, useValue: jasmine.createSpy('getComponentByBrowseByType').and.returnValue(null) } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(waitForAsync(() => { 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 35e4edf9005..a32a06b233b 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 @@ -6,10 +6,13 @@ import { BROWSE_BY_COMPONENT_FACTORY } from './browse-by-decorator'; import { GenericConstructor } from '../../core/shared/generic-constructor'; import { BrowseDefinition } from '../../core/shared/browse-definition.model'; import { ThemeService } from '../../shared/theme-support/theme.service'; +import { AsyncPipe, NgComponentOutlet } from '@angular/common'; @Component({ selector: 'ds-browse-by-switcher', - templateUrl: './browse-by-switcher.component.html' + templateUrl: './browse-by-switcher.component.html', + imports: [AsyncPipe, NgComponentOutlet], + standalone: true }) /** * Component for determining what Browse-By component to use depending on the metadata (browse ID) provided diff --git a/src/app/browse-by/browse-by-switcher/themed-browse-by-switcher.component.ts b/src/app/browse-by/browse-by-switcher/themed-browse-by-switcher.component.ts index 0187d4e3c5e..9ba4ca89d9a 100644 --- a/src/app/browse-by/browse-by-switcher/themed-browse-by-switcher.component.ts +++ b/src/app/browse-by/browse-by-switcher/themed-browse-by-switcher.component.ts @@ -7,9 +7,10 @@ import { BrowseBySwitcherComponent } from './browse-by-switcher.component'; * Themed wrapper for BrowseBySwitcherComponent */ @Component({ - selector: 'ds-themed-browse-by-switcher', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html' + selector: 'ds-themed-browse-by-switcher', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedBrowseBySwitcherComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.spec.ts b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.spec.ts index c724017b1fd..dd6ec06b492 100644 --- a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.spec.ts +++ b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.spec.ts @@ -9,6 +9,7 @@ import { BehaviorSubject } from 'rxjs'; import { createDataWithBrowseDefinition } from '../browse-by-switcher/browse-by-switcher.component.spec'; import { HierarchicalBrowseDefinition } from '../../core/shared/hierarchical-browse-definition.model'; import { ThemeService } from '../../shared/theme-support/theme.service'; +import { VocabularyTreeviewComponent } from '../../shared/form/vocabulary-treeview/vocabulary-treeview.component'; describe('BrowseByTaxonomyPageComponent', () => { let component: BrowseByTaxonomyPageComponent; @@ -28,14 +29,16 @@ describe('BrowseByTaxonomyPageComponent', () => { }); await TestBed.configureTestingModule({ - imports: [ TranslateModule.forRoot() ], - declarations: [ BrowseByTaxonomyPageComponent ], - providers: [ + imports: [TranslateModule.forRoot(), BrowseByTaxonomyPageComponent], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: ThemeService, useValue: themeService }, - ], - schemas: [NO_ERRORS_SCHEMA] - }) + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(BrowseByTaxonomyPageComponent, { + remove: { imports: [VocabularyTreeviewComponent]} + }) .compileComponents(); }); diff --git a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts index cf6345bf394..e05ec22a13b 100644 --- a/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts +++ b/src/app/browse-by/browse-by-taxonomy-page/browse-by-taxonomy-page.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, Inject, OnDestroy } from '@angular/core'; import { VocabularyOptions } from '../../core/submission/vocabularies/models/vocabulary-options.model'; import { VocabularyEntryDetail } from '../../core/submission/vocabularies/models/vocabulary-entry-detail.model'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, RouterLink } from '@angular/router'; import { Observable, Subscription } from 'rxjs'; import { BrowseDefinition } from '../../core/shared/browse-definition.model'; import { GenericConstructor } from '../../core/shared/generic-constructor'; @@ -9,11 +9,19 @@ import { BROWSE_BY_COMPONENT_FACTORY } from '../browse-by-switcher/browse-by-dec import { map } from 'rxjs/operators'; import { ThemeService } from 'src/app/shared/theme-support/theme.service'; import { HierarchicalBrowseDefinition } from '../../core/shared/hierarchical-browse-definition.model'; +import { VocabularyTreeviewComponent } from '../../shared/form/vocabulary-treeview/vocabulary-treeview.component'; +import { TranslateModule } from '@ngx-translate/core'; @Component({ selector: 'ds-browse-by-taxonomy-page', templateUrl: './browse-by-taxonomy-page.component.html', - styleUrls: ['./browse-by-taxonomy-page.component.scss'] + styleUrls: ['./browse-by-taxonomy-page.component.scss'], + imports: [ + VocabularyTreeviewComponent, + RouterLink, + TranslateModule + ], + standalone: true }) /** * Component for browsing items by metadata in a hierarchical controlled vocabulary diff --git a/src/app/browse-by/browse-by-taxonomy-page/themed-browse-by-taxonomy-page.component.ts b/src/app/browse-by/browse-by-taxonomy-page/themed-browse-by-taxonomy-page.component.ts index 212044b8539..8e45056c735 100644 --- a/src/app/browse-by/browse-by-taxonomy-page/themed-browse-by-taxonomy-page.component.ts +++ b/src/app/browse-by/browse-by-taxonomy-page/themed-browse-by-taxonomy-page.component.ts @@ -4,9 +4,10 @@ import { rendersBrowseBy } from '../browse-by-switcher/browse-by-decorator'; import { BrowseByTaxonomyPageComponent } from './browse-by-taxonomy-page.component'; @Component({ - selector: 'ds-themed-browse-by-taxonomy-page', - templateUrl: '../../shared/theme-support/themed.component.html', - styleUrls: [] + selector: 'ds-themed-browse-by-taxonomy-page', + templateUrl: '../../shared/theme-support/themed.component.html', + styleUrls: [], + standalone: true }) /** * Themed wrapper for BrowseByTaxonomyPageComponent diff --git a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts index e32c0ac430d..3d17223eba0 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts @@ -22,6 +22,18 @@ import { PaginationService } from '../../core/pagination/pagination.service'; import { PaginationServiceStub } from '../../shared/testing/pagination-service.stub'; import { APP_CONFIG } from '../../../config/app-config.interface'; import { environment } from '../../../environments/environment'; +import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { + ThemedComcolPageHandleComponent +} from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { BrowseByComponent } from '../../shared/browse-by/browse-by.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; describe('BrowseByTitlePageComponent', () => { @@ -70,18 +82,30 @@ describe('BrowseByTitlePageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [BrowseByTitlePageComponent, EnumKeysPipe, VarDirective], - providers: [ + imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BrowseByTitlePageComponent, EnumKeysPipe, VarDirective], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: BrowseService, useValue: mockBrowseService }, { provide: DSpaceObjectDataService, useValue: mockDsoService }, { provide: PaginationService, useValue: paginationService }, { provide: Router, useValue: new RouterMock() }, { provide: APP_CONFIG, useValue: environment } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(BrowseByTitlePageComponent, { + remove: {imports: [ + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + ThemedComcolPageHandleComponent, + ComcolPageContentComponent, + DsoEditMenuComponent, + ThemedComcolPageBrowseByComponent, + BrowseByComponent, + ThemedLoadingComponent + ]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts index 58df79ebe85..71bf668e98d 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts @@ -14,11 +14,41 @@ import { map } from 'rxjs/operators'; import { PaginationComponentOptions } from '../../shared/pagination/pagination-component-options.model'; import { AppConfig, APP_CONFIG } from '../../../config/app-config.interface'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ComcolPageHeaderComponent } from '../../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { + ThemedComcolPageHandleComponent +} from '../../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { DsoEditMenuComponent } from '../../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { BrowseByComponent } from '../../shared/browse-by/browse-by.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; @Component({ - selector: 'ds-browse-by-title-page', - styleUrls: ['../browse-by-metadata-page/browse-by-metadata-page.component.scss'], - templateUrl: '../browse-by-metadata-page/browse-by-metadata-page.component.html' + selector: 'ds-browse-by-title-page', + styleUrls: ['../browse-by-metadata-page/browse-by-metadata-page.component.scss'], + templateUrl: '../browse-by-metadata-page/browse-by-metadata-page.component.html', + standalone: true, + imports: [ + VarDirective, + AsyncPipe, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + NgIf, + ThemedComcolPageHandleComponent, + ComcolPageContentComponent, + DsoEditMenuComponent, + ThemedComcolPageBrowseByComponent, + BrowseByComponent, + TranslateModule, + ThemedLoadingComponent + ], }) /** * Component for browsing items by title (dc.title) diff --git a/src/app/browse-by/browse-by-title-page/themed-browse-by-title-page.component.ts b/src/app/browse-by/browse-by-title-page/themed-browse-by-title-page.component.ts index 4a1bcc0bc11..35234d599c2 100644 --- a/src/app/browse-by/browse-by-title-page/themed-browse-by-title-page.component.ts +++ b/src/app/browse-by/browse-by-title-page/themed-browse-by-title-page.component.ts @@ -7,9 +7,10 @@ import {BrowseByDataType, rendersBrowseBy} from '../browse-by-switcher/browse-by * Themed wrapper for BrowseByTitlePageComponent */ @Component({ - selector: 'ds-themed-browse-by-title-page', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-browse-by-title-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) @rendersBrowseBy(BrowseByDataType.Title) diff --git a/src/app/browse-by/browse-by.module.ts b/src/app/browse-by/browse-by.module.ts index c0e2d3f9ff8..e82536a9e4a 100644 --- a/src/app/browse-by/browse-by.module.ts +++ b/src/app/browse-by/browse-by.module.ts @@ -29,21 +29,19 @@ const ENTRY_COMPONENTS = [ ]; @NgModule({ - imports: [ - SharedBrowseByModule, - CommonModule, - ComcolModule, - DsoPageModule, - FormModule, - ], - declarations: [ - BrowseBySwitcherComponent, - ThemedBrowseBySwitcherComponent, - ...ENTRY_COMPONENTS - ], - exports: [ - BrowseBySwitcherComponent - ] + imports: [ + SharedBrowseByModule, + CommonModule, + ComcolModule, + DsoPageModule, + FormModule, + BrowseBySwitcherComponent, + ThemedBrowseBySwitcherComponent, + ...ENTRY_COMPONENTS + ], + exports: [ + BrowseBySwitcherComponent + ] }) export class BrowseByModule { /** diff --git a/src/app/collection-page/collection-form/collection-form.component.ts b/src/app/collection-page/collection-form/collection-form.component.ts index aae200b4019..778fcca12b5 100644 --- a/src/app/collection-page/collection-form/collection-form.component.ts +++ b/src/app/collection-page/collection-form/collection-form.component.ts @@ -1,7 +1,7 @@ import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChange, SimpleChanges } from '@angular/core'; import { Observable } from 'rxjs'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { DynamicFormControlModel, DynamicFormOptionConfig, @@ -23,6 +23,11 @@ import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators' import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models'; import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type'; import { hasNoValue, isNotNull } from 'src/app/shared/empty.util'; +import { FormComponent } from '../../shared/form/form.component'; +import { UploaderComponent } from '../../shared/upload/uploader/uploader.component'; +import { AsyncPipe, NgClass, NgIf } from '@angular/common'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { VarDirective } from '../../shared/utils/var.directive'; /** @@ -31,7 +36,18 @@ import { hasNoValue, isNotNull } from 'src/app/shared/empty.util'; @Component({ selector: 'ds-collection-form', styleUrls: ['../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.scss'], - templateUrl: '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.html' + templateUrl: '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.html', + standalone: true, + imports: [ + FormComponent, + TranslateModule, + UploaderComponent, + AsyncPipe, + ComcolPageLogoComponent, + NgIf, + NgClass, + VarDirective + ], }) export class CollectionFormComponent extends ComColFormComponent implements OnInit, OnChanges { /** diff --git a/src/app/collection-page/collection-form/collection-form.module.ts b/src/app/collection-page/collection-form/collection-form.module.ts index ddf18f05869..88debb19575 100644 --- a/src/app/collection-page/collection-form/collection-form.module.ts +++ b/src/app/collection-page/collection-form/collection-form.module.ts @@ -6,17 +6,15 @@ import { ComcolModule } from '../../shared/comcol/comcol.module'; import { FormModule } from '../../shared/form/form.module'; @NgModule({ - imports: [ - ComcolModule, - FormModule, - SharedModule - ], - declarations: [ - CollectionFormComponent, - ], - exports: [ - CollectionFormComponent - ] + imports: [ + ComcolModule, + FormModule, + SharedModule, + CollectionFormComponent + ], + exports: [ + CollectionFormComponent + ] }) export class CollectionFormModule { diff --git a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts index db844b588f9..dede5dbdfb3 100644 --- a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts +++ b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.spec.ts @@ -168,9 +168,8 @@ describe('CollectionItemMapperComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule], - declarations: [CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective, ErrorComponent, LoadingComponent], - providers: [ + imports: [CommonModule, FormsModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, CollectionItemMapperComponent, ItemSelectComponent, SearchFormComponent, PaginationComponent, EnumKeysPipe, VarDirective, ErrorComponent, LoadingComponent], + providers: [ { provide: ActivatedRoute, useValue: activatedRouteStub }, { provide: Router, useValue: routerStub }, { provide: SearchConfigurationService, useValue: searchConfigServiceStub }, @@ -186,8 +185,8 @@ describe('CollectionItemMapperComponent', () => { { provide: GroupDataService, useValue: groupDataService }, { provide: LinkHeadService, useValue: linkHeadService }, { provide: ConfigurationDataService, useValue: configurationDataService }, - ] - }).overrideComponent(CollectionItemMapperComponent, { + ] +}).overrideComponent(CollectionItemMapperComponent, { set: { providers: [ { diff --git a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.ts b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.ts index e0e4aaf9302..11b788450f8 100644 --- a/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.ts +++ b/src/app/collection-page/collection-item-mapper/collection-item-mapper.component.ts @@ -20,7 +20,7 @@ import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { ItemDataService } from '../../core/data/item-data.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { isNotEmpty } from '../../shared/empty.util'; import { SEARCH_CONFIG_SERVICE } from '../../my-dspace-page/my-dspace-page.component'; @@ -30,6 +30,10 @@ import { SearchService } from '../../core/shared/search/search.service'; import { followLink } from '../../shared/utils/follow-link-config.model'; import { NoContent } from '../../core/shared/NoContent.model'; import { FeatureID } from '../../core/data/feature-authorization/feature-id'; +import { ThemedSearchFormComponent } from '../../shared/search-form/themed-search-form.component'; +import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ItemSelectComponent } from '../../shared/object-select/item-select/item-select.component'; @Component({ selector: 'ds-collection-item-mapper', @@ -45,7 +49,16 @@ import { FeatureID } from '../../core/data/feature-authorization/feature-id'; provide: SEARCH_CONFIG_SERVICE, useClass: SearchConfigurationService } - ] + ], + imports: [ + ThemedSearchFormComponent, + NgbNavModule, + TranslateModule, + AsyncPipe, + ItemSelectComponent, + NgIf + ], + standalone: true }) /** * Component used to map items to a collection diff --git a/src/app/collection-page/collection-page.component.ts b/src/app/collection-page/collection-page.component.ts index 16704cef52e..512c8407918 100644 --- a/src/app/collection-page/collection-page.component.ts +++ b/src/app/collection-page/collection-page.component.ts @@ -31,6 +31,26 @@ import { redirectOn4xx } from '../core/shared/authorized.operators'; import { BROWSE_LINKS_TO_FOLLOW } from '../core/browse/browse.service'; import { DSONameService } from '../core/breadcrumbs/dso-name.service'; import { APP_CONFIG, AppConfig } from '../../../src/config/app-config.interface'; +import { ComcolPageContentComponent } from '../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { ErrorComponent } from '../shared/error/error.component'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component'; +import { VarDirective } from '../shared/utils/var.directive'; +import { ComcolPageHeaderComponent } from '../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { + ThemedComcolPageHandleComponent +} from '../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { DsoEditMenuComponent } from '../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + DsoPageSubscriptionButtonComponent +} from '../shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { ObjectCollectionComponent } from '../shared/object-collection/object-collection.component'; @Component({ selector: 'ds-collection-page', @@ -40,7 +60,25 @@ import { APP_CONFIG, AppConfig } from '../../../src/config/app-config.interface' animations: [ fadeIn, fadeInOut - ] + ], + imports: [ + ComcolPageContentComponent, + ErrorComponent, + NgIf, + ThemedLoadingComponent, + TranslateModule, + ViewTrackerComponent, + VarDirective, + AsyncPipe, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + ThemedComcolPageHandleComponent, + DsoEditMenuComponent, + DsoPageSubscriptionButtonComponent, + ThemedComcolPageBrowseByComponent, + ObjectCollectionComponent + ], + standalone: true }) export class CollectionPageComponent implements OnInit { collectionRD$: Observable>; diff --git a/src/app/collection-page/collection-page.module.ts b/src/app/collection-page/collection-page.module.ts index 6bcefed2b72..ba908f9fcc1 100644 --- a/src/app/collection-page/collection-page.module.ts +++ b/src/app/collection-page/collection-page.module.ts @@ -20,29 +20,27 @@ import { DsoSharedModule } from '../dso-shared/dso-shared.module'; import { DsoPageModule } from '../shared/dso-page/dso-page.module'; @NgModule({ - imports: [ - CommonModule, - SharedModule, - CollectionPageRoutingModule, - StatisticsModule.forRoot(), - EditItemPageModule, - CollectionFormModule, - ComcolModule, - DsoSharedModule, - DsoPageModule, - ], - declarations: [ - CollectionPageComponent, - ThemedCollectionPageComponent, - CreateCollectionPageComponent, - DeleteCollectionPageComponent, - EditItemTemplatePageComponent, - ThemedEditItemTemplatePageComponent, - CollectionItemMapperComponent - ], - providers: [ - SearchService, - ], + imports: [ + CommonModule, + SharedModule, + CollectionPageRoutingModule, + StatisticsModule.forRoot(), + EditItemPageModule, + CollectionFormModule, + ComcolModule, + DsoSharedModule, + DsoPageModule, + CollectionPageComponent, + ThemedCollectionPageComponent, + CreateCollectionPageComponent, + DeleteCollectionPageComponent, + EditItemTemplatePageComponent, + ThemedEditItemTemplatePageComponent, + CollectionItemMapperComponent + ], + providers: [ + SearchService, + ] }) export class CollectionPageModule { diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.spec.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.spec.ts index 5a4295cb260..d062f39e958 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.spec.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.spec.ts @@ -22,22 +22,21 @@ describe('CreateCollectionPageComponent', () => { beforeEach(waitForAsync(() => { return TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [CreateCollectionPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, CreateCollectionPageComponent], + providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: CollectionDataService, useValue: {} }, { - provide: CommunityDataService, - useValue: { findById: () => observableOf({ payload: { name: 'test' } }) } + provide: CommunityDataService, + useValue: { findById: () => observableOf({ payload: { name: 'test' } }) } }, { provide: RouteService, useValue: { getQueryParameterValue: () => observableOf('1234') } }, { provide: Router, useValue: {} }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, - { provide: RequestService, useValue: {}} - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + { provide: RequestService, useValue: {} } + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/create-collection-page/create-collection-page.component.ts b/src/app/collection-page/create-collection-page/create-collection-page.component.ts index a8cf594c3b0..6ce30a1848d 100644 --- a/src/app/collection-page/create-collection-page/create-collection-page.component.ts +++ b/src/app/collection-page/create-collection-page/create-collection-page.component.ts @@ -6,9 +6,11 @@ import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/crea import { Collection } from '../../core/shared/collection.model'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { RequestService } from '../../core/data/request.service'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { CollectionFormComponent } from '../collection-form/collection-form.component'; +import { AsyncPipe } from '@angular/common'; /** * Component that represents the page where a user can create a new Collection @@ -16,7 +18,13 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-create-collection', styleUrls: ['./create-collection-page.component.scss'], - templateUrl: './create-collection-page.component.html' + templateUrl: './create-collection-page.component.html', + imports: [ + CollectionFormComponent, + TranslateModule, + AsyncPipe + ], + standalone: true }) export class CreateCollectionPageComponent extends CreateComColPageComponent { protected frontendURL = '/collections/'; diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.spec.ts b/src/app/collection-page/delete-collection-page/delete-collection-page.component.spec.ts index 9fc88932d07..b95b8958fbd 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.spec.ts +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.spec.ts @@ -19,17 +19,16 @@ describe('DeleteCollectionPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [DeleteCollectionPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, DeleteCollectionPageComponent], + providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: CollectionDataService, useValue: {} }, { provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } }, { provide: NotificationsService, useValue: {} }, { provide: RequestService, useValue: {} } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts index 0a1b87e58b3..20f676ff02d 100644 --- a/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts +++ b/src/app/collection-page/delete-collection-page/delete-collection-page.component.ts @@ -4,8 +4,10 @@ import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/dele import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CollectionDataService } from '../../core/data/collection-data.service'; import { Collection } from '../../core/shared/collection.model'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { VarDirective } from '../../shared/utils/var.directive'; /** * Component that represents the page where a user can delete an existing Collection @@ -13,7 +15,14 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-delete-collection', styleUrls: ['./delete-collection-page.component.scss'], - templateUrl: './delete-collection-page.component.html' + templateUrl: './delete-collection-page.component.html', + imports: [ + TranslateModule, + AsyncPipe, + NgIf, + VarDirective + ], + standalone: true }) export class DeleteCollectionPageComponent extends DeleteComColPageComponent { protected frontendURL = '/collections/'; diff --git a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts index 04da8bbcd92..5eaa42077ba 100644 --- a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.spec.ts @@ -8,8 +8,8 @@ xdescribe('CollectionAccessControlComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ CollectionAccessControlComponent ] - }) + imports: [CollectionAccessControlComponent] +}) .compileComponents(); }); diff --git a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.ts b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.ts index 4192fe5a9a3..17cfbf3bfd9 100644 --- a/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-access-control/collection-access-control.component.ts @@ -5,11 +5,21 @@ import { Community } from '../../../core/shared/community.model'; import { ActivatedRoute } from '@angular/router'; import { map } from 'rxjs/operators'; import { getFirstSucceededRemoteData } from '../../../core/shared/operators'; +import { + AccessControlFormContainerComponent +} from '../../../shared/access-control-form-container/access-control-form-container.component'; +import { AsyncPipe, NgIf } from '@angular/common'; @Component({ selector: 'ds-collection-access-control', templateUrl: './collection-access-control.component.html', styleUrls: ['./collection-access-control.component.scss'], + imports: [ + AccessControlFormContainerComponent, + NgIf, + AsyncPipe + ], + standalone: true }) export class CollectionAccessControlComponent implements OnInit { itemRD$: Observable>; diff --git a/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts index c8e529443a4..5a345d8baf2 100644 --- a/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.spec.ts @@ -10,6 +10,7 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { CollectionAuthorizationsComponent } from './collection-authorizations.component'; import { Collection } from '../../../core/shared/collection.model'; import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils'; +import { ResourcePoliciesComponent } from '../../../shared/resource-policies/resource-policies.component'; describe('CollectionAuthorizationsComponent', () => { let comp: CollectionAuthorizationsComponent; @@ -37,17 +38,21 @@ describe('CollectionAuthorizationsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - CommonModule - ], - declarations: [CollectionAuthorizationsComponent], - providers: [ + imports: [ + CommonModule, + CollectionAuthorizationsComponent + ], + providers: [ { provide: ActivatedRoute, useValue: routeStub }, ChangeDetectorRef, CollectionAuthorizationsComponent, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(CollectionAuthorizationsComponent, { + remove: { imports: [ResourcePoliciesComponent] } + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.ts b/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.ts index d1b59a0c903..3c84c4ccbbd 100644 --- a/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-authorizations/collection-authorizations.component.ts @@ -6,10 +6,17 @@ import { first, map } from 'rxjs/operators'; import { RemoteData } from '../../../core/data/remote-data'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; +import { ResourcePoliciesComponent } from '../../../shared/resource-policies/resource-policies.component'; +import { AsyncPipe } from '@angular/common'; @Component({ selector: 'ds-collection-authorizations', templateUrl: './collection-authorizations.component.html', + imports: [ + ResourcePoliciesComponent, + AsyncPipe + ], + standalone: true }) /** * Component that handles the Collection Authorizations diff --git a/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts index 2cf25734e12..193a1637c1c 100644 --- a/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.spec.ts @@ -7,6 +7,7 @@ import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.ut import { Collection } from '../../../core/shared/collection.model'; import { ActivatedRoute } from '@angular/router'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; +import { CurationFormComponent } from '../../../curation-form/curation-form.component'; describe('CollectionCurateComponent', () => { let comp: CollectionCurateComponent; @@ -34,14 +35,17 @@ describe('CollectionCurateComponent', () => { }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], - declarations: [CollectionCurateComponent], - providers: [ - {provide: ActivatedRoute, useValue: routeStub}, - {provide: DSONameService, useValue: dsoNameService} - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + imports: [TranslateModule.forRoot(), CollectionCurateComponent], + providers: [ + { provide: ActivatedRoute, useValue: routeStub }, + { provide: DSONameService, useValue: dsoNameService } + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) + .overrideComponent(CollectionCurateComponent, { + remove: { imports: [CurationFormComponent]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.ts b/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.ts index e20f229cd64..2a09a6e00fc 100644 --- a/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-curate/collection-curate.component.ts @@ -6,6 +6,9 @@ import { ActivatedRoute } from '@angular/router'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { Collection } from '../../../core/shared/collection.model'; import { hasValue } from '../../../shared/empty.util'; +import { CurationFormComponent } from '../../../curation-form/curation-form.component'; +import { TranslateModule } from '@ngx-translate/core'; +import { AsyncPipe } from '@angular/common'; /** * Component for managing a collection's curation tasks @@ -13,6 +16,12 @@ import { hasValue } from '../../../shared/empty.util'; @Component({ selector: 'ds-collection-curate', templateUrl: './collection-curate.component.html', + imports: [ + CurationFormComponent, + TranslateModule, + AsyncPipe + ], + standalone: true }) export class CollectionCurateComponent { dsoRD$: Observable>; diff --git a/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts index 7cc54bd994c..e9575a15ba1 100644 --- a/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.spec.ts @@ -59,18 +59,17 @@ describe('CollectionMetadataComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [CollectionMetadataComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, CollectionMetadataComponent], + providers: [ { provide: CollectionDataService, useValue: {} }, { provide: ItemTemplateDataService, useValue: itemTemplateServiceStub }, { provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: createSuccessfulRemoteDataObject(collection) }) } } }, { provide: NotificationsService, useValue: notificationsService }, { provide: RequestService, useValue: requestService }, - { provide: Router, useValue: routerMock} - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + { provide: Router, useValue: routerMock } + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.ts b/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.ts index 634363527f7..0d075d6db94 100644 --- a/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-metadata/collection-metadata.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; import { ComcolMetadataComponent } from '../../../shared/comcol/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component'; import { Collection } from '../../../core/shared/collection.model'; import { CollectionDataService } from '../../../core/data/collection-data.service'; -import { ActivatedRoute, NavigationEnd, Router, Scroll } from '@angular/router'; +import { ActivatedRoute, NavigationEnd, Router, RouterLink, Scroll } from '@angular/router'; import { ItemTemplateDataService } from '../../../core/data/item-template-data.service'; import { combineLatest as combineLatestObservable, Observable } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; @@ -10,11 +10,14 @@ import { Item } from '../../../core/shared/item.model'; import { getFirstCompletedRemoteData, getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators'; import { map, switchMap } from 'rxjs/operators'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { RequestService } from '../../../core/data/request.service'; import { getCollectionItemTemplateRoute } from '../../collection-page-routing-paths'; import { NoContent } from '../../../core/shared/NoContent.model'; import { hasValue } from '../../../shared/empty.util'; +import { CollectionFormComponent } from '../../collection-form/collection-form.component'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { VarDirective } from '../../../shared/utils/var.directive'; /** * Component for editing a collection's metadata @@ -22,6 +25,15 @@ import { hasValue } from '../../../shared/empty.util'; @Component({ selector: 'ds-collection-metadata', templateUrl: './collection-metadata.component.html', + imports: [ + CollectionFormComponent, + RouterLink, + AsyncPipe, + TranslateModule, + NgIf, + VarDirective + ], + standalone: true }) export class CollectionMetadataComponent extends ComcolMetadataComponent implements OnInit { protected frontendURL = '/collections/'; diff --git a/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.spec.ts index c375a23ddf9..fd75a001733 100644 --- a/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.spec.ts @@ -69,25 +69,23 @@ describe('CollectionRolesComponent', () => { }; TestBed.configureTestingModule({ - imports: [ + imports: [ ComcolModule, SharedModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), - NoopAnimationsModule - ], - declarations: [ - CollectionRolesComponent, - ], - providers: [ + NoopAnimationsModule, + CollectionRolesComponent + ], + providers: [ { provide: ActivatedRoute, useValue: route }, { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: RequestService, useValue: requestService }, { provide: GroupDataService, useValue: groupDataService }, { provide: NotificationsService, useClass: NotificationsServiceStub } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); fixture = TestBed.createComponent(CollectionRolesComponent); comp = fixture.componentInstance; diff --git a/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.ts b/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.ts index 0177cc3a386..7049168eeb9 100644 --- a/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-roles/collection-roles.component.ts @@ -7,6 +7,10 @@ import { Collection } from '../../../core/shared/collection.model'; import { getRemoteDataPayload, getFirstSucceededRemoteData } from '../../../core/shared/operators'; import { HALLink } from '../../../core/shared/hal-link.model'; import { hasValue } from '../../../shared/empty.util'; +import { + ComcolRoleComponent +} from '../../../shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component'; +import { AsyncPipe, NgForOf } from '@angular/common'; /** * Component for managing a collection's roles @@ -14,6 +18,12 @@ import { hasValue } from '../../../shared/empty.util'; @Component({ selector: 'ds-collection-roles', templateUrl: './collection-roles.component.html', + imports: [ + ComcolRoleComponent, + NgForOf, + AsyncPipe + ], + standalone: true }) export class CollectionRolesComponent implements OnInit { diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts index 3eb83ebe8ac..54af5296e70 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.spec.ts @@ -99,19 +99,18 @@ describe('CollectionSourceControlsComponent', () => { requestService = jasmine.createSpyObj('requestService', ['removeByHrefSubstring', 'setStaleByHrefSubstring']); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [CollectionSourceControlsComponent, VarDirective], - providers: [ - {provide: ScriptDataService, useValue: scriptDataService}, - {provide: ProcessDataService, useValue: processDataService}, - {provide: RequestService, useValue: requestService}, - {provide: NotificationsService, useValue: notificationsService}, - {provide: CollectionDataService, useValue: collectionService}, - {provide: HttpClient, useValue: httpClient}, - {provide: BitstreamDataService, useValue: bitstreamService} - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + imports: [TranslateModule.forRoot(), RouterTestingModule, CollectionSourceControlsComponent, VarDirective], + providers: [ + { provide: ScriptDataService, useValue: scriptDataService }, + { provide: ProcessDataService, useValue: processDataService }, + { provide: RequestService, useValue: requestService }, + { provide: NotificationsService, useValue: notificationsService }, + { provide: CollectionDataService, useValue: collectionService }, + { provide: HttpClient, useValue: httpClient }, + { provide: BitstreamDataService, useValue: bitstreamService } + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(CollectionSourceControlsComponent); diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts index 7113c25e9f6..f96fad01871 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source-controls/collection-source-controls.component.ts @@ -17,10 +17,12 @@ import { NotificationsService } from '../../../../shared/notifications/notificat import { Collection } from '../../../../core/shared/collection.model'; import { CollectionDataService } from '../../../../core/data/collection-data.service'; import { Process } from '../../../../process-page/processes/process.model'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { HttpClient } from '@angular/common/http'; import { BitstreamDataService } from '../../../../core/data/bitstream-data.service'; import { ContentSourceSetSerializer } from '../../../../core/shared/content-source-set-serializer'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { VarDirective } from '../../../../shared/utils/var.directive'; /** * Component that contains the controls to run, reset and test the harvest @@ -29,6 +31,13 @@ import { ContentSourceSetSerializer } from '../../../../core/shared/content-sour selector: 'ds-collection-source-controls', styleUrls: ['./collection-source-controls.component.scss'], templateUrl: './collection-source-controls.component.html', + imports: [ + TranslateModule, + AsyncPipe, + NgIf, + VarDirective + ], + standalone: true }) export class CollectionSourceControlsComponent implements OnDestroy { diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts index e7e98d95233..890e221c6b4 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts @@ -20,6 +20,9 @@ import { CollectionDataService } from '../../../core/data/collection-data.servic import { RequestService } from '../../../core/data/request.service'; import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { FieldUpdate } from '../../../core/data/object-updates/field-update.model'; +import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component'; +import { FormComponent } from '../../../shared/form/form.component'; +import { CollectionSourceControlsComponent } from './collection-source-controls/collection-source-controls.component'; const infoNotification: INotification = new Notification('id', NotificationType.Info, 'info'); const warningNotification: INotification = new Notification('id', NotificationType.Warning, 'warning'); @@ -119,9 +122,8 @@ describe('CollectionSourceComponent', () => { requestService = jasmine.createSpyObj('requestService', ['removeByHrefSubstring', 'setStaleByHrefSubstring']); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), RouterTestingModule], - declarations: [CollectionSourceComponent], - providers: [ + imports: [TranslateModule.forRoot(), RouterTestingModule, CollectionSourceComponent], + providers: [ { provide: ObjectUpdatesService, useValue: objectUpdatesService }, { provide: NotificationsService, useValue: notificationsService }, { provide: Location, useValue: location }, @@ -130,9 +132,17 @@ describe('CollectionSourceComponent', () => { { provide: Router, useValue: router }, { provide: CollectionDataService, useValue: collectionService }, { provide: RequestService, useValue: requestService } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}) + .overrideComponent(CollectionSourceComponent, { + remove: { imports: [ + ThemedLoadingComponent, + FormComponent, + CollectionSourceControlsComponent + ]} + }) + .compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts index 2d1308cc83a..4a77e1ac4aa 100644 --- a/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts +++ b/src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts @@ -10,8 +10,8 @@ import { DynamicRadioGroupModel, DynamicSelectModel } from '@ng-dynamic-forms/core'; -import { Location } from '@angular/common'; -import { TranslateService } from '@ngx-translate/core'; +import { AsyncPipe, Location, NgIf } from '@angular/common'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { UntypedFormGroup } from '@angular/forms'; @@ -31,6 +31,9 @@ import { RequestService } from '../../../core/data/request.service'; import { environment } from '../../../../environments/environment'; import { FieldUpdate } from '../../../core/data/object-updates/field-update.model'; import { FieldUpdates } from '../../../core/data/object-updates/field-updates.model'; +import { ThemedLoadingComponent } from "../../../shared/loading/themed-loading.component"; +import { FormComponent } from "../../../shared/form/form.component"; +import { CollectionSourceControlsComponent } from "./collection-source-controls/collection-source-controls.component"; /** * Component for managing the content source of the collection @@ -38,6 +41,15 @@ import { FieldUpdates } from '../../../core/data/object-updates/field-updates.mo @Component({ selector: 'ds-collection-source', templateUrl: './collection-source.component.html', + imports: [ + AsyncPipe, + TranslateModule, + NgIf, + ThemedLoadingComponent, + FormComponent, + CollectionSourceControlsComponent + ], + standalone: true }) export class CollectionSourceComponent extends AbstractTrackableComponent implements OnInit, OnDestroy { /** diff --git a/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts b/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts index 00f05f50c0f..c60a34f8b9d 100644 --- a/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts +++ b/src/app/collection-page/edit-collection-page/edit-collection-page.component.spec.ts @@ -38,14 +38,13 @@ describe('EditCollectionPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [EditCollectionPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, EditCollectionPageComponent], + providers: [ { provide: CollectionDataService, useValue: {} }, { provide: ActivatedRoute, useValue: routeStub }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-collection-page/edit-collection-page.component.ts b/src/app/collection-page/edit-collection-page/edit-collection-page.component.ts index 62fbb3ee3df..da037696b7b 100644 --- a/src/app/collection-page/edit-collection-page/edit-collection-page.component.ts +++ b/src/app/collection-page/edit-collection-page/edit-collection-page.component.ts @@ -1,15 +1,27 @@ import { Component } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, RouterLink, RouterOutlet } from '@angular/router'; import { EditComColPageComponent } from '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component'; import { Collection } from '../../core/shared/collection.model'; import { getCollectionPageRoute } from '../collection-page-routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; /** * Component that represents the page where a user can edit an existing Collection */ @Component({ selector: 'ds-edit-collection', - templateUrl: '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html' + templateUrl: '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html', + imports: [ + RouterLink, + TranslateModule, + NgClass, + NgForOf, + RouterOutlet, + NgIf, + AsyncPipe + ], + standalone: true }) export class EditCollectionPageComponent extends EditComColPageComponent { type = 'collection'; diff --git a/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts b/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts index 8d0cb179f1f..adaa964a7c6 100644 --- a/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts +++ b/src/app/collection-page/edit-collection-page/edit-collection-page.module.ts @@ -22,26 +22,24 @@ import { AccessControlFormModule } from '../../shared/access-control-form-contai * Module that contains all components related to the Edit Collection page administrator functionality */ @NgModule({ - imports: [ - CommonModule, - SharedModule, - EditCollectionPageRoutingModule, - CollectionFormModule, - ResourcePoliciesModule, - FormModule, - ComcolModule, - AccessControlFormModule, - ], - declarations: [ - EditCollectionPageComponent, - CollectionMetadataComponent, - CollectionRolesComponent, - CollectionCurateComponent, - CollectionSourceComponent, - CollectionAccessControlComponent, - CollectionSourceControlsComponent, - CollectionAuthorizationsComponent - ] + imports: [ + CommonModule, + SharedModule, + EditCollectionPageRoutingModule, + CollectionFormModule, + ResourcePoliciesModule, + FormModule, + ComcolModule, + AccessControlFormModule, + EditCollectionPageComponent, + CollectionMetadataComponent, + CollectionRolesComponent, + CollectionCurateComponent, + CollectionSourceComponent, + CollectionAccessControlComponent, + CollectionSourceControlsComponent, + CollectionAuthorizationsComponent + ] }) export class EditCollectionPageModule { diff --git a/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts b/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts index 72b776dd7d5..248c70758bf 100644 --- a/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts +++ b/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.spec.ts @@ -28,14 +28,13 @@ describe('EditItemTemplatePageComponent', () => { findByCollectionID: createSuccessfulRemoteDataObject$({}) }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [EditItemTemplatePageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, EditItemTemplatePageComponent], + providers: [ { provide: ItemTemplateDataService, useValue: itemTemplateService }, { provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: createSuccessfulRemoteDataObject(collection) }) } } } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.ts b/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.ts index 238ec5e37a2..6c42e5420a1 100644 --- a/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.ts +++ b/src/app/collection-page/edit-item-template-page/edit-item-template-page.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { RemoteData } from '../../core/data/remote-data'; import { Collection } from '../../core/shared/collection.model'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, RouterLink } from '@angular/router'; import { first, map, switchMap } from 'rxjs/operators'; import { ItemTemplateDataService } from '../../core/data/item-template-data.service'; import { getCollectionEditRoute } from '../collection-page-routing-paths'; @@ -10,10 +10,27 @@ import { Item } from '../../core/shared/item.model'; import { getFirstSucceededRemoteDataPayload } from '../../core/shared/operators'; import { AlertType } from '../../shared/alert/alert-type'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { ThemedDsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/themed-dso-edit-metadata.component'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { AlertComponent } from '../../shared/alert/alert.component'; @Component({ selector: 'ds-edit-item-template-page', templateUrl: './edit-item-template-page.component.html', + imports: [ + ThemedDsoEditMetadataComponent, + RouterLink, + AsyncPipe, + VarDirective, + NgIf, + TranslateModule, + ThemedLoadingComponent, + AlertComponent + ], + standalone: true }) /** * Component for editing the item template of a collection diff --git a/src/app/collection-page/edit-item-template-page/themed-edit-item-template-page.component.ts b/src/app/collection-page/edit-item-template-page/themed-edit-item-template-page.component.ts index b53f4e6c45d..4679c0e18d1 100644 --- a/src/app/collection-page/edit-item-template-page/themed-edit-item-template-page.component.ts +++ b/src/app/collection-page/edit-item-template-page/themed-edit-item-template-page.component.ts @@ -3,9 +3,10 @@ import { ThemedComponent } from '../../shared/theme-support/themed.component'; import { EditItemTemplatePageComponent } from './edit-item-template-page.component'; @Component({ - selector: 'ds-themed-edit-item-template-page', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-edit-item-template-page', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) /** * Component for editing the item template of a collection diff --git a/src/app/collection-page/themed-collection-page.component.ts b/src/app/collection-page/themed-collection-page.component.ts index 2faf418423a..fab3bfa83d8 100644 --- a/src/app/collection-page/themed-collection-page.component.ts +++ b/src/app/collection-page/themed-collection-page.component.ts @@ -6,9 +6,10 @@ import { CollectionPageComponent } from './collection-page.component'; * Themed wrapper for CollectionPageComponent */ @Component({ - selector: 'ds-themed-collection-page', - styleUrls: [], - templateUrl: '../shared/theme-support/themed.component.html', + selector: 'ds-themed-collection-page', + styleUrls: [], + templateUrl: '../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCollectionPageComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/community-list-page/community-list-page.component.spec.ts b/src/app/community-list-page/community-list-page.component.spec.ts index 080a0a9e18d..0e1230a4122 100644 --- a/src/app/community-list-page/community-list-page.component.spec.ts +++ b/src/app/community-list-page/community-list-page.component.spec.ts @@ -11,20 +11,20 @@ describe('CommunityListPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - }, + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + }, }), - ], - declarations: [CommunityListPageComponent], - providers: [ + CommunityListPageComponent + ], + providers: [ CommunityListPageComponent, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }) + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) .compileComponents(); })); diff --git a/src/app/community-list-page/community-list-page.component.ts b/src/app/community-list-page/community-list-page.component.ts index 5ab3cce5de3..a2e511f8a9e 100644 --- a/src/app/community-list-page/community-list-page.component.ts +++ b/src/app/community-list-page/community-list-page.component.ts @@ -1,12 +1,16 @@ import { Component } from '@angular/core'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedCommunityListComponent } from './community-list/themed-community-list.component'; /** * Page with title and the community list tree, as described in community-list.component; * navigated to with community-list.page.routing.module */ @Component({ - selector: 'ds-community-list-page', - templateUrl: './community-list-page.component.html', + selector: 'ds-community-list-page', + templateUrl: './community-list-page.component.html', + standalone: true, + imports: [ThemedCommunityListComponent, TranslateModule] }) export class CommunityListPageComponent { diff --git a/src/app/community-list-page/community-list-page.module.ts b/src/app/community-list-page/community-list-page.module.ts index 15946b2e89a..73b7ed64211 100644 --- a/src/app/community-list-page/community-list-page.module.ts +++ b/src/app/community-list-page/community-list-page.module.ts @@ -19,19 +19,17 @@ const DECLARATIONS = [ * The page which houses a title and the community list, as described in community-list.component */ @NgModule({ - imports: [ - CommonModule, - SharedModule, - CommunityListPageRoutingModule, - CdkTreeModule, - ], - declarations: [ - ...DECLARATIONS - ], - exports: [ - ...DECLARATIONS, - CdkTreeModule, - ], + imports: [ + CommonModule, + SharedModule, + CommunityListPageRoutingModule, + CdkTreeModule, + ...DECLARATIONS + ], + exports: [ + ...DECLARATIONS, + CdkTreeModule, + ] }) export class CommunityListPageModule { diff --git a/src/app/community-list-page/community-list/community-list.component.spec.ts b/src/app/community-list-page/community-list/community-list.component.spec.ts index ce6b27dbeb2..31dd9feaccd 100644 --- a/src/app/community-list-page/community-list/community-list.component.spec.ts +++ b/src/app/community-list-page/community-list/community-list.component.spec.ts @@ -17,6 +17,9 @@ import { By } from '@angular/platform-browser'; import { isEmpty, isNotEmpty } from '../../shared/empty.util'; import { FlatNode } from '../flat-node.model'; import { RouterLinkWithHref } from '@angular/router'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { TruncatableComponent } from '../../shared/truncatable/truncatable.component'; +import { TruncatablePartComponent } from '../../shared/truncatable/truncatable-part/truncatable-part.component'; describe('CommunityListComponent', () => { let component: CommunityListComponent; @@ -186,21 +189,30 @@ describe('CommunityListComponent', () => { } }; TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useClass: TranslateLoaderMock - }, + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderMock + }, }), CdkTreeModule, RouterTestingModule, - RouterLinkWithHref], - declarations: [CommunityListComponent], - providers: [CommunityListComponent, + RouterLinkWithHref, + CommunityListComponent + ], + providers: [CommunityListComponent, { provide: CommunityListService, useValue: communityListServiceStub },], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }) + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}) + .overrideComponent(CommunityListComponent, { + remove: { + imports: [ + ThemedLoadingComponent, + TruncatableComponent, + TruncatablePartComponent, + ]} + }) .compileComponents(); })); diff --git a/src/app/community-list-page/community-list/community-list.component.ts b/src/app/community-list-page/community-list/community-list.component.ts index 90dd6b3c05d..ba5adc51162 100644 --- a/src/app/community-list-page/community-list/community-list.component.ts +++ b/src/app/community-list-page/community-list/community-list.component.ts @@ -1,13 +1,19 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { take } from 'rxjs/operators'; import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model'; -import { CommunityListService} from '../community-list-service'; +import { CommunityListService } from '../community-list-service'; import { CommunityListDatasource } from '../community-list-datasource'; -import { FlatTreeControl } from '@angular/cdk/tree'; +import { CdkTreeModule, FlatTreeControl } from '@angular/cdk/tree'; import { isEmpty } from '../../shared/empty.util'; import { FlatNode } from '../flat-node.model'; import { FindListOptions } from '../../core/data/find-list-options.model'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { TruncatablePartComponent } from '../../shared/truncatable/truncatable-part/truncatable-part.component'; +import { TruncatableComponent } from '../../shared/truncatable/truncatable.component'; +import { RouterLink } from '@angular/router'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { AsyncPipe, NgClass, NgIf } from '@angular/common'; /** * A tree-structured list of nodes representing the communities, their subCommunities and collections. @@ -19,6 +25,8 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-community-list', templateUrl: './community-list.component.html', + standalone: true, + imports: [NgIf, ThemedLoadingComponent, CdkTreeModule, NgClass, RouterLink, TruncatableComponent, TruncatablePartComponent, AsyncPipe, TranslateModule] }) export class CommunityListComponent implements OnInit, OnDestroy { diff --git a/src/app/community-list-page/community-list/themed-community-list.component.ts b/src/app/community-list-page/community-list/themed-community-list.component.ts index 4a986e737c1..62f4cb306ac 100644 --- a/src/app/community-list-page/community-list/themed-community-list.component.ts +++ b/src/app/community-list-page/community-list/themed-community-list.component.ts @@ -4,9 +4,10 @@ import { Component } from '@angular/core'; @Component({ - selector: 'ds-themed-community-list', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-community-list', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCommunityListComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/community-list-page/themed-community-list-page.component.ts b/src/app/community-list-page/themed-community-list-page.component.ts index 20fa97bedd1..8b0cb4e281d 100644 --- a/src/app/community-list-page/themed-community-list-page.component.ts +++ b/src/app/community-list-page/themed-community-list-page.component.ts @@ -6,9 +6,10 @@ import { CommunityListPageComponent } from './community-list-page.component'; * Themed wrapper for CommunityListPageComponent */ @Component({ - selector: 'ds-themed-community-list-page', - styleUrls: [], - templateUrl: '../shared/theme-support/themed.component.html', + selector: 'ds-themed-community-list-page', + styleUrls: [], + templateUrl: '../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCommunityListPageComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/community-page/community-form/community-form.component.ts b/src/app/community-page/community-form/community-form.component.ts index fa4809738d9..c718ec6ef8a 100644 --- a/src/app/community-page/community-form/community-form.component.ts +++ b/src/app/community-page/community-form/community-form.component.ts @@ -7,13 +7,18 @@ import { } from '@ng-dynamic-forms/core'; import { Community } from '../../core/shared/community.model'; import { ComColFormComponent } from '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { CommunityDataService } from '../../core/data/community-data.service'; import { AuthService } from '../../core/auth/auth.service'; import { RequestService } from '../../core/data/request.service'; import { ObjectCacheService } from '../../core/cache/object-cache.service'; import { environment } from '../../../environments/environment'; +import { FormComponent } from '../../shared/form/form.component'; +import { UploaderComponent } from '../../shared/upload/uploader/uploader.component'; +import { AsyncPipe, NgClass, NgIf } from '@angular/common'; +import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { VarDirective } from '../../shared/utils/var.directive'; /** * Form used for creating and editing communities @@ -21,7 +26,18 @@ import { environment } from '../../../environments/environment'; @Component({ selector: 'ds-community-form', styleUrls: ['../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.scss'], - templateUrl: '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.html' + templateUrl: '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component.html', + standalone: true, + imports: [ + FormComponent, + TranslateModule, + UploaderComponent, + AsyncPipe, + ComcolPageLogoComponent, + NgIf, + NgClass, + VarDirective + ], }) export class CommunityFormComponent extends ComColFormComponent implements OnChanges { /** diff --git a/src/app/community-page/community-form/community-form.module.ts b/src/app/community-page/community-form/community-form.module.ts index 925d218973f..a8bddb5ffed 100644 --- a/src/app/community-page/community-form/community-form.module.ts +++ b/src/app/community-page/community-form/community-form.module.ts @@ -6,17 +6,15 @@ import { ComcolModule } from '../../shared/comcol/comcol.module'; import { FormModule } from '../../shared/form/form.module'; @NgModule({ - imports: [ - ComcolModule, - FormModule, - SharedModule - ], - declarations: [ - CommunityFormComponent, - ], - exports: [ - CommunityFormComponent - ] + imports: [ + ComcolModule, + FormModule, + SharedModule, + CommunityFormComponent + ], + exports: [ + CommunityFormComponent + ] }) export class CommunityFormModule { diff --git a/src/app/community-page/community-page.component.ts b/src/app/community-page/community-page.component.ts index a5bbff3cee7..9dd045957a6 100644 --- a/src/app/community-page/community-page.component.ts +++ b/src/app/community-page/community-page.component.ts @@ -20,13 +20,57 @@ import { FeatureID } from '../core/data/feature-authorization/feature-id'; import { getCommunityPageRoute } from './community-page-routing-paths'; import { redirectOn4xx } from '../core/shared/authorized.operators'; import { DSONameService } from '../core/breadcrumbs/dso-name.service'; +import { ComcolPageContentComponent } from '../shared/comcol/comcol-page-content/comcol-page-content.component'; +import { ErrorComponent } from '../shared/error/error.component'; +import { ThemedLoadingComponent } from '../shared/loading/themed-loading.component'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { + ThemedCommunityPageSubCommunityListComponent +} from './sub-community-list/themed-community-page-sub-community-list.component'; +import { + ThemedCollectionPageSubCollectionListComponent +} from './sub-collection-list/themed-community-page-sub-collection-list.component'; +import { + ThemedComcolPageBrowseByComponent +} from '../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { DsoEditMenuComponent } from '../shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { + DsoPageSubscriptionButtonComponent +} from '../shared/dso-page/dso-page-subscription-button/dso-page-subscription-button.component'; +import { + ThemedComcolPageHandleComponent +} from '../shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageLogoComponent } from '../shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { ComcolPageHeaderComponent } from '../shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component'; +import { VarDirective } from '../shared/utils/var.directive'; @Component({ selector: 'ds-community-page', styleUrls: ['./community-page.component.scss'], templateUrl: './community-page.component.html', changeDetection: ChangeDetectionStrategy.OnPush, - animations: [fadeInOut] + animations: [fadeInOut], + imports: [ + ComcolPageContentComponent, + ErrorComponent, + ThemedLoadingComponent, + NgIf, + TranslateModule, + ThemedCommunityPageSubCommunityListComponent, + ThemedCollectionPageSubCollectionListComponent, + ThemedComcolPageBrowseByComponent, + DsoEditMenuComponent, + DsoPageSubscriptionButtonComponent, + ThemedComcolPageHandleComponent, + ComcolPageLogoComponent, + ComcolPageHeaderComponent, + AsyncPipe, + ViewTrackerComponent, + VarDirective + ], + standalone: true }) /** * This component represents a detail page for a single community diff --git a/src/app/community-page/community-page.module.ts b/src/app/community-page/community-page.module.ts index 45ffb2a7868..d997351bca6 100644 --- a/src/app/community-page/community-page.module.ts +++ b/src/app/community-page/community-page.module.ts @@ -31,21 +31,19 @@ const DECLARATIONS = [CommunityPageComponent, DeleteCommunityPageComponent]; @NgModule({ - imports: [ - CommonModule, - SharedModule, - CommunityPageRoutingModule, - StatisticsModule.forRoot(), - CommunityFormModule, - ComcolModule, - DsoPageModule, - ], - declarations: [ - ...DECLARATIONS - ], - exports: [ - ...DECLARATIONS - ] + imports: [ + CommonModule, + SharedModule, + CommunityPageRoutingModule, + StatisticsModule.forRoot(), + CommunityFormModule, + ComcolModule, + DsoPageModule, + ...DECLARATIONS + ], + exports: [ + ...DECLARATIONS + ] }) export class CommunityPageModule { diff --git a/src/app/community-page/create-community-page/create-community-page.component.spec.ts b/src/app/community-page/create-community-page/create-community-page.component.spec.ts index fbff82efd86..55681a05090 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.spec.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.spec.ts @@ -19,17 +19,16 @@ describe('CreateCommunityPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [CreateCommunityPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, CreateCommunityPageComponent], + providers: [ { provide: CommunityDataService, useValue: { findById: () => observableOf({}) } }, { provide: RouteService, useValue: { getQueryParameterValue: () => observableOf('1234') } }, { provide: Router, useValue: {} }, { provide: NotificationsService, useValue: new NotificationsServiceStub() }, { provide: RequestService, useValue: {} } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/create-community-page/create-community-page.component.ts b/src/app/community-page/create-community-page/create-community-page.component.ts index eea09083887..b0756c12758 100644 --- a/src/app/community-page/create-community-page/create-community-page.component.ts +++ b/src/app/community-page/create-community-page/create-community-page.component.ts @@ -5,9 +5,12 @@ import { RouteService } from '../../core/services/route.service'; import { Router } from '@angular/router'; import { CreateComColPageComponent } from '../../shared/comcol/comcol-forms/create-comcol-page/create-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { RequestService } from '../../core/data/request.service'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { CommunityFormComponent } from '../community-form/community-form.component'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { AsyncPipe, NgIf } from '@angular/common'; /** * Component that represents the page where a user can create a new Community @@ -15,7 +18,15 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-create-community', styleUrls: ['./create-community-page.component.scss'], - templateUrl: './create-community-page.component.html' + templateUrl: './create-community-page.component.html', + imports: [ + CommunityFormComponent, + TranslateModule, + VarDirective, + NgIf, + AsyncPipe + ], + standalone: true }) export class CreateCommunityPageComponent extends CreateComColPageComponent { protected frontendURL = '/communities/'; diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.spec.ts b/src/app/community-page/delete-community-page/delete-community-page.component.spec.ts index 55d0508c103..4fcc1cc26f1 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.spec.ts +++ b/src/app/community-page/delete-community-page/delete-community-page.component.spec.ts @@ -19,17 +19,16 @@ describe('DeleteCommunityPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [DeleteCommunityPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, DeleteCommunityPageComponent], + providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: CommunityDataService, useValue: {} }, { provide: ActivatedRoute, useValue: { data: observableOf({ dso: { payload: {} } }) } }, { provide: NotificationsService, useValue: {} }, - { provide: RequestService, useValue: {}} - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + { provide: RequestService, useValue: {} } + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.ts b/src/app/community-page/delete-community-page/delete-community-page.component.ts index 65b7c81b38b..83eb1981aa8 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.ts +++ b/src/app/community-page/delete-community-page/delete-community-page.component.ts @@ -4,8 +4,10 @@ import { CommunityDataService } from '../../core/data/community-data.service'; import { ActivatedRoute, Router } from '@angular/router'; import { DeleteComColPageComponent } from '../../shared/comcol/comcol-forms/delete-comcol-page/delete-comcol-page.component'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { TranslateService } from '@ngx-translate/core'; +import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { VarDirective } from '../../shared/utils/var.directive'; /** * Component that represents the page where a user can delete an existing Community @@ -13,7 +15,14 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-delete-community', styleUrls: ['./delete-community-page.component.scss'], - templateUrl: './delete-community-page.component.html' + templateUrl: './delete-community-page.component.html', + imports: [ + TranslateModule, + AsyncPipe, + VarDirective, + NgIf + ], + standalone: true }) export class DeleteCommunityPageComponent extends DeleteComColPageComponent { protected frontendURL = '/communities/'; diff --git a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts index d895cfd820b..8b9d0d3815a 100644 --- a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.spec.ts @@ -8,8 +8,8 @@ xdescribe('CommunityAccessControlComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ CommunityAccessControlComponent ] - }) + imports: [CommunityAccessControlComponent] +}) .compileComponents(); }); diff --git a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.ts b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.ts index 8a216e38dfa..1ab0a3a4dbc 100644 --- a/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.ts +++ b/src/app/community-page/edit-community-page/community-access-control/community-access-control.component.ts @@ -5,11 +5,21 @@ import { ActivatedRoute } from '@angular/router'; import { map } from 'rxjs/operators'; import { getFirstSucceededRemoteData } from '../../../core/shared/operators'; import { Community } from '../../../core/shared/community.model'; +import { + AccessControlFormContainerComponent +} from '../../../shared/access-control-form-container/access-control-form-container.component'; +import { AsyncPipe, NgIf } from '@angular/common'; @Component({ selector: 'ds-community-access-control', templateUrl: './community-access-control.component.html', styleUrls: ['./community-access-control.component.scss'], + imports: [ + AccessControlFormContainerComponent, + NgIf, + AsyncPipe + ], + standalone: true }) export class CommunityAccessControlComponent implements OnInit { itemRD$: Observable>; diff --git a/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts b/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts index 719cf83a26f..41042f3578b 100644 --- a/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.spec.ts @@ -37,17 +37,17 @@ describe('CommunityAuthorizationsComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ - CommonModule - ], - declarations: [CommunityAuthorizationsComponent], - providers: [ + imports: [ + CommonModule, + CommunityAuthorizationsComponent + ], + providers: [ { provide: ActivatedRoute, useValue: routeStub }, ChangeDetectorRef, CommunityAuthorizationsComponent, - ], - schemas: [NO_ERRORS_SCHEMA], - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.ts b/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.ts index 7a9f224311d..68c87d87ecd 100644 --- a/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.ts +++ b/src/app/community-page/edit-community-page/community-authorizations/community-authorizations.component.ts @@ -4,10 +4,17 @@ import { Observable } from 'rxjs'; import { first, map } from 'rxjs/operators'; import { RemoteData } from '../../../core/data/remote-data'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; +import { ResourcePoliciesComponent } from '../../../shared/resource-policies/resource-policies.component'; +import { AsyncPipe } from '@angular/common'; @Component({ selector: 'ds-community-authorizations', templateUrl: './community-authorizations.component.html', + imports: [ + ResourcePoliciesComponent, + AsyncPipe + ], + standalone: true }) /** * Component that handles the community Authorizations diff --git a/src/app/community-page/edit-community-page/community-curate/community-curate.component.spec.ts b/src/app/community-page/edit-community-page/community-curate/community-curate.component.spec.ts index 1b1ee2c9f95..c24a0296029 100644 --- a/src/app/community-page/edit-community-page/community-curate/community-curate.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-curate/community-curate.component.spec.ts @@ -34,14 +34,13 @@ describe('CommunityCurateComponent', () => { }); TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], - declarations: [CommunityCurateComponent], - providers: [ - {provide: ActivatedRoute, useValue: routeStub}, - {provide: DSONameService, useValue: dsoNameService} - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA] - }).compileComponents(); + imports: [TranslateModule.forRoot(), CommunityCurateComponent], + providers: [ + { provide: ActivatedRoute, useValue: routeStub }, + { provide: DSONameService, useValue: dsoNameService } + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/edit-community-page/community-curate/community-curate.component.ts b/src/app/community-page/edit-community-page/community-curate/community-curate.component.ts index 8ae04af8f15..aa71c09fe9f 100644 --- a/src/app/community-page/edit-community-page/community-curate/community-curate.component.ts +++ b/src/app/community-page/edit-community-page/community-curate/community-curate.component.ts @@ -6,6 +6,9 @@ import { RemoteData } from '../../../core/data/remote-data'; import { Observable } from 'rxjs'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; import { hasValue } from '../../../shared/empty.util'; +import { CurationFormComponent } from "../../../curation-form/curation-form.component"; +import { TranslateModule } from "@ngx-translate/core"; +import { AsyncPipe } from "@angular/common"; /** * Component for managing a community's curation tasks @@ -13,6 +16,12 @@ import { hasValue } from '../../../shared/empty.util'; @Component({ selector: 'ds-community-curate', templateUrl: './community-curate.component.html', + imports: [ + CurationFormComponent, + TranslateModule, + AsyncPipe + ], + standalone: true }) export class CommunityCurateComponent implements OnInit { diff --git a/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts b/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts index c597fac0bd3..9de18344b13 100644 --- a/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.spec.ts @@ -17,15 +17,14 @@ describe('CommunityMetadataComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [CommunityMetadataComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, CommunityMetadataComponent], + providers: [ { provide: CommunityDataService, useValue: {} }, { provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: { payload: {} } }) } } }, { provide: NotificationsService, useValue: new NotificationsServiceStub() } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.ts b/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.ts index a2dbfa6eb61..5a08bc84105 100644 --- a/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.ts +++ b/src/app/community-page/edit-community-page/community-metadata/community-metadata.component.ts @@ -5,6 +5,8 @@ import { Community } from '../../../core/shared/community.model'; import { CommunityDataService } from '../../../core/data/community-data.service'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; +import { CommunityFormComponent } from '../../community-form/community-form.component'; +import { AsyncPipe } from '@angular/common'; /** * Component for editing a community's metadata @@ -12,6 +14,11 @@ import { TranslateService } from '@ngx-translate/core'; @Component({ selector: 'ds-community-metadata', templateUrl: './community-metadata.component.html', + imports: [ + CommunityFormComponent, + AsyncPipe + ], + standalone: true }) export class CommunityMetadataComponent extends ComcolMetadataComponent { protected frontendURL = '/communities/'; diff --git a/src/app/community-page/edit-community-page/community-roles/community-roles.component.spec.ts b/src/app/community-page/edit-community-page/community-roles/community-roles.component.spec.ts index f1f9e77caa6..615baf8897c 100644 --- a/src/app/community-page/edit-community-page/community-roles/community-roles.component.spec.ts +++ b/src/app/community-page/edit-community-page/community-roles/community-roles.component.spec.ts @@ -54,25 +54,23 @@ describe('CommunityRolesComponent', () => { }; TestBed.configureTestingModule({ - imports: [ + imports: [ ComcolModule, SharedModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), - NoopAnimationsModule - ], - declarations: [ - CommunityRolesComponent, - ], - providers: [ + NoopAnimationsModule, + CommunityRolesComponent + ], + providers: [ { provide: DSONameService, useValue: new DSONameServiceMock() }, { provide: ActivatedRoute, useValue: route }, { provide: RequestService, useValue: requestService }, { provide: GroupDataService, useValue: groupDataService }, { provide: NotificationsService, useClass: NotificationsServiceStub } - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); fixture = TestBed.createComponent(CommunityRolesComponent); comp = fixture.componentInstance; diff --git a/src/app/community-page/edit-community-page/community-roles/community-roles.component.ts b/src/app/community-page/edit-community-page/community-roles/community-roles.component.ts index 9468aa7048b..a04bf3a6f1d 100644 --- a/src/app/community-page/edit-community-page/community-roles/community-roles.component.ts +++ b/src/app/community-page/edit-community-page/community-roles/community-roles.component.ts @@ -6,6 +6,10 @@ import { Community } from '../../../core/shared/community.model'; import { getRemoteDataPayload, getFirstSucceededRemoteData } from '../../../core/shared/operators'; import { RemoteData } from '../../../core/data/remote-data'; import { HALLink } from '../../../core/shared/hal-link.model'; +import { + ComcolRoleComponent +} from '../../../shared/comcol/comcol-forms/edit-comcol-page/comcol-role/comcol-role.component'; +import { AsyncPipe, NgForOf } from '@angular/common'; /** * Component for managing a community's roles @@ -13,6 +17,12 @@ import { HALLink } from '../../../core/shared/hal-link.model'; @Component({ selector: 'ds-community-roles', templateUrl: './community-roles.component.html', + imports: [ + ComcolRoleComponent, + AsyncPipe, + NgForOf + ], + standalone: true }) export class CommunityRolesComponent implements OnInit { diff --git a/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts b/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts index 3a4c3351c32..0843366fbc6 100644 --- a/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts +++ b/src/app/community-page/edit-community-page/edit-community-page.component.spec.ts @@ -38,14 +38,13 @@ describe('EditCommunityPageComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule], - declarations: [EditCommunityPageComponent], - providers: [ + imports: [TranslateModule.forRoot(), SharedModule, CommonModule, RouterTestingModule, EditCommunityPageComponent], + providers: [ { provide: CommunityDataService, useValue: {} }, { provide: ActivatedRoute, useValue: routeStub }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/edit-community-page/edit-community-page.component.ts b/src/app/community-page/edit-community-page/edit-community-page.component.ts index 54a6ee49442..c50bad802a6 100644 --- a/src/app/community-page/edit-community-page/edit-community-page.component.ts +++ b/src/app/community-page/edit-community-page/edit-community-page.component.ts @@ -1,15 +1,27 @@ import { Component } from '@angular/core'; import { Community } from '../../core/shared/community.model'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, Router, RouterLink, RouterOutlet } from '@angular/router'; import { EditComColPageComponent } from '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component'; import { getCommunityPageRoute } from '../community-page-routing-paths'; +import { TranslateModule } from '@ngx-translate/core'; +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common'; /** * Component that represents the page where a user can edit an existing Community */ @Component({ selector: 'ds-edit-community', - templateUrl: '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html' + templateUrl: '../../shared/comcol/comcol-forms/edit-comcol-page/edit-comcol-page.component.html', + standalone: true, + imports: [ + RouterLink, + TranslateModule, + NgClass, + NgForOf, + RouterOutlet, + NgIf, + AsyncPipe + ] }) export class EditCommunityPageComponent extends EditComColPageComponent { type = 'community'; diff --git a/src/app/community-page/edit-community-page/edit-community-page.module.ts b/src/app/community-page/edit-community-page/edit-community-page.module.ts index 5190d6a0083..65ad5e3df78 100644 --- a/src/app/community-page/edit-community-page/edit-community-page.module.ts +++ b/src/app/community-page/edit-community-page/edit-community-page.module.ts @@ -19,23 +19,21 @@ import { * Module that contains all components related to the Edit Community page administrator functionality */ @NgModule({ - imports: [ - CommonModule, - SharedModule, - EditCommunityPageRoutingModule, - CommunityFormModule, - ComcolModule, - ResourcePoliciesModule, - AccessControlFormModule, - ], - declarations: [ - EditCommunityPageComponent, - CommunityCurateComponent, - CommunityMetadataComponent, - CommunityRolesComponent, - CommunityAuthorizationsComponent, - CommunityAccessControlComponent - ] + imports: [ + CommonModule, + SharedModule, + EditCommunityPageRoutingModule, + CommunityFormModule, + ComcolModule, + ResourcePoliciesModule, + AccessControlFormModule, + EditCommunityPageComponent, + CommunityCurateComponent, + CommunityMetadataComponent, + CommunityRolesComponent, + CommunityAuthorizationsComponent, + CommunityAccessControlComponent + ] }) export class EditCommunityPageModule { diff --git a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts index bca3c42a950..dd7a6411cd8 100644 --- a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts +++ b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.spec.ts @@ -147,15 +147,15 @@ describe('CommunityPageSubCollectionList Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), SharedModule, RouterTestingModule.withRoutes([]), NgbModule, - NoopAnimationsModule - ], - declarations: [CommunityPageSubCollectionListComponent], - providers: [ + NoopAnimationsModule, + CommunityPageSubCollectionListComponent + ], + providers: [ { provide: CollectionDataService, useValue: collectionDataServiceStub }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: PaginationService, useValue: paginationService }, @@ -165,9 +165,9 @@ describe('CommunityPageSubCollectionList Component', () => { { provide: LinkHeadService, useValue: linkHeadService }, { provide: ConfigurationDataService, useValue: configurationDataService }, { provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts index 3a77149e5be..efd435af38f 100644 --- a/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts +++ b/src/app/community-page/sub-collection-list/community-page-sub-collection-list.component.ts @@ -14,12 +14,28 @@ import { CollectionDataService } from '../../core/data/collection-data.service'; import { PaginationService } from '../../core/pagination/pagination.service'; import { switchMap } from 'rxjs/operators'; import { hasValue } from '../../shared/empty.util'; +import { ObjectCollectionComponent } from '../../shared/object-collection/object-collection.component'; +import { ErrorComponent } from "../../shared/error/error.component"; +import { ThemedLoadingComponent } from "../../shared/loading/themed-loading.component"; +import { AsyncPipe, NgIf } from "@angular/common"; +import { TranslateModule } from "@ngx-translate/core"; +import { VarDirective } from "../../shared/utils/var.directive"; @Component({ selector: 'ds-community-page-sub-collection-list', styleUrls: ['./community-page-sub-collection-list.component.scss'], templateUrl: './community-page-sub-collection-list.component.html', - animations:[fadeIn] + animations: [fadeIn], + imports: [ + ObjectCollectionComponent, + ErrorComponent, + ThemedLoadingComponent, + NgIf, + TranslateModule, + AsyncPipe, + VarDirective + ], + standalone: true }) export class CommunityPageSubCollectionListComponent implements OnInit, OnDestroy { @Input() community: Community; diff --git a/src/app/community-page/sub-collection-list/themed-community-page-sub-collection-list.component.ts b/src/app/community-page/sub-collection-list/themed-community-page-sub-collection-list.component.ts index f1f49f204c2..cc4f208d938 100644 --- a/src/app/community-page/sub-collection-list/themed-community-page-sub-collection-list.component.ts +++ b/src/app/community-page/sub-collection-list/themed-community-page-sub-collection-list.component.ts @@ -4,9 +4,10 @@ import { Component, Input } from '@angular/core'; import { Community } from '../../core/shared/community.model'; @Component({ - selector: 'ds-themed-community-page-sub-collection-list', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-community-page-sub-collection-list', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCollectionPageSubCollectionListComponent extends ThemedComponent { @Input() community: Community; diff --git a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts index 0a14fe6dd14..a5a8feda599 100644 --- a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts +++ b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.spec.ts @@ -148,15 +148,15 @@ describe('CommunityPageSubCommunityListComponent Component', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ + imports: [ TranslateModule.forRoot(), SharedModule, RouterTestingModule.withRoutes([]), NgbModule, - NoopAnimationsModule - ], - declarations: [CommunityPageSubCommunityListComponent], - providers: [ + NoopAnimationsModule, + CommunityPageSubCommunityListComponent + ], + providers: [ { provide: CommunityDataService, useValue: communityDataServiceStub }, { provide: HostWindowService, useValue: new HostWindowServiceStub(0) }, { provide: PaginationService, useValue: paginationService }, @@ -166,9 +166,9 @@ describe('CommunityPageSubCommunityListComponent Component', () => { { provide: LinkHeadService, useValue: linkHeadService }, { provide: ConfigurationDataService, useValue: configurationDataService }, { provide: SearchConfigurationService, useValue: new SearchConfigurationServiceStub() }, - ], - schemas: [NO_ERRORS_SCHEMA] - }).compileComponents(); + ], + schemas: [NO_ERRORS_SCHEMA] +}).compileComponents(); })); beforeEach(() => { diff --git a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.ts b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.ts index 5a0409a0519..8bd288debf4 100644 --- a/src/app/community-page/sub-community-list/community-page-sub-community-list.component.ts +++ b/src/app/community-page/sub-community-list/community-page-sub-community-list.component.ts @@ -13,12 +13,28 @@ import { CommunityDataService } from '../../core/data/community-data.service'; import { switchMap } from 'rxjs/operators'; import { PaginationService } from '../../core/pagination/pagination.service'; import { hasValue } from '../../shared/empty.util'; +import { ErrorComponent } from '../../shared/error/error.component'; +import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component'; +import { VarDirective } from '../../shared/utils/var.directive'; +import { AsyncPipe, NgIf } from '@angular/common'; +import { ObjectCollectionComponent } from '../../shared/object-collection/object-collection.component'; +import { TranslateModule } from '@ngx-translate/core'; @Component({ selector: 'ds-community-page-sub-community-list', styleUrls: ['./community-page-sub-community-list.component.scss'], templateUrl: './community-page-sub-community-list.component.html', - animations: [fadeIn] + animations: [fadeIn], + imports: [ + ErrorComponent, + ThemedLoadingComponent, + VarDirective, + NgIf, + ObjectCollectionComponent, + AsyncPipe, + TranslateModule + ], + standalone: true }) /** * Component to render the sub-communities of a Community diff --git a/src/app/community-page/sub-community-list/themed-community-page-sub-community-list.component.ts b/src/app/community-page/sub-community-list/themed-community-page-sub-community-list.component.ts index 852c53186ef..4521ac3ce79 100644 --- a/src/app/community-page/sub-community-list/themed-community-page-sub-community-list.component.ts +++ b/src/app/community-page/sub-community-list/themed-community-page-sub-community-list.component.ts @@ -4,9 +4,10 @@ import { Component, Input } from '@angular/core'; import { Community } from '../../core/shared/community.model'; @Component({ - selector: 'ds-themed-community-page-sub-community-list', - styleUrls: [], - templateUrl: '../../shared/theme-support/themed.component.html', + selector: 'ds-themed-community-page-sub-community-list', + styleUrls: [], + templateUrl: '../../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCommunityPageSubCommunityListComponent extends ThemedComponent { diff --git a/src/app/community-page/themed-community-page.component.ts b/src/app/community-page/themed-community-page.component.ts index eeb058fb047..8a4aa4094b6 100644 --- a/src/app/community-page/themed-community-page.component.ts +++ b/src/app/community-page/themed-community-page.component.ts @@ -6,9 +6,10 @@ import { CommunityPageComponent } from './community-page.component'; * Themed wrapper for CommunityPageComponent */ @Component({ - selector: 'ds-themed-community-page', - styleUrls: [], - templateUrl: '../shared/theme-support/themed.component.html', + selector: 'ds-themed-community-page', + styleUrls: [], + templateUrl: '../shared/theme-support/themed.component.html', + standalone: true }) export class ThemedCommunityPageComponent extends ThemedComponent { protected getComponentName(): string { diff --git a/src/app/core/auth/auth.service.spec.ts b/src/app/core/auth/auth.service.spec.ts index b38d17aecdb..874a62cac3e 100644 --- a/src/app/core/auth/auth.service.spec.ts +++ b/src/app/core/auth/auth.service.spec.ts @@ -112,32 +112,31 @@ describe('AuthService test', () => { beforeEach(() => { init(); TestBed.configureTestingModule({ - imports: [ - CommonModule, - StoreModule.forRoot({ authReducer }, { + imports: [ + CommonModule, + StoreModule.forRoot({ authReducer }, { runtimeChecks: { - strictStateImmutability: false, - strictActionImmutability: false + strictStateImmutability: false, + strictActionImmutability: false } - }), - ], - declarations: [], - providers: [ - { provide: AuthRequestService, useValue: authRequest }, - { provide: NativeWindowService, useValue: window }, - { provide: REQUEST, useValue: {} }, - { provide: Router, useValue: routerStub }, - { provide: RouteService, useValue: routeServiceStub }, - { provide: ActivatedRoute, useValue: routeStub }, - { provide: Store, useValue: mockStore }, - { provide: EPersonDataService, useValue: mockEpersonDataService }, - { provide: HardRedirectService, useValue: hardRedirectService }, - { provide: NotificationsService, useValue: NotificationsServiceStub }, - { provide: TranslateService, useValue: getMockTranslateService() }, - CookieService, - AuthService - ], - }); + }), + ], + providers: [ + { provide: AuthRequestService, useValue: authRequest }, + { provide: NativeWindowService, useValue: window }, + { provide: REQUEST, useValue: {} }, + { provide: Router, useValue: routerStub }, + { provide: RouteService, useValue: routeServiceStub }, + { provide: ActivatedRoute, useValue: routeStub }, + { provide: Store, useValue: mockStore }, + { provide: EPersonDataService, useValue: mockEpersonDataService }, + { provide: HardRedirectService, useValue: hardRedirectService }, + { provide: NotificationsService, useValue: NotificationsServiceStub }, + { provide: TranslateService, useValue: getMockTranslateService() }, + CookieService, + AuthService + ] +}); authService = TestBed.inject(AuthService); }); diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index 6604936cde1..d7208bdad50 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -65,7 +65,7 @@ export const IMPERSONATING_COOKIE = 'dsImpersonatingEPerson'; /** * The auth service. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class AuthService { /** diff --git a/src/app/core/auth/authenticated.guard.ts b/src/app/core/auth/authenticated.guard.ts index 1ab1d2e0a51..f3275ad0036 100644 --- a/src/app/core/auth/authenticated.guard.ts +++ b/src/app/core/auth/authenticated.guard.ts @@ -19,7 +19,7 @@ import { CoreState } from '../core-state.model'; * Prevent unauthorized activating and loading of routes * @class AuthenticatedGuard */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class AuthenticatedGuard implements CanActivate { /** diff --git a/src/app/core/auth/token-response-parsing.service.ts b/src/app/core/auth/token-response-parsing.service.ts index 1ba7a16b14e..b28c5b13929 100644 --- a/src/app/core/auth/token-response-parsing.service.ts +++ b/src/app/core/auth/token-response-parsing.service.ts @@ -5,7 +5,7 @@ import { isNotEmpty } from '../../shared/empty.util'; import { Injectable } from '@angular/core'; import { RestRequest } from '../data/rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) /** * A ResponseParsingService used to parse RawRestResponse coming from the REST API to a token string * wrapped in a TokenResponse diff --git a/src/app/core/browse/browse-definition-data.service.ts b/src/app/core/browse/browse-definition-data.service.ts index bc495a51f4f..27f6c258627 100644 --- a/src/app/core/browse/browse-definition-data.service.ts +++ b/src/app/core/browse/browse-definition-data.service.ts @@ -1,6 +1,5 @@ // eslint-disable-next-line max-classes-per-file import { Injectable } from '@angular/core'; -import { BROWSE_DEFINITION } from '../shared/browse-definition.resource-type'; import { RequestService } from '../data/request.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; @@ -12,7 +11,6 @@ import { PaginatedList } from '../data/paginated-list.model'; import { FindListOptions } from '../data/find-list-options.model'; import { IdentifiableDataService } from '../data/base/identifiable-data.service'; import { FindAllData, FindAllDataImpl } from '../data/base/find-all-data'; -import { dataService } from '../data/base/data-service.decorator'; import { isNotEmpty, isNotEmptyOperator, hasValue } from '../../shared/empty.util'; import { take } from 'rxjs/operators'; import { BrowseDefinitionRestRequest } from '../data/request.models'; @@ -62,7 +60,6 @@ class BrowseDefinitionFindAllDataImpl extends FindAllDataImpl @Injectable({ providedIn: 'root', }) -@dataService(BROWSE_DEFINITION) export class BrowseDefinitionDataService extends IdentifiableDataService implements FindAllData, SearchData { private findAllData: BrowseDefinitionFindAllDataImpl; private searchData: SearchDataImpl; diff --git a/src/app/core/browse/browse.service.ts b/src/app/core/browse/browse.service.ts index b210b349494..4e864043711 100644 --- a/src/app/core/browse/browse.service.ts +++ b/src/app/core/browse/browse.service.ts @@ -33,7 +33,7 @@ export const BROWSE_LINKS_TO_FOLLOW: FollowLinkConfig[] = [ /** * The service handling all browse requests */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class BrowseService { protected linkPath = 'browses'; diff --git a/src/app/core/cache/builders/link.service.ts b/src/app/core/cache/builders/link.service.ts index afc7ab88e40..354f70aad13 100644 --- a/src/app/core/cache/builders/link.service.ts +++ b/src/app/core/cache/builders/link.service.ts @@ -1,31 +1,28 @@ import { Inject, Injectable, Injector } from '@angular/core'; -import { hasNoValue, hasValue, isNotEmpty } from '../../../shared/empty.util'; +import { hasValue, isNotEmpty } from '../../../shared/empty.util'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { GenericConstructor } from '../../shared/generic-constructor'; import { HALResource } from '../../shared/hal-resource.model'; import { DATA_SERVICE_FACTORY } from '../../data/base/data-service.decorator'; -import { - LINK_DEFINITION_FACTORY, - LINK_DEFINITION_MAP_FACTORY, - LinkDefinition, -} from './build-decorators'; +import { LINK_DEFINITION_FACTORY, LINK_DEFINITION_MAP_FACTORY, LinkDefinition, } from './build-decorators'; import { RemoteData } from '../../data/remote-data'; -import { EMPTY, Observable } from 'rxjs'; +import { EMPTY, Observable, of } from 'rxjs'; import { ResourceType } from '../../shared/resource-type'; import { HALDataService } from '../../data/base/hal-data-service.interface'; import { PaginatedList } from '../../data/paginated-list.model'; +import { lazyService } from '../../lazy-service'; +import { catchError, switchMap } from 'rxjs/operators'; +import { LAZY_DATA_SERVICES } from '../../data-services-map'; /** * A Service to handle the resolving and removing * of resolved {@link HALLink}s on HALResources */ -@Injectable({ - providedIn: 'root', -}) +@Injectable({providedIn: 'root',}) export class LinkService { constructor( - protected parentInjector: Injector, + protected injector: Injector, @Inject(DATA_SERVICE_FACTORY) private getDataServiceFor: (resourceType: ResourceType) => GenericConstructor>, @Inject(LINK_DEFINITION_FACTORY) private getLinkDefinition: (source: GenericConstructor, linkName: keyof T['_links']) => LinkDefinition, @Inject(LINK_DEFINITION_MAP_FACTORY) private getLinkDefinitions: (source: GenericConstructor) => Map>, @@ -57,32 +54,32 @@ export class LinkService { const matchingLinkDef = this.getLinkDefinition(model.constructor, linkToFollow.name); if (hasValue(matchingLinkDef)) { - const provider = this.getDataServiceFor(matchingLinkDef.resourceType); + const lazyProvider$: Observable> = lazyService(LAZY_DATA_SERVICES[matchingLinkDef.resourceType.value], this.injector); - if (hasNoValue(provider)) { - throw new Error(`The @link() for ${String(linkToFollow.name)} on ${model.constructor.name} models uses the resource type ${matchingLinkDef.resourceType.value.toUpperCase()}, but there is no service with an @dataService(${matchingLinkDef.resourceType.value.toUpperCase()}) annotation in order to retrieve it`); - } + return lazyProvider$.pipe( + switchMap((provider: HALDataService) => { + const link = model._links[matchingLinkDef.linkName]; + if (hasValue(link)) { + const href = link.href; - const service: HALDataService = Injector.create({ - providers: [], - parent: this.parentInjector, - }).get(provider); + try { + if (matchingLinkDef.isList) { + return provider.findListByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); + } else { + return provider.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); + } + } catch (e) { + console.error(`Something went wrong when using ${matchingLinkDef.resourceType.value}) ${hasValue(provider) ? '' : '(undefined) '}to resolve link ${String(linkToFollow.name)} at ${href}`); + throw e; + } + } - const link = model._links[matchingLinkDef.linkName]; - if (hasValue(link)) { - const href = link.href; - - try { - if (matchingLinkDef.isList) { - return service.findListByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); - } else { - return service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); - } - } catch (e) { - console.error(`Something went wrong when using @dataService(${matchingLinkDef.resourceType.value}) ${hasValue(service) ? '' : '(undefined) '}to resolve link ${String(linkToFollow.name)} at ${href}`); - throw e; - } - } + return of(null); + }), + catchError((err) => { + throw new Error(`The @link() for ${String(linkToFollow.name)} on ${model.constructor.name} models uses the resource type ${matchingLinkDef.resourceType.value.toUpperCase()}, but there is no service with an @dataService(${matchingLinkDef.resourceType.value.toUpperCase()}) annotation in order to retrieve it`); + }) + ); } else if (!linkToFollow.isOptional) { throw new Error(`followLink('${String(linkToFollow.name)}') was used as a required link for a ${model.constructor.name}, but there is no property on ${model.constructor.name} models with an @link() for ${String(linkToFollow.name)}`); } diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts index 075bf3ca0ca..22fda16ff01 100644 --- a/src/app/core/cache/builders/remote-data-build.service.ts +++ b/src/app/core/cache/builders/remote-data-build.service.ts @@ -27,7 +27,7 @@ import { RequestEntry } from '../../data/request-entry.model'; import { ResponseState } from '../../data/response-state.model'; import { getFirstCompletedRemoteData } from '../../shared/operators'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class RemoteDataBuildService { constructor(protected objectCache: ObjectCacheService, protected linkService: LinkService, diff --git a/src/app/core/cache/object-cache.service.ts b/src/app/core/cache/object-cache.service.ts index 9ca02162108..3a99e8dbef9 100644 --- a/src/app/core/cache/object-cache.service.ts +++ b/src/app/core/cache/object-cache.service.ts @@ -42,7 +42,7 @@ const entryFromSelfLinkSelector = /** * A service to interact with the object cache */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class ObjectCacheService { constructor( private store: Store, diff --git a/src/app/core/config/bulk-access-config-data.service.ts b/src/app/core/config/bulk-access-config-data.service.ts index 28b4029ea28..6a87fba2cc6 100644 --- a/src/app/core/config/bulk-access-config-data.service.ts +++ b/src/app/core/config/bulk-access-config-data.service.ts @@ -4,14 +4,11 @@ import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RequestService } from '../data/request.service'; import { ConfigDataService } from './config-data.service'; -import { dataService } from '../data/base/data-service.decorator'; -import { BULK_ACCESS_CONDITION_OPTIONS } from './models/config-type'; /** * Data Service responsible for retrieving Bulk Access Condition Options from the REST API */ @Injectable({ providedIn: 'root' }) -@dataService(BULK_ACCESS_CONDITION_OPTIONS) export class BulkAccessConfigDataService extends ConfigDataService { constructor( diff --git a/src/app/core/config/submission-accesses-config-data.service.ts b/src/app/core/config/submission-accesses-config-data.service.ts index d2da0fce422..eba7aaf25e1 100644 --- a/src/app/core/config/submission-accesses-config-data.service.ts +++ b/src/app/core/config/submission-accesses-config-data.service.ts @@ -3,20 +3,17 @@ import { ConfigDataService } from './config-data.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ObjectCacheService } from '../cache/object-cache.service'; -import { SUBMISSION_ACCESSES_TYPE } from './models/config-type'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ConfigObject } from './models/config.model'; import { SubmissionAccessesModel } from './models/config-submission-accesses.model'; import { RemoteData } from '../data/remote-data'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../data/base/data-service.decorator'; /** * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. */ @Injectable() -@dataService(SUBMISSION_ACCESSES_TYPE) export class SubmissionAccessesConfigDataService extends ConfigDataService { constructor( protected requestService: RequestService, diff --git a/src/app/core/config/submission-forms-config-data.service.ts b/src/app/core/config/submission-forms-config-data.service.ts index f4c0690685b..de139b90281 100644 --- a/src/app/core/config/submission-forms-config-data.service.ts +++ b/src/app/core/config/submission-forms-config-data.service.ts @@ -15,7 +15,7 @@ import { dataService } from '../data/base/data-service.decorator'; /** * Data service to retrieve submission form configuration objects from the REST server. */ -@Injectable() +@Injectable({ providedIn: 'root' }) @dataService(SUBMISSION_FORMS_TYPE) export class SubmissionFormsConfigDataService extends ConfigDataService { constructor( diff --git a/src/app/core/config/submission-uploads-config-data.service.ts b/src/app/core/config/submission-uploads-config-data.service.ts index 8f838352a9e..26f240a43db 100644 --- a/src/app/core/config/submission-uploads-config-data.service.ts +++ b/src/app/core/config/submission-uploads-config-data.service.ts @@ -3,20 +3,17 @@ import { ConfigDataService } from './config-data.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ObjectCacheService } from '../cache/object-cache.service'; -import { SUBMISSION_UPLOADS_TYPE } from './models/config-type'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ConfigObject } from './models/config.model'; import { SubmissionUploadsModel } from './models/config-submission-uploads.model'; import { RemoteData } from '../data/remote-data'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../data/base/data-service.decorator'; /** * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. */ @Injectable() -@dataService(SUBMISSION_UPLOADS_TYPE) export class SubmissionUploadsConfigDataService extends ConfigDataService { constructor( protected requestService: RequestService, diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts deleted file mode 100644 index dbca773375a..00000000000 --- a/src/app/core/core.module.ts +++ /dev/null @@ -1,416 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { HttpClient } from '@angular/common/http'; -import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; - -import { EffectsModule } from '@ngrx/effects'; - -import { Action, StoreConfig, StoreModule } from '@ngrx/store'; -import { MyDSpaceGuard } from '../my-dspace-page/my-dspace.guard'; - -import { isNotEmpty } from '../shared/empty.util'; -import { HostWindowService } from '../shared/host-window.service'; -import { MenuService } from '../shared/menu/menu.service'; -import { EndpointMockingRestService } from '../shared/mocks/dspace-rest/endpoint-mocking-rest.service'; -import { - MOCK_RESPONSE_MAP, - mockResponseMap, - ResponseMapMock -} from '../shared/mocks/dspace-rest/mocks/response-map.mock'; -import { NotificationsService } from '../shared/notifications/notifications.service'; -import { SelectableListService } from '../shared/object-list/selectable-list/selectable-list.service'; -import { ObjectSelectService } from '../shared/object-select/object-select.service'; -import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model'; -import { SidebarService } from '../shared/sidebar/sidebar.service'; -import { AuthenticatedGuard } from './auth/authenticated.guard'; -import { AuthStatus } from './auth/models/auth-status.model'; -import { BrowseService } from './browse/browse.service'; -import { RemoteDataBuildService } from './cache/builders/remote-data-build.service'; -import { ObjectCacheService } from './cache/object-cache.service'; -import { SubmissionDefinitionsModel } from './config/models/config-submission-definitions.model'; -import { SubmissionFormsModel } from './config/models/config-submission-forms.model'; -import { SubmissionSectionModel } from './config/models/config-submission-section.model'; -import { SubmissionUploadsModel } from './config/models/config-submission-uploads.model'; -import { SubmissionFormsConfigDataService } from './config/submission-forms-config-data.service'; -import { coreEffects } from './core.effects'; -import { coreReducers } from './core.reducers'; -import { BitstreamFormatDataService } from './data/bitstream-format-data.service'; -import { CollectionDataService } from './data/collection-data.service'; -import { CommunityDataService } from './data/community-data.service'; -import { ContentSourceResponseParsingService } from './data/content-source-response-parsing.service'; -import { DebugResponseParsingService } from './data/debug-response-parsing.service'; -import { DefaultChangeAnalyzer } from './data/default-change-analyzer.service'; -import { DSOChangeAnalyzer } from './data/dso-change-analyzer.service'; -import { DSOResponseParsingService } from './data/dso-response-parsing.service'; -import { DSpaceObjectDataService } from './data/dspace-object-data.service'; -import { EndpointMapResponseParsingService } from './data/endpoint-map-response-parsing.service'; -import { EntityTypeDataService } from './data/entity-type-data.service'; -import { ExternalSourceDataService } from './data/external-source-data.service'; -import { FacetConfigResponseParsingService } from './data/facet-config-response-parsing.service'; -import { FacetValueResponseParsingService } from './data/facet-value-response-parsing.service'; -import { FilteredDiscoveryPageResponseParsingService } from './data/filtered-discovery-page-response-parsing.service'; -import { ItemDataService } from './data/item-data.service'; -import { LookupRelationService } from './data/lookup-relation.service'; -import { MyDSpaceResponseParsingService } from './data/mydspace-response-parsing.service'; -import { ObjectUpdatesService } from './data/object-updates/object-updates.service'; -import { RelationshipTypeDataService } from './data/relationship-type-data.service'; -import { RelationshipDataService } from './data/relationship-data.service'; -import { ResourcePolicyDataService } from './resource-policy/resource-policy-data.service'; -import { SearchResponseParsingService } from './data/search-response-parsing.service'; -import { SiteDataService } from './data/site-data.service'; -import { DspaceRestService } from './dspace-rest/dspace-rest.service'; -import { EPersonDataService } from './eperson/eperson-data.service'; -import { EPerson } from './eperson/models/eperson.model'; -import { Group } from './eperson/models/group.model'; -import { JsonPatchOperationsBuilder } from './json-patch/builder/json-patch-operations-builder'; -import { MetadataField } from './metadata/metadata-field.model'; -import { MetadataSchema } from './metadata/metadata-schema.model'; -import { MetadataService } from './metadata/metadata.service'; -import { RegistryService } from './registry/registry.service'; -import { RoleService } from './roles/role.service'; -import { FeedbackDataService } from './feedback/feedback-data.service'; - -import { ServerResponseService } from './services/server-response.service'; -import { NativeWindowFactory, NativeWindowService } from './services/window.service'; -import { BitstreamFormat } from './shared/bitstream-format.model'; -import { Bitstream } from './shared/bitstream.model'; -import { BrowseDefinition } from './shared/browse-definition.model'; -import { BrowseEntry } from './shared/browse-entry.model'; -import { Bundle } from './shared/bundle.model'; -import { Collection } from './shared/collection.model'; -import { Community } from './shared/community.model'; -import { DSpaceObject } from './shared/dspace-object.model'; -import { ExternalSourceEntry } from './shared/external-source-entry.model'; -import { ExternalSource } from './shared/external-source.model'; -import { HALEndpointService } from './shared/hal-endpoint.service'; -import { ItemType } from './shared/item-relationships/item-type.model'; -import { RelationshipType } from './shared/item-relationships/relationship-type.model'; -import { Relationship } from './shared/item-relationships/relationship.model'; -import { Item } from './shared/item.model'; -import { License } from './shared/license.model'; -import { ResourcePolicy } from './resource-policy/models/resource-policy.model'; -import { SearchConfigurationService } from './shared/search/search-configuration.service'; -import { SearchFilterService } from './shared/search/search-filter.service'; -import { SearchService } from './shared/search/search.service'; -import { Site } from './shared/site.model'; -import { UUIDService } from './shared/uuid.service'; -import { WorkflowItem } from './submission/models/workflowitem.model'; -import { WorkspaceItem } from './submission/models/workspaceitem.model'; -import { SubmissionJsonPatchOperationsService } from './submission/submission-json-patch-operations.service'; -import { SubmissionResponseParsingService } from './submission/submission-response-parsing.service'; -import { SubmissionRestService } from './submission/submission-rest.service'; -import { WorkflowItemDataService } from './submission/workflowitem-data.service'; -import { WorkspaceitemDataService } from './submission/workspaceitem-data.service'; -import { ClaimedTaskDataService } from './tasks/claimed-task-data.service'; -import { ClaimedTask } from './tasks/models/claimed-task-object.model'; -import { PoolTask } from './tasks/models/pool-task-object.model'; -import { TaskObject } from './tasks/models/task-object.model'; -import { PoolTaskDataService } from './tasks/pool-task-data.service'; -import { TaskResponseParsingService } from './tasks/task-response-parsing.service'; -import { ArrayMoveChangeAnalyzer } from './data/array-move-change-analyzer.service'; -import { BitstreamDataService } from './data/bitstream-data.service'; -import { environment } from '../../environments/environment'; -import { storeModuleConfig } from '../app.reducer'; -import { VersionDataService } from './data/version-data.service'; -import { VersionHistoryDataService } from './data/version-history-data.service'; -import { Version } from './shared/version.model'; -import { VersionHistory } from './shared/version-history.model'; -import { Script } from '../process-page/scripts/script.model'; -import { Process } from '../process-page/processes/process.model'; -import { ProcessDataService } from './data/processes/process-data.service'; -import { ScriptDataService } from './data/processes/script-data.service'; -import { WorkflowActionDataService } from './data/workflow-action-data.service'; -import { WorkflowAction } from './tasks/models/workflow-action-object.model'; -import { ItemTemplateDataService } from './data/item-template-data.service'; -import { TemplateItem } from './shared/template-item.model'; -import { Feature } from './shared/feature.model'; -import { Authorization } from './shared/authorization.model'; -import { FeatureDataService } from './data/feature-authorization/feature-data.service'; -import { AuthorizationDataService } from './data/feature-authorization/authorization-data.service'; -import { - SiteAdministratorGuard -} from './data/feature-authorization/feature-authorization-guard/site-administrator.guard'; -import { Registration } from './shared/registration.model'; -import { MetadataSchemaDataService } from './data/metadata-schema-data.service'; -import { MetadataFieldDataService } from './data/metadata-field-data.service'; -import { TokenResponseParsingService } from './auth/token-response-parsing.service'; -import { SubmissionCcLicenseDataService } from './submission/submission-cc-license-data.service'; -import { SubmissionCcLicence } from './submission/models/submission-cc-license.model'; -import { SubmissionCcLicenceUrl } from './submission/models/submission-cc-license-url.model'; -import { SubmissionCcLicenseUrlDataService } from './submission/submission-cc-license-url-data.service'; -import { VocabularyEntry } from './submission/vocabularies/models/vocabulary-entry.model'; -import { Vocabulary } from './submission/vocabularies/models/vocabulary.model'; -import { VocabularyEntryDetail } from './submission/vocabularies/models/vocabulary-entry-detail.model'; -import { VocabularyService } from './submission/vocabularies/vocabulary.service'; -import { ConfigurationDataService } from './data/configuration-data.service'; -import { ConfigurationProperty } from './shared/configuration-property.model'; -import { ReloadGuard } from './reload/reload.guard'; -import { EndUserAgreementCurrentUserGuard } from './end-user-agreement/end-user-agreement-current-user.guard'; -import { EndUserAgreementCookieGuard } from './end-user-agreement/end-user-agreement-cookie.guard'; -import { EndUserAgreementService } from './end-user-agreement/end-user-agreement.service'; -import { SiteRegisterGuard } from './data/feature-authorization/feature-authorization-guard/site-register.guard'; -import { ShortLivedToken } from './auth/models/short-lived-token.model'; -import { UsageReport } from './statistics/models/usage-report.model'; -import { RootDataService } from './data/root-data.service'; -import { Root } from './data/root.model'; -import { SearchConfig } from './shared/search/search-filters/search-config.model'; -import { SequenceService } from './shared/sequence.service'; -import { CoreState } from './core-state.model'; -import { GroupDataService } from './eperson/group-data.service'; -import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model'; -import { RatingAdvancedWorkflowInfo } from './tasks/models/rating-advanced-workflow-info.model'; -import { AdvancedWorkflowInfo } from './tasks/models/advanced-workflow-info.model'; -import { SelectReviewerAdvancedWorkflowInfo } from './tasks/models/select-reviewer-advanced-workflow-info.model'; -import { AccessStatusObject } from '../shared/object-collection/shared/badges/access-status-badge/access-status.model'; -import { AccessStatusDataService } from './data/access-status-data.service'; -import { LinkHeadService } from './services/link-head.service'; -import { ResearcherProfileDataService } from './profile/researcher-profile-data.service'; -import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service'; -import { ResearcherProfile } from './profile/model/researcher-profile.model'; -import { OrcidQueueDataService } from './orcid/orcid-queue-data.service'; -import { OrcidHistoryDataService } from './orcid/orcid-history-data.service'; -import { OrcidQueue } from './orcid/model/orcid-queue.model'; -import { OrcidHistory } from './orcid/model/orcid-history.model'; -import { OrcidAuthService } from './orcid/orcid-auth.service'; -import { VocabularyDataService } from './submission/vocabularies/vocabulary.data.service'; -import { VocabularyEntryDetailsDataService } from './submission/vocabularies/vocabulary-entry-details.data.service'; -import { IdentifierData } from '../shared/object-list/identifier-data/identifier-data.model'; -import { Subscription } from '../shared/subscriptions/models/subscription.model'; -import { SupervisionOrderDataService } from './supervision-order/supervision-order-data.service'; -import { ItemRequest } from './shared/item-request.model'; -import { HierarchicalBrowseDefinition } from './shared/hierarchical-browse-definition.model'; -import { FlatBrowseDefinition } from './shared/flat-browse-definition.model'; -import { ValueListBrowseDefinition } from './shared/value-list-browse-definition.model'; -import { NonHierarchicalBrowseDefinition } from './shared/non-hierarchical-browse-definition'; -import { BulkAccessConditionOptions } from './config/models/bulk-access-condition-options.model'; - -/** - * When not in production, endpoint responses can be mocked for testing purposes - * If there is no mock version available for the endpoint, the actual REST response will be used just like in production mode - */ -export const restServiceFactory = (mocks: ResponseMapMock, http: HttpClient) => { - if (environment.production) { - return new DspaceRestService(http); - } else { - return new EndpointMockingRestService(mocks, http); - } -}; - -const IMPORTS = [ - CommonModule, - StoreModule.forFeature('core', coreReducers, storeModuleConfig as StoreConfig), - EffectsModule.forFeature(coreEffects) -]; - -const DECLARATIONS = []; - -const EXPORTS = []; - -const PROVIDERS = [ - AuthenticatedGuard, - CommunityDataService, - CollectionDataService, - SiteDataService, - DSOResponseParsingService, - { provide: MOCK_RESPONSE_MAP, useValue: mockResponseMap }, - { provide: DspaceRestService, useFactory: restServiceFactory, deps: [MOCK_RESPONSE_MAP, HttpClient] }, - EPersonDataService, - LinkHeadService, - HALEndpointService, - HostWindowService, - ItemDataService, - MetadataService, - ObjectCacheService, - PaginationComponentOptions, - ResourcePolicyDataService, - RegistryService, - BitstreamFormatDataService, - RemoteDataBuildService, - EndpointMapResponseParsingService, - FacetValueResponseParsingService, - FacetConfigResponseParsingService, - DebugResponseParsingService, - SearchResponseParsingService, - MyDSpaceResponseParsingService, - ServerResponseService, - BrowseService, - AccessStatusDataService, - SubmissionCcLicenseDataService, - SubmissionCcLicenseUrlDataService, - SubmissionFormsConfigDataService, - SubmissionRestService, - SubmissionResponseParsingService, - SubmissionJsonPatchOperationsService, - JsonPatchOperationsBuilder, - UUIDService, - NotificationsService, - WorkspaceitemDataService, - WorkflowItemDataService, - DSpaceObjectDataService, - ConfigurationDataService, - DSOChangeAnalyzer, - DefaultChangeAnalyzer, - ArrayMoveChangeAnalyzer, - ObjectSelectService, - MenuService, - ObjectUpdatesService, - SearchService, - RelationshipDataService, - MyDSpaceGuard, - RoleService, - TaskResponseParsingService, - ClaimedTaskDataService, - PoolTaskDataService, - BitstreamDataService, - EntityTypeDataService, - ContentSourceResponseParsingService, - ItemTemplateDataService, - SearchService, - SidebarService, - SearchFilterService, - SearchFilterService, - SearchConfigurationService, - SelectableListService, - RelationshipTypeDataService, - ExternalSourceDataService, - LookupRelationService, - VersionDataService, - VersionHistoryDataService, - WorkflowActionDataService, - ProcessDataService, - ScriptDataService, - FeatureDataService, - AuthorizationDataService, - SiteAdministratorGuard, - SiteRegisterGuard, - MetadataSchemaDataService, - MetadataFieldDataService, - TokenResponseParsingService, - ReloadGuard, - EndUserAgreementCurrentUserGuard, - EndUserAgreementCookieGuard, - EndUserAgreementService, - RootDataService, - NotificationsService, - FilteredDiscoveryPageResponseParsingService, - { provide: NativeWindowService, useFactory: NativeWindowFactory }, - VocabularyService, - VocabularyDataService, - VocabularyEntryDetailsDataService, - SequenceService, - GroupDataService, - FeedbackDataService, - ResearcherProfileDataService, - ProfileClaimService, - OrcidAuthService, - OrcidQueueDataService, - OrcidHistoryDataService, - SupervisionOrderDataService -]; - -/** - * Declaration needed to make sure all decorator functions are called in time - */ -export const models = - [ - Root, - DSpaceObject, - Bundle, - Bitstream, - BitstreamFormat, - Item, - Site, - Collection, - Community, - EPerson, - Group, - ResourcePolicy, - MetadataSchema, - MetadataField, - License, - WorkflowItem, - WorkspaceItem, - SubmissionCcLicence, - SubmissionCcLicenceUrl, - SubmissionDefinitionsModel, - SubmissionFormsModel, - SubmissionSectionModel, - SubmissionUploadsModel, - AuthStatus, - BrowseEntry, - BrowseDefinition, - NonHierarchicalBrowseDefinition, - FlatBrowseDefinition, - ValueListBrowseDefinition, - HierarchicalBrowseDefinition, - ClaimedTask, - TaskObject, - PoolTask, - Relationship, - RelationshipType, - ItemType, - ExternalSource, - ExternalSourceEntry, - Script, - Process, - Version, - VersionHistory, - WorkflowAction, - AdvancedWorkflowInfo, - RatingAdvancedWorkflowInfo, - SelectReviewerAdvancedWorkflowInfo, - TemplateItem, - Feature, - Authorization, - Registration, - Vocabulary, - VocabularyEntry, - VocabularyEntryDetail, - ConfigurationProperty, - ShortLivedToken, - Registration, - UsageReport, - Root, - SearchConfig, - SubmissionAccessesModel, - AccessStatusObject, - ResearcherProfile, - OrcidQueue, - OrcidHistory, - AccessStatusObject, - IdentifierData, - Subscription, - ItemRequest, - BulkAccessConditionOptions - ]; - -@NgModule({ - imports: [ - ...IMPORTS - ], - declarations: [ - ...DECLARATIONS - ], - exports: [ - ...EXPORTS - ], - providers: [ - ...PROVIDERS - ] -}) - -export class CoreModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: CoreModule, - providers: [ - ...PROVIDERS - ] - }; - } - - constructor(@Optional() @SkipSelf() parentModule: CoreModule) { - if (isNotEmpty(parentModule)) { - throw new Error('CoreModule is already loaded. Import it in the AppModule only'); - } - } -} diff --git a/src/app/core/data-services-map.ts b/src/app/core/data-services-map.ts new file mode 100644 index 00000000000..6abb153a678 --- /dev/null +++ b/src/app/core/data-services-map.ts @@ -0,0 +1,116 @@ +import { AUTHORIZATION } from './shared/authorization.resource-type'; +import { BROWSE_DEFINITION } from './shared/browse-definition.resource-type'; +import { + BULK_ACCESS_CONDITION_OPTIONS, + SUBMISSION_ACCESSES_TYPE, + SUBMISSION_FORMS_TYPE, + SUBMISSION_UPLOADS_TYPE +} from './config/models/config-type'; +import { METADATA_SCHEMA } from './metadata/metadata-schema.resource-type'; +import { BITSTREAM } from './shared/bitstream.resource-type'; +import { USAGE_REPORT } from './statistics/models/usage-report.resource-type'; +import { COLLECTION } from './shared/collection.resource-type'; +import { CLAIMED_TASK } from './tasks/models/claimed-task-object.resource-type'; +import { + VOCABULARY, + VOCABULARY_ENTRY, + VOCABULARY_ENTRY_DETAIL +} from './submission/vocabularies/models/vocabularies.resource-type'; +import { ITEM_TYPE } from './shared/item-relationships/item-type.resource-type'; +import { LICENSE } from './shared/license.resource-type'; +import { COMMUNITY } from './shared/community.resource-type'; +import { BUNDLE } from './shared/bundle.resource-type'; +import { CONFIG_PROPERTY } from './shared/config-property.resource-type'; +import { POOL_TASK } from './tasks/models/pool-task-object.resource-type'; +import { SUPERVISION_ORDER } from './supervision-order/models/supervision-order.resource-type'; +import { WorkspaceItem } from './submission/models/workspaceitem.model'; +import { WorkflowItem } from './submission/models/workflowitem.model'; +import { SUBMISSION_CC_LICENSE_URL } from './submission/models/submission-cc-licence-link.resource-type'; +import { SUBMISSION_CC_LICENSE } from './submission/models/submission-cc-licence.resource-type'; +import { RESOURCE_POLICY } from './resource-policy/models/resource-policy.resource-type'; +import { RESEARCHER_PROFILE } from './profile/model/researcher-profile.resource-type'; +import { ORCID_QUEUE } from './orcid/model/orcid-queue.resource-type'; +import { ORCID_HISTORY } from './orcid/model/orcid-history.resource-type'; +import { FEEDBACK } from './feedback/models/feedback.resource-type'; +import { GROUP } from './eperson/models/group.resource-type'; +import { EPERSON } from './eperson/models/eperson.resource-type'; +import { WORKFLOW_ACTION } from './tasks/models/workflow-action-object.resource-type'; +import { VERSION_HISTORY } from './shared/version-history.resource-type'; +import { SITE } from './shared/site.resource-type'; +import { ROOT } from './data/root.resource-type'; +import { RELATIONSHIP_TYPE } from './shared/item-relationships/relationship-type.resource-type'; +import { RELATIONSHIP } from './shared/item-relationships/relationship.resource-type'; +import { METADATA_FIELD } from './metadata/metadata-field.resource-type'; +import { ITEM } from './shared/item.resource-type'; +import { VERSION } from './shared/version.resource-type'; +import { FEATURE } from './shared/feature.resource-type'; +import { DSPACE_OBJECT } from './shared/dspace-object.resource-type'; +import { BITSTREAM_FORMAT } from './shared/bitstream-format.resource-type'; +import { Type } from '@angular/core'; +import { HALDataService } from './data/base/hal-data-service.interface'; +import { SYSTEMWIDEALERT } from '../system-wide-alert/system-wide-alert.resource-type'; +import { + ACCESS_STATUS +} from '../shared/object-collection/shared/badges/access-status-badge/access-status.resource-type'; +import { SUBSCRIPTION } from '../shared/subscriptions/models/subscription.resource-type'; +import { SCRIPT } from '../process-page/scripts/script.resource-type'; +import { PROCESS } from '../process-page/processes/process.resource-type'; +import { IDENTIFIERS } from '../shared/object-list/identifier-data/identifier-data.resource-type'; + +export const LAZY_DATA_SERVICES: {[key: string]: () => Promise>>} = { + [AUTHORIZATION.value]: () => import('./data/feature-authorization/authorization-data.service').then(m => m.AuthorizationDataService), + [BROWSE_DEFINITION.value]: () => import('./browse/browse-definition-data.service').then(m => m.BrowseDefinitionDataService), + [BULK_ACCESS_CONDITION_OPTIONS.value]: () => import('./config/bulk-access-config-data.service').then(m => m.BulkAccessConfigDataService), + [METADATA_SCHEMA.value]: () => import('./data/metadata-schema-data.service').then(m => m.MetadataSchemaDataService), + [SUBMISSION_UPLOADS_TYPE.value]: () => import('./config/submission-uploads-config-data.service').then(m => m.SubmissionUploadsConfigDataService), + [BITSTREAM.value]: () => import('./data/bitstream-data.service').then(m => m.BitstreamDataService), + [SUBMISSION_ACCESSES_TYPE.value]: () => import('./config/submission-accesses-config-data.service').then(m => m.SubmissionAccessesConfigDataService), + [SYSTEMWIDEALERT.value]: () => import('./data/system-wide-alert-data.service').then(m => m.SystemWideAlertDataService), + [USAGE_REPORT.value]: () => import('./statistics/usage-report-data.service').then(m => m.UsageReportDataService), + [ACCESS_STATUS.value]: () => import('./data/access-status-data.service').then(m => m.AccessStatusDataService), + [COLLECTION.value]: () => import('./data/collection-data.service').then(m => m.CollectionDataService), + [CLAIMED_TASK.value]: () => import('./tasks/claimed-task-data.service').then(m => m.ClaimedTaskDataService), + [VOCABULARY_ENTRY.value]: () => import('./data/href-only-data.service').then(m => m.HrefOnlyDataService), + [ITEM_TYPE.value]: () => import('./data/href-only-data.service').then(m => m.HrefOnlyDataService), + [LICENSE.value]: () => import('./data/href-only-data.service').then(m => m.HrefOnlyDataService), + [SUBSCRIPTION.value]: () => import('../shared/subscriptions/subscriptions-data.service').then(m => m.SubscriptionsDataService), + [COMMUNITY.value]: () => import('./data/community-data.service').then(m => m.CommunityDataService), + [VOCABULARY.value]: () => import('./submission/vocabularies/vocabulary.data.service').then(m => m.VocabularyDataService), + [BUNDLE.value]: () => import('./data/bundle-data.service').then(m => m.BundleDataService), + [CONFIG_PROPERTY.value]: () => import('./data/configuration-data.service').then(m => m.ConfigurationDataService), + [POOL_TASK.value]: () => import('./tasks/pool-task-data.service').then(m => m.PoolTaskDataService), + [CLAIMED_TASK.value]: () => import('./tasks/claimed-task-data.service').then(m => m.ClaimedTaskDataService), + [SUPERVISION_ORDER.value]: () => import('./supervision-order/supervision-order-data.service').then(m => m.SupervisionOrderDataService), + [WorkspaceItem.type.value]: () => import('./submission/workspaceitem-data.service').then(m => m.WorkspaceitemDataService), + [WorkflowItem.type.value]: () => import('./submission/workflowitem-data.service').then(m => m.WorkflowItemDataService), + [VOCABULARY.value]: () => import('./submission/vocabularies/vocabulary.data.service').then(m => m.VocabularyDataService), + [VOCABULARY_ENTRY_DETAIL.value]: () => import('./submission/vocabularies/vocabulary-entry-details.data.service').then(m => m.VocabularyEntryDetailsDataService), + [SUBMISSION_CC_LICENSE_URL.value]: () => import('./submission/submission-cc-license-url-data.service').then(m => m.SubmissionCcLicenseUrlDataService), + [SUBMISSION_CC_LICENSE.value]: () => import('./submission/submission-cc-license-data.service').then(m => m.SubmissionCcLicenseDataService), + [USAGE_REPORT.value]: () => import('./statistics/usage-report-data.service').then(m => m.UsageReportDataService), + [RESOURCE_POLICY.value]: () => import('./resource-policy/resource-policy-data.service').then(m => m.ResourcePolicyDataService), + [RESEARCHER_PROFILE.value]: () => import('./profile/researcher-profile-data.service').then(m => m.ResearcherProfileDataService), + [ORCID_QUEUE.value]: () => import('./orcid/orcid-queue-data.service').then(m => m.OrcidQueueDataService), + [ORCID_HISTORY.value]: () => import('./orcid/orcid-history-data.service').then(m => m.OrcidHistoryDataService), + [FEEDBACK.value]: () => import('./feedback/feedback-data.service').then(m => m.FeedbackDataService), + [GROUP.value]: () => import('./eperson/group-data.service').then(m => m.GroupDataService), + [EPERSON.value]: () => import('./eperson/eperson-data.service').then(m => m.EPersonDataService), + [WORKFLOW_ACTION.value]: () => import('./data/workflow-action-data.service').then(m => m.WorkflowActionDataService), + [VERSION_HISTORY.value]: () => import('./data/version-history-data.service').then(m => m.VersionHistoryDataService), + [SITE.value]: () => import('./data/site-data.service').then(m => m.SiteDataService), + [ROOT.value]: () => import('./data/root-data.service').then(m => m.RootDataService), + [RELATIONSHIP_TYPE.value]: () => import('./data/relationship-type-data.service').then(m => m.RelationshipTypeDataService), + [RELATIONSHIP.value]: () => import('./data/relationship-data.service').then(m => m.RelationshipDataService), + [SCRIPT.value]: () => import('./data/processes/script-data.service').then(m => m.ScriptDataService), + [PROCESS.value]: () => import('./data/processes/process-data.service').then(m => m.ProcessDataService), + [METADATA_FIELD.value]: () => import('./data/metadata-field-data.service').then(m => m.MetadataFieldDataService), + [ITEM.value]: () => import('./data/item-data.service').then(m => m.ItemDataService), + [VERSION.value]: () => import('./data/version-data.service').then(m => m.VersionDataService), + [IDENTIFIERS.value]: () => import('./data/identifier-data.service').then(m => m.IdentifierDataService), + [FEATURE.value]: () => import('./data/feature-authorization/authorization-data.service').then(m => m.AuthorizationDataService), + [DSPACE_OBJECT.value]: () => import('./data/dspace-object-data.service').then(m => m.DSpaceObjectDataService), + [BITSTREAM_FORMAT.value]: () => import('./data/bitstream-format-data.service').then(m => m.BitstreamFormatDataService), + [SUBMISSION_FORMS_TYPE.value]: () => import('./config/submission-forms-config-data.service').then(m => m.SubmissionFormsConfigDataService), +}; + + diff --git a/src/app/core/data/access-status-data.service.ts b/src/app/core/data/access-status-data.service.ts index e8b77245e87..5c83f040eed 100644 --- a/src/app/core/data/access-status-data.service.ts +++ b/src/app/core/data/access-status-data.service.ts @@ -4,18 +4,15 @@ import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RequestService } from './request.service'; import { AccessStatusObject } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.model'; -import { ACCESS_STATUS } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.resource-type'; import { Observable } from 'rxjs'; import { RemoteData } from './remote-data'; import { Item } from '../shared/item.model'; import { BaseDataService } from './base/base-data.service'; -import { dataService } from './base/data-service.decorator'; /** * Data service responsible for retrieving the access status of Items */ -@Injectable() -@dataService(ACCESS_STATUS) +@Injectable({ providedIn: 'root' }) export class AccessStatusDataService extends BaseDataService { constructor( diff --git a/src/app/core/data/array-move-change-analyzer.service.ts b/src/app/core/data/array-move-change-analyzer.service.ts index 36744e9f96e..ffc73801d98 100644 --- a/src/app/core/data/array-move-change-analyzer.service.ts +++ b/src/app/core/data/array-move-change-analyzer.service.ts @@ -6,7 +6,7 @@ import { hasValue } from '../../shared/empty.util'; /** * A class to determine move operations between two arrays */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class ArrayMoveChangeAnalyzer { /** diff --git a/src/app/core/data/bitstream-data.service.ts b/src/app/core/data/bitstream-data.service.ts index bb4ec281665..1a599a12bcf 100644 --- a/src/app/core/data/bitstream-data.service.ts +++ b/src/app/core/data/bitstream-data.service.ts @@ -7,7 +7,6 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Bitstream } from '../shared/bitstream.model'; -import { BITSTREAM } from '../shared/bitstream.resource-type'; import { Bundle } from '../shared/bundle.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Item } from '../shared/item.model'; @@ -32,16 +31,12 @@ import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NoContent } from '../shared/NoContent.model'; import { IdentifiableDataService } from './base/identifiable-data.service'; -import { dataService } from './base/data-service.decorator'; import { Operation, RemoveOperation } from 'fast-json-patch'; /** * A service to retrieve {@link Bitstream}s from the REST API */ -@Injectable({ - providedIn: 'root', -}) -@dataService(BITSTREAM) +@Injectable({ providedIn: 'root' }) export class BitstreamDataService extends IdentifiableDataService implements SearchData, PatchData, DeleteData { private searchData: SearchDataImpl; private patchData: PatchDataImpl; diff --git a/src/app/core/data/bitstream-format-data.service.ts b/src/app/core/data/bitstream-format-data.service.ts index 01043898158..bc1a515f1fc 100644 --- a/src/app/core/data/bitstream-format-data.service.ts +++ b/src/app/core/data/bitstream-format-data.service.ts @@ -2,14 +2,17 @@ import { Injectable } from '@angular/core'; import { createSelector, select, Store } from '@ngrx/store'; import { Observable } from 'rxjs'; import { distinctUntilChanged, map, tap } from 'rxjs/operators'; -import { BitstreamFormatsRegistryDeselectAction, BitstreamFormatsRegistryDeselectAllAction, BitstreamFormatsRegistrySelectAction } from '../../admin/admin-registries/bitstream-formats/bitstream-format.actions'; +import { + BitstreamFormatsRegistryDeselectAction, + BitstreamFormatsRegistryDeselectAllAction, + BitstreamFormatsRegistrySelectAction +} from '../../admin/admin-registries/bitstream-formats/bitstream-format.actions'; import { BitstreamFormatRegistryState } from '../../admin/admin-registries/bitstream-formats/bitstream-format.reducers'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { coreSelector } from '../core.selectors'; import { BitstreamFormat } from '../shared/bitstream-format.model'; -import { BITSTREAM_FORMAT } from '../shared/bitstream-format.resource-type'; import { Bitstream } from '../shared/bitstream.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RemoteData } from './remote-data'; @@ -24,7 +27,6 @@ import { FollowLinkConfig } from 'src/app/shared/utils/follow-link-config.model' import { FindListOptions } from './find-list-options.model'; import { PaginatedList } from './paginated-list.model'; import { NoContent } from '../shared/NoContent.model'; -import { dataService } from './base/data-service.decorator'; const bitstreamFormatsStateSelector = createSelector( coreSelector, @@ -38,8 +40,7 @@ const selectedBitstreamFormatSelector = createSelector( /** * A service responsible for fetching/sending data from/to the REST API on the bitstreamformats endpoint */ -@Injectable() -@dataService(BITSTREAM_FORMAT) +@Injectable({ providedIn: 'root' }) export class BitstreamFormatDataService extends IdentifiableDataService implements FindAllData, DeleteData { protected linkPath = 'bitstreamformats'; diff --git a/src/app/core/data/bundle-data.service.ts b/src/app/core/data/bundle-data.service.ts index 19f0e737069..ac6abbf2572 100644 --- a/src/app/core/data/bundle-data.service.ts +++ b/src/app/core/data/bundle-data.service.ts @@ -27,10 +27,7 @@ import { dataService } from './base/data-service.decorator'; /** * A service to retrieve {@link Bundle}s from the REST API */ -@Injectable( - { providedIn: 'root' }, -) -@dataService(BUNDLE) +@Injectable({ providedIn: 'root' }) export class BundleDataService extends IdentifiableDataService implements PatchData { private bitstreamsEndpoint = 'bitstreams'; diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index 405b35c1f94..a4cd37b8665 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -14,7 +14,6 @@ import { ObjectCacheService } from '../cache/object-cache.service'; import { HttpOptions } from '../dspace-rest/dspace-rest.service'; import { DSpaceSerializer } from '../dspace-rest/dspace.serializer'; import { Collection } from '../shared/collection.model'; -import { COLLECTION } from '../shared/collection.resource-type'; import { ContentSource } from '../shared/content-source.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Item } from '../shared/item.model'; @@ -33,10 +32,8 @@ import { BitstreamDataService } from './bitstream-data.service'; import { RestRequest } from './rest-request.model'; import { FindListOptions } from './find-list-options.model'; import { Community } from '../shared/community.model'; -import { dataService } from './base/data-service.decorator'; -@Injectable() -@dataService(COLLECTION) +@Injectable({ providedIn: 'root' }) export class CollectionDataService extends ComColDataService { protected errorTitle = 'collection.source.update.notifications.error.title'; protected contentSourceError = 'collection.source.update.notifications.error.content'; diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts index efb6d50e848..bd954506ad2 100644 --- a/src/app/core/data/community-data.service.ts +++ b/src/app/core/data/community-data.service.ts @@ -6,7 +6,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Community } from '../shared/community.model'; -import { COMMUNITY } from '../shared/community.resource-type'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ComColDataService } from './comcol-data.service'; import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; @@ -17,10 +16,8 @@ import { BitstreamDataService } from './bitstream-data.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { isNotEmpty } from '../../shared/empty.util'; import { FindListOptions } from './find-list-options.model'; -import { dataService } from './base/data-service.decorator'; -@Injectable() -@dataService(COMMUNITY) +@Injectable({ providedIn: 'root' }) export class CommunityDataService extends ComColDataService { protected topLinkPath = 'search/top'; diff --git a/src/app/core/data/configuration-data.service.ts b/src/app/core/data/configuration-data.service.ts index de044e25e33..49453fa7458 100644 --- a/src/app/core/data/configuration-data.service.ts +++ b/src/app/core/data/configuration-data.service.ts @@ -7,12 +7,9 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RemoteData } from './remote-data'; import { RequestService } from './request.service'; import { ConfigurationProperty } from '../shared/configuration-property.model'; -import { CONFIG_PROPERTY } from '../shared/config-property.resource-type'; import { IdentifiableDataService } from './base/identifiable-data.service'; -import { dataService } from './base/data-service.decorator'; -@Injectable() -@dataService(CONFIG_PROPERTY) +@Injectable({ providedIn: 'root' }) /** * Data Service responsible for retrieving Configuration properties */ diff --git a/src/app/core/data/content-source-response-parsing.service.ts b/src/app/core/data/content-source-response-parsing.service.ts index 066ccf28c9d..c38fef7db96 100644 --- a/src/app/core/data/content-source-response-parsing.service.ts +++ b/src/app/core/data/content-source-response-parsing.service.ts @@ -7,7 +7,7 @@ import { MetadataConfig } from '../shared/metadata-config.model'; import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service'; import { RestRequest } from './rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) /** * A ResponseParsingService used to parse RawRestResponse coming from the REST API to a ContentSource object */ diff --git a/src/app/core/data/debug-response-parsing.service.ts b/src/app/core/data/debug-response-parsing.service.ts index 992a29e4b84..0cc8922aeee 100644 --- a/src/app/core/data/debug-response-parsing.service.ts +++ b/src/app/core/data/debug-response-parsing.service.ts @@ -4,7 +4,7 @@ import { RawRestResponse } from '../dspace-rest/raw-rest-response.model'; import { ResponseParsingService } from './parsing.service'; import { RestRequest } from './rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class DebugResponseParsingService implements ResponseParsingService { parse(request: RestRequest, data: RawRestResponse): RestResponse { console.log('request', request, 'data', data); diff --git a/src/app/core/data/default-change-analyzer.service.ts b/src/app/core/data/default-change-analyzer.service.ts index 70c45bbc2de..c42e406fbe2 100644 --- a/src/app/core/data/default-change-analyzer.service.ts +++ b/src/app/core/data/default-change-analyzer.service.ts @@ -10,7 +10,7 @@ import { TypedObject } from '../cache/typed-object.model'; * A class to determine what differs between two * CacheableObjects */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class DefaultChangeAnalyzer implements ChangeAnalyzer { /** * Compare the metadata of two CacheableObject and return the differences as diff --git a/src/app/core/data/dso-change-analyzer.service.ts b/src/app/core/data/dso-change-analyzer.service.ts index a621895633b..ee1faacd537 100644 --- a/src/app/core/data/dso-change-analyzer.service.ts +++ b/src/app/core/data/dso-change-analyzer.service.ts @@ -9,7 +9,7 @@ import cloneDeep from 'lodash/cloneDeep'; * A class to determine what differs between two * DSpaceObjects */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class DSOChangeAnalyzer implements ChangeAnalyzer { /** diff --git a/src/app/core/data/dso-response-parsing.service.ts b/src/app/core/data/dso-response-parsing.service.ts index 74117e79d35..41281aa7cd9 100644 --- a/src/app/core/data/dso-response-parsing.service.ts +++ b/src/app/core/data/dso-response-parsing.service.ts @@ -14,7 +14,7 @@ import { RestRequest } from './rest-request.model'; * @deprecated use DspaceRestResponseParsingService for new code, this is only left to support a * few legacy use cases, and should get removed eventually */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class DSOResponseParsingService extends BaseResponseParsingService implements ResponseParsingService { protected toCache = true; diff --git a/src/app/core/data/dspace-object-data.service.ts b/src/app/core/data/dspace-object-data.service.ts index 2ad024133c7..784ec89be8f 100644 --- a/src/app/core/data/dspace-object-data.service.ts +++ b/src/app/core/data/dspace-object-data.service.ts @@ -2,14 +2,11 @@ import { Injectable } from '@angular/core'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { DSpaceObject } from '../shared/dspace-object.model'; -import { DSPACE_OBJECT } from '../shared/dspace-object.resource-type'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RequestService } from './request.service'; import { IdentifiableDataService } from './base/identifiable-data.service'; -import { dataService } from './base/data-service.decorator'; -@Injectable() -@dataService(DSPACE_OBJECT) +@Injectable({ providedIn: 'root' }) export class DSpaceObjectDataService extends IdentifiableDataService { constructor( protected requestService: RequestService, diff --git a/src/app/core/data/endpoint-map-response-parsing.service.ts b/src/app/core/data/endpoint-map-response-parsing.service.ts index 728714876c4..e937adf3fcd 100644 --- a/src/app/core/data/endpoint-map-response-parsing.service.ts +++ b/src/app/core/data/endpoint-map-response-parsing.service.ts @@ -20,7 +20,7 @@ import { RestRequest } from './rest-request.model'; * * When all endpoints are properly typed, it can be removed. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class EndpointMapResponseParsingService extends DspaceRestResponseParsingService { /** diff --git a/src/app/core/data/entity-type-data.service.ts b/src/app/core/data/entity-type-data.service.ts index 4020ff638dd..653805f2cf1 100644 --- a/src/app/core/data/entity-type-data.service.ts +++ b/src/app/core/data/entity-type-data.service.ts @@ -20,7 +20,7 @@ import { FindAllData, FindAllDataImpl } from './base/find-all-data'; /** * Service handling all ItemType requests */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class EntityTypeDataService extends BaseDataService implements FindAllData, SearchData { private findAllData: FindAllData; private searchData: SearchDataImpl; diff --git a/src/app/core/data/external-source-data.service.ts b/src/app/core/data/external-source-data.service.ts index 02c5e4a53cc..a4673766e2e 100644 --- a/src/app/core/data/external-source-data.service.ts +++ b/src/app/core/data/external-source-data.service.ts @@ -19,7 +19,7 @@ import { SearchData, SearchDataImpl } from './base/search-data'; /** * A service handling all external source requests */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class ExternalSourceDataService extends IdentifiableDataService implements SearchData { private searchData: SearchData; diff --git a/src/app/core/data/facet-config-response-parsing.service.ts b/src/app/core/data/facet-config-response-parsing.service.ts index 3e4493c32bf..41d9436e1f2 100644 --- a/src/app/core/data/facet-config-response-parsing.service.ts +++ b/src/app/core/data/facet-config-response-parsing.service.ts @@ -7,7 +7,7 @@ import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing import { FacetConfigResponse } from '../../shared/search/models/facet-config-response.model'; import { RestRequest } from './rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class FacetConfigResponseParsingService extends DspaceRestResponseParsingService { parse(request: RestRequest, data: RawRestResponse): ParsedResponse { diff --git a/src/app/core/data/facet-value-response-parsing.service.ts b/src/app/core/data/facet-value-response-parsing.service.ts index 0911ed50734..05ca454d071 100644 --- a/src/app/core/data/facet-value-response-parsing.service.ts +++ b/src/app/core/data/facet-value-response-parsing.service.ts @@ -7,7 +7,7 @@ import { FacetValues } from '../../shared/search/models/facet-values.model'; import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service'; import { RestRequest } from './rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class FacetValueResponseParsingService extends DspaceRestResponseParsingService { parse(request: RestRequest, data: RawRestResponse): ParsedResponse { const payload = data.payload; diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index c43d335234b..5dc59f703dd 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -1,6 +1,5 @@ import { Observable, of as observableOf } from 'rxjs'; import { Injectable } from '@angular/core'; -import { AUTHORIZATION } from '../../shared/authorization.resource-type'; import { Authorization } from '../../shared/authorization.model'; import { RequestService } from '../request.service'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service'; @@ -20,13 +19,11 @@ import { getFirstCompletedRemoteData } from '../../shared/operators'; import { FindListOptions } from '../find-list-options.model'; import { BaseDataService } from '../base/base-data.service'; import { SearchData, SearchDataImpl } from '../base/search-data'; -import { dataService } from '../base/data-service.decorator'; /** * A service to retrieve {@link Authorization}s from the REST API */ -@Injectable() -@dataService(AUTHORIZATION) +@Injectable({ providedIn: 'root' }) export class AuthorizationDataService extends BaseDataService implements SearchData { protected linkPath = 'authorizations'; protected searchByObjectPath = 'object'; diff --git a/src/app/core/data/feature-authorization/feature-authorization-guard/site-administrator.guard.ts b/src/app/core/data/feature-authorization/feature-authorization-guard/site-administrator.guard.ts index cc6f50c1613..ad74e5c4ce7 100644 --- a/src/app/core/data/feature-authorization/feature-authorization-guard/site-administrator.guard.ts +++ b/src/app/core/data/feature-authorization/feature-authorization-guard/site-administrator.guard.ts @@ -10,9 +10,7 @@ import { AuthService } from '../../../auth/auth.service'; * Prevent unauthorized activating and loading of routes when the current authenticated user doesn't have administrator * rights to the {@link Site} */ -@Injectable({ - providedIn: 'root' -}) +@Injectable({ providedIn: 'root' }) export class SiteAdministratorGuard extends SingleFeatureAuthorizationGuard { constructor(protected authorizationService: AuthorizationDataService, protected router: Router, protected authService: AuthService) { super(authorizationService, router, authService); diff --git a/src/app/core/data/feature-authorization/feature-authorization-guard/site-register.guard.ts b/src/app/core/data/feature-authorization/feature-authorization-guard/site-register.guard.ts index bdbb8250e27..30aa1c92e06 100644 --- a/src/app/core/data/feature-authorization/feature-authorization-guard/site-register.guard.ts +++ b/src/app/core/data/feature-authorization/feature-authorization-guard/site-register.guard.ts @@ -10,9 +10,7 @@ import { AuthService } from '../../../auth/auth.service'; * Prevent unauthorized activating and loading of routes when the current authenticated user doesn't have registration * rights to the {@link Site} */ -@Injectable({ - providedIn: 'root' -}) +@Injectable({ providedIn: 'root' }) export class SiteRegisterGuard extends SingleFeatureAuthorizationGuard { constructor(protected authorizationService: AuthorizationDataService, protected router: Router, protected authService: AuthService) { super(authorizationService, router, authService); diff --git a/src/app/core/data/feature-authorization/feature-data.service.ts b/src/app/core/data/feature-authorization/feature-data.service.ts index eda87911539..a64d50ecb2e 100644 --- a/src/app/core/data/feature-authorization/feature-data.service.ts +++ b/src/app/core/data/feature-authorization/feature-data.service.ts @@ -1,18 +1,15 @@ import { Injectable } from '@angular/core'; -import { FEATURE } from '../../shared/feature.resource-type'; import { Feature } from '../../shared/feature.model'; import { RequestService } from '../request.service'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../../cache/object-cache.service'; import { HALEndpointService } from '../../shared/hal-endpoint.service'; import { BaseDataService } from '../base/base-data.service'; -import { dataService } from '../base/data-service.decorator'; /** * A service to retrieve {@link Feature}s from the REST API */ -@Injectable() -@dataService(FEATURE) +@Injectable({ providedIn: 'root' }) export class FeatureDataService extends BaseDataService { protected linkPath = 'features'; diff --git a/src/app/core/data/filtered-discovery-page-response-parsing.service.ts b/src/app/core/data/filtered-discovery-page-response-parsing.service.ts index da7a21c488f..af9afa577b2 100644 --- a/src/app/core/data/filtered-discovery-page-response-parsing.service.ts +++ b/src/app/core/data/filtered-discovery-page-response-parsing.service.ts @@ -10,7 +10,7 @@ import { RestRequest } from './rest-request.model'; * A ResponseParsingService used to parse RawRestResponse coming from the REST API to a discovery query (string) * wrapped in a FilteredDiscoveryQueryResponse */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class FilteredDiscoveryPageResponseParsingService extends BaseResponseParsingService implements ResponseParsingService { objectFactory = {}; toCache = false; diff --git a/src/app/core/data/href-only-data.service.ts b/src/app/core/data/href-only-data.service.ts index 0a765de101b..b98464af4d6 100644 --- a/src/app/core/data/href-only-data.service.ts +++ b/src/app/core/data/href-only-data.service.ts @@ -3,18 +3,14 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Injectable } from '@angular/core'; -import { VOCABULARY_ENTRY } from '../submission/vocabularies/models/vocabularies.resource-type'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RemoteData } from './remote-data'; import { Observable } from 'rxjs'; import { PaginatedList } from './paginated-list.model'; -import { ITEM_TYPE } from '../shared/item-relationships/item-type.resource-type'; -import { LICENSE } from '../shared/license.resource-type'; import { CacheableObject } from '../cache/cacheable-object.model'; import { FindListOptions } from './find-list-options.model'; import { BaseDataService } from './base/base-data.service'; import { HALDataService } from './base/hal-data-service.interface'; -import { dataService } from './base/data-service.decorator'; /** * A DataService with only findByHref methods. Its purpose is to be used for resources that don't @@ -32,12 +28,7 @@ import { dataService } from './base/data-service.decorator'; * ``` * This means we cannot extend from {@link BaseDataService} directly because the method signatures would not match. */ -@Injectable({ - providedIn: 'root', -}) -@dataService(VOCABULARY_ENTRY) -@dataService(ITEM_TYPE) -@dataService(LICENSE) +@Injectable({providedIn: 'root'}) export class HrefOnlyDataService implements HALDataService { /** * Works with a {@link BaseDataService} internally, but only exposes two of its methods diff --git a/src/app/core/data/identifier-data.service.ts b/src/app/core/data/identifier-data.service.ts index 03422dadfb0..7bbd84f1e89 100644 --- a/src/app/core/data/identifier-data.service.ts +++ b/src/app/core/data/identifier-data.service.ts @@ -2,7 +2,6 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { dataService } from './base/data-service.decorator'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -13,12 +12,11 @@ import { CoreState } from '../core-state.model'; import { Observable } from 'rxjs'; import { RemoteData } from './remote-data'; import { Item } from '../shared/item.model'; -import { IDENTIFIERS } from '../../shared/object-list/identifier-data/identifier-data.resource-type'; import { IdentifierData } from '../../shared/object-list/identifier-data/identifier-data.model'; import { getFirstCompletedRemoteData } from '../shared/operators'; import { map, switchMap } from 'rxjs/operators'; -import {ConfigurationProperty} from '../shared/configuration-property.model'; -import {ConfigurationDataService} from './configuration-data.service'; +import { ConfigurationProperty } from '../shared/configuration-property.model'; +import { ConfigurationDataService } from './configuration-data.service'; import { HttpOptions } from '../dspace-rest/dspace-rest.service'; import { PostRequest } from './request.models'; import { sendRequest } from '../shared/request.operators'; @@ -29,8 +27,7 @@ import { RestRequest } from './rest-request.model'; * from the /identifiers endpoint, as well as the backend configuration that controls whether a 'Register DOI' * button appears for admins in the item status page */ -@Injectable() -@dataService(IDENTIFIERS) +@Injectable({ providedIn: 'root' }) export class IdentifierDataService extends BaseDataService { constructor( diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts index c3fa84dd6c8..eff0cc0f5af 100644 --- a/src/app/core/data/item-data.service.ts +++ b/src/app/core/data/item-data.service.ts @@ -20,7 +20,6 @@ import { Collection } from '../shared/collection.model'; import { ExternalSourceEntry } from '../shared/external-source-entry.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Item } from '../shared/item.model'; -import { ITEM } from '../shared/item.resource-type'; import { URLCombiner } from '../url-combiner/url-combiner'; import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; import { PaginatedList } from './paginated-list.model'; @@ -45,7 +44,6 @@ import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { RestRequestMethod } from './rest-request-method'; import { CreateData, CreateDataImpl } from './base/create-data'; import { RequestParam } from '../cache/models/request-param.model'; -import { dataService } from './base/data-service.decorator'; /** * An abstract service for CRUD operations on Items @@ -403,8 +401,7 @@ export abstract class BaseItemDataService extends IdentifiableDataService /** * A service for CRUD operations on Items */ -@Injectable() -@dataService(ITEM) +@Injectable({ providedIn: 'root' }) export class ItemDataService extends BaseItemDataService { constructor( protected requestService: RequestService, diff --git a/src/app/core/data/item-template-data.service.ts b/src/app/core/data/item-template-data.service.ts index 634c966dbaa..4de38deaad1 100644 --- a/src/app/core/data/item-template-data.service.ts +++ b/src/app/core/data/item-template-data.service.ts @@ -63,7 +63,7 @@ class CollectionItemTemplateDataService extends IdentifiableDataService { /** * A service responsible for fetching/sending data from/to the REST API on a collection's itemtemplates endpoint */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class ItemTemplateDataService extends BaseItemDataService { private byCollection: CollectionItemTemplateDataService; diff --git a/src/app/core/data/lookup-relation.service.ts b/src/app/core/data/lookup-relation.service.ts index 7a6bc2358b5..3b344449dc9 100644 --- a/src/app/core/data/lookup-relation.service.ts +++ b/src/app/core/data/lookup-relation.service.ts @@ -19,7 +19,7 @@ import { RequestService } from './request.service'; /** * A service for retrieving local and external entries information during a relation lookup */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class LookupRelationService { /** * The search config last used for retrieving local results diff --git a/src/app/core/data/metadata-field-data.service.ts b/src/app/core/data/metadata-field-data.service.ts index d05e3533d32..8ff2df4ecdf 100644 --- a/src/app/core/data/metadata-field-data.service.ts +++ b/src/app/core/data/metadata-field-data.service.ts @@ -5,7 +5,6 @@ import { RemoteData } from './remote-data'; import { RequestService } from './request.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; -import { METADATA_FIELD } from '../metadata/metadata-field.resource-type'; import { MetadataField } from '../metadata/metadata-field.model'; import { MetadataSchema } from '../metadata/metadata-schema.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; @@ -21,13 +20,11 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { ObjectCacheService } from '../cache/object-cache.service'; import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { IdentifiableDataService } from './base/identifiable-data.service'; -import { dataService } from './base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the metadatafields endpoint */ -@Injectable() -@dataService(METADATA_FIELD) +@Injectable({ providedIn: 'root' }) export class MetadataFieldDataService extends IdentifiableDataService implements CreateData, PutData, DeleteData, SearchData { private createData: CreateData; private searchData: SearchData; diff --git a/src/app/core/data/metadata-schema-data.service.ts b/src/app/core/data/metadata-schema-data.service.ts index 6bd633b8c64..76f72681afa 100644 --- a/src/app/core/data/metadata-schema-data.service.ts +++ b/src/app/core/data/metadata-schema-data.service.ts @@ -3,7 +3,6 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { MetadataSchema } from '../metadata/metadata-schema.model'; -import { METADATA_SCHEMA } from '../metadata/metadata-schema.resource-type'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RequestService } from './request.service'; import { Observable } from 'rxjs'; @@ -19,13 +18,11 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { PaginatedList } from './paginated-list.model'; import { IdentifiableDataService } from './base/identifiable-data.service'; import { DeleteData, DeleteDataImpl } from './base/delete-data'; -import { dataService } from './base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint */ -@Injectable() -@dataService(METADATA_SCHEMA) +@Injectable({ providedIn: 'root' }) export class MetadataSchemaDataService extends IdentifiableDataService implements FindAllData, DeleteData { private createData: CreateData; private findAllData: FindAllData; diff --git a/src/app/core/data/mydspace-response-parsing.service.ts b/src/app/core/data/mydspace-response-parsing.service.ts index e46e319149c..210564008b1 100644 --- a/src/app/core/data/mydspace-response-parsing.service.ts +++ b/src/app/core/data/mydspace-response-parsing.service.ts @@ -8,7 +8,7 @@ import { MetadataMap, MetadataValue } from '../shared/metadata.models'; import { DspaceRestResponseParsingService } from './dspace-rest-response-parsing.service'; import { RestRequest } from './rest-request.model'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class MyDSpaceResponseParsingService extends DspaceRestResponseParsingService { parse(request: RestRequest, data: RawRestResponse): ParsedResponse { // fallback for unexpected empty response diff --git a/src/app/core/data/object-updates/object-updates.service.ts b/src/app/core/data/object-updates/object-updates.service.ts index 2fb6d47d31c..8d95f9a03f4 100644 --- a/src/app/core/data/object-updates/object-updates.service.ts +++ b/src/app/core/data/object-updates/object-updates.service.ts @@ -55,7 +55,7 @@ function virtualMetadataSourceSelector(url: string, source: string): MemoizedSel /** * Service that dispatches and reads from the ObjectUpdates' state in the store */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class ObjectUpdatesService { constructor(private store: Store, private injector: Injector) { diff --git a/src/app/core/data/processes/process-data.service.ts b/src/app/core/data/processes/process-data.service.ts index 3bf34eb650d..9c21fe33a9c 100644 --- a/src/app/core/data/processes/process-data.service.ts +++ b/src/app/core/data/processes/process-data.service.ts @@ -4,7 +4,6 @@ import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.s import { ObjectCacheService } from '../../cache/object-cache.service'; import { HALEndpointService } from '../../shared/hal-endpoint.service'; import { Process } from '../../../process-page/processes/process.model'; -import { PROCESS } from '../../../process-page/processes/process.resource-type'; import { Observable } from 'rxjs'; import { switchMap } from 'rxjs/operators'; import { PaginatedList } from '../paginated-list.model'; @@ -15,13 +14,11 @@ import { IdentifiableDataService } from '../base/identifiable-data.service'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { FindAllData, FindAllDataImpl } from '../base/find-all-data'; import { FindListOptions } from '../find-list-options.model'; -import { dataService } from '../base/data-service.decorator'; import { DeleteData, DeleteDataImpl } from '../base/delete-data'; import { NotificationsService } from '../../../shared/notifications/notifications.service'; import { NoContent } from '../../shared/NoContent.model'; -@Injectable() -@dataService(PROCESS) +@Injectable({ providedIn: 'root' }) export class ProcessDataService extends IdentifiableDataService implements FindAllData, DeleteData { private findAllData: FindAllData; private deleteData: DeleteData; diff --git a/src/app/core/data/processes/script-data.service.ts b/src/app/core/data/processes/script-data.service.ts index d9c92cb1d21..12ad806c26d 100644 --- a/src/app/core/data/processes/script-data.service.ts +++ b/src/app/core/data/processes/script-data.service.ts @@ -10,7 +10,6 @@ import { RemoteData } from '../remote-data'; import { MultipartPostRequest } from '../request.models'; import { RequestService } from '../request.service'; import { Observable } from 'rxjs'; -import { SCRIPT } from '../../../process-page/scripts/script.resource-type'; import { Process } from '../../../process-page/processes/process.model'; import { hasValue } from '../../../shared/empty.util'; import { getFirstCompletedRemoteData } from '../../shared/operators'; @@ -20,15 +19,13 @@ import { FindAllData, FindAllDataImpl } from '../base/find-all-data'; import { FindListOptions } from '../find-list-options.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { PaginatedList } from '../paginated-list.model'; -import { dataService } from '../base/data-service.decorator'; export const METADATA_IMPORT_SCRIPT_NAME = 'metadata-import'; export const METADATA_EXPORT_SCRIPT_NAME = 'metadata-export'; export const BATCH_IMPORT_SCRIPT_NAME = 'import'; export const BATCH_EXPORT_SCRIPT_NAME = 'export'; -@Injectable() -@dataService(SCRIPT) +@Injectable({ providedIn: 'root' }) export class ScriptDataService extends IdentifiableDataService