[DURACOM-191] run angular script for migration

This commit is contained in:
Andrea Barbasso
2023-12-20 11:23:00 +01:00
parent 3a461eee80
commit 8b665a6d99
19 changed files with 158 additions and 123 deletions

View File

@@ -9,19 +9,17 @@ import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assura
import {NotificationsModule} from '../../notifications/notifications.module'; import {NotificationsModule} from '../../notifications/notifications.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
SharedModule, SharedModule,
CoreModule.forRoot(), CoreModule.forRoot(),
AdminNotificationsRoutingModule, AdminNotificationsRoutingModule,
NotificationsModule NotificationsModule,
], AdminQualityAssuranceTopicsPageComponent,
declarations: [ AdminQualityAssuranceEventsPageComponent,
AdminQualityAssuranceTopicsPageComponent, AdminQualityAssuranceSourcePageComponent
AdminQualityAssuranceEventsPageComponent, ],
AdminQualityAssuranceSourcePageComponent entryComponents: []
],
entryComponents: []
}) })
/** /**
* This module handles all components related to the notifications pages * This module handles all components related to the notifications pages

View File

@@ -8,9 +8,9 @@ describe('AdminQualityAssuranceEventsPageComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceEventsPageComponent ], imports: [AdminQualityAssuranceEventsPageComponent],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@@ -1,11 +1,14 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { QualityAssuranceEventsComponent } from '../../../notifications/qa/events/quality-assurance-events.component';
/** /**
* Component for the page that show the QA events related to a specific topic. * Component for the page that show the QA events related to a specific topic.
*/ */
@Component({ @Component({
selector: 'ds-quality-assurance-events-page', selector: 'ds-quality-assurance-events-page',
templateUrl: './admin-quality-assurance-events-page.component.html' templateUrl: './admin-quality-assurance-events-page.component.html',
standalone: true,
imports: [QualityAssuranceEventsComponent]
}) })
export class AdminQualityAssuranceEventsPageComponent { export class AdminQualityAssuranceEventsPageComponent {

View File

@@ -9,9 +9,9 @@ describe('AdminQualityAssuranceSourcePageComponent', () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceSourcePageComponent ], imports: [AdminQualityAssuranceSourcePageComponent],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();
}); });

View File

@@ -1,10 +1,13 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { QualityAssuranceSourceComponent } from '../../../notifications/qa/source/quality-assurance-source.component';
/** /**
* Component for the page that show the QA sources. * Component for the page that show the QA sources.
*/ */
@Component({ @Component({
selector: 'ds-admin-quality-assurance-source-page-component', selector: 'ds-admin-quality-assurance-source-page-component',
templateUrl: './admin-quality-assurance-source-page.component.html', templateUrl: './admin-quality-assurance-source-page.component.html',
standalone: true,
imports: [QualityAssuranceSourceComponent]
}) })
export class AdminQualityAssuranceSourcePageComponent {} export class AdminQualityAssuranceSourcePageComponent {}

View File

@@ -8,9 +8,9 @@ describe('AdminQualityAssuranceTopicsPageComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceTopicsPageComponent ], imports: [AdminQualityAssuranceTopicsPageComponent],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@@ -1,11 +1,14 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { QualityAssuranceTopicsComponent } from '../../../notifications/qa/topics/quality-assurance-topics.component';
/** /**
* Component for the page that show the QA topics related to a specific source. * Component for the page that show the QA topics related to a specific source.
*/ */
@Component({ @Component({
selector: 'ds-notification-qa-page', selector: 'ds-notification-qa-page',
templateUrl: './admin-quality-assurance-topics-page.component.html' templateUrl: './admin-quality-assurance-topics-page.component.html',
standalone: true,
imports: [QualityAssuranceTopicsComponent]
}) })
export class AdminQualityAssuranceTopicsPageComponent { export class AdminQualityAssuranceTopicsPageComponent {

View File

@@ -79,7 +79,8 @@ describe('ItemEditBitstreamComponent', () => {
TranslateModule.forRoot(), TranslateModule.forRoot(),
RouterTestingModule.withRoutes([]), RouterTestingModule.withRoutes([]),
ItemEditBitstreamComponent, ItemEditBitstreamComponent,
VarDirective], VarDirective
],
declarations: [BrowserOnlyMockPipe], declarations: [BrowserOnlyMockPipe],
providers: [ providers: [
{ provide: ObjectUpdatesService, useValue: objectUpdatesService }, { provide: ObjectUpdatesService, useValue: objectUpdatesService },

View File

@@ -60,23 +60,21 @@ const PROVIDERS = [
@NgModule({ @NgModule({
imports: [ imports: [
...MODULES ...MODULES,
...COMPONENTS,
...DIRECTIVES,
...ENTRY_COMPONENTS
], ],
declarations: [ providers: [
...COMPONENTS, ...PROVIDERS
...DIRECTIVES, ],
...ENTRY_COMPONENTS entryComponents: [
], ...ENTRY_COMPONENTS
providers: [ ],
...PROVIDERS exports: [
], ...COMPONENTS,
entryComponents: [ ...DIRECTIVES
...ENTRY_COMPONENTS ]
],
exports: [
...COMPONENTS,
...DIRECTIVES
]
}) })
/** /**

View File

@@ -103,15 +103,13 @@ describe('QualityAssuranceEventsComponent test suite', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
CommonModule, CommonModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceEventsComponent, QualityAssuranceEventsComponent,
TestComponent, TestComponent
], ],
providers: [ providers: [
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
{ provide: QualityAssuranceEventDataService, useValue: qualityAssuranceEventRestServiceStub }, { provide: QualityAssuranceEventDataService, useValue: qualityAssuranceEventRestServiceStub },
{ provide: NgbModal, useValue: modalStub }, { provide: NgbModal, useValue: modalStub },
@@ -119,9 +117,9 @@ describe('QualityAssuranceEventsComponent test suite', () => {
{ provide: TranslateService, useValue: getMockTranslateService() }, { provide: TranslateService, useValue: getMockTranslateService() },
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
QualityAssuranceEventsComponent QualityAssuranceEventsComponent
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(); }).compileComponents().then();
scheduler = getTestScheduler(); scheduler = getTestScheduler();
})); }));
@@ -332,8 +330,10 @@ describe('QualityAssuranceEventsComponent test suite', () => {
// declare a test component // declare a test component
@Component({ @Component({
selector: 'ds-test-cmp', selector: 'ds-test-cmp',
template: `` template: ``,
standalone: true,
imports: [CommonModule]
}) })
class TestComponent { class TestComponent {

View File

@@ -1,8 +1,8 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute, RouterLink } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { BehaviorSubject, combineLatest, from, Observable, of, Subscription } from 'rxjs'; import { BehaviorSubject, combineLatest, from, Observable, of, Subscription } from 'rxjs';
import { distinctUntilChanged, last, map, mergeMap, scan, switchMap, take, tap } from 'rxjs/operators'; import { distinctUntilChanged, last, map, mergeMap, scan, switchMap, take, tap } from 'rxjs/operators';
@@ -31,14 +31,20 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import { FindListOptions } from '../../../core/data/find-list-options.model'; import { FindListOptions } from '../../../core/data/find-list-options.model';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/** /**
* Component to display the Quality Assurance event list. * Component to display the Quality Assurance event list.
*/ */
@Component({ @Component({
selector: 'ds-quality-assurance-events', selector: 'ds-quality-assurance-events',
templateUrl: './quality-assurance-events.component.html', templateUrl: './quality-assurance-events.component.html',
styleUrls: ['./quality-assurance-events.component.scss'], styleUrls: ['./quality-assurance-events.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule]
}) })
export class QualityAssuranceEventsComponent implements OnInit, OnDestroy { export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
/** /**

View File

@@ -71,22 +71,20 @@ describe('ProjectEntryImportModalComponent test suite', () => {
beforeEach(async (() => { beforeEach(async (() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
CommonModule, CommonModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
],
declarations: [
ProjectEntryImportModalComponent, ProjectEntryImportModalComponent,
TestComponent, TestComponent
], ],
providers: [ providers: [
{ provide: NgbActiveModal, useValue: modalStub }, { provide: NgbActiveModal, useValue: modalStub },
{ provide: SearchService, useValue: searchServiceStub }, { provide: SearchService, useValue: searchServiceStub },
{ provide: SelectableListService, useValue: jasmine.createSpyObj('selectableListService', ['deselect', 'select', 'deselectAll']) }, { provide: SelectableListService, useValue: jasmine.createSpyObj('selectableListService', ['deselect', 'select', 'deselectAll']) },
ProjectEntryImportModalComponent ProjectEntryImportModalComponent
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(); }).compileComponents().then();
})); }));
// First test to check the correct component creation // First test to check the correct component creation
@@ -202,8 +200,10 @@ describe('ProjectEntryImportModalComponent test suite', () => {
// declare a test component // declare a test component
@Component({ @Component({
selector: 'ds-test-cmp', selector: 'ds-test-cmp',
template: `` template: ``,
standalone: true,
imports: [CommonModule]
}) })
class TestComponent { class TestComponent {
eventData = eventData; eventData = eventData;

View File

@@ -18,6 +18,13 @@ import {
} from '../../../core/notifications/qa/models/quality-assurance-event.model'; } from '../../../core/notifications/qa/models/quality-assurance-event.model';
import { hasValue, isNotEmpty } from '../../../shared/empty.util'; import { hasValue, isNotEmpty } from '../../../shared/empty.util';
import { Item } from '../../../core/shared/item.model'; import { Item } from '../../../core/shared/item.model';
import { TranslateModule } from '@ngx-translate/core';
import { AlertComponent } from '../../../shared/alert/alert.component';
import { ThemedSearchResultsComponent } from '../../../shared/search/search-results/themed-search-results.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { FormsModule } from '@angular/forms';
import { NgIf, AsyncPipe } from '@angular/common';
import { RouterLink } from '@angular/router';
/** /**
* The possible types of import for the external entry * The possible types of import for the external entry
@@ -77,9 +84,11 @@ export interface QualityAssuranceEventData {
} }
@Component({ @Component({
selector: 'ds-project-entry-import-modal', selector: 'ds-project-entry-import-modal',
styleUrls: ['./project-entry-import-modal.component.scss'], styleUrls: ['./project-entry-import-modal.component.scss'],
templateUrl: './project-entry-import-modal.component.html' templateUrl: './project-entry-import-modal.component.html',
standalone: true,
imports: [RouterLink, NgIf, FormsModule, LoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule]
}) })
/** /**
* Component to display a modal window for linking a project to an Quality Assurance event * Component to display a modal window for linking a project to an Quality Assurance event

View File

@@ -31,22 +31,20 @@ describe('QualityAssuranceSourceComponent test suite', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
CommonModule, CommonModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceSourceComponent, QualityAssuranceSourceComponent,
TestComponent, TestComponent
], ],
providers: [ providers: [
{ provide: NotificationsStateService, useValue: mockNotificationsStateService }, { provide: NotificationsStateService, useValue: mockNotificationsStateService },
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } }, { provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
QualityAssuranceSourceComponent QualityAssuranceSourceComponent
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => { }).compileComponents().then(() => {
mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([ mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([
qualityAssuranceSourceObjectMorePid, qualityAssuranceSourceObjectMorePid,
qualityAssuranceSourceObjectMoreAbstract qualityAssuranceSourceObjectMoreAbstract
@@ -144,8 +142,10 @@ describe('QualityAssuranceSourceComponent test suite', () => {
// declare a test component // declare a test component
@Component({ @Component({
selector: 'ds-test-cmp', selector: 'ds-test-cmp',
template: `` template: ``,
standalone: true,
imports: [CommonModule]
}) })
class TestComponent { class TestComponent {

View File

@@ -8,14 +8,22 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
import { NotificationsStateService } from '../../notifications-state.service'; import { NotificationsStateService } from '../../notifications-state.service';
import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service'; import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
import { hasValue } from '../../../shared/empty.util'; import { hasValue } from '../../../shared/empty.util';
import { TranslateModule } from '@ngx-translate/core';
import { RouterLink } from '@angular/router';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/** /**
* Component to display the Quality Assurance source list. * Component to display the Quality Assurance source list.
*/ */
@Component({ @Component({
selector: 'ds-quality-assurance-source', selector: 'ds-quality-assurance-source',
templateUrl: './quality-assurance-source.component.html', templateUrl: './quality-assurance-source.component.html',
styleUrls: ['./quality-assurance-source.component.scss'] styleUrls: ['./quality-assurance-source.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, AsyncPipe, TranslateModule]
}) })
export class QualityAssuranceSourceComponent implements OnInit { export class QualityAssuranceSourceComponent implements OnInit {

View File

@@ -33,28 +33,26 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
CommonModule, CommonModule,
TranslateModule.forRoot(), TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceTopicsComponent, QualityAssuranceTopicsComponent,
TestComponent, TestComponent
], ],
providers: [ providers: [
{ provide: NotificationsStateService, useValue: mockNotificationsStateService }, { provide: NotificationsStateService, useValue: mockNotificationsStateService },
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), snapshot: { { provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), snapshot: {
paramMap: { paramMap: {
get: () => 'openaire', get: () => 'openaire',
}, },
}}}, } } },
{ provide: PaginationService, useValue: paginationService }, { provide: PaginationService, useValue: paginationService },
QualityAssuranceTopicsComponent, QualityAssuranceTopicsComponent,
// tslint:disable-next-line: no-empty // tslint:disable-next-line: no-empty
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } }} { provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } } }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => { }).compileComponents().then(() => {
mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([ mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([
qualityAssuranceTopicObjectMorePid, qualityAssuranceTopicObjectMorePid,
qualityAssuranceTopicObjectMoreAbstract qualityAssuranceTopicObjectMoreAbstract
@@ -152,8 +150,10 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
// declare a test component // declare a test component
@Component({ @Component({
selector: 'ds-test-cmp', selector: 'ds-test-cmp',
template: `` template: ``,
standalone: true,
imports: [CommonModule]
}) })
class TestComponent { class TestComponent {

View File

@@ -14,16 +14,23 @@ import {
AdminQualityAssuranceTopicsPageParams AdminQualityAssuranceTopicsPageParams
} from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service'; } from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
import { PaginationService } from '../../../core/pagination/pagination.service'; import { PaginationService } from '../../../core/pagination/pagination.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute, RouterLink } from '@angular/router';
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service'; import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { TranslateModule } from '@ngx-translate/core';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/** /**
* Component to display the Quality Assurance topic list. * Component to display the Quality Assurance topic list.
*/ */
@Component({ @Component({
selector: 'ds-quality-assurance-topic', selector: 'ds-quality-assurance-topic',
templateUrl: './quality-assurance-topics.component.html', templateUrl: './quality-assurance-topics.component.html',
styleUrls: ['./quality-assurance-topics.component.scss'], styleUrls: ['./quality-assurance-topics.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, AsyncPipe, TranslateModule]
}) })
export class QualityAssuranceTopicsComponent implements OnInit { export class QualityAssuranceTopicsComponent implements OnInit {
/** /**

View File

@@ -79,17 +79,17 @@ describe('AuthNavMenuComponent', () => {
}), }),
TranslateModule.forRoot(), TranslateModule.forRoot(),
AuthNavMenuComponent AuthNavMenuComponent
], ],
declarations: [BrowserOnlyMockPipe], declarations: [BrowserOnlyMockPipe],
providers: [ providers: [
{ provide: HostWindowService, useValue: window }, { provide: HostWindowService, useValue: window },
{ provide: AuthService, useValue: authService }, { provide: AuthService, useValue: authService },
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() }, { provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
], ],
schemas: [ schemas: [
CUSTOM_ELEMENTS_SCHEMA CUSTOM_ELEMENTS_SCHEMA
] ]
}) })
.compileComponents(); .compileComponents();
})); }));

View File

@@ -199,8 +199,7 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
searchConfigurationServiceStub.paginatedSearchOptions = new BehaviorSubject(new PaginatedSearchOptions({pagination: {id: 'default'} as any})); searchConfigurationServiceStub.paginatedSearchOptions = new BehaviorSubject(new PaginatedSearchOptions({pagination: {id: 'default'} as any}));
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [...additionalDeclarations], imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, NgbCollapseModule, compType, ...additionalDeclarations],
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, NgbCollapseModule, compType],
providers: [ providers: [
{ provide: SearchService, useValue: searchServiceStub }, { provide: SearchService, useValue: searchServiceStub },
{ {